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
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 global synchronized 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.
Callbacks structure to populate by user.
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.
Callbacks structure to populate by user for requests.
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
alloc_incoming_data_buffer
Allocate memory for incoming data.
on_data_received
Called when new data is received for a request.
A structure used to build a request based on its attributes.
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.
Create new internal modem instance.
event_loop
a platform-specific event loop instance
timer
a platform-specific timer 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
a pointer to a struct blecon_modem_t instance
Destroy internal modem instance.
modem
deallocator
a function to deallocate memory or NULL
Create new external modem instance.
event_loop
a platform-specific event loop instance
transport
a platform-specific transport instance
allocator
a function to allocate memory
a pointer to a struct blecon_modem_t instance
Destroy external modem instance.
modem
deallocator
a function to deallocate memory or NULL
Initialise Blecon.
blecon
the blecon instance to initialise
modem
the modem instance to use
Set-up Blecon.
blecon
the blecon instance to set-up
true on success, or false on failure
Set callbacks.
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
Get information about the modem.
blecon
the blecon instance
info
a pointer to a struct blecon_modem_info_t structure which is populated on success
Set application-related data.
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
true on success, or false on failure
Announce the device ID to surrounding hotspots.
blecon
the blecon instance
true on success, or false on failure
Initiate a connection to the Blecon infrastructure.
blecon
the blecon instance
true on success, or false on failure
Terminate the current connection, or cancel the connection attempt.
blecon
the blecon instance
true on success, or false on failure
Check if a connection is established.
blecon
the blecon instance
true if connected, or false if not
Get the device's ID in URL form.
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)
true on success, or false on failure
Get the device's ID in UUID form.
blecon
the blecon instance
uuid
a 16-byte array where to store the uuid
true on success, or false on failure
Get the current global synchronized time.
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
true on success, or false on failure
Perform a ping to the Blecon infrastructure.
blecon
the blecon instance
timeout_ms
the timeout in milliseconds
true on success, or false on failure
Cancel a ping to the Blecon infrastructure.
blecon
the blecon instance
true on success, or false on failure
Get latency information from the last ping.
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)
true on success, or false on failure
Start a peer scanning session.
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
true on success, or false on failure
Stop the current peer scanning session.
blecon
the blecon instance
true on success, or false on failure
Get the data from the last peer scan.
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
true on success, or false on failure
Submit a request for processing.
blecon
the blecon instance
request
the request to submit
Get a request processor.
blecon
the blecon instance
a pointer to a struct blecon_request_processor_t instance
Initialise a request.
request
the request instance to initialise
parameters
Retrieve a request's parameters.
request
the request instance
a pointer to the request's parameters
Get the status of a request.
request
the request instance
the status code of the request
Send data for a request.
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
true if the operation was queued successfully, or false on failure
Get the user data associated with a send data operation.
op
the send data operation instance
a pointer to the user data
Start a receiving operation.
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
true if the operation was queued successfully, or false on failure
Get the user data associated with a receive data operation.
op
the receive data operation instance
a pointer to the user data
Clean-up a request.
request
the request to clean-up
Called when the data set in has been sent.
a pointer to a struct blecon_modem_t instance created by
a pointer to a struct blecon_modem_t instance created by
a struct structure containing the request's parameters