{"id":2428,"date":"2020-08-06T11:40:18","date_gmt":"2020-08-06T16:40:18","guid":{"rendered":"http:\/\/blog.espol.edu.ec\/girni\/?p=2428"},"modified":"2022-03-24T11:47:55","modified_gmt":"2022-03-24T16:47:55","slug":"lorawan-mensajes-mqtt","status":"publish","type":"post","link":"https:\/\/blog.espol.edu.ec\/girni\/lorawan-mensajes-mqtt\/","title":{"rendered":"3.1 LoRaWAN - mensajes MQTT"},"content":{"rendered":"<p>Los datos son enviados como un tren de bits escritos en hexadecimal desde el dispositivo.<\/p>\n<p>Por ejemplo, un mensaje a transmitir conformado por 4 datos num\u00e9ricos en hexadecimal desde el dispositivo son:<\/p>\n<pre>static void prepareTxFrame( uint8_t port ){\r\n    appDataSize = 4;\/\/AppDataSize max value is 64\r\n    appData[0] = 0x00;\r\n    appData[1] = 0x01;\r\n    appData[2] = 0x02;\r\n    appData[3] = 0x03;\r\n}<\/pre>\n<p>Se leen en un mensaje mqtt como:<\/p>\n<pre>application\/1\/device\/3532363324003700\/event\/up {\r\n    \"applicationID\":\"1\",\r\n    \"applicationName\":\"GirniAppPrueba01\",\r\n    \"deviceName\":\"GirniDispositivo01\",\r\n    \"devEUI\":\"3532363324003700\",\r\n    \"txInfo\":{\"frequency\":902700000,\"dr\":0},\r\n    \"adr\":true,\r\n    \"fCnt\":0,\r\n    \"fPort\":2,\r\n    <strong>\"data\":\"AAECAw==\"<\/strong>\r\n    }<\/pre>\n<p>por lo que el mensaje recibido por el gateway es:<\/p>\n<pre>\"data\":\"AAECAw==\"<\/pre>\n<p>que para leerlo nuevamente en hexadecimal requiere ser traducido desde \"base64\" por ejemplo en la consola de Rasberry OS como:<\/p>\n<pre>pi@GWHTM01:~ $ echo -n AAECAw== | base64 --decode | hexdump -C\r\n00000000  <strong>00 01 02 03<\/strong>                                       |....|\r\n00000004<\/pre>\n<p>que es el mensaje original enviado desde el dispositivo<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Los datos son enviados como un tren de bits escritos en hexadecimal desde el dispositivo. Por ejemplo, un mensaje a transmitir conformado por 4 datos num\u00e9ricos en hexadecimal desde el dispositivo son: static void prepareTxFrame( uint8_t port ){ appDataSize = 4;\/\/AppDataSize max value is 64 appData[0] = 0x00; appData[1] = 0x01; appData[2] = 0x02; appData[3] &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.espol.edu.ec\/girni\/lorawan-mensajes-mqtt\/\" class=\"more-link\">Continuar leyendo<span class=\"screen-reader-text\"> \"3.1 LoRaWAN - mensajes MQTT\"<\/span><\/a><\/p>\n","protected":false},"author":8043,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1447338],"tags":[602214,1457736],"class_list":["post-2428","post","type-post","status-publish","format-standard","hentry","category-lorawan-open-gateway","tag-iot","tag-lorawan"],"_links":{"self":[{"href":"https:\/\/blog.espol.edu.ec\/girni\/wp-json\/wp\/v2\/posts\/2428","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.espol.edu.ec\/girni\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.espol.edu.ec\/girni\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.espol.edu.ec\/girni\/wp-json\/wp\/v2\/users\/8043"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.espol.edu.ec\/girni\/wp-json\/wp\/v2\/comments?post=2428"}],"version-history":[{"count":9,"href":"https:\/\/blog.espol.edu.ec\/girni\/wp-json\/wp\/v2\/posts\/2428\/revisions"}],"predecessor-version":[{"id":3382,"href":"https:\/\/blog.espol.edu.ec\/girni\/wp-json\/wp\/v2\/posts\/2428\/revisions\/3382"}],"wp:attachment":[{"href":"https:\/\/blog.espol.edu.ec\/girni\/wp-json\/wp\/v2\/media?parent=2428"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.espol.edu.ec\/girni\/wp-json\/wp\/v2\/categories?post=2428"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.espol.edu.ec\/girni\/wp-json\/wp\/v2\/tags?post=2428"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}