2021-07-15 12:09 AM
I try to read the device name of a connected central device from the peripheral once the connection is complete
GAP_ConnectionComplete_CB(cc->peer_bdaddr, cc->handle);
uint16_t uuid = 0x2a00;
resp = aci_gatt_read_using_charac_uuid(cc->handle, 0x0001, 0xffff, UUID_TYPE_16, (uint8_t*)&uuid);
but the response is ERR_INVALID_HCI_CMD_PARAMS. Can someone spot my mistake? It seems that if I do the same thing from the BlueNRG GUI the parameters are valid. Of course I cannot confirm that the GUI really uses aci_gatt_read_using_charac_uuid().
Update:
What also confuses me is that according to UM1865 the aci_gatt_read_using_charc_uuid function should only return 0x00, 0x42 or 0x46 but not 0x12.
2021-07-29 07:59 AM
Is my use of this function correct or how would I read a characteristic from a connected central device?
2021-10-08 06:01 AM
This is still an open issue, any help is highly appreciated!
2021-10-22 07:42 AM
No one ever head to read out a characteristic from a central device? :)
2021-10-25 08:27 PM
There shall be no difference to use GUI or not. If it works with GUI, it also works with your code. So, compare your parameter differences.
Check the GUI in the Sent/Received Packets pane, click the packet you sent, and the content will be showed in the Packet Details.
The call returns a HCI status event, and the list of error codes can be found in Core spec.
The value 0x12 would be invalid HCI command parameters. Possibly one of these occurs:
• the parameter total length is invalid.
• a command parameter is an invalid type.
• a connection identifier does not match the corresponding event.
• a parameter is odd when it is required to be even.
• a parameter is outside of the specified range.
• two or more parameter values have inconsistent values.
I usually use ACI_GATT_READ_CHAR_VALUE (with attribute handle), but it doesn't matter. ACI_GATT_READ_USING_CHAR_UUID shall work as well. Just use whatever suitable for the application.
2021-10-26 06:18 AM
@Winfred LU thanks for the response
I use the exact same parameters, or can you spot an issue in my call? It works with ACI_GATT_READ_CHAR_VALUE though, but it's much more cumbersome to figure out the attribute handle than the uuid, isn't it?
2021-10-28 06:39 PM
Your call would be correct.
There seems to be a typo in DK 2.0.2, if you look to the ACI framework in bluenrg_aci_const.h file (line 634),
the OCF code to read GATT characteristic using UUID shall be 119.
Secondly, in the file bluenrg_gatt_aci.c, check aci_gatt_read_using_charac_uuid() function, around line 890,
there is a missing setting on event:
rq.event = EVT_CMD_STATUS;
Patching them shall fix the issue.
2021-10-28 11:45 PM
@Winfred LU Works like a charm, thank you very much!