Data Sheet

character string is equivalent to the characters printed on the
transmitter, and entered into a receiver.
Parameters:
addr - a 5 character string. eg "63GEA"
Returns:
uint32- a value equivalent to the incodeded Dexcom
Transmitter address.
Uses:
getSrcValue(char)
This function returns a value equivalent to the character for
encoding.
See srcNameTable[]
*/
uint32 asciiToDexcomSrc(char addr[6])
{
// prepare a uint32 variable for our return value
uint32 src = 0;
// look up the first character, and shift it 20 bits left.
src |= (getSrcValue(addr[0]) << 20);
// look up the second character, and shift it 15 bits left.
src |= (getSrcValue(addr[1]) << 15);
// look up the third character, and shift it 10 bits left.
src |= (getSrcValue(addr[2]) << 10);
// look up the fourth character, and shift it 50 bits left.
src |= (getSrcValue(addr[3]) << 5);
// look up the fifth character
src |= getSrcValue(addr[4]);
//printf("asciiToDexcomSrc: val=%u, src=%u\r\n", val, src);
return src;
}
/* getSrcValue - function to determine the encoding value of a
character in a Dexcom Transmitter ID.
Parameters:
srcVal - The character to determine the value of
Returns:
uint32 - The encoding value of the character.
*/
uint32 getSrcValue(char srcVal)
{
uint8 i = 0;
for(i = 0; i < 32; i++)
{
if (SrcNameTable[i]==srcVal) break;
}
//printf("getSrcVal: %c %u\r\n",srcVal, i);
return i & 0xFF;
}
Decoding a long integer transmitter ID is far simpler. You may implement a similar piece of
code if you are storing the ID as a long int, but wish to display the text equivalent.
// convert the passed uint32 Dexcom source address into an ascii
string in the passed char addr[6] array.