10#ifndef _EL_CLIENT_SOCKET_H_
11#define _EL_CLIENT_SOCKET_H_
17#define DEFAULT_SOCKET_TIMEOUT 5000
25#define SOCKET_TCP_CLIENT 0
26#define SOCKET_TCP_CLIENT_LISTEN 1
27#define SOCKET_TCP_SERVER 2
52 int begin(
const char* host, uint16_t port, uint8_t sock_mode,
void (*userCb)(uint8_t resp_type, uint8_t client_num, uint16_t len,
char *data)=0);
55 void send(
const char* data);
58 void send(
const char* data,
int len);
64 uint16_t
getResponse(uint8_t *resp_type, uint8_t *client_num,
char* data, uint16_t maxLen);
75 void socketCallback(
void* resp);
139 typedef void (* _userCallback)(uint8_t resp_type, uint8_t client_num, uint16_t len,
char *data);
140 _userCallback _userCb;
142 bool _hasUserCb =
false;
#define DEFAULT_SOCKET_TIMEOUT
Definitions for ELClient.
Core Utility - Templated Function Pointer Class.
uint16_t getResponse(uint8_t *resp_type, uint8_t *client_num, char *data, uint16_t maxLen)
Retrieve response.
void send(const char *data)
Send null-terminated data to the remote server.
uint16_t waitResponse(uint8_t *resp_type, uint8_t *client_num, char *data, uint16_t maxLen, uint32_t timeout=DEFAULT_SOCKET_TIMEOUT)
Wait for the response.
int begin(const char *host, uint16_t port, uint8_t sock_mode, void(*userCb)(uint8_t resp_type, uint8_t client_num, uint16_t len, char *data)=0)
Initialize communication to a remote server.
API abstraction for a Function Pointers.