2015-01-04 14:29:26 +00:00
|
|
|
#define INTERFACE_VERSION "irmc v0.02"
|
|
|
|
|
2015-01-04 14:02:03 +00:00
|
|
|
// Structures for the packets: unsigned short command
|
|
|
|
#define DIS 0x0002 // disconnect
|
|
|
|
#define DAT 0x0003
|
|
|
|
#define CON 0x0004 // connect
|
|
|
|
#define ACK 0x0005
|
|
|
|
|
2015-01-04 14:32:43 +00:00
|
|
|
#define SIZE_COMMAND_PACKET 4
|
|
|
|
#define SIZE_DATA_PACKET 496
|
|
|
|
#define SIZE_DATA_PACKET_PAYLOAD 492 // = SIZE_DATA_PACKET - SIZE_COMMAND_PACKET
|
|
|
|
|
|
|
|
#define SIZE_ID 128
|
|
|
|
#define SIZE_STATUS 128
|
|
|
|
#define SIZE_CODE 51
|
2015-02-03 22:29:32 +00:00
|
|
|
|
2015-01-04 14:02:03 +00:00
|
|
|
// This structure will be used to (dis-)connect to KOB servers
|
|
|
|
struct command_packet_format{
|
|
|
|
unsigned short command; // CON / DIS
|
|
|
|
unsigned short channel; // Channel number
|
|
|
|
};
|
2015-02-03 22:29:32 +00:00
|
|
|
|
2015-01-04 14:02:03 +00:00
|
|
|
// This structure will be used for id, rx and tx packets
|
|
|
|
struct data_packet_format{
|
|
|
|
unsigned short command;
|
|
|
|
unsigned short length;
|
2015-01-04 14:26:52 +00:00
|
|
|
char id[SIZE_ID];
|
2015-01-04 14:02:03 +00:00
|
|
|
char a1[4];
|
|
|
|
unsigned int sequence;
|
|
|
|
unsigned int a21;
|
|
|
|
unsigned int a22;
|
|
|
|
unsigned int a23;
|
2015-01-04 14:32:43 +00:00
|
|
|
signed int code[SIZE_CODE];
|
2015-01-04 14:02:03 +00:00
|
|
|
unsigned int n;
|
2016-09-24 15:03:30 +00:00
|
|
|
char status[SIZE_STATUS]; /* This is called version in MorseKob, in cwcom this transmits the sent character?! */
|
2015-01-04 14:02:03 +00:00
|
|
|
char a4[8];
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
// Define the packets used
|
|
|
|
#define DEFAULT_CHANNEL 103
|
|
|
|
|
2016-09-24 14:55:36 +00:00
|
|
|
/* Define functions provided by cwprotocol */
|
2015-01-04 14:26:52 +00:00
|
|
|
int prepare_id (struct data_packet_format *id_packet, char *id);
|
|
|
|
int prepare_tx (struct data_packet_format *tx_packet, char *id);
|
2016-09-24 14:55:36 +00:00
|
|
|
void identifyclient (void);
|
|
|
|
int send_latch (void);
|
|
|
|
int send_unlatch (void);
|
|
|
|
|
|
|
|
/* Define external struct for global variables */
|
|
|
|
extern struct command_packet_format connect_packet;
|
|
|
|
extern struct command_packet_format disconnect_packet;
|
|
|
|
extern struct data_packet_format id_packet;
|
|
|
|
extern struct data_packet_format rx_data_packet;
|
|
|
|
extern struct data_packet_format tx_data_packet;
|
|
|
|
|
|
|
|
extern int tx_sequence, rx_sequence;
|
|
|
|
|
|
|
|
extern int fd_socket;
|
|
|
|
|
|
|
|
|
2016-09-24 14:28:30 +00:00
|
|
|
|