pubsub.h File Reference
#include <csp/csp.h>
#include <csp/interfaces/csp_if_socket.h>
#include <stdbool.h>
#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  pubsub_conn
 PubSub connection structure. More...
 

Functions

csp_socket_t * kprv_server_setup (uint8_t port, uint8_t num_connections)
 Performs the neccesary setup for the telemetry server to begin receiving subscriber connections. More...
 
bool kprv_server_accept (csp_socket_t *socket, pubsub_conn *conn)
 Attempts to accept a subscriber connection. More...
 
bool kprv_server_socket_accept (csp_socket_t *socket, pubsub_conn *conn)
 Attempts to accept a subscriber connection over a tcp socket. More...
 
void kprv_subscriber_socket_close (pubsub_conn *conn)
 Performs shutdown and cleanup of tcp socket based connections. More...
 
bool kprv_subscriber_connect (pubsub_conn *conn, uint8_t address, uint8_t port)
 Used by a telemetry subscriber to connect to the publishing server. More...
 
bool kprv_subscriber_socket_connect (pubsub_conn *conn, uint8_t address, uint8_t port)
 Used by a client to connect to a server using a tcp socket. More...
 
bool kprv_publisher_read (const pubsub_conn *conn, void *buffer, int buffer_size, uint8_t port)
 Attempts to receive data over the specified pubsub_conn. More...
 
bool kprv_subscriber_read (const pubsub_conn *conn, void *buffer, int buffer_size, uint8_t port)
 Attempts to receive data over the specified pubsub_conn. More...
 
bool kprv_send_csp (const pubsub_conn *conn, const void *data, uint16_t length)
 Wrapper function for sending data via a csp connection. More...