none
BluetoothGATTSetCharacteristicValue () does not work as described. Need a real working example RRS feed

  • Question

  • Is there anywhere a working example of this function? I have written a Program which can open GATT devices and can read characteristics via BluetoothGATTGetCharacteristicValue()

    Basically what I want do do is this (This is how its done in Android where everything works fine.)=

    Overridden from class

    DistoBluetoothService

        public void writeGattCharacteristic(byte[] value)
        {
         BluetoothGattService theDeviceService = m_BluetoothGatt.getService(DEVICE_SERVICE);

         if (theDeviceService == null)
         {
          Log.d(TAG,"writeGattCharacteristic: theDeviceService null");     
          return;     
         }
         
         BluetoothGattCharacteristic deviceCharacteristicCommand = theDeviceService.getCharacteristic(DEVICE_CHARACTERISTIC_COMMAND);
         if (deviceCharacteristicCommand == null)
         {
          Log.d(TAG,"deviceCharacteristicCommand null");
          return;
         }
         deviceCharacteristicCommand.setValue(value);
         boolean status = m_BluetoothGatt.writeCharacteristic(deviceCharacteristicCommand);
         if(D) Log.d(TAG,"writeCharacteristic Status" + status);
        }


    Monday, March 24, 2014 8:20 AM