An implementation of Analog cellular networks like A-Netz, B-Netz, C-Netz, NMT, AMPS, TACS, JTACS, Radiocom 2000, IMTS, MPT1327, Eurosignal and more
http://osmocom-analog.eversberg.eu/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
700 B
33 lines
700 B
#include "stdio.h"
|
|
#include "stdint.h"
|
|
#include "string.h"
|
|
#include "../libhagelbarger/hagelbarger.h"
|
|
|
|
int main(void)
|
|
{
|
|
uint8_t message[9] = "JollyRog", code[20];
|
|
|
|
printf("Message: %s\n", message);
|
|
|
|
/* clean tail at code bit 70 and above */
|
|
memset(code, 0, sizeof(code));
|
|
|
|
/* encode message */
|
|
hagelbarger_encode(message, code, 70);
|
|
|
|
/* decode */
|
|
hagelbarger_decode(code, message, 64);
|
|
printf("Decoded without corruption: %s (must be the same as above)\n", message);
|
|
|
|
/* corrupt data */
|
|
code[0] ^= 0xfc;
|
|
code[3] ^= 0xfc;
|
|
code[7] ^= 0xfc;
|
|
|
|
/* decode */
|
|
hagelbarger_decode(code, message, 64);
|
|
printf("Decoded with corruption: %s (must be the same as above)\n", message);
|
|
|
|
return 0;
|
|
}
|
|
|
|
|