Download User Guide - smartBASIC BL600 Extensions

Transcript
smart BASIC
User Manual
PRINT "\nAdvertising, and Gatt Client is open\n"
ELSE
PRINT "\nFailure OnStartup"
ENDIF
WAITEVENT
PRINT "\nExiting..."
Expected Output:
Advertising, and Gatt Client is open
- Connected, so write to attribute handle 3
EVNOTIFYBUF Event
- write again to attribute handle 3
EVNOTIFYBUF Event
- write again to attribute handle 3
EVNOTIFYBUF Event
write to attribute handle 300 which does not exist
Even when the attribute does not exist an event will occur
EVNOTIFYBUF Event
- Disconnected
Exiting...
BLEGATTCWRITECMD is an extension function.
BleGattcNotifyRead
FUNCTION
A Gatt Server has the ability to notify or indicate the value attribute of a characteristic when
enabled via the Client Characeristic Configuration Descriptor (CCCD). This means data will
arrive from a Gatt Server at any time and so has to be managed so that it can synchronised with
the smartBASIC runtime engine.
Data arriving via a notification does not require Gatt acknowledgements, however indications
require them. This Gatt Client manager saves data arriving via a notification in the same ring
buffer for later extraction using the command BleGattcNotifyRead() and for indications an
automatic gatt acknowledgement is sent when the data is saved in the ring buffer. This
acknowledgment happens even if the data was discarded because the ring buffer was full. If
however it is required that the data NOT be acknowledged when it is discarded on a full buffer
then set the flags parameter in the BleGattcOpen() function where the Gatt Client manager is
opened.
In the case when an ack is NOT sent on data discard, the Gatt Server will be throttled and so no
further data will be notified or indicated by it until BleGattNotifyRead() is called to extract data
from the ring buffer to create space and it will trigger a delayed acknowledgement.
When the Gatt Client manager is opened using BleGattcOpen() it is possible to specify the size
of the ring buffer. If a value of 0 is supplied then a default size is created. SYSINFO(2019) in a
smartBASIC application or the interactive mode command AT I 2019 will return the default size.
Likewise SYSINFO(2020) or the command AT I 2020 will return the maximum size.
Americas: +1-800-492-2320 Option 2
Europe: +44-1628-858-940
Hong Kong: +852 2923 0610
wireless.support@lairdtech.com
www.lairdtech.com/bluetooth
152
Laird Technologies