Comments (5)
https://github.com/adafruit/Adafruit_Wippersnapper_Arduino/actions/runs/3451873666/jobs/5761396456#step:8:120
Both lines in this error message are missing the QOS parameter which are on the next lines in the MQTT library.
/home/runner/Arduino/libraries/Adafruit_Wippersnapper_Arduino/src/Wippersnapper.cpp: In function 'void publishI2CResponse(wippersnapper_signal_v1_I2CResponse*)':
/home/runner/Arduino/libraries/Adafruit_Wippersnapper_Arduino/src/Wippersnapper.cpp:466:79: error: call of overloaded 'publish(char*&, uint8_t [512], size_t&, int)' is ambiguous
WS._mqtt->publish(WS._topic_signal_i2c_device, WS._buffer_outgoing, msgSz, 1);
^
In file included from /home/runner/Arduino/libraries/Adafruit_Wippersnapper_Arduino/src/Wippersnapper.h:51,
from /home/runner/Arduino/libraries/Adafruit_Wippersnapper_Arduino/src/Wippersnapper.cpp:34:
/home/runner/Arduino/libraries/Adafruit_MQTT_Library/Adafruit_MQTT.h:195:8: note: candidate: 'bool Adafruit_MQTT::publish(const char*, uint8_t*, uint16_t, uint8_t)'
bool publish(const char *topic, uint8_t *payload, uint16_t bLen,
^~~~~~~
/home/runner/Arduino/libraries/Adafruit_MQTT_Library/Adafruit_MQTT.h:197:8: note: candidate: 'bool Adafruit_MQTT::publish(const char*, uint8_t*, uint16_t, bool, uint8_t)'
bool publish(const char *topic, uint8_t *payload, uint16_t bLen, bool retain,
^~~~~~~
from adafruit_mqtt_library.
I had a quick play and removing the default values for qos in the header file allowed my wippersnapper build to get past the ambiguity, but that feels not great as it wasn't added to line 192 etc in #216. Played with parameter order and defaults but didn't help.
Then occurred to me to remove the default values for just the new overloads, avoiding breaking the default QOS value in old code examples, but enforcing the providing of both qos+retain if specifying retain. Don't know if that's acceptable or not
@ben-willmore @brentru
This was what I ended up with in .h file lines 192-198:
bool publish(const char *topic, const char *payload, uint8_t qos = 0);
bool publish(const char *topic, const char *payload, uint8_t qos,
bool retain);
bool publish(const char *topic, uint8_t *payload, uint16_t bLen,
uint8_t qos = 0);
bool publish(const char *topic, uint8_t *payload, uint16_t bLen,
uint8_t qos, bool retain);
-Edit- Whoops, forgot I left the order changed, well you get the idea, by not specifying QOS in the second overloaded forms which include retain, the ambiguity goes away.
-Edit2- When I change the parameter order back, and leave QOS default specified, then everything breaks again, I guess due to the value for QOS being misinterpreted as a value suitable for retain
(bool) in the wippersnapper example.
from adafruit_mqtt_library.
You're right -- it's a bit surprising that this is ambiguous but it does make sense. Unless I misunderstood your second edit, I don't see a better solution to this than moving retain
to the end of the argument list and giving it a default value, as in https://github.com/ben-willmore/Adafruit_MQTT_Library/tree/retain-default-parameters .
from adafruit_mqtt_library.
Yeah i think that makes most sense looking at what you've done in that branch, but to be honest I suck at c/c++, more of a c# guy sorry and haven't got time to retest this moment.
from adafruit_mqtt_library.
@ben-willmore your commit in ben-willmore@83af73f makes sense and fixes this issue. Are you OK with checking out a PR? I can test WipperSnapper against that.
from adafruit_mqtt_library.
Related Issues (20)
- How to use to set callback to a class member function ? HOT 1
- Message length limit when publishing HOT 5
- Dynamically Assigning Adafruit IO credentials to Adafruit MQTT object
- Client disconected due protocol error when counting PUBLISH packets from 0 HOT 6
- connection closed: Error: read ECONNRESET
- packet_id_counter incrementing even if packet is dropped
- ESP32 won't reconnect to wifi after disconnecting HOT 1
- Support for FONA 3G cellular card HOT 1
- In several minitues my device always disconnect but connect back immediately HOT 1
- Feature Request: Add functionality for the Arduino Protenta Pro Series of boards HOT 2
- Connectivity issue when using broker on local IP HOT 2
- Silent Limit on the number of subscribed topics, callback ignored HOT 1
- Mqtt port issue . Not recognizing from config file.
- [ESP32] MQTT Payload not getting triggered only when the payload is exactly 104 and 105 characters?!?
- Dual band wifi connection issue with esp32
- Won't Complie on ESP32 HOT 1
- ESP32 expect a WDT, but none is configured
- Connection failure occurs when the connection length is greater than 128
- Overzealous library dependencies HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from adafruit_mqtt_library.