Socket Driver

group SocketDriver

Functions

int socket_init(csp_socket_handle_t *socket_iface, uint8_t mode, uint16_t port)

Initializes and connects a unix socket, returns socket handle.

Return
int CSP_ERR_NONE if successful, otherwise CSP_ERR_DRIVER
Parameters
  • socket_iface: socket interface to store handle in
  • mode: CSP_SOCKET_CLIENT or CSP_SOCKET_SERVER, which type of connection is created
  • port: socket interface port number

int socket_close(csp_socket_handle_t *socket_driver)
int socket_status(const csp_socket_handle_t *socket_iface)

Attempts to check open/closed status of socket.

Return
int CSP_ERR_NONE if socket open, otherwise CSP_ERR_DRIVER
Parameters
  • socket_iface: socket interface containing socket handle

bool cbor_parse_csp_packet(csp_packet_t *packet, void *buffer, int buffer_size)
int cbor_encode_csp_packet(csp_packet_t *packet, uint8_t *buffer)