Modem API Reference
The Blecon Device SDK provides a developer interface to the Blecon modem.
Last updated
The Blecon Device SDK provides a developer interface to the Blecon modem.
Last updated
Get Support
Ask a questionThe Blecon SDK is available on GitHub. This document refers to SDK Version 2.0.1.
Name | Description |
---|---|
Name | Description |
---|---|
Callbacks structure to populate by user.
Callbacks structure to populate by user for requests.
A structure used to build a request based on its attributes.
Create new internal modem instance.
a pointer to a struct blecon_modem_t instance
Destroy internal modem instance.
Create new external modem instance.
a pointer to a struct blecon_modem_t instance
Destroy external modem instance.
Initialise Blecon.
Set-up Blecon.
true on success, or false on failure
Set callbacks.
Get information about the modem.
Set application-related data.
true on success, or false on failure
Announce the device ID to surrounding hotspots.
true on success, or false on failure
Initiate a connection to the Blecon infrastructure.
true on success, or false on failure
Terminate the current connection, or cancel the connection attempt.
true on success, or false on failure
Check if a connection is established.
true if connected, or false if not
Get the device's ID in URL form.
true on success, or false on failure
Get the device's ID in UUID form.
true on success, or false on failure
Get the current time.
true on success, or false on failure
Perform a ping to the Blecon infrastructure.
true on success, or false on failure
Cancel a ping to the Blecon infrastructure.
true on success, or false on failure
Get latency information from the last ping.
true on success, or false on failure
Start a peer scanning session.
true on success, or false on failure
Stop the current peer scanning session.
true on success, or false on failure
Get the data from the last peer scan.
true on success, or false on failure
Submit a request for processing.
Get a request processor.
a pointer to a struct blecon_request_processor_t instance
Initialise a request.
Retrieve a request's parameters.
a pointer to the request's parameters
Get the status of a request.
the status code of the request
Send data for a request.
true if the operation was queued successfully, or false on failure
Get the user data associated with a send data operation.
a pointer to the user data
Start a receiving operation.
true if the operation was queued successfully, or false on failure
Get the user data associated with a receive data operation.
a pointer to the user data
Clean-up a request.
Type | Name | Description |
---|---|---|
Type | Name | Description |
---|---|---|
Type | Name | Description |
---|---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Callbacks structure to populate by user.
Callbacks structure to populate by user for requests.
A structure used to build a request based on its attributes.
Create new internal modem instance.
Destroy internal modem instance.
Create new external modem instance.
Destroy external modem instance.
Initialise Blecon.
Set-up Blecon.
Set callbacks.
Get information about the modem.
Set application-related data.
Announce the device ID to surrounding hotspots.
Initiate a connection to the Blecon infrastructure.
Terminate the current connection, or cancel the connection attempt.
Check if a connection is established.
Get the device's ID in URL form.
Get the device's ID in UUID form.
Get the current time.
Perform a ping to the Blecon infrastructure.
Cancel a ping to the Blecon infrastructure.
Get latency information from the last ping.
Start a peer scanning session.
Stop the current peer scanning session.
Get the data from the last peer scan.
Submit a request for processing.
Get a request processor.
Initialise a request.
Retrieve a request's parameters.
Get the status of a request.
Send data for a request.
Get the user data associated with a send data operation.
Start a receiving operation.
Get the user data associated with a receive data operation.
Clean-up a request.
on_connection
Called when a blecon connection is open.
on_disconnection
Called when a blecon connection is closed.
on_time_update
Called when time is updated from the Blecon infrastructure.
on_ping_result
Called when a ping is completed.
on_scan_report
Called when a scan report is available.
on_scan_complete
Called when a scan completed.
on_closed
Called when a request has completed and all data has been sent and received by the modem, or when the request terminated with an error.
on_data_sent
Called when the data set in blecon_request_send_data() has been sent.
alloc_incoming_data_buffer
Allocate memory for incoming data.
on_data_received
Called when new data is received for a request.
oneway
If true, the request is one-way (no response expected)
method
< The namespace of this request's event type (maximum BLECON_NAMESPACE_MAX_SZ characters, including null terminator) or NULL
request_content_type
The content type of the request (e.g. application/cbor, maximum BLECON_CONTENT_TYPE_MAX_SZ characters, including null terminator) or NULL.
response_content_type
The expected content type of the response (e.g. application/cbor, maximum BLECON_CONTENT_TYPE_MAX_SZ characters, including null terminator) or NULL.
response_mtu
The maximum size of a response data frame (for a single data operation, maximum BLECON_MTU)
callbacks
The callbacks to use for this request.
user_data
User data to pass to the callbacks.
event_loop
a platform-specific event loop instance
bluetooth
a platform-specific bluetooth instance
crypto
a platform-specific crypto instance
nvm
a platform-specific nvm instance
nfc
a platform-specific nfc instance
scan_buffer_size
the size of the scan buffer
allocator
a function to allocate memory
modem
a pointer to a struct blecon_modem_t instance created by blecon_int_modem_create()
deallocator
a function to deallocate memory or NULL
event_loop
a platform-specific event loop instance
transport
a platform-specific transport instance
allocator
a function to allocate memory
modem
a pointer to a struct blecon_modem_t instance created by blecon_ext_modem_create()
deallocator
a function to deallocate memory or NULL
blecon
the blecon instance to initialise
modem
the modem instance to use
blecon
the blecon instance to set-up
blecon
the blecon instance
callbacks
a struct blecon_modem_callbacks_t structure containing the user's callbacks
user_data
user data to pass to the callbacks
blecon
the blecon instance
info
a pointer to a struct blecon_modem_info_t structure which is populated on success
blecon
the blecon instance
application_model_id
the device's specific model id encoded as a UUID (16 bytes long)
application_schema_version
the device's schema version
blecon
the blecon instance
blecon
the blecon instance
blecon
the blecon instance
blecon
the blecon instance
blecon
the blecon instance
url
a char array where to store the url (0-terminated)
max_sz
the maximum size of the array (including space for 0 terminator)
blecon
the blecon instance
uuid
a 16-byte array where to store the uuid
blecon
the blecon instance
time_valid
a pointer to a bool which is set to true if the time is valid
utc_time_ms_now
a pointer to a uint64_t where the current time is stored
utc_time_ms_last_updated
a pointer to a uint64_t where the time of last update is stored
blecon
the blecon instance
timeout_ms
the timeout in milliseconds
blecon
the blecon instance
blecon
the blecon instance
latency_available
a pointer to a bool which is set to true if the latency is available
connection_latency_ms
a pointer to a uint32_t where the connection latency is stored (milliseconds)
round_trip_latency_ms
a pointer to a uint32_t where the round trip latency is stored (milliseconds)
blecon
the blecon instance
peer_scan
true to report peer devices
raw_scan
true to report raw advertising data
duration_ms
the duration of the scan in milliseconds
blecon
the blecon instance
blecon
the blecon instance
peer_scan_report_iterator
a function to call for each peer device report; if NULL, no peer device reports are returned
raw_scan_report_iterator
a function to call for each raw advertising data report; if NULL, no raw advertising data reports are returned
overflow
a pointer to a bool which is set to true if the scan data buffer overflowed
user_data
user data to pass to the report iterator callbacks
blecon
the blecon instance
request
the request to submit
blecon
the blecon instance
request
the request instance to initialise
parameters
a struct blecon_request_parameters_t structure containing the request's parameters
request
the request instance
request
the request instance
op
a pointer to a struct blecon_request_send_data_op_t structure which is populated on success
request
a pointer to the relevant request structure
data
the data to send
sz
the size of the data buffer (maximum BLECON_MTU)
finished
a flag indicating if this is the end of the data
user_data
a pointer to user-defined data which will be associated with the operation
op
the send data operation instance
op
a pointer to a struct blecon_request_receive_data_op_t structure which is populated on success
request
a pointer to the relevant request structure
user_data
a pointer to user-defined data which will be associated with the operation
op
the receive data operation instance
request
the request to clean-up