|
static void | golioth_lock (struct golioth_client *client) |
|
static void | golioth_unlock (struct golioth_client *client) |
|
void | golioth_init (struct golioth_client *client) |
| Initialize golioth client instance. More...
|
|
bool | golioth_is_connected (struct golioth_client *client) |
| Check if client is connected to Golioth. 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_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_process_rx (struct golioth_client *client) |
| Process incoming data from Golioth. More...
|
|
void | golioth_poll_prepare (struct golioth_client *client, int64_t now, int *fd, int64_t *timeout) |
| Prepare for poll() system call on transport socket. More...
|
|
Functions for communicating with the Golioth servers
◆ GOLIOTH_COAP_MAX_NON_PAYLOAD_LEN
#define GOLIOTH_COAP_MAX_NON_PAYLOAD_LEN 128 |
◆ GOLIOTH_EMPTY_PACKET_LEN
◆ GOLIOTH_MAX_IDENTITY_LEN
#define GOLIOTH_MAX_IDENTITY_LEN 32 |
◆ golioth_content_format
Set of Content-Format option values for Golioth APIs.
Enumerator |
---|
GOLIOTH_CONTENT_FORMAT_APP_OCTET_STREAM | |
GOLIOTH_CONTENT_FORMAT_APP_JSON | |
GOLIOTH_CONTENT_FORMAT_APP_CBOR | |
Definition at line 33 of file net/golioth.h.
◆ golioth_connect()
int golioth_connect |
( |
struct golioth_client * |
client, |
|
|
const char * |
host, |
|
|
uint16_t |
port |
|
) |
| |
Connect to Golioth.
Attempt to connect to Golioth.
- Parameters
-
client | Client instance |
host | Server hostname or IP address |
port | Server port number |
- Return values
-
◆ golioth_disconnect()
Disconnect from Golioth.
Attempt to disconnect from Golioth.
- Parameters
-
- Return values
-
◆ golioth_init()
Initialize golioth client instance.
Initializes internal data of client instance. Must be called before using any other APIs on client instance.
- Parameters
-
◆ golioth_is_connected()
Check if client is connected to Golioth.
Check if client instance is connected to Golioth.
- Parameters
-
- Return values
-
true | When client is connected to Golioth. |
false | When client is not connected to Golioth. |
◆ golioth_lock()
◆ golioth_ping()
Send PING message to Golioth.
- Parameters
-
- Return values
-
◆ golioth_poll_prepare()
void golioth_poll_prepare |
( |
struct golioth_client * |
client, |
|
|
int64_t |
now, |
|
|
int * |
fd, |
|
|
int64_t * |
timeout |
|
) |
| |
Prepare for poll() system call on transport socket.
- Parameters
-
[in] | client | Client instance |
[in] | now | Timestamp in msec for current event loop (e.g. output of k_uptime_get()) |
[out] | fd | File descriptor of transport socket (optional, can be NULL) |
[out] | timeout | Timeout till the next action needs to be taken, such as resending a packet (optional, can be NULL) |
◆ golioth_process_rx()
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.
- Parameters
-
- Return values
-
◆ golioth_send_coap()
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.
- Parameters
-
client | Client instance |
packet | CoAP packet |
- Return values
-
◆ golioth_send_coap_payload()
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.
- Parameters
-
client | Client instance |
packet | CoAP packet (without payload) |
data | Payload data |
data_len | Payload length |
- Return values
-
◆ golioth_send_hello()
Send Hello message to Golioth.
Sends Hello message to Golioth, which is mostly useful verifying Golioth connection.
- Parameters
-
- Return values
-
◆ golioth_set_proto_coap_dtls()
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.
- Parameters
-
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) |
- Return values
-
◆ golioth_unlock()