Advertisement
Guest User

Untitled

a guest
Oct 25th, 2016
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. function onMessage(client, topic, message)
  2.  
  3. if handleQuery(topic.."+"..message) then
  4. uart.write(0,topic.."+"..message)
  5.  
  6. uart.on("data","%", function(data)
  7. if data=="quit%" then
  8. uart.on("data") -- unregister event
  9. end
  10.  
  11. if data ~= "quit%" then
  12. client:publish(topic.."/response","REPLY:"..data,0,0)
  13. end
  14. end,0)
  15. else
  16. client:publish(topic.."/response","REPLY: Invalid query",0,0)
  17. end
  18. end
  19.  
  20. REPLY:<value>%
  21. quit%
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement