2019-08-07 03:44 PM
i am able to send 20 bytes to an android app through the following codes when the android app executes command: bluetooth_gatt.readCharacteristic(gattChar);
:
void aci_gatt_read_permit_req_event(uint16_t Connection_Handle,
uint16_t Attribute_Handle,
uint16_t Offset)
{
uint8_t send1[] = {0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,
0x31,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,};
if (aci_gatt_update_char_value_ext(Connection_Handle,envSensServHandle,tempCharHandle,0,20,0,20,(uint8_t *)send_to)==BLE_STATUS_SUCCESS){
aci_gatt_allow_read(Connection_Handle);
};
my question is :
if it is possible to achieve that the andriod app keep reading and bluenrg2 keep sending data? and if it is possible to get ride of aci_gatt_allow_read(Connection_Handle);
how to achieve send 247 data at once? the data sheet says it is possible, but i couldn't find and instruction about it.
QUESTION 2:
the following are the andriod code to enable notification, but when i send a notification through aci_gatt_update_char_value_ext, the android app didn't enter the callback relating to notification received.
bluetooth_gatt.setCharacteristicNotification(gattChar, enabled);
BluetoothGattDescriptor descriptor = gattChar.getDescriptor(UUID.fromString("00002904-0000-1000-8000-00805f9b34fb"));
// 00002904-0000-1000-8000-00805f9b34fb are get from the following code:
//for (BluetoothGattDescriptor descriptor:gattChar.getDescriptors()){
// Log.e(Constants.TAG, "BluetoothGattDescriptor: "+descriptor.getUuid().toString());
// }
descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
boolean ok = bluetooth_gatt.writeDescriptor(descriptor);