/**@class android.bluetooth.BluetoothGatt implements android.bluetooth.BluetoothProfile @extends java.lang.Object Public API for the Bluetooth GATT Profile. <p>This class provides Bluetooth GATT functionality to enable communication with Bluetooth Smart or Smart Ready devices. <p>To connect to a remote peripheral device, create a {@link android.bluetooth.BluetoothGattCallback} and call {@link android.bluetooth.BluetoothDevice#connectGatt} to get a instance of this class. GATT capable devices can be discovered using the Bluetooth device discovery or BLE scan process. */ var BluetoothGatt = { /**A GATT operation completed successfully */ GATT_SUCCESS : "0", /**GATT read operation is not permitted */ GATT_READ_NOT_PERMITTED : "2", /**GATT write operation is not permitted */ GATT_WRITE_NOT_PERMITTED : "3", /**Insufficient authentication for a given operation */ GATT_INSUFFICIENT_AUTHENTICATION : "5", /**The given request is not supported */ GATT_REQUEST_NOT_SUPPORTED : "6", /**Insufficient encryption for a given operation */ GATT_INSUFFICIENT_ENCRYPTION : "15", /**A read or write operation was requested with an invalid offset */ GATT_INVALID_OFFSET : "7", /**A write operation exceeds the maximum length of the attribute */ GATT_INVALID_ATTRIBUTE_LENGTH : "13", /**A remote device connection is congested. */ GATT_CONNECTION_CONGESTED : "143", /**A GATT operation failed, errors other than the above */ GATT_FAILURE : "257", /** Connection parameter update - Use the connection parameters recommended by the Bluetooth SIG. This is the default value if no connection parameter update is requested. */ CONNECTION_PRIORITY_BALANCED : "0", /** Connection parameter update - Request a high priority, low latency connection. An application should only request high priority connection parameters to transfer large amounts of data over LE quickly. Once the transfer is complete, the application should request {@link android.bluetooth.BluetoothGatt#CONNECTION_PRIORITY_BALANCED} connection parameters to reduce energy use. */ CONNECTION_PRIORITY_HIGH : "1", /**Connection parameter update - Request low power, reduced data rate connection parameters. */ CONNECTION_PRIORITY_LOW_POWER : "2", /**Close this Bluetooth GATT client. Application should call this method as early as possible after it is done with this GATT client. */ close : function( ) {}, /**Disconnects an established connection, or cancels a connection attempt currently in progress. <p>Requires {@link android.Manifest.permission#BLUETOOTH} permission. */ disconnect : function( ) {}, /**Connect back to remote device. <p>This method is used to re-connect to a remote device after the connection has been dropped. If the device is not in range, the re-connection will be triggered once the device is back in range. @return {Boolean} true, if the connection attempt was initiated successfully */ connect : function( ) {}, /**Set the preferred connection PHY for this app. Please note that this is just a recommendation, whether the PHY change will happen depends on other applications preferences, local and remote controller capabilities. Controller can override these settings. <p> {@link android.bluetooth.BluetoothGattCallback#onPhyUpdate} will be triggered as a result of this call, even if no PHY change happens. It is also triggered when remote device updates the PHY. @param {Number} txPhy preferred transmitter PHY. Bitwise OR of any of {@link BluetoothDevice#PHY_LE_1M_MASK}, {@link BluetoothDevice#PHY_LE_2M_MASK}, and {@link BluetoothDevice#PHY_LE_CODED_MASK}. @param {Number} rxPhy preferred receiver PHY. Bitwise OR of any of {@link BluetoothDevice#PHY_LE_1M_MASK}, {@link BluetoothDevice#PHY_LE_2M_MASK}, and {@link BluetoothDevice#PHY_LE_CODED_MASK}. @param {Number} phyOptions preferred coding to use when transmitting on the LE Coded PHY. Can be one of {@link BluetoothDevice#PHY_OPTION_NO_PREFERRED}, {@link BluetoothDevice#PHY_OPTION_S2} or {@link BluetoothDevice#PHY_OPTION_S8} */ setPreferredPhy : function( ) {}, /**Read the current transmitter PHY and receiver PHY of the connection. The values are returned in {@link android.bluetooth.BluetoothGattCallback#onPhyRead} */ readPhy : function( ) {}, /**Return the remote bluetooth device this GATT client targets to @return {Object {android.bluetooth.BluetoothDevice}} remote bluetooth device */ getDevice : function( ) {}, /**Discovers services offered by a remote device as well as their characteristics and descriptors. <p>This is an asynchronous operation. Once service discovery is completed, the {@link android.bluetooth.BluetoothGattCallback#onServicesDiscovered} callback is triggered. If the discovery was successful, the remote services can be retrieved using the {@link #getServices} function. <p>Requires {@link android.Manifest.permission#BLUETOOTH} permission. @return {Boolean} true, if the remote service discovery has been started */ discoverServices : function( ) {}, /**Discovers a service by UUID. This is exposed only for passing PTS tests. It should never be used by real applications. The service is not searched for characteristics and descriptors, or returned in any callback. <p>Requires {@link android.Manifest.permission#BLUETOOTH} permission. @return {Boolean} true, if the remote service discovery has been started @hide */ discoverServiceByUuid : function( ) {}, /**Returns a list of GATT services offered by the remote device. <p>This function requires that service discovery has been completed for the given device. <p>Requires {@link android.Manifest.permission#BLUETOOTH} permission. @return {Object {java.util.List}} List of services on the remote device. Returns an empty list if service discovery has not yet been performed. */ getServices : function( ) {}, /**Returns a {@link android.bluetooth.BluetoothGattService}, if the requested UUID is supported by the remote device. <p>This function requires that service discovery has been completed for the given device. <p>If multiple instances of the same service (as identified by UUID) exist, the first instance of the service is returned. <p>Requires {@link android.Manifest.permission#BLUETOOTH} permission. @param {Object {UUID}} uuid UUID of the requested service @return {Object {android.bluetooth.BluetoothGattService}} BluetoothGattService if supported, or null if the requested service is not offered by the remote device. */ getService : function( ) {}, /**Reads the requested characteristic from the associated remote device. <p>This is an asynchronous operation. The result of the read operation is reported by the {@link android.bluetooth.BluetoothGattCallback#onCharacteristicRead} callback. <p>Requires {@link android.Manifest.permission#BLUETOOTH} permission. @param {Object {BluetoothGattCharacteristic}} characteristic Characteristic to read from the remote device @return {Boolean} true, if the read operation was initiated successfully */ readCharacteristic : function( ) {}, /**Reads the characteristic using its UUID from the associated remote device. <p>This is an asynchronous operation. The result of the read operation is reported by the {@link android.bluetooth.BluetoothGattCallback#onCharacteristicRead} callback. <p>Requires {@link android.Manifest.permission#BLUETOOTH} permission. @param {Object {UUID}} uuid UUID of characteristic to read from the remote device @return {Boolean} true, if the read operation was initiated successfully @hide */ readUsingCharacteristicUuid : function( ) {}, /**Writes a given characteristic and its values to the associated remote device. <p>Once the write operation has been completed, the {@link android.bluetooth.BluetoothGattCallback#onCharacteristicWrite} callback is invoked, reporting the result of the operation. <p>Requires {@link android.Manifest.permission#BLUETOOTH} permission. @param {Object {BluetoothGattCharacteristic}} characteristic Characteristic to write on the remote device @return {Boolean} true, if the write operation was initiated successfully */ writeCharacteristic : function( ) {}, /**Reads the value for a given descriptor from the associated remote device. <p>Once the read operation has been completed, the {@link android.bluetooth.BluetoothGattCallback#onDescriptorRead} callback is triggered, signaling the result of the operation. <p>Requires {@link android.Manifest.permission#BLUETOOTH} permission. @param {Object {BluetoothGattDescriptor}} descriptor Descriptor value to read from the remote device @return {Boolean} true, if the read operation was initiated successfully */ readDescriptor : function( ) {}, /**Write the value of a given descriptor to the associated remote device. <p>A {@link android.bluetooth.BluetoothGattCallback#onDescriptorWrite} callback is triggered to report the result of the write operation. <p>Requires {@link android.Manifest.permission#BLUETOOTH} permission. @param {Object {BluetoothGattDescriptor}} descriptor Descriptor to write to the associated remote device @return {Boolean} true, if the write operation was initiated successfully */ writeDescriptor : function( ) {}, /**Initiates a reliable write transaction for a given remote device. <p>Once a reliable write transaction has been initiated, all calls to {@link #writeCharacteristic} are sent to the remote device for verification and queued up for atomic execution. The application will receive an {@link android.bluetooth.BluetoothGattCallback#onCharacteristicWrite} callback in response to every {@link #writeCharacteristic} call and is responsible for verifying if the value has been transmitted accurately. <p>After all characteristics have been queued up and verified, {@link #executeReliableWrite} will execute all writes. If a characteristic was not written correctly, calling {@link #abortReliableWrite} will cancel the current transaction without committing any values on the remote device. <p>Requires {@link android.Manifest.permission#BLUETOOTH} permission. @return {Boolean} true, if the reliable write transaction has been initiated */ beginReliableWrite : function( ) {}, /**Executes a reliable write transaction for a given remote device. <p>This function will commit all queued up characteristic write operations for a given remote device. <p>A {@link android.bluetooth.BluetoothGattCallback#onReliableWriteCompleted} callback is invoked to indicate whether the transaction has been executed correctly. <p>Requires {@link android.Manifest.permission#BLUETOOTH} permission. @return {Boolean} true, if the request to execute the transaction has been sent */ executeReliableWrite : function( ) {}, /**Cancels a reliable write transaction for a given device. <p>Calling this function will discard all queued characteristic write operations for a given remote device. <p>Requires {@link android.Manifest.permission#BLUETOOTH} permission. */ abortReliableWrite : function( ) {}, /** @deprecated Use {@link #abortReliableWrite()} */ abortReliableWrite : function( ) {}, /**Enable or disable notifications/indications for a given characteristic. <p>Once notifications are enabled for a characteristic, a {@link android.bluetooth.BluetoothGattCallback#onCharacteristicChanged} callback will be triggered if the remote device indicates that the given characteristic has changed. <p>Requires {@link android.Manifest.permission#BLUETOOTH} permission. @param {Object {BluetoothGattCharacteristic}} characteristic The characteristic for which to enable notifications @param {Boolean} enable Set to true to enable notifications/indications @return {Boolean} true, if the requested notification status was set successfully */ setCharacteristicNotification : function( ) {}, /**Clears the internal cache and forces a refresh of the services from the remote device. @hide */ refresh : function( ) {}, /**Read the RSSI for a connected remote device. <p>The {@link android.bluetooth.BluetoothGattCallback#onReadRemoteRssi} callback will be invoked when the RSSI value has been read. <p>Requires {@link android.Manifest.permission#BLUETOOTH} permission. @return {Boolean} true, if the RSSI value has been requested successfully */ readRemoteRssi : function( ) {}, /**Request an MTU size used for a given connection. <p>When performing a write request operation (write without response), the data sent is truncated to the MTU size. This function may be used to request a larger MTU size to be able to send more data at once. <p>A {@link android.bluetooth.BluetoothGattCallback#onMtuChanged} callback will indicate whether this operation was successful. <p>Requires {@link android.Manifest.permission#BLUETOOTH} permission. @return {Boolean} true, if the new MTU value has been requested successfully */ requestMtu : function( ) {}, /**Request a connection parameter update. <p>This function will send a connection parameter update request to the remote device. @param {Number} connectionPriority Request a specific connection priority. Must be one of {@link BluetoothGatt#CONNECTION_PRIORITY_BALANCED}, {@link BluetoothGatt#CONNECTION_PRIORITY_HIGH} or {@link BluetoothGatt#CONNECTION_PRIORITY_LOW_POWER}. @throws IllegalArgumentException If the parameters are outside of their specified range. */ requestConnectionPriority : function( ) {}, /**Request an LE connection parameter update. <p>This function will send an LE connection parameters update request to the remote device. @return {Boolean} true, if the request is send to the Bluetooth stack. @hide */ requestLeConnectionUpdate : function( ) {}, /**Not supported - please use {@link android.bluetooth.BluetoothManager#getConnectedDevices(int)} with {@link android.bluetooth.BluetoothProfile#GATT} as argument @throws UnsupportedOperationException */ getConnectionState : function( ) {}, /**Not supported - please use {@link android.bluetooth.BluetoothManager#getConnectedDevices(int)} with {@link android.bluetooth.BluetoothProfile#GATT} as argument @throws UnsupportedOperationException */ getConnectedDevices : function( ) {}, /**Not supported - please use {@link android.bluetooth.BluetoothManager#getDevicesMatchingConnectionStates(int, int[])} with {@link android.bluetooth.BluetoothProfile#GATT} as first argument @throws UnsupportedOperationException */ getDevicesMatchingConnectionStates : function( ) {}, };