Coder Social home page Coder Social logo

Comments (12)

knolleary avatar knolleary commented on May 28, 2024

IPAddress.h overloads various operators so it can be used in place of uint8_t *.

Have a look at hardware/arduino/sam/cores/arduino/IPAddress.h in the arduino install.

I have no idea why this does not work on Galileo. Does it use a modified version of the standard libraries? You mention removing the reference to pgm_read_byte_near - again, a standard part of the arduino environment - which makes me think the Galileo must be using something different, and incompatible.

from pubsubclient.

ppatierno avatar ppatierno commented on May 28, 2024

On of most important things of Galileo is that all Arduino libraries are compatible with it.
However, it is written on all Galileo documentation....but it seems to be not completely true. :-)
Obviously, pgm_read_byte_near came from AVR and on Galileo there isn't an AVR but an Intel Quark based on x86.

from pubsubclient.

knolleary avatar knolleary commented on May 28, 2024

You can see here how I #define a replacement pgm_read_byte_near in order to build this library on i686 for the unit tests. You might be able to do similar in your sketch without modifying the core library.

I don't have a galileo board, so there isn't anything I can do with this issue.

from pubsubclient.

ppatierno avatar ppatierno commented on May 28, 2024

Ok ... Thanks Nick I will update you with news from Intel...

from pubsubclient.

ppatierno avatar ppatierno commented on May 28, 2024

Hi Nick...why did you define pgm_read_byte_near in a header file outside the lib but inside the tests folder ?
The same thing for IPAddress.h where you defined IPAddress as uint8_t*.
Is the righe place inside the library ?

from pubsubclient.

knolleary avatar knolleary commented on May 28, 2024

pgm_read_byte_near is a standard function in the arduino environment - as is IPAddress.
The proper definitions for those are provided by the Arduino IDE.

The code in the tests folder is standalone code that I can compile and run on my laptop to test the library. To be able to do this, I had to create stub versions of the standard arduino code that the library depends on - this is what you can see in tests/lib.

For example, pgm_read_byte_near, as you have previously said, is an AVR specific function to read from PROGMEM. In order to test my library correctly calls that function, I have provided an alternative version in my stub version of Arduino.h.

Similarly, my library doesn't explicitly use any of the advanced features of the arduino implementation of IPAddress - for my tests it is sufficient just to #define it as uint8_t*.

from pubsubclient.

ppatierno avatar ppatierno commented on May 28, 2024

Ok....but....

Arduino.h distribuited with Intel Galileo IDE isn't different from the original and the pgm_read_byte_near isn't defined inside it. I have to redefine it inside a new header file different from Arduino.h and include it inside you library.

Other problem I posted on the Intel community forum...
Your methods use ip addresses as byte array so you have defined IPAddress as uint8_t* to avoid to change your library. On Galileo, It seems that the methods in the EthernetClient class work only with instance of IPAddress class and not with bytes array....so for now I have to change your library to accept IPAddress class instance.

from pubsubclient.

knolleary avatar knolleary commented on May 28, 2024

The code under tests is not intended to be used on a functional platform. It is purely for unit testing the functionality of the client. Where I have put particular definitions is only of interest to anyone writing additional tests.

Do you know if there is a #define that can be used to detect the library is being compiled for Galileo? If there is, you could add whatever additional #defines are needed inside #ifdef blocks in PubSubClient.h

from pubsubclient.

ppatierno avatar ppatierno commented on May 28, 2024

I will investigate on it...

from pubsubclient.

thisisthechris avatar thisisthechris commented on May 28, 2024

I've managed to get it to compile by following this https://communities.intel.com/thread/46076 and adding #include <avr/pgmspace.h> to PubSubClient.cpp - however I've had no luck getting it to connect

from pubsubclient.

chandruxp avatar chandruxp commented on May 28, 2024

Same problem as @thisisthechris on edison board. No errors during building. I guess the problem is while connecting..

@thisisthechris did you manage to come over it?

from pubsubclient.

knolleary avatar knolleary commented on May 28, 2024

Spent today figuring some of this out having got my hands on a Galileo (finally! I hear you all cry).

I can't explain why passing the broker IP address as byte* fails, but was able to reproduce. I've now added functions that accept IPAddress and will update the docs to 'prefer' them as they work everywhere.

I've also put ifdefs around the progmem stuff - so it gets excluded when progmem isn't defined. That all works, but a bit more work needed to get that to work on the esp8266.

Expect a new release of the library this week.

from pubsubclient.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.