Infuse-IoT SDK API 0.0.1
A Scalable Open Source RTOS
|
Data Structures | |
struct | rpc_client_cmd_ctx |
struct | rpc_client_ctx |
struct | rpc_client_auto_load_params |
State for auto loader control. More... | |
Typedefs | |
typedef void(* | rpc_client_rsp_fn) (const struct net_buf *buf, void *user_data) |
Callback run when the response arrives. | |
typedef int(* | rpc_client_data_loader) (void *user_data, uint32_t offset, void *data, size_t data_len) |
Callback to load more data for queueing. | |
Functions | |
void | rpc_client_init (struct rpc_client_ctx *ctx, const struct device *dev, union epacket_interface_address address) |
Initialise RPC client object for use. | |
static uint32_t | rpc_client_last_request_id (const struct rpc_client_ctx *ctx) |
Get the request ID used by the last command. | |
int | rpc_client_update_response_timeout (struct rpc_client_ctx *ctx, uint32_t request_id, k_timeout_t timeout) |
Update the response timeout of an executing command. | |
int | rpc_client_command_queue (struct rpc_client_ctx *ctx, enum rpc_builtin_id cmd, void *req_params, size_t req_params_len, rpc_client_rsp_fn cb, void *user_data, k_timeout_t ctx_timeout, k_timeout_t response_timeout) |
Queue a command for execution on a remote device. | |
int | rpc_client_ack_wait (struct rpc_client_ctx *ctx, uint32_t request_id, k_timeout_t timeout) |
Wait for an INFUSE_RPC_DATA_ACK from the remote device. | |
int | rpc_client_data_queue (struct rpc_client_ctx *ctx, uint32_t request_id, uint32_t offset, const void *data, size_t data_len) |
Queue data associated with a previously queued command. | |
int | rpc_client_data_queue_auto_load (struct rpc_client_ctx *ctx, uint32_t request_id, uint32_t offset, void *buffer, size_t buffer_len, const struct rpc_client_auto_load_params *loader_params) |
Queue data associated with a previously queued command, loaded via callback. | |
int | rpc_client_command_sync (struct rpc_client_ctx *ctx, enum rpc_builtin_id cmd, void *req_params, size_t req_params_len, k_timeout_t ctx_timeout, k_timeout_t response_timeout, struct net_buf **rsp) |
Queue a command for execution on a remote device and wait for the response. | |
void | rpc_client_cleanup (struct rpc_client_ctx *ctx) |
Cleanup a RPC client object. | |
typedef int(* rpc_client_data_loader) (void *user_data, uint32_t offset, void *data, size_t data_len) |
#include <infuse/rpc/client.h>
Callback to load more data for queueing.
user_data | Arbitrary pointer supplied to rpc_client_data_queue |
offset | Offset of data requested |
data | Pointer to load data into |
data_len | Length of data to load |
0 | on success |
-errno | on error |
typedef void(* rpc_client_rsp_fn) (const struct net_buf *buf, void *user_data) |
#include <infuse/rpc/client.h>
Callback run when the response arrives.
buf | Response packet if not NULL, NULL on timeout |
user_data | User data provided to rpc_client_command_queue |
int rpc_client_ack_wait | ( | struct rpc_client_ctx * | ctx, |
uint32_t | request_id, | ||
k_timeout_t | timeout ) |
#include <infuse/rpc/client.h>
Wait for an INFUSE_RPC_DATA_ACK from the remote device.
ctx | RPC client context |
request_id | Request ID from rpc_client_last_request_id |
timeout |
0 | On success |
-EINVAL | If request ID is no longer valid |
-EAGAIN | If waiting for ACK timed out |
void rpc_client_cleanup | ( | struct rpc_client_ctx * | ctx | ) |
int rpc_client_command_queue | ( | struct rpc_client_ctx * | ctx, |
enum rpc_builtin_id | cmd, | ||
void * | req_params, | ||
size_t | req_params_len, | ||
rpc_client_rsp_fn | cb, | ||
void * | user_data, | ||
k_timeout_t | ctx_timeout, | ||
k_timeout_t | response_timeout ) |
#include <infuse/rpc/client.h>
Queue a command for execution on a remote device.
ctx | RPC client context |
cmd | Command ID |
req_params | Command request parameters |
req_params_len | Length of command request |
cb | Callback to run when associated response is received |
user_data | Arbitrary user data to supply to callback |
ctx_timeout | Maximum duration to wait for a command context to become available |
response_timeout | Maximum duration to wait for a response to be received from remote device |
0 | If command pushed to remote device |
-EAGAIN | If command context claim timed out |
-EINVAL | If request params, callback or response timeout are invalid values |
int rpc_client_command_sync | ( | struct rpc_client_ctx * | ctx, |
enum rpc_builtin_id | cmd, | ||
void * | req_params, | ||
size_t | req_params_len, | ||
k_timeout_t | ctx_timeout, | ||
k_timeout_t | response_timeout, | ||
struct net_buf ** | rsp ) |
#include <infuse/rpc/client.h>
Queue a command for execution on a remote device and wait for the response.
ctx | RPC client context |
cmd | Command ID |
req_params | Command request parameters |
req_params_len | Length of command request |
ctx_timeout | Maximum duration to wait for a command context to become available |
response_timeout | Maximum duration to wait for a response to be received from remote device |
rsp | Output store for response buffer |
0 | On success |
-ETIMEDOUT | On response timeout |
-errno | Error code from rpc_client_command_queue on error |
int rpc_client_data_queue | ( | struct rpc_client_ctx * | ctx, |
uint32_t | request_id, | ||
uint32_t | offset, | ||
const void * | data, | ||
size_t | data_len ) |
#include <infuse/rpc/client.h>
Queue data associated with a previously queued command.
ctx | RPC client context |
request_id | Request ID from rpc_client_last_request_id |
offset | Byte offset of data |
data | Command data pointer |
data_len | Command data length |
0 | If data pushed to remote device |
-EINVAL | If request ID is no longer valid |
int rpc_client_data_queue_auto_load | ( | struct rpc_client_ctx * | ctx, |
uint32_t | request_id, | ||
uint32_t | offset, | ||
void * | buffer, | ||
size_t | buffer_len, | ||
const struct rpc_client_auto_load_params * | loader_params ) |
#include <infuse/rpc/client.h>
Queue data associated with a previously queued command, loaded via callback.
ctx | RPC client context |
request_id | Request ID from rpc_client_last_request_id |
offset | Byte offset of data |
buffer | Buffer for loading data |
buffer_len | Buffer data length |
loader_params | Context for loading data |
0 | If data pushed to remote device |
-EINVAL | If request ID is no longer valid |
void rpc_client_init | ( | struct rpc_client_ctx * | ctx, |
const struct device * | dev, | ||
union epacket_interface_address | address ) |
#include <infuse/rpc/client.h>
Initialise RPC client object for use.
ctx | RPC client context |
dev | ePacket interface to send commands on |
address | Interface address to communicate with |
|
inlinestatic |
#include <infuse/rpc/client.h>
Get the request ID used by the last command.
ctx | RPC client context |
int rpc_client_update_response_timeout | ( | struct rpc_client_ctx * | ctx, |
uint32_t | request_id, | ||
k_timeout_t | timeout ) |
#include <infuse/rpc/client.h>
Update the response timeout of an executing command.
ctx | RPC client context |
request_id | Request ID from rpc_client_last_request_id |
timeout | New response timeout |
0 | On success |
-EINVAL | If request ID is no longer valid |