For a given communication standard RTCM SC104 3.1, I need to split the data by bytes as a pair of 12-bit data segments. Therefore, for this message, I need to put the message type number in the first byte and half the second byte. Then I need to run an integer ID on half the second byte and continue the third byte. This kind of pattern continues until the end of the message, discarding other integers in 20-bit, 5-bit and other sizes, significantly reducing the number 0, which usually fills the end of the integer MSB values.
I did not see a clear definition, but I assume that it should go out in the network byte order, so before copying the bits I will have to cancel my integers in memory. I'm still new to cpp, and I wonder how can I get the individual bytes that make up an integer in memory? If I can access bytes, then I could use bitwise or break bits from 2 bytes into one for the message.
Here begins the assembly of the message before adding data:
char buf1002[BUFFERSIZE];
buf1002[0] = 0x3E;
buf1002[1] = 0xA0;
The reference station will be from unsigned short, so an integer of 2 bytes. So, how do I start reading one byte? Am I starting with a memory location pointer? If so, then what?
Any help would be greatly appreciated.
source
share