1 /* 2 * Copyright (C) 2015 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.google.android.auto.mapservice; 18 19 import android.os.Parcel; 20 import android.os.Parcelable; 21 import android.bluetooth.BluetoothDevice; 22 23 import com.google.android.auto.mapservice.IBluetoothMapServiceCallbacks; 24 import com.google.android.auto.mapservice.BluetoothMapMessage; 25 26 27 /** 28 * Bluetooth Message service provides the API for Car to send and receive messages by using the MAP 29 * protocol over Bluetooth. The current set of functions that may be achieved are: 30 * A) Send SMS/MMS over bluetooth. 31 * B) Receive notifications for all SMS/MMS events on the phone (see Callback AIDL). 32 * @hide 33 */ 34 interface IBluetoothMapService { 35 // NOTE: Function calls that return a boolean status indicate the success or failure of the call 36 // itself. For example a false return status could mean that the service is not connected and 37 // that the client should not expect a callback (if one was going to be sent back) OR the 38 // successful execution of the request (for instance delete message). 39 40 // Connect a manager with a callback. 41 // After connect is called any events that happen on remote 42 // end of MAP protocol (Phone side) will be reported to the client 43 // (see IBluetoothMapCallbacks interface). Also, ONLY after callback is called should it make 44 // sense to use the other functions in the protocol here. 45 // @callback - Callback to receive events from Bluetooth MAP protocol. connect(in IBluetoothMapServiceCallbacks callback, in BluetoothDevice device)46 boolean connect(in IBluetoothMapServiceCallbacks callback, in BluetoothDevice device); 47 48 // Disconnect the client from the service. disconnect(in IBluetoothMapServiceCallbacks callback)49 void disconnect(in IBluetoothMapServiceCallbacks callback); 50 51 // Enable/Disable notifications. 52 // @status: Whether to enable or disable the notifications. enableNotifications(in IBluetoothMapServiceCallbacks callbacks, boolean status)53 boolean enableNotifications(in IBluetoothMapServiceCallbacks callbacks, boolean status); 54 55 // Pushes the message to the outbox of remote device. 56 // Sending message is only supported for text based messages. 57 // @message - Message to be sent. pushMessage(in IBluetoothMapServiceCallbacks callback, in BluetoothMapMessage message)58 boolean pushMessage(in IBluetoothMapServiceCallbacks callback, in BluetoothMapMessage message); 59 60 // Fetch a message with a given handle. 61 // @handle - Handle of the message most likely obtained from a BluetoothMapEventReport object. getMessage(in IBluetoothMapServiceCallbacks callback, String handle)62 boolean getMessage(in IBluetoothMapServiceCallbacks callback, String handle); 63 64 // Get a listing of message handles. 65 // @folder - Folder to fetch the messages from. 66 // @count - Number of messages to fetch, if 0 is provided then no message listings are fetched. 67 // @offset - When paging (to be done by the client), offset can be provided to fetch further 68 // messages. Client should be careful of new messages/deletions/message moves which could 69 // invalidate the paging and it has to be done over. getMessagesListing(in IBluetoothMapServiceCallbacks callback, String folder, int count, int offset)70 boolean getMessagesListing(in IBluetoothMapServiceCallbacks callback, 71 String folder, int count, int offset); 72 } 73