Add buttons on app MQTT PAHO [message #1708370] |
Tue, 15 September 2015 23:36  |
Eclipse User |
|
|
|
Hello everyone.
I am having difficulty grade to include buttons in the application MQTT app . By the way a great example for using MQTT service. But in my application I wish there was a toogle button to upload the topic and message.
I tried to include the button on activity_publish and add a View.OnClickListener the Listener class, but without success. I think I can not include button treatment in Listener class.
Anyone have any suggestions ?
I just wanted to have a button to send topic " Led " Message " ON" , for example.
Thanks!
Regards,
Jeff
|
|
|
|
|
Re: Add buttons on app MQTT PAHO [message #1708759 is a reply to message #1708492] |
Sun, 20 September 2015 10:08  |
Eclipse User |
|
|
|
Hi,
I've been messing with the home app and saw that a simple solution could be I use the same menu / publish button with a possible toogle function. So that within the publish () method could be an IF to test the current condition of the topic. If it is ON, it publishes OFF, if OFF, ON sends the broker.
The current topic of the status information is in MqttCallBackHandle / Class in notifyArgs variable [1 ] .
I ask , how can I use it within publish () ?
Something like :
Publish ( )
If ( notifyArgs [1 ] ) equals ( ON) ) {
Publish OFF}
else {
Publish ON}
|
|
|
Powered by
FUDForum. Page generated in 0.78744 seconds