Welcome to EnviroDIY, a community for do-it-yourself environmental science and monitoring. EnviroDIY is part of WikiWatershed, an initiative of Stroud Water Research Center designed to help people advance knowledge and stewardship of fresh water.
New to EnviroDIY? Start here

Sabin

Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • in reply to: DigiXBeeWifi class mqtt codeflow example #19624
    Sabin
    Participant

      Thank you for your response.
      I used TinyGSM directly and got into this problem. I was deploying broker locally,, the code on the inside check for dns lookup.. Currently I commented this code out and tinygsm works.
      https://github.com/issues/created?issue=vshymanskyy%7CTinyGSM%7C854

      This is what my full code looks without tinygsm:

      This is how I am implementing tinygsm

      Tinygsm implementation will result in flaky broker connection like this:
      1773954855: New client connected from 144.39.141.49:49164 as ArduinoTempSensor (p4, c1, k15). 1773954865: Client ArduinoTempSensor [144.39.141.49:49164] disconnected: connection closed by client. 1773954865: New connection from 144.39.141.49:49165 on port 1883. 1773954865: Protocol error from 144.39.141.49:49165: First packet not CONNECT (30). 1773954865: Client 144.39.141.49 [144.39.141.49:49165] disconnected: protocol error.

      in reply to: DigiXBeeWifi class mqtt codeflow example #19622
      Sabin
      Participant

        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>

      Viewing 2 posts - 1 through 2 (of 2 total)