Google Cloud IoT device SDK for embedded C
1.0.2
|
The Cloud IoT device SDK for embedded C is a library of source files for securely connecting to and communicating with Cloud IoT Core. The SDK is designed for embedded IoT devices, so the SDK:
To use the SDK:
Download the latest version.
Include the main library files in the client application.
The following tables list the functions you can use to communicate over MQTT.
Function | Description |
---|---|
iotc_initialize() | Initializes the time and random number libraries in the BSP. |
iotc_shutdown() | Shuts down the SDK and frees all resources created during initialization. |
iotc_get_heap_usage() | Gets the amount of heap memory allocated to the SDK. |
iotc_get_network_timeout() | Gets the connection timeout. |
iotc_get_state_string() | Gets the state message associated with a numeric code. |
iotc_set_fs_functions() | Sets the file operations to the custom file management functions in the BSP. |
iotc_set_maximum_heap_usage() | Sets the maximum heap memory that the SDK can use. |
iotc_set_network_timeout() | Sets the connection timeout. |
Function | Description |
---|---|
iotc_create_context() | Creates a connection context. |
iotc_delete_context() | Deletes and frees the provided context. |
iotc_is_context_connected() | Checks if a context is connected to an MQTT broker. |
Function | Description |
---|---|
iotc_connect() | Connects to Cloud IoT Core. |
iotc_connect_to() | Connects to a custom MQTT broker endpoint. |
iotc_create_iotcore_jwt() | Creates a JSON Web Token for authenticating to Cloud IoT Core. |
iotc_shutdown_connection() | Disconnects asynchronously from an MQTT broker. |
Function | Description |
---|---|
iotc_publish() | Publishes a message to an MQTT topic. |
iotc_publish_data() | Publishes binary data to an MQTT topic. |
iotc_subscribe() | Subscribes to an MQTT topic. |
Function | Description |
---|---|
iotc_schedule_timed_task() | Invokes a callback after an interval. |
iotc_cancel_timed_task() | Removes a scheduled task from the internal event system. |
iotc_events_process_blocking() | Invokes the event processing loop and executes the event engine as the main application process. |
iotc_events_process_tick() | Invokes the event processing loop on RTOS or non-OS devices that must yield for standard tick operations. |
iotc_events_stop() | Shuts down the event engine. |
The SDK depends on hardware-specific drivers and routines to implement MQTT with TLS. Embedded systems rely on unique hardware, so the SDK abstracts these dependencies in the Board Support Package (BSP).
The SDK has a turn-key POSIX BSP, so the SDK builds natively on POSIX platforms. You can customize the BSP to port the SDK to non-POSIX platforms.
The repository has example client applications for connecting:
native_posix
boards to Cloud IoT Core