Modules | |
Golioth System Client | |
Golioth Wifi | |
Classes | |
struct | golioth_unsecure |
UDP (unsecure) credentials (identity only) of Golioth client. More... | |
struct | golioth_tls |
(D)TLS credentials of Golioth client. More... | |
struct | golioth_client |
Represents a Golioth client instance. More... | |
struct | golioth_blockwise_observe_ctx |
Represents a Golioth blockwise observe context. More... | |
struct | golioth_blockwise_download_ctx |
Represents blockwise download transfer from Golioth. More... | |
Macros | |
#define | GOLIOTH_COAP_MAX_NON_PAYLOAD_LEN 128 |
#define | GOLIOTH_MAX_IDENTITY_LEN 32 |
#define | GOLIOTH_EMPTY_PACKET_LEN (16 + GOLIOTH_MAX_IDENTITY_LEN) |
#define | GOLIOTH_LIGHTDB_PATH(x) ".d/" x |
#define | GOLIOTH_LIGHTDB_STREAM_PATH(x) ".s/" x |
Typedefs | |
typedef int(* | golioth_blockwise_observe_received_t) (struct golioth_blockwise_observe_ctx *ctx, const uint8_t *data, size_t offset, size_t len, bool last) |
Type of the callback being called when a single block of data is received as part of CoAP observe notification. More... | |
typedef int(* | golioth_blockwise_download_received_t) (struct golioth_blockwise_download_ctx *ctx, const uint8_t *data, size_t offset, size_t len, bool last) |
Type of the callback being called when a single block of data is received as part of CoAP response. More... | |
Functions | |
void | golioth_blockwise_download_init (struct golioth_client *client, struct golioth_blockwise_download_ctx *ctx) |
Initialize blockwise download. More... | |
void | golioth_init (struct golioth_client *client) |
Initialize golioth client instance. More... | |
int | golioth_connect (struct golioth_client *client, const char *host, uint16_t port) |
Connect to Golioth. More... | |
int | golioth_disconnect (struct golioth_client *client) |
Disconnect from Golioth. More... | |
int | golioth_set_proto_coap_udp (struct golioth_client *client, uint8_t *identity, size_t identity_len) |
Set UDP as transport protocol. More... | |
int | golioth_set_proto_coap_dtls (struct golioth_client *client, sec_tag_t *sec_tag_list, size_t sec_tag_count) |
Set DTLS as transport protocol. More... | |
int | golioth_send_coap (struct golioth_client *client, struct coap_packet *packet) |
Send CoAP packet to Golioth. More... | |
int | golioth_send_coap_payload (struct golioth_client *client, struct coap_packet *packet, uint8_t *data, uint16_t data_len) |
Send CoAP packet with separate payload to Golioth. More... | |
int | golioth_ping (struct golioth_client *client) |
Send PING message to Golioth. More... | |
int | golioth_send_hello (struct golioth_client *client) |
Send Hello message to Golioth. More... | |
int | golioth_lightdb_get (struct golioth_client *client, const uint8_t *path, enum coap_content_format format, struct coap_reply *reply, coap_reply_t reply_cb) |
Get value from Golioth's Light DB. More... | |
int | golioth_lightdb_set (struct golioth_client *client, const uint8_t *path, enum coap_content_format format, uint8_t *data, uint16_t data_len) |
Set value to Golioth's Light DB. More... | |
int | golioth_lightdb_delete (struct golioth_client *client, const uint8_t *path) |
Delete value in Golioth's Light DB. More... | |
int | golioth_lightdb_observe (struct golioth_client *client, const uint8_t *path, enum coap_content_format format, struct coap_reply *reply, coap_reply_t reply_cb) |
Observe value in Golioth's Light DB. More... | |
int | golioth_observe_blockwise (struct golioth_client *client, struct golioth_blockwise_observe_ctx *ctx, const char *path, struct coap_reply *reply, golioth_blockwise_observe_received_t received_cb) |
Observe resource with blockwise updates. More... | |
int | golioth_process_rx (struct golioth_client *client) |
Process incoming data from Golioth. More... | |
Functions for communicating with the Golioth servers
#define GOLIOTH_COAP_MAX_NON_PAYLOAD_LEN 128 |
#define GOLIOTH_EMPTY_PACKET_LEN (16 + GOLIOTH_MAX_IDENTITY_LEN) |
#define GOLIOTH_LIGHTDB_PATH | ( | x | ) | ".d/" x |
#define GOLIOTH_LIGHTDB_STREAM_PATH | ( | x | ) | ".s/" x |
#define GOLIOTH_MAX_IDENTITY_LEN 32 |
golioth_blockwise_download_received_t |
Type of the callback being called when a single block of data is received as part of CoAP response.
golioth_blockwise_observe_received_t |
Type of the callback being called when a single block of data is received as part of CoAP observe notification.
void golioth_blockwise_download_init | ( | struct golioth_client * | client, |
struct golioth_blockwise_download_ctx * | ctx | ||
) |
Initialize blockwise download.
client | Client instance |
ctx | Blockwise download context |
int golioth_connect | ( | struct golioth_client * | client, |
const char * | host, | ||
uint16_t | port | ||
) |
Connect to Golioth.
Attempt to connect to Golioth.
client | Client instance |
host | Server hostname or IP address |
port | Server port number |
0 | On success |
<0 | On failure |
int golioth_disconnect | ( | struct golioth_client * | client | ) |
Disconnect from Golioth.
Attempt to disconnect from Golioth.
client | Client instance |
0 | On success |
<0 | On failure |
void golioth_init | ( | struct golioth_client * | client | ) |
Initialize golioth client instance.
Initializes internal data of client instance. Must be called before using any other APIs on client instance.
client | Client instance |
int golioth_lightdb_delete | ( | struct golioth_client * | client, |
const uint8_t * | path | ||
) |
Delete value in Golioth's Light DB.
Delete value in Light DB.
client | Client instance |
path | Light DB resource path |
0 | On success |
<0 | On failure |
int golioth_lightdb_get | ( | struct golioth_client * | client, |
const uint8_t * | path, | ||
enum coap_content_format | format, | ||
struct coap_reply * | reply, | ||
coap_reply_t | reply_cb | ||
) |
Get value from Golioth's Light DB.
Get value from Light DB and initialize passed CoAP reply handler.
client | Client instance |
path | Light DB resource path |
format | Requested format of payload |
reply | CoAP reply handler object used for notifying about received value |
reply_cb | Reply handler callback |
0 | On success |
<0 | On failure |
int golioth_lightdb_observe | ( | struct golioth_client * | client, |
const uint8_t * | path, | ||
enum coap_content_format | format, | ||
struct coap_reply * | reply, | ||
coap_reply_t | reply_cb | ||
) |
Observe value in Golioth's Light DB.
Observe value in Light DB and initialize passed CoAP reply handler.
client | Client instance |
path | Light DB resource path to be monitored |
format | Requested format of payload |
reply | CoAP reply handler object used for notifying about updated value |
reply_cb | Reply handler callback |
0 | On success |
<0 | On failure |
int golioth_lightdb_set | ( | struct golioth_client * | client, |
const uint8_t * | path, | ||
enum coap_content_format | format, | ||
uint8_t * | data, | ||
uint16_t | data_len | ||
) |
Set value to Golioth's Light DB.
Set new value to Light DB.
client | Client instance |
path | Light DB resource path |
format | Format of payload |
data | Payload data |
data_len | Payload length |
0 | On success |
<0 | On failure |
int golioth_observe_blockwise | ( | struct golioth_client * | client, |
struct golioth_blockwise_observe_ctx * | ctx, | ||
const char * | path, | ||
struct coap_reply * | reply, | ||
golioth_blockwise_observe_received_t | received_cb | ||
) |
Observe resource with blockwise updates.
client | Client instance |
ctx | Blockwise observe context that will be used for handling resouce updates |
path | Resource path to be monitored |
reply | CoAP reply handler object used for notifying about updated value |
received_cb | Received block handler callback |
0 | On success |
<0 | On failure |
int golioth_ping | ( | struct golioth_client * | client | ) |
Send PING message to Golioth.
client | Client instance |
0 | On success |
<0 | On failure |
int golioth_process_rx | ( | struct golioth_client * | client | ) |
Process incoming data from Golioth.
Process incoming data on network socket. It does not block when there is no more data, so it is best to use it with zsock_poll.
client | Client instance |
0 | On success |
<0 | On failure |
int golioth_send_coap | ( | struct golioth_client * | client, |
struct coap_packet * | packet | ||
) |
Send CoAP packet to Golioth.
This is low-level API for sending arbitrary CoAP packet to Golioth.
client | Client instance |
packet | CoAP packet |
0 | On success |
<0 | On failure |
int golioth_send_coap_payload | ( | struct golioth_client * | client, |
struct coap_packet * | packet, | ||
uint8_t * | data, | ||
uint16_t | data_len | ||
) |
Send CoAP packet with separate payload to Golioth.
Similar to golioth_send_coap, but appends payload (internally) before sending.
client | Client instance |
packet | CoAP packet (without payload) |
data | Payload data |
data | Payload length |
0 | On success |
<0 | On failure |
int golioth_send_hello | ( | struct golioth_client * | client | ) |
Send Hello message to Golioth.
Sends Hello message to Golioth, which is mostly useful verifying Golioth connection.
client | Client instance |
0 | On success |
<0 | On failure |
int golioth_set_proto_coap_dtls | ( | struct golioth_client * | client, |
sec_tag_t * | sec_tag_list, | ||
size_t | sec_tag_count | ||
) |
Set DTLS as transport protocol.
Set DTLS as transport protocol for CoAP packets to Golioth and assignes credentials to be used.
client | Client instance |
sec_tag_list | Secure tag array (see sec_tag_t and TLS_SEC_TAG_LIST) |
sec_tag_count | Secure tag count (see sec_tag_t and TLS_SEC_TAG_LIST) |
0 | On success |
<0 | On failure |
int golioth_set_proto_coap_udp | ( | struct golioth_client * | client, |
uint8_t * | identity, | ||
size_t | identity_len | ||
) |
Set UDP as transport protocol.
Set UDP as transport protocol for CoAP packets to Golioth and assignes credentials (identity) to be used.
client | Client instance |
identity | Client identity |
0 | On success |
<0 | On failure |