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

Publish with NO_ACK missing ttl field? #1201

Closed
kennethlimcp opened this issue Dec 12, 2016 · 11 comments · Fixed by #1236

Comments

@kennethlimcp
Copy link
Contributor

commented Dec 12, 2016

A user tried doing Particle.publish("t", temperature, ttl, PRIVATE, NO_ACK);: http://community.particle.io/t/problems-compiling-particle-publish-with-no-ack-on-electron-solved/27924

as per documented here: https://docs.particle.io/reference/firmware/electron/#particle-publish-

but it seems like it's not working.

Test case on v0.6.0:

void setup()
{
  Particle.publish("t", "10", 10, PRIVATE, NO_ACK);
}

Completeness:

  • Minimum test case added
  • Device, system and user firmware versions stated
@m-mcgowan

This comment has been minimized.

Copy link
Contributor

commented Dec 13, 2016

Thanks for the report.

but it seems like it's not working.

We need a bit more to go on ;-) Please explain the observed behaviour vs expected behaviour. Thanks!

@kennethlimcp

This comment has been minimized.

Copy link
Contributor Author

commented Dec 13, 2016

opps..

test.cpp:12:50: error: no matching function for call to 'CloudClass::publish(const char [2], const char [3], int, const PublishFlag&, const PublishFlag&)'
 
                                                  ^

test.cpp:12:50: note: candidates are:
In file included from ../wiring/inc/spark_wiring.h:48:0,
                 from ./inc/application.h:36,
                 from test.cpp:2:
../wiring/inc/spark_wiring_cloud.h:222:17: note: bool CloudClass::publish(const char*, PublishFlag)
     inline bool publish(const char *eventName, PublishFlag eventType=PUBLIC)
                 ^
../wiring/inc/spark_wiring_cloud.h:222:17: note:   candidate expects 2 arguments, 5 provided
../wiring/inc/spark_wiring_cloud.h:227:17: note: bool CloudClass::publish(const char*, const char*, PublishFlag)
     inline bool publish(const char *eventName, const char *eventData, PublishFlag eventType=PUBLIC)
                 ^
../wiring/inc/spark_wiring_cloud.h:227:17: note:   candidate expects 3 arguments, 5 provided
../wiring/inc/spark_wiring_cloud.h:232:17: note: bool CloudClass::publish(const char*, const char*, PublishFlag, PublishFlag)
     inline bool publish(const char *eventName, const char *eventData, PublishFlag f1, PublishFlag f2)
                 ^
../wiring/inc/spark_wiring_cloud.h:232:17: note:   candidate expects 4 arguments, 5 provided
../wiring/inc/spark_wiring_cloud.h:238:17: note: bool CloudClass::publish(const char*, const char*, int, PublishFlag)
     inline bool publish(const char *eventName, const char *eventData, int ttl, PublishFlag eventType=PUBLIC)
                 ^
../wiring/inc/spark_wiring_cloud.h:238:17: note:   candidate expects 4 arguments, 5 provided
make[1]: *** [../build/target/user/platform-6test.o] Error 1
make: *** [user] Error 2

Excepted: compiles fine
Actual: compilation failed

@m-mcgowan

This comment has been minimized.

Copy link
Contributor

commented Dec 13, 2016

The first two arguments are strings - the event name and the event data, so the first 10 should be "10"

@kennethlimcp

This comment has been minimized.

Copy link
Contributor Author

commented Dec 13, 2016

copy-pasta error. Updated the test case (that still doesn't compile)

I don't see a test case for this 5 argument Particle.publish() so i wonder if it's available.

@m-mcgowan m-mcgowan added this to the 0.6.1 milestone Dec 13, 2016

@m-mcgowan m-mcgowan self-assigned this Dec 13, 2016

@m-mcgowan

This comment has been minimized.

Copy link
Contributor

commented Dec 13, 2016

Good catch Kenneth...looks like the 5 arg version is missing. This is a quick fix, so we'll get it out in the next release. Although please keep in mind that I don't believe TTL is actually honoured at present, so the workaround is to simply remove it.

@kennethlimcp

This comment has been minimized.

Copy link
Contributor Author

commented Dec 13, 2016

Definitely, but the docs said otherwise. 🗡

The easier and more correct fix might be to simply remove it from the docs

@technobly technobly modified the milestones: 0.7.x, 0.6.1 Dec 20, 2016

@smpickett

This comment has been minimized.

Copy link

commented Dec 23, 2016

There still appears to be a problem with the documentation that needs to be updated. Specifically:

int temperature = sensor.readTemperature(); // by way of example, not part of the API
Particle.publish("t", temperature, NO_ACK);
Particle.publish("t", temperature, PRIVATE, NO_ACK);
Particle.publish("t", temperature, ttl, PRIVATE, NO_ACK);

should be changed so that the 'temperature' argument is a string. No?

@technobly

This comment has been minimized.

Copy link
Member

commented Dec 23, 2016

Yes! Thanks @smpickett, will do it now.

@technobly technobly assigned sergeuz and unassigned m-mcgowan Jan 17, 2017

@technobly technobly modified the milestones: 0.7.0, 0.6.1 Jan 17, 2017

@technobly technobly added the bug label Jan 17, 2017

@sergeuz sergeuz referenced this issue Jan 20, 2017
5 of 7 tasks complete
@JohnKozell

This comment has been minimized.

Copy link

commented Sep 30, 2017

I'm compiling to electron and 0.6.2, yet I'm still getting the following error:
no matching function for call to 'CloudClass::publish(const char [8], char [255], int, const PublishFlag&, const PublishFlag&)

Am I missing something?

My call is:
Particle.publish("reading", payload, 60, PRIVATE, NO_ACK);
Where payload is defined as:
char payload[255];

@sergeuz

This comment has been minimized.

Copy link
Member

commented Oct 6, 2017

@JohnKozell The fix is available starting with the 0.7.0-rc.1 release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.