2019-11-27 08:30 AM
I'm trying to :-
A> use one characteristic that Server can use to write data to Client with indication
B> use same characteristic so that Client can send data to Server with indication
the characteristic is set up as follows aci_gatt_add_char(....CHAR_PROP_READ|CHAR_PROP_INDICATE|CHAR_PROP_WRITE on both Client and Server
I have achieved A> and works pretty well, however I'm having problems with B>
the problem is even though I can send easily send the data from Client to Server and Server is receiving the data in the aci_gatt_notification_event()
How can I achieve notification back? I'm happy to have the Client >> Server write on a separate Characteristic
2019-12-01 07:52 PM
Please try to call ACI_GATT_SET_EVENT_MASK enabling ACI_GATT_ATTRIBUTE_MODIFIED_EVENT
Whenever an ATT write comes, there shall be an ACI_GATT_ATTRIBUTE_MODIFIED_EVENT reported.
2019-12-02 03:10 AM
thanks, I'll give that a try
2019-12-02 03:39 AM
I've added but now I can't connect?
won't just writing ACI_GATT_ATTRIBUTE_MODIFIED_EVENT wipe out all the other masks?
I see in bluenrg1_gatt_aci.h >>>
@brief Mask events from the GATT. The default configuration is all the events masked
so ACI_GATT_ATTRIBUTE_MODIFIED_EVENT should already be set? Also, is ACI_GATT_ATTRIBUTE_MODIFIED_EVENT defined somewhere?
2019-12-02 04:16 AM
I did ret = aci_gatt_set_event_mask(0x7FFFF); on server end and added aci_gatt_attribute_modified_event() handler but handler never gets call even though the write is still working.
What was wrong with catching the write responce in aci_gat_notification_event() in my original post- this works (its just I cant send a notification back to say that I have received.
2019-12-02 07:45 PM
If the attribute property includes "write", the GATT write request would have the write response already.
In case you need to know whenever the characteristic is updated, please add "notify" in its properties during configuring the database, then subscribe the notification from the client.
2019-12-04 03:26 AM
I added CHAR_PROP_INDICATE so now have
aci_gatt_add_char(....CHAR_PROP_READ|CHAR_PROP_INDICATE|CHAR_PROP_WRITE|CHAR_PROP_INDICATE
but aci_gatt_notification_event() still doesn't get called on client.
Also, when server sends data to client, client receives data push on notification AND on indication which is not what I need.
2019-12-04 07:36 PM
If you add indicate property (CHAR_PROP_INDICATE), when an indication comes the aci_gatt_indication_event() will be called.
If you need notify, please add CHAR_PROP_NOTIFY, then the aci_gatt_notify_event() will be called when a notification is received.
Both these event callbacks only work on a GATT client.
aci_gatt_confirm_indication() can only be used by a GATT to confirm (send a confirmation back to the server) for a received indication.
2019-12-05 02:58 AM
Are you saying it's not possible to achieve what I'm asking for?
If not, then please please share with US how I can get some sort of acknowledgement on the CLIENT from the server that the server received the data.
2019-12-05 11:04 PM
No. I was saying that please do not misunderstand the notification and indication.
Notification is used when a server is configured to notify a Characteristic Value to a client without expecting any Attribute Protocol layer acknowledgment that the notification was successfully received.
Indication is used when a server is configured to indicate a Characteristic Value to a client and expects an Attribute Protocol layer acknowledgement that the indication was successfully received.
Back to the question of using ACI_GATT_UPDATE_CHAR_VALUE,
If notifications (or indications) are enabled on that characteristic, a notification (or indication) will be sent to the client after sending this command to the BlueNRG-1.
On the GATT client the callbacks will be called accordingly, either aci_gatt_notification_event() or aci_gatt_indication_event().
But in the case indication is used, on the client you have to confirm the indication reception using the command aci_gatt_confirm_indication().