Golioth Firmware SDK
Loading...
Searching...
No Matches
location.h File Reference
#include <golioth/client.h>
#include <golioth/golioth_status.h>
#include <stdint.h>
#include <zcbor_encode.h>

Go to the source code of this file.

Data Structures

struct  golioth_location_rsp
 
struct  golioth_location_req
 Wi-Fi location request, used with golioth_location_init(), golioth_location_finish() and golioth_location_get_sync() More...
 

Macros

#define GOLIOTH_LOCATION_FLAG_WIFI   (1 << 0)
 

Functions

void golioth_location_init (struct golioth_location_req *req)
 
enum golioth_status golioth_location_finish (struct golioth_location_req *req)
 
enum golioth_status golioth_location_get_sync (struct golioth_client *client, const struct golioth_location_req *req, struct golioth_location_rsp *rsp, int32_t timeout_s)
 

Macro Definition Documentation

◆ GOLIOTH_LOCATION_FLAG_WIFI

#define GOLIOTH_LOCATION_FLAG_WIFI   (1 << 0)

Definition at line 30 of file location.h.

Function Documentation

◆ golioth_location_finish()

enum golioth_status golioth_location_finish ( struct golioth_location_req * req)

Finish building location request

Needs to be called after filling data with golioth_location_*_append() APIs and before requesting location with golioth_location_get_sync().

Parameters
reqLocation request
Return values
GOLIOTH_OKLocation request finished successfully
GOLIOTH_ERR_NULLNo location information encoded within request
GOLIOTH_ERR_MEM_ALLOCNot enough memory in request buffer

◆ golioth_location_get_sync()

enum golioth_status golioth_location_get_sync ( struct golioth_client * client,
const struct golioth_location_req * req,
struct golioth_location_rsp * rsp,
int32_t timeout_s )

Get location from cloud

Parameters
clientThe client handle from golioth_client_create
reqLocation request sent to Golioth cloud
rspLocation response received from Golioth cloud
timeout_sThe timeout, in seconds, for receiving a server response
Return values
GOLIOTH_OKresponse received from server, set was successful
GOLIOTH_ERR_NULLinvalid client handle
GOLIOTH_ERR_INVALID_STATEclient is not running, currently stopped
GOLIOTH_ERR_QUEUE_FULLrequest queue is full, this request is dropped
GOLIOTH_ERR_TIMEOUTresponse not received from server, timeout occurred

◆ golioth_location_init()

void golioth_location_init ( struct golioth_location_req * req)

Initialize location request

Needs to be called before filling data with golioth_location_*_append() APIs.

Parameters
reqLocation request