Sample program showing how to create a real application that connects to a real radio. This sample connects to /dev/ttyUSB0 at 9600 baud and sends a radio personality request every second. It prints out the details of the reply.
#include "Address.h"
#include "ApplicationLayer.h"
#include "PhysicalLayer.h"
#include "DataLayer.h"
#include "NetworkLayer.h"
#include "UnixPort.h"
#include "Log.h"
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <time.h>
#define RADIO_DEVICE_NAME "/dev/ttyUSB0"
#define RADIO_DEVICE_BAUD 9600
{
public:
{
printf("link ready\n");
}
uint32_t serial, uint8_t facilities_a, uint8_t facilities_b,
uint8_t facilities_c, uint8_t codings)
{
printf(
"receiveRadioPersonality:\n Address:%s\n Manufacturers Code: %d\n Model: %d\n Serial Number: %d\n Facilities A: %02x\n Facilities B: %02x\n Facilities C: %02x\n Codings: %02x\n", address.
asString(), manufacturers_code, model, serial, facilities_a, facilities_b, facilities_c, codings);
}
{
printf("link failure\n");
}
};
int main(int argc, char** argv)
{
time_t last_time = 0;
while (1)
{
usleep(10000);
time_t this_time = time(0);
if (this_time != last_time)
{
last_time = this_time;
}
}
return 0;
};