- You are here: Home > How can I send binary data using the GSatMicro and what...
You are here
Inquiry:How can I send binary data using the GSatMicro and what is the length limit?
In the realm of binary messaging, here's an all-encompassing solution that shows how to pack and transmit binary.
The first thing we are going to run is a quick "in memory" function that makes converting from something easy to enter on the console (ASCII) hex characters to binary. One binary byte (8 bits) is represented by 2 hex bytes (also 8 bits). This in-memory function will make it easy to enter pairs of hex characters to convert to binary.
In your application, you can take a binary string and parse it out to the appropriate hex characters.
Each command must be less than 100 characters, so let's create some strings that are about 70 characters. Then we will take 48 hex bytes and convert them to 24 binary bytes, and append them to a "tx" variable.
Remember the maximum binary MO payload for the satellite modem is 340 bytes.
Last step is actually transmitting this "tx" variable with a simple "iridium.transmit(tx)"
function hex2bin(str) a='' for c in str:gmatch".." do a=a..string.char(tonumber(c,16)) end return a end