Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MQTT - knolleary or ESP8266 library not working in same directory #16

Open
questuk opened this issue Jun 22, 2015 · 5 comments
Open

MQTT - knolleary or ESP8266 library not working in same directory #16

questuk opened this issue Jun 22, 2015 · 5 comments

Comments

@questuk
Copy link

questuk commented Jun 22, 2015

Hi Imroy,

I am trying to use MQTT using the following:
Ethernet Arduino board or using ESP2866 module

For the past 3 years I have been using this library, https://github.com/knolleary/pubsubclient this has worked well.

I now wish to use the ESP8266 with MQTT using this library, https://github.com/Imroy/pubsubclient

Both of these have there own PubSubClient.h , so cannot be in my arduino library at the same time !

My problem is when I compile my code for Ethernet Arduino it will only compile error free using the knolleary library and the ESP8266 will only compile error free using the Imroy library.

This gives me the problem of removing one then installing the correct library every time I use ESP8266 or Ethernet Arduino code.

How can I get both to work ?

regards

Gary

@Imroy
Copy link
Owner

Imroy commented Jun 22, 2015

The problem seems to revolve around my library including from WiFiClient.h, which is provided by either ESP8266WiFi or the Arduino WiFi library. This is because early in my customising of pubsubclient I didn't like that the constructor took a "Client" object from the sketch. I thought "the sketch isn't doing anything else with that object, pubsubclient can handle that itself". I didn't realise what effect this would have on compatibility.
So it looks like I'll have to go back to having the sketch passing a "Client" object to the constructor.

Imroy added a commit that referenced this issue Jun 22, 2015
** API BREAKAGE **

We have to go back to passing a "Client" object to the PubSubClient constructor. I didn't like this when I originally saw it and moved the WiFiClient object into the class. But this meant that other platforms couldn't easily provide compatible objects from their own network stacks.
I have no idea if this work on the Arduino Ethernet/WiFi/Yun boards because I don't have them. It compiles though.

Brought to light by #16.
@ichilton
Copy link

Is it possible to rename your library, so it can co-exist with the standard knolleary/pubsubclient?

Calling this one something like esp8266_pubsubclient wuold be much better.

Thanks,

Ian

@Testato
Copy link

Testato commented Jun 30, 2015

+1
This is a very good idea

Il 30/giu/2015 10:52 PM, "Ian Chilton" notifications@github.com ha
scritto:

Is it possible to rename your library, so it can co-exist with the
standard knolleary/pubsubclient?

Calling this one something like esp8266_pubsubclient wuold be much better.

Thanks,

Ian


Reply to this email directly or view it on GitHub.

@Imroy
Copy link
Owner

Imroy commented Jul 6, 2015

I made changes so that it could work with any platform providing a "Client" interface (WiFiClient, EthernetClient, etc). There's nothing really ESP8266 specific that I know of, so calling it esp8266_pubsubclient would not make sense.
Although, calling it "pubsubclient2" might be justifiable.

@questuk
Copy link
Author

questuk commented Jul 28, 2015

Hi Imroy,

Just wondered if you have got any further on getting the library working for Ethernet Arduino board and ESP2866 module ?

Regards

Gary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants