Home › Forums › Mayfly Data Logger › DigiXBeeWifi class mqtt codeflow example › Reply To: DigiXBeeWifi class mqtt codeflow example
Thank you for your response.
I think it’s the master branch.
Also, this is what I am trying to do.
DigiXBeeWifi modemXBWF(&Serial1, powerPin, statusPin, false,
modemResetPin, modemSleepRqPin,
ssid, pwd, false);Client* netClient = nullptr;
MqttClient* mqttClient = nullptr;void setup() {
Serial.begin(9600);
Serial1.begin(9600);
delay(2000);if (!modemXBWF.connectInternet(60000L)) {
Serial.println(“WiFi failed!”);
return;
}
Serial.println(“WiFi connected!”);delay(1200);
netClient = modemXBWF.createClient();
mqttClient = new MqttClient(*netClient);
<div>Somehow this code is called. bool DigiXBeeWifi::extraModemSetup(void). I don’t know which line does this. So the broker connection fails.
I have used this workaround by implementing the Client with just a fake abstract wrapper and preconnect xbee s6b with xctu…
class XBeeTransparentClient : public Client {
public:
XBeeTransparentClient(Stream& s) : _stream(s) {}int connect(IPAddress ip, uint16_t port) override { return 1; }
int connect(const char* host, uint16_t port) override { return 1; }
void stop() override {}
uint8_t connected() override { return 1; }
operator bool() override { return true; }
size_t write(uint8_t b) override { return _stream.write(b); }
size_t write(const uint8_t* buf, size_t size) override { return _stream.write(buf, size); }
int available() override { return _stream.available(); }
int read() override { return _stream.read(); }
int read(uint8_t* buf, size_t size) override { return _stream.readBytes(buf, size); }
int peek() override { return _stream.peek(); }
void flush() override {}
private:
Stream& _stream;
};
</div>
Welcome to EnviroDIY, a community for do-it-yourself environmental science and monitoring. EnviroDIY is part of