mirror of
https://gitlab.com/wirelos/sprocket-lib.git
synced 2025-12-16 13:25:03 +01:00
mesh mqtt gateway example
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
#define __MESHNET_H__
|
||||
|
||||
#include <painlessMesh.h>
|
||||
|
||||
#include <WiFiClient.h>
|
||||
#include "Network.h"
|
||||
|
||||
using namespace std;
|
||||
@@ -13,15 +13,13 @@ using namespace std::placeholders;
|
||||
#define MESH_PASSWORD "somethingSneaky"
|
||||
#define MESH_PORT 5555
|
||||
|
||||
|
||||
|
||||
class MeshNet : public Network {
|
||||
public:
|
||||
painlessMesh mesh;
|
||||
Network* init(){
|
||||
Serial.println("init mesh");
|
||||
//mesh.setDebugMsgTypes( ERROR | MESH_STATUS | CONNECTION | SYNC | COMMUNICATION | GENERAL | MSG_TYPES | REMOTE ); // all types on
|
||||
mesh.setDebugMsgTypes( ERROR | STARTUP);
|
||||
mesh.setDebugMsgTypes( ERROR | STARTUP | CONNECTION);
|
||||
mesh.init( MESH_PREFIX, MESH_PASSWORD, scheduler, MESH_PORT, WIFI_AP_STA, 11 );
|
||||
//mesh.onReceive(bind(&MeshNet::receivedCallback,this, _1, _2));
|
||||
mesh.onNewConnection(bind(&MeshNet::newConnectionCallback, this, _1));
|
||||
@@ -31,6 +29,9 @@ class MeshNet : public Network {
|
||||
return this;
|
||||
}
|
||||
Network* connect(){
|
||||
Serial.println("connect station");
|
||||
mesh.stationManual("tErAx1d", "ramalamadingdong");
|
||||
mesh.setHostname("MeshNode");
|
||||
return this;
|
||||
}
|
||||
void broadcast(String msg){
|
||||
|
||||
Reference in New Issue
Block a user