hey guys i know about arduino and some about c++
i want to change a variable on class painlessMesh from class MeshConnection on A library called painlessMesh : i have done search about friend class , static variables and .... but none of these works for me or i dont know how to work with them:
what i wnat to do is when i call painlessMesh::setNodeType(uint32_t Type)
it change MeshConnection::nodeTYPE to uint32_t Type
this is class painlessMesh on painlessMesh.h file:
#include "painlessMeshConnection.h"
using ConnectionList = std::list<std::shared_ptr>;
class painlessMesh {
public:
uint32_t getNodeId(void) { return _nodeId; };
void setNodeType(uint32_t Type) { MeshConnection::nodeTYPE =Type };
uint32_t getNodeType(uint32_t nodeId) ;
std::list<uint32_t> getNodeList();
uint32_t NodeType;
protected:
// in painlessMeshSync.cpp
//must be accessable from callback
void handleNodeSync(std::shared_ptr conn, JsonObject& root);
void startTimeSync(std::shared_ptr conn);
void handleTimeSync(std::shared_ptr conn, JsonObject& root, uint32_t receivedAt);
void handleTimeDelay(std::shared_ptr conn, JsonObject& root, uint32_t receivedAt);
bool adoptionCalc(std::shared_ptr conn);
// in painlessMeshConnection.cpp
//void cleanDeadConnections(void); // Not implemented. Needed?
void tcpConnect(void);
bool closeConnectionSTA();
// variables
uint32_t _nodeId;
String _meshSSID;
String _meshPassword;
uint16_t _meshPort;
uint8_t _meshChannel;
wifi_auth_mode_t _meshAuthMode;
uint8_t _meshHidden;
uint8_t _meshMaxConn;
ConnectionList _connections;
friend class StationScan;
friend class MeshConnection;
friend void onDataCb(void * arg, AsyncClient *client, void *data, size_t len);
};
and this is class painlessMesh on painlessMeshConnection.h file:
class MeshConnection {
public:
AsyncClient *client;
painlessMesh *mesh;
uint32_t nodeId = 0;
uint32_t nodeTYPE=0 ;
String subConnections;
timeSync time;
bool newConnection = true;
bool connected = true;
bool station = true;
uint32_t timeDelayLastRequested = 0; // Timestamp to be compared in manageConnections() to check response for timeout
bool addMessage(String &message, bool priority = false);
bool writeNext();
ReceiveBuffer receiveBuffer;
SentBuffer sentBuffer;
Task nodeSyncTask;
Task timeSyncTask;
Task readBufferTask;
MeshConnection(AsyncClient *client, painlessMesh *pMesh, bool station);
~MeshConnection();
void handleMessage(String &msg, uint32_t receivedAt);
void close();
friend class painlessMesh;
};
when i use : MeshConnection test;
and then test.nodeTYPE =Type; it doestn compile (because of orange line) and this is the error i got:
D:\arduino\Arduino\portable\sketchbook\libraries\painlessMesh-master-5549db3a5d1db7d05a066273797bd3b99c034095\src\painlessMeshConnection.h:82:9: note: MeshConnection::MeshConnection(AsyncClient*, painlessMesh*, bool)
MeshConnection(AsyncClient *client, painlessMesh *pMesh, bool station);
so what should i do?