minor cleanup

pull/1/head
Tom Early 9 years ago
parent a20b097be0
commit 3e3962413c

@ -164,50 +164,50 @@ static struct sockaddr_in outaddr;
static int serfd = -1;
static bool busy20000 = false;
static std::atomic<bool> keep_running(true);
static unsigned char DVP_RQST_NAME[] = {0x04, 0x20, 0x01, 0x00};
static unsigned char DVP_REPL_NAME[] = {0x10, 0x00, 0x01, 0x00, 'D', 'V', 'A', 'P', ' ', 'D', 'o', 'n', 'g', 'l', 'e', 0x00};
static unsigned char DVP_RQST_SER[] = {0x04, 0x20, 0x02, 0x00};
static unsigned char DVP_REPL_SER[] = {0x0C, 0x00, 0x02, 0x00};
static unsigned char DVP_RQST_FW[] = {0x05, 0x20, 0x04, 0x00, 0x01};
static unsigned char DVP_REPL_FW[] = {0x07, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00};
static unsigned char DVP_RQST_MODU[] = {0x05, 0x00, 0x28, 0x00, 0x01};
static unsigned char DVP_REPL_MODU[] = {0x05, 0x00, 0x28, 0x00, 0x01};
static unsigned char DVP_RQST_MODE[] = {0x05, 0x00, 0x2A, 0x00, 0x00};
static unsigned char DVP_REPL_MODE[] = {0x05, 0x00, 0x2A, 0x00, 0x00};
static unsigned char DVP_RQST_SQL[] = {0x05, 0x00, 0x80, 0x00, 0x00};
static unsigned char DVP_REPL_SQL[] = {0x05, 0x00, 0x80, 0x00, 0x00};
static unsigned char DVP_RQST_PWR[] = {0x06, 0x00, 0x38, 0x01, 0x00, 0x00};
static unsigned char DVP_REPL_PWR[] = {0x06, 0x00, 0x38, 0x01, 0x00, 0x00};
static unsigned char DVP_RQST_OFF[] = {0x06, 0x00, 0x00, 0x04, 0x00, 0x00};
static unsigned char DVP_REPL_OFF[] = {0x06, 0x00, 0x00, 0x04, 0x00, 0x00};
static unsigned char DVP_RQST_FREQ[] = {0x08, 0x00, 0x20, 0x02, 0x00, 0x00, 0x00, 0x00};
static unsigned char DVP_REPL_FREQ[] = {0x08, 0x00, 0x20, 0x02, 0x00, 0x00, 0x00, 0x00};
static unsigned char DVP_RQST_START[] = {0x05, 0x00, 0x18, 0x00, 0x01};
static unsigned char DVP_REPL_START[] = {0x05, 0x00, 0x18, 0x00, 0x01};
static unsigned char DVP_RQST_STOP[] = {0x05, 0x00, 0x18, 0x00, 0x00};
static unsigned char DVP_REPL_STOP[] = {0x05, 0x00, 0x18, 0x00, 0x00};
static unsigned char DVP_HDR[] = {
static const unsigned char DVP_RQST_NAME[] = {0x04, 0x20, 0x01, 0x00};
static const unsigned char DVP_REPL_NAME[] = {0x10, 0x00, 0x01, 0x00, 'D', 'V', 'A', 'P', ' ', 'D', 'o', 'n', 'g', 'l', 'e', 0x00};
static const unsigned char DVP_RQST_SER[] = {0x04, 0x20, 0x02, 0x00};
static const unsigned char DVP_REPL_SER[] = {0x0C, 0x00, 0x02, 0x00};
static const unsigned char DVP_RQST_FW[] = {0x05, 0x20, 0x04, 0x00, 0x01};
static const unsigned char DVP_REPL_FW[] = {0x07, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00};
static const unsigned char DVP_RQST_MODU[] = {0x05, 0x00, 0x28, 0x00, 0x01};
static const unsigned char DVP_REPL_MODU[] = {0x05, 0x00, 0x28, 0x00, 0x01};
static const unsigned char DVP_RQST_MODE[] = {0x05, 0x00, 0x2A, 0x00, 0x00};
static const unsigned char DVP_REPL_MODE[] = {0x05, 0x00, 0x2A, 0x00, 0x00};
static const unsigned char DVP_RQST_SQL[] = {0x05, 0x00, 0x80, 0x00, 0x00};
static const unsigned char DVP_REPL_SQL[] = {0x05, 0x00, 0x80, 0x00, 0x00};
static const unsigned char DVP_RQST_PWR[] = {0x06, 0x00, 0x38, 0x01, 0x00, 0x00};
static const unsigned char DVP_REPL_PWR[] = {0x06, 0x00, 0x38, 0x01, 0x00, 0x00};
static const unsigned char DVP_RQST_OFF[] = {0x06, 0x00, 0x00, 0x04, 0x00, 0x00};
static const unsigned char DVP_REPL_OFF[] = {0x06, 0x00, 0x00, 0x04, 0x00, 0x00};
static const unsigned char DVP_RQST_FREQ[] = {0x08, 0x00, 0x20, 0x02, 0x00, 0x00, 0x00, 0x00};
static const unsigned char DVP_REPL_FREQ[] = {0x08, 0x00, 0x20, 0x02, 0x00, 0x00, 0x00, 0x00};
static const unsigned char DVP_RQST_START[] = {0x05, 0x00, 0x18, 0x00, 0x01};
static const unsigned char DVP_REPL_START[] = {0x05, 0x00, 0x18, 0x00, 0x01};
static const unsigned char DVP_RQST_STOP[] = {0x05, 0x00, 0x18, 0x00, 0x00};
static const unsigned char DVP_REPL_STOP[] = {0x05, 0x00, 0x18, 0x00, 0x00};
static const unsigned char DVP_HDR[] = {
0x2F, 0xA0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
static unsigned char DVP_REPL_HDR[] = {
static const unsigned char DVP_REPL_HDR[] = {
0x2F, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
static unsigned char DVP_REPL_PTT[] = {0x05, 0x20, 0x18, 0x01, 0x00};
static const unsigned char DVP_REPL_PTT[] = {0x05, 0x20, 0x18, 0x01, 0x00};
static unsigned char DVP_DAT[] = {
0x12, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
static unsigned char DVP_STS[] = {0x07, 0x20, 0x90, 0x00, 0x00, 0x00, 0x00};
static unsigned char DVP_ACK[] = {0x03, 0x60, 0x00};
static unsigned int MAX_REPL_CNT = 20;
static const unsigned char DVP_STS[] = {0x07, 0x20, 0x90, 0x00, 0x00, 0x00, 0x00};
static const unsigned char DVP_ACK[] = {0x03, 0x60, 0x00};
static const unsigned int MAX_REPL_CNT = 20;
enum REPLY_TYPE {
RT_TIMEOUT,
RT_ERR,
@ -242,7 +242,7 @@ static int open_sock();
static bool open_ser(char *dvp);
static bool open_dvp();
static int read_from_dvp(unsigned char* buf, unsigned int len);
static int write_to_dvp(unsigned char* buf, unsigned int len);
static int write_to_dvp(const unsigned char* buf, const unsigned int len);
static bool get_name();
static bool get_fw();
static bool get_ser(char *dvp);
@ -528,7 +528,7 @@ static int read_config(const char *cfgFile)
traceit("Max loops = %d\n", inactiveMax);
/* convert to Microseconds */
WAIT_FOR_PACKETS = WAIT_FOR_PACKETS * 1000;
WAIT_FOR_PACKETS *= 1000;
return 0;
}
@ -554,7 +554,7 @@ static int open_sock()
insock = -1;
return -1;
}
fcntl(insock,F_SETFL,O_NONBLOCK);
fcntl(insock, F_SETFL, O_NONBLOCK);
memset(&outaddr, 0, sizeof(outaddr));
outaddr.sin_family = AF_INET;
@ -734,7 +734,7 @@ static int read_from_dvp(unsigned char *buf, unsigned int len)
return len;
}
static int write_to_dvp(unsigned char *buf, unsigned int len)
static int write_to_dvp(const unsigned char *buf, const unsigned int len)
{
unsigned int ptr = 0;
@ -1186,7 +1186,7 @@ static void readFrom20000()
struct timeval tv;
int inactive = 0;
short seq_no = 0;
unsigned streamid[2] = {0x00, 0x00};
unsigned char streamid[2] = {0x00, 0x00};
u_int16_t sid;
unsigned char sync_codes[3] = {0x55, 0x2d, 0x16};
SPKT net_buf;
@ -1311,8 +1311,7 @@ static void readFrom20000()
seq_no = 0;
} else if (len == 29) {
if (busy20000) {
if ((net_buf.myicm.streamid[0] == streamid[0]) &&
(net_buf.myicm.streamid[1] == streamid[1])) {
if ((net_buf.myicm.streamid[0] == streamid[0]) && (net_buf.myicm.streamid[1] == streamid[1])) {
if (net_buf.myicm.ctrl == ctrl_in) {
/* do not update written_to_q, ctrl_in */
; // traceit("dup\n");

@ -217,7 +217,7 @@ module = {
# the internal ip of this program, "0.0.0.0" is usually best
# internal_ip = "0.0.0.0"
# port number default: A:19990 B:19999 C:20000
# port number default: A:19998 B:19999 C:20000
# port = 20000 # default for mod C
}
}

Loading…
Cancel
Save

Powered by TurnKey Linux.