bitQuit_Android/app/src/main/java/com/tonydicola/bletest/app/MainActivity.java
@Override
        public void onServicesDiscovered(BluetoothGatt gatt, int status) {
            super.onServicesDiscovered(gatt, status);
            if (status == BluetoothGatt.GATT_SUCCESS) {
//                writeLine("Service discovery completed!");
            } else {
//                writeLine("Service discovery failed with status: " + status);
            }
            // Save reference to each characteristic.
            tx = gatt.getService(UART_UUID).getCharacteristic(TX_UUID);
            rx = gatt.getService(UART_UUID).getCharacteristic(RX_UUID);
            // Setup notifications on RX characteristic changes (i.e. data received).
            // First call setCharacteristicNotification to enable notification.
            if (!gatt.setCharacteristicNotification(rx, true)) {
//                writeLine("Couldn't set notifications for RX characteristic!");
            }
            // Next update the RX characteristic's client descriptor to enable notifications.
            if (rx.getDescriptor(CLIENT_UUID) != null) {
                BluetoothGattDescriptor desc = rx.getDescriptor(CLIENT_UUID);
                desc.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
                if (!gatt.writeDescriptor(desc)) {
                    //                  writeLine("Couldn't write RX client descriptor value!");
                }
            } else {
//                writeLine("Couldn't get RX client descriptor!");
            }
        }
// manipulating any services or characteristics.
manipulating any services or characteristics.
manipulating any services or characteristics .
@Override
        public void onServicesDiscovered(BluetoothGatt gatt, int status) {
            super.onServicesDiscovered(gatt, status);
            if (status == BluetoothGatt.GATT_SUCCESS) {
            } else {
            }
            tx = gatt.getService(UART_UUID).getCharacteristic(TX_UUID);
            rx = gatt.getService(UART_UUID).getCharacteristic(RX_UUID);
            if (!gatt.setCharacteristicNotification(rx, true)) {
            }
            if (rx.getDescriptor(CLIENT_UUID) != null) {
                BluetoothGattDescriptor desc = rx.getDescriptor(CLIENT_UUID);
                desc.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
                if (!gatt.writeDescriptor(desc)) {
                }
            } else {
            }
        }
@ Override public void onServicesDiscovered ( BluetoothGatt gatt , int status ) { super . onServicesDiscovered ( gatt , status ) ; if ( status == BluetoothGatt . GATT_SUCCESS ) { } else { } tx = gatt . getService ( UART_UUID ) . getCharacteristic ( TX_UUID ) ; rx = gatt . getService ( UART_UUID ) . getCharacteristic ( RX_UUID ) ; if ( ! gatt . setCharacteristicNotification ( rx , true ) ) { } if ( rx . getDescriptor ( CLIENT_UUID ) != null ) { BluetoothGattDescriptor desc = rx . getDescriptor ( CLIENT_UUID ) ; desc . setValue ( BluetoothGattDescriptor . ENABLE_NOTIFICATION_VALUE ) ; if ( ! gatt . writeDescriptor ( desc ) ) { } } else { } }
manipulating any services or characteristics.
manipulating any services or characteristics .
//                writeLine("Service discovery completed!"); //                writeLine("Service discovery failed with status: " + status); // Save reference to each characteristic. // Setup notifications on RX characteristic changes (i.e. data received). // First call setCharacteristicNotification to enable notification. //                writeLine("Couldn't set notifications for RX characteristic!"); // Next update the RX characteristic's client descriptor to enable notifications. //                  writeLine("Couldn't write RX client descriptor value!"); //                writeLine("Couldn't get RX client descriptor!");