Microchip® Advanced Software Framework

websocket.h File Reference
#include "websocket-http-client.h"
#include "compiler.h"

Data Structures

struct  websocket
 

Macros

#define WEBSOCKET_MAX_URLLEN   WEBSOCKET_CONF_MAX_URLLEN
 

Typedefs

typedef void(* websocket_callback )(struct websocket *s, websocket_result result, uint8_t *data, uint16_t datalen)
 

Enumerations

enum  {
  WEBSOCKET_STATE_CLOSED = 0,
  WEBSOCKET_STATE_DNS_REQUEST_SENT = 1,
  WEBSOCKET_STATE_HTTP_REQUEST_SENT = 2,
  WEBSOCKET_STATE_WAITING_FOR_HEADER = 3,
  WEBSOCKET_STATE_RECEIVING_HEADER = 4,
  WEBSOCKET_STATE_HEADER_RECEIVED = 5,
  WEBSOCKET_STATE_RECEIVING_DATA = 6
}
 
enum  websocket_result {
  WEBSOCKET_ERR = 0,
  WEBSOCKET_OK = 1,
  WEBSOCKET_IN_PROGRESS = 2,
  WEBSOCKET_HOSTNAME_NOT_FOUND = 3,
  WEBSOCKET_CONNECTED = 4,
  WEBSOCKET_DATA = 5,
  WEBSOCKET_RESET = 6,
  WEBSOCKET_TIMEDOUT = 7,
  WEBSOCKET_CLOSED = 8,
  WEBSOCKET_PINGED = 9,
  WEBSOCKET_DATA_RECEIVED = 10,
  WEBSOCKET_PONG_RECEIVED = 11
}
 

Functions

void websocket_close (struct websocket *s)
 
void websocket_init (void)
 
websocket_result websocket_open (struct websocket *s, const char *url, const char *subprotocol, websocket_callback c)
 
int websocket_ping (struct websocket *s)
 
int websocket_send (struct websocket *s, const uint8_t *data, uint16_t datalen)
 
int websocket_send_str (struct websocket *s, const char *strptr)
 

#define WEBSOCKET_MAX_URLLEN   WEBSOCKET_CONF_MAX_URLLEN

Referenced by websocket_open().

typedef void(* websocket_callback)(struct websocket *s, websocket_result result, uint8_t *data, uint16_t datalen)

anonymous enum
Enumerator
WEBSOCKET_STATE_CLOSED 
WEBSOCKET_STATE_DNS_REQUEST_SENT 
WEBSOCKET_STATE_HTTP_REQUEST_SENT 
WEBSOCKET_STATE_WAITING_FOR_HEADER 
WEBSOCKET_STATE_RECEIVING_HEADER 
WEBSOCKET_STATE_HEADER_RECEIVED 
WEBSOCKET_STATE_RECEIVING_DATA 
Enumerator
WEBSOCKET_ERR 
WEBSOCKET_OK 
WEBSOCKET_IN_PROGRESS 
WEBSOCKET_HOSTNAME_NOT_FOUND 
WEBSOCKET_CONNECTED 
WEBSOCKET_DATA 
WEBSOCKET_RESET 
WEBSOCKET_TIMEDOUT 
WEBSOCKET_CLOSED 
WEBSOCKET_PINGED 
WEBSOCKET_DATA_RECEIVED 
WEBSOCKET_PONG_RECEIVED 

void websocket_close ( struct websocket s)
void websocket_init ( void  )

References inited, list_init(), NULL, and process_start().

Referenced by websocket_open().

int websocket_send ( struct websocket s,
const uint8_t *  data,
uint16_t  datalen 
)

References send_data, and WEBSOCKET_OPCODE_BIN.

int websocket_send_str ( struct websocket s,
const char *  strptr 
)

References send_data, and WEBSOCKET_OPCODE_TEXT.