Home | History | Annotate | Download | only in bluetooth
      1 /*
      2  * Copyright (C) 2013 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 android.bluetooth;
     18 
     19 import android.bluetooth.BluetoothDevice;
     20 import android.os.ParcelUuid;
     21 
     22 import android.bluetooth.IBluetoothGattCallback;
     23 import android.bluetooth.IBluetoothGattServerCallback;
     24 
     25 /**
     26  * API for interacting with BLE / GATT
     27  * @hide
     28  */
     29 interface IBluetoothGatt {
     30     List<BluetoothDevice> getDevicesMatchingConnectionStates(in int[] states);
     31 
     32     void startScan(in int appIf, in boolean isServer);
     33     void startScanWithUuids(in int appIf, in boolean isServer, in ParcelUuid[] ids);
     34     void stopScan(in int appIf, in boolean isServer);
     35 
     36     void registerClient(in ParcelUuid appId, in IBluetoothGattCallback callback);
     37     void unregisterClient(in int clientIf);
     38     void clientConnect(in int clientIf, in String address, in boolean isDirect);
     39     void clientDisconnect(in int clientIf, in String address);
     40     void refreshDevice(in int clientIf, in String address);
     41     void discoverServices(in int clientIf, in String address);
     42     void readCharacteristic(in int clientIf, in String address, in int srvcType,
     43                             in int srvcInstanceId, in ParcelUuid srvcId,
     44                             in int charInstanceId, in ParcelUuid charId,
     45                             in int authReq);
     46     void writeCharacteristic(in int clientIf, in String address, in int srvcType,
     47                             in int srvcInstanceId, in ParcelUuid srvcId,
     48                             in int charInstanceId, in ParcelUuid charId,
     49                             in int writeType, in int authReq, in byte[] value);
     50     void readDescriptor(in int clientIf, in String address, in int srvcType,
     51                             in int srvcInstanceId, in ParcelUuid srvcId,
     52                             in int charInstanceId, in ParcelUuid charId,
     53                             in ParcelUuid descrUuid, in int authReq);
     54     void writeDescriptor(in int clientIf, in String address, in int srvcType,
     55                             in int srvcInstanceId, in ParcelUuid srvcId,
     56                             in int charInstanceId, in ParcelUuid charId,
     57                             in ParcelUuid descrId, in int writeType,
     58                             in int authReq, in byte[] value);
     59     void registerForNotification(in int clientIf, in String address, in int srvcType,
     60                             in int srvcInstanceId, in ParcelUuid srvcId,
     61                             in int charInstanceId, in ParcelUuid charId,
     62                             in boolean enable);
     63     void beginReliableWrite(in int clientIf, in String address);
     64     void endReliableWrite(in int clientIf, in String address, in boolean execute);
     65     void readRemoteRssi(in int clientIf, in String address);
     66 
     67     void registerServer(in ParcelUuid appId, in IBluetoothGattServerCallback callback);
     68     void unregisterServer(in int serverIf);
     69     void serverConnect(in int servertIf, in String address, in boolean isDirect);
     70     void serverDisconnect(in int serverIf, in String address);
     71     void beginServiceDeclaration(in int serverIf, in int srvcType,
     72                             in int srvcInstanceId, in int minHandles,
     73                             in ParcelUuid srvcId);
     74     void addIncludedService(in int serverIf, in int srvcType,
     75                             in int srvcInstanceId, in ParcelUuid srvcId);
     76     void addCharacteristic(in int serverIf, in ParcelUuid charId,
     77                             in int properties, in int permissions);
     78     void addDescriptor(in int serverIf, in ParcelUuid descId,
     79                             in int permissions);
     80     void endServiceDeclaration(in int serverIf);
     81     void removeService(in int serverIf, in int srvcType,
     82                             in int srvcInstanceId, in ParcelUuid srvcId);
     83     void clearServices(in int serverIf);
     84     void sendResponse(in int serverIf, in String address, in int requestId,
     85                             in int status, in int offset, in byte[] value);
     86     void sendNotification(in int serverIf, in String address, in int srvcType,
     87                             in int srvcInstanceId, in ParcelUuid srvcId,
     88                             in int charInstanceId, in ParcelUuid charId,
     89                             in boolean confirm, in byte[] value);
     90 }
     91