(DIR) Return Create A Forum - Home --------------------------------------------------------- mc-Things (HTM) https://mcthings.createaforum.com --------------------------------------------------------- ***************************************************** (DIR) Return to: MQTT ***************************************************** #Post#: 543-------------------------------------------------- Working with ListOfByte By: Artanicus Date: July 15, 2016, 1:36 pm --------------------------------------------------------- So, I've got MQTT running and I'm getting beacons fine. I can even push data myself, but it seems I'm restricted to payloading a ListOfByte and cannot payload a string directly. Converting a String to ListOfByte works fine: payload.Add(payString) .. But how do I do the reverse on the backend side? I don't really know what language you're emulating so ListOfByte seems like a confusing and undocumented data type that's hard to work with. (Is there really no option to just push a raw string without conversions on the other side?) #Post#: 544-------------------------------------------------- Re: Working with ListOfByte By: kristofferis Date: July 15, 2016, 1:47 pm --------------------------------------------------------- You should not have to do any conversion on the clients that is connected and subscribed to the topic that you are publishing on. Have you tried and seen something strange? #Post#: 545-------------------------------------------------- Re: Working with ListOfByte By: Artanicus Date: July 15, 2016, 1:50 pm --------------------------------------------------------- I don't have a working example right now (don't have Windows available right now) but I'm watching the beacon stream and trying to decode it somehow but it's not really making much sense. What I was getting out of trying to push any string content was similar. Example hexdump of beacons below. 00001cc0 be da 09 01 00 0a 58 06 01 00 00 00 00 00 b6 da |......X.........| 00001cd0 09 01 00 0a 58 06 01 00 00 00 00 00 b5 da 09 01 |....X...........| 00001ce0 00 0a 58 06 01 00 00 00 00 00 b6 da 09 01 00 0a |..X.............| 00001cf0 45 06 01 00 00 00 00 00 bf da 09 01 00 0a 45 06 |E.............E.| 00001d00 01 00 00 00 00 00 be da 09 01 00 0a 58 06 01 00 |............X...| 00001d10 00 00 00 00 b5 da 09 01 00 0a 58 06 01 00 00 00 |..........X.....| 00001d20 00 00 b6 da 09 01 00 0a 58 06 01 00 00 00 00 00 |........X.......| 00001d30 b5 da 09 01 00 0a 45 06 01 00 00 00 00 00 be da |......E.........| 00001d40 09 01 00 0a 45 06 01 00 00 00 00 00 bf da 09 01 |....E...........| 00001d50 00 0a 45 06 01 00 00 00 00 00 bf da 09 01 00 0a |..E.............| 00001d60 58 06 01 00 00 00 00 00 b6 da 09 01 00 0a 58 06 |X.............X.| 00001d70 01 00 00 00 00 00 b5 da 09 01 00 0a 58 06 01 00 |............X...| 00001d80 00 00 00 00 b6 da 09 01 00 0a 45 06 01 00 00 00 |..........E.....| 00001d90 00 00 bf da 09 01 00 0a 45 06 01 00 00 00 00 00 |........E.......| 00001da0 bf da 09 01 00 0a 45 06 01 00 00 00 00 00 bf da |......E.........| 00001db0 09 01 00 0a 58 06 01 00 00 00 00 00 b6 da 09 01 |....X...........| 00001dc0 00 0a 58 06 01 00 00 00 00 00 b5 da 09 01 00 0a |..X.............| 00001dd0 58 06 01 00 00 00 00 00 b6 da 09 01 00 0a 45 06 |X.............E.| 00001de0 01 00 00 00 00 00 bf da 09 01 00 0a 45 06 01 00 |............E...| 00001df0 00 00 00 00 bf da 09 01 00 0a 45 06 01 00 00 00 |..........E.....| 00001e00 00 00 be da 09 01 00 0a 58 06 01 00 00 00 00 00 |........X.......| 00001e10 b6 da 09 01 00 0a 58 06 01 00 00 00 00 00 b5 da |......X.........| 00001e20 09 01 00 0a 58 06 01 00 00 00 00 00 b6 da 09 01 |....X...........| 00001e30 00 0a 58 06 01 00 00 00 00 00 b2 da 09 01 00 0a |..X.............| 00001e40 58 06 01 00 00 00 00 00 b5 da 09 01 00 0a 58 06 |X.............X.| 00001e50 01 00 00 00 00 00 b6 da 09 01 00 0a 58 06 01 00 |............X...| 00001e60 00 00 00 00 b5 da 09 01 00 0a 58 06 01 00 00 00 |..........X.....| 00001e70 00 00 b5 da 09 01 00 0a 58 06 01 00 00 00 00 00 |........X.......| 00001e80 b6 da 09 01 00 0a 58 06 01 00 00 00 00 00 b5 da |......X.........| 00001e90 09 01 00 0a 58 06 01 00 00 00 00 00 b6 da 09 01 |....X...........| 00001ea0 00 0a 58 06 01 00 00 00 00 00 b6 da 09 01 00 0a |..X.............| 00001eb0 58 06 01 00 00 00 00 00 b6 da 09 01 00 0a 58 06 |X.............X.| 00001ec0 01 00 00 00 00 00 b5 da 09 01 00 0a 58 06 01 00 |............X...| 00001ed0 00 00 00 00 b5 da 09 01 00 0a 58 06 01 00 00 00 |..........X.....| 00001ee0 00 00 b6 da 09 01 00 0a 58 06 01 00 00 00 00 00 |........X.......| 00001ef0 b5 da 09 01 00 0a 5f 06 01 00 00 00 00 00 b8 da |......_.........| 00001f00 09 01 00 0a 5f 06 01 00 00 00 00 00 b8 da 09 01 |...._...........| 00001f10 00 0a 5f 06 01 00 00 00 00 00 b9 da 09 01 00 0a |.._.............| 00001f20 5f 06 01 00 00 00 00 00 b8 da 09 01 00 0a 55 06 |_.............U.| 00001f30 01 00 00 00 00 00 bf da 09 01 00 0a 5d 06 01 00 |............]...| 00001f40 00 00 00 00 bd da 09 01 00 0a 55 06 01 00 00 00 |..........U.....| 00001f50 00 00 bf da 09 01 00 0a 5d 06 01 00 00 00 00 00 |........].......| 00001f60 be da 09 01 00 0a 55 06 01 00 00 00 00 00 bf da |......U.........| 00001f70 09 01 00 0a 55 06 01 00 00 00 00 00 be da 09 01 |....U...........| 00001f80 00 0a 55 06 01 00 00 00 00 00 be da 09 01 00 0a |..U.............| 00001f90 5d 06 01 00 00 00 00 00 b7 da 09 01 00 0a 5d 06 |].............].| 00001fa0 01 00 00 00 00 00 be da 09 01 00 0a 5d 06 01 00 |............]...| 00001fb0 00 00 00 00 be da 09 01 00 0a 58 06 01 00 00 00 |..........X.....| #Post#: 546-------------------------------------------------- Re: Working with ListOfByte By: kristofferis Date: July 15, 2016, 1:56 pm --------------------------------------------------------- Please try to connect a MQTT client to your broker and watch the result of your string that you have published. I am doing it like this and its working. You do not need to make any conversion on the connected client. #Post#: 551-------------------------------------------------- Re: Working with ListOfByte By: Artanicus Date: July 15, 2016, 3:24 pm --------------------------------------------------------- Seems you are correct, the ListOfByte gets automatically decoded by the gateway before pushing to MQTT. I really wish there was proper documentation. -_- #Post#: 2097-------------------------------------------------- Re: Working with ListOfByte By: rudydevolder Date: September 28, 2017, 3:57 am --------------------------------------------------------- The listofbyte object has also lots of methods that start with ExtractTo like ExtractTobyte, ExtractToShort, ExtractToFloat, ExtractToInteger with an Endianess option. Just give the index in the list of bytes as a pointer from wich byte in the sequence you want to decode. Very easy and straightforward. Verstuurd vanaf mijn SM-G9350 met Tapatalk *****************************************************