many updates..
new sensors.. display.. led.. drawing.. stuff..
This commit is contained in:
6
net/IP.h
6
net/IP.h
@@ -13,17 +13,17 @@
|
||||
ip_addr_t addr;
|
||||
|
||||
/** empty ctor */
|
||||
explicit IP() {
|
||||
explicit IP4() {
|
||||
addr.addr = 0;
|
||||
}
|
||||
|
||||
/** ctor with IP-string */
|
||||
explicit IP(const char* ipStr) {
|
||||
explicit IP4(const char* ipStr) {
|
||||
set(ipStr);
|
||||
}
|
||||
|
||||
/** ctor with ip_addr_t */
|
||||
explicit IP(ip_addr addr) : addr(addr) {
|
||||
explicit IP4(ip_addr addr) : addr(addr) {
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
14
net/UDP.h
14
net/UDP.h
@@ -46,7 +46,7 @@ public:
|
||||
|
||||
}
|
||||
|
||||
bool send(const IP ip, const Port port, const void* data, const uint16_t dataLen) {
|
||||
bool send(const IP4 ip, const Port port, const void* data, const uint16_t dataLen) {
|
||||
|
||||
debugMod1(NAME, "sending packet to remote port %d", port);
|
||||
|
||||
@@ -65,9 +65,21 @@ public:
|
||||
|
||||
/** set the callback to call whenever a packet is received */
|
||||
void setRecvCallback(UDPCallback callback) {
|
||||
debugMod(NAME, "setRecvCallback()");
|
||||
espconn_regist_recvcb(con, callback);
|
||||
}
|
||||
|
||||
/** get the IP address of the most recent packet's sender */
|
||||
IP4 getSenderIP() {
|
||||
|
||||
remot_info* rem;
|
||||
espconn_get_connection_info(con, &rem, 0);
|
||||
ip_addr_t* _ip = (ip_addr_t*) rem->remote_ip;
|
||||
return IP4(*_ip);
|
||||
//const uint16_t port = rem->remote_port;
|
||||
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
/** initialize the UDP "connection" */
|
||||
|
||||
Reference in New Issue
Block a user