Skip to content

A c library to encapsulate and decapsulate AT strings for the ESP8266 module

Notifications You must be signed in to change notification settings

enrico1036/ESP8266

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ESP8266

A c library to encapsulate and decapsulate AT strings for the ESP8266 module intended to be used on microcontrollers that don't support classes

This library provides a set of functions to prepare and read AT commands exchanged with the ESP8266 module. ####Important! The library doesn't actually sends or receive data from the module but only prepare the string to be sent by the user

For example, a receiving message is formatted like "+IPD,0,11:Hello World", the unwrap function decapsulates the message and fills an char array with "Hello World"

##References: Each following function need an array to be filled with the message

void reset(char* dst);
//Reset the module

Arguments:
dst: Char array where the generated string is put

Returns:
null (nothing)


void setMode(char* dst, int mode);
//Set the wifi mode such as: Access Point, Station, or Mixed

Arguments:
dst: Char array where the generated string is put
mode: Integer that sets the wifi mode (STA, AP, APSTA)

Returns:
null (nothing)


void connectWifi(char* dst, char *ssid, char *password);
//Estabilish a connection with a determinated wifi network in Station mode

Arguments:
dst: Char array where the generated string is put
ssid: Wifi name you want to connect
password: Wifi network password

Returns:
null (nothing)


void setLinkMode(char* dst, int mode);
//Set the number of simultaneous connections allowed

Arguments:
dst: Char array where the generated string is put
mode: Integer that sets the link mode (ONE_CONNECTION, MULTIPLE_CONNECTIONS)

Returns:
null (nothing)


void disconnectWifi(char* dst);
//Disconnect from the current wifi

Arguments:
dst: Char array where the generated string is put

Returns:
null (nothing)


void startServer(char* dst, int port);
//Start a server listening in a specified port

Arguments:
dst: Char array where the generated string is put
port: Integer that specify on which port you want to accept connections

Returns:
null (nothing)


void wrap(char* dst, int conn, char* data);
//Prepare data to be sent

Arguments:
dst: Char array where the generated string is put
conn: Integer containind the connection number you want to send data
data: Char array you should fill with data you want to send to the "conn" connection

Returns:
null (nothing)


int unwrap(char* src, int* conn, char* data);
//Decapsulate data from the received packet

Arguments:
src: Char array where you should put the entire packet arrived from the module
conn: Integer filled with the connection number specified in received packet
data: Char array filled with the actual data contained in the received packet

Returns:
Integer that indicates data length


Thanks to ssokol where I retrived some useful information

About

A c library to encapsulate and decapsulate AT strings for the ESP8266 module

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages