# Help with byte joggling - payload funtion

**URL:** <https://www.thethingsnetwork.org/forum/t/help-with-byte-joggling-payload-funtion/18885>\
**Category:** Application Development\
**Created:** [October 17, 2018, 9:57am UTC](https://www.thethingsnetwork.org/forum/t/help-with-byte-joggling-payload-funtion/18885 "2018-10-17T09:57:02Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![flodenh](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/flodenh/32/25844_2.png) [@flodenh](https://www.thethingsnetwork.org/forum/u/flodenh)\
**Post date:** [October 17, 2018, 9:57am UTC](https://www.thethingsnetwork.org/forum/t/help-with-byte-joggling-payload-funtion/18885/1 "2018-10-17T09:57:02Z")

</div>

Hi  
I am trying to create a payload function for decoding messages from the micro tracker from Abeeway. In the reference guide I can see that byte 6 to 8 in the paylod contains the latitude and it is calculated in the following way:

Latitude = Latitude \<\< 8  
If Latitude \> 0x7FFFFFFF then Latitude = Latitude – 0x10000000  
Latitude = Latitude / 10000000

So my question is - how do I combine byte 6 to 8 and do the calculation above in the TTN payload function.

Br Henrik

---

<div class="post-metadata">

**Author:** ![flodenh](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/flodenh/32/25844_2.png) [@flodenh](https://www.thethingsnetwork.org/forum/u/flodenh)\
**Post date:** [October 17, 2018, 12:01pm UTC](https://www.thethingsnetwork.org/forum/t/help-with-byte-joggling-payload-funtion/18885/2 "2018-10-17T12:01:51Z")

</div>

… solved it myself by reading this exellent post by Arjan:

> [@Best practices when sending GPS location data \[HowTo\]](https://www.thethingsnetwork.org/forum/t/best-practices-when-sending-gps-location-data/1242/21):
>
> When sending 3 bytes, we’re basically not sending the 4th byte of each integer, which should be 0xFF for negative numbers. Like for New York (40.712784, -74.005941, which would be sent as integers 407127 and -740059) we would send: For LSB: 0x573606 25B5F4 instead of 0x57360600 25B5F4FF ([Least Significant Bit/Byte first](https://en.wikipedia.org/wiki/Most_significant_bit#Most_Significant_Bit_First_vs_Least_Significant_Bit_First), to match [@JohanAdriaans’ encoding example](https://www.thethingsnetwork.org/forum/t/best-practices-when-sending-gps-location-data/1242/13) above). For MSB: 0x063657 F4B525 instead of 0x00063657 FFF4B525. When decoding these 6 bytes back into two 32 bits signed integers,…

Thanks!

---

<div class="post-metadata">

**Author:** ![thomassieczkowski](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/thomassieczkowski/32/19635_2.png) [@thomassieczkowski](https://www.thethingsnetwork.org/forum/u/thomassieczkowski)\
**Post date:** [February 2, 2019, 7:27pm UTC](https://www.thethingsnetwork.org/forum/t/help-with-byte-joggling-payload-funtion/18885/3 "2019-02-02T19:27:00Z")

</div>

Have you manage to decode abeeway Microtracker data?

---

<div class="post-metadata">

**Author:** ![flodenh](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/flodenh/32/25844_2.png) [@flodenh](https://www.thethingsnetwork.org/forum/u/flodenh)\
**Post date:** [February 2, 2019, 7:52pm UTC](https://www.thethingsnetwork.org/forum/t/help-with-byte-joggling-payload-funtion/18885/4 "2019-02-02T19:52:07Z")

</div>

It is a work in progress but has gotten quite far. Here is my decode function as of now: [Abeeway decoder.txt](https://www.thethingsnetwork.org/forum/uploads/default/original/3X/6/0/60ffae819d41ef9b01c23c7ddbc884941cefb97c.txt) (1.7 KB)

---

<div class="post-metadata">

**Author:** ![thomassieczkowski](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/thomassieczkowski/32/19635_2.png) [@thomassieczkowski](https://www.thethingsnetwork.org/forum/u/thomassieczkowski)\
**Post date:** [February 3, 2019, 7:05pm UTC](https://www.thethingsnetwork.org/forum/t/help-with-byte-joggling-payload-funtion/18885/5 "2019-02-03T19:05:38Z")

</div>

Thanks! 🙂 If I have any progress I’ll let you know.

---

<div class="post-metadata">

**Author:** ![thomassieczkowski](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/thomassieczkowski/32/19635_2.png) [@thomassieczkowski](https://www.thethingsnetwork.org/forum/u/thomassieczkowski)\
**Post date:** [February 9, 2019, 12:34am UTC](https://www.thethingsnetwork.org/forum/t/help-with-byte-joggling-payload-funtion/18885/6 "2019-02-09T00:34:29Z")

</div>

Hi @flodenh - Your function seems to work but the geolocation data, right? I’d be glad to share some time over Skype if you want to solve this out. Abeeway is not helping us out by sending a JS decoder… And it is quite tricky to get this working on JS.

---

<div class="post-metadata">

**Author:** ![Jaisantosh](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/jaisantosh/32/35697_2.png) [@Jaisantosh](https://www.thethingsnetwork.org/forum/u/Jaisantosh)\
**Post date:** [March 25, 2022, 5:29am UTC](https://www.thethingsnetwork.org/forum/t/help-with-byte-joggling-payload-funtion/18885/7 "2022-03-25T05:29:06Z")

</div>

Hi, Can anybody give me the downlink details to get the BLE scanned data only from Abeeway MicroTracker? or do I have to use the decoder?  
I’m getting this value in MAC Payload: (033C00A809196032B13AA0F6DC003192010D70C4C01173E2722BC3889D9804F5E2C3) Does this value also contains BLE Beacon details?  
I couldn’t find that in any of their document.

Thanks

---

<div class="post-metadata">

**Author:** ![Johan\_Scheepers](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/johan_scheepers/32/48536_2.png) [@Johan\_Scheepers](https://www.thethingsnetwork.org/forum/u/Johan_Scheepers)\
**Post date:** [March 25, 2022, 6:13am UTC](https://www.thethingsnetwork.org/forum/t/help-with-byte-joggling-payload-funtion/18885/8 "2022-03-25T06:13:55Z")

</div>

As I said in the other post search the forum, decoder is on there and read the manufactures documentation, their doc are extensive.

---

<div class="post-metadata">

**Author:** ![descartes](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/descartes/32/47220_2.png) [@descartes](https://www.thethingsnetwork.org/forum/u/descartes)\
**Post date:** [March 25, 2022, 9:17am UTC](https://www.thethingsnetwork.org/forum/t/help-with-byte-joggling-payload-funtion/18885/9 "2022-03-25T09:17:13Z")

</div>

Please don’t double post - we are all volunteers here and it splits the efforts if there are multiple threads running at once.

---

<div class="post-metadata">

**Author:** ![descartes](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/descartes/32/47220_2.png) [@descartes](https://www.thethingsnetwork.org/forum/u/descartes)\
**Post date:** [March 25, 2022, 9:17am UTC](https://www.thethingsnetwork.org/forum/t/help-with-byte-joggling-payload-funtion/18885/10 "2022-03-25T09:17:16Z")

</div>


