Parse ESN
Have you ever tried to parse
the ESN value returned by RadioGetInfo? Its not trivial to convert it into
the form we are familiar with. This function does just that. This only
works for Mobitex based devices.
void RimGetESN(int &part1,int &part2,int &part3)
{
RADIO_INFO radio_info;
int esn_1, esn_2, esn_3;
RadioGetDetailedInfo( &radio_info );
part1 = radio_info.ESN >> 24;
esn_1 = radio_info.ESN >> 16;
esn_2 = radio_info.ESN >> 8;
esn_3 = radio_info.ESN;
// MODEL NUMBER
part2 = esn_1;
part2 >>= 2;
part2 &= 0x003F;
// ID NUMBER
part3 = ((long)esn_1 & 0x00000003L) << 16 |
((long)esn_2 & 0x000000FFL) << 8 |
((long)esn_3 & 0x000000FFL);
}