fix home directory
[protos/xbee.git] / commands.c
index be8e03c..9e000bd 100644 (file)
@@ -76,7 +76,6 @@ static int range_cur_count = 0;
 
 static struct event rc_send_event;
 static int rc_send_period_ms = 100;
-static uint64_t rc_send_dstaddr = 0xFFFF; /* broadcast by default */
 static int rc_send_running = 0;
 static const char *xbee_logfilename = "/tmp/xbee.log";
 
@@ -88,7 +87,7 @@ static void monitor_cb(int s, short event, void *arg)
        if (monitor_current == NULL)
                monitor_current = LIST_FIRST(&monitor_list);
 
-       xbeeapp_send_atcmd(monitor_current->atcmd, NULL, 0, 0);
+       xbeeapp_send_atcmd(monitor_current->atcmd, NULL, 0, 0, NULL, NULL);
        monitor_current = LIST_NEXT(monitor_current, next);
 
        evtimer_set(&monitor_event, monitor_cb, cl);
@@ -114,7 +113,7 @@ static void range_cb(int s, short event, void *arg)
        }
        range_power = ((range_power + i) & 0x7);
 
-       xbeeapp_send_atcmd("PL", &range_power, sizeof(range_power), 0);
+       xbeeapp_send_atcmd("PL", &range_power, sizeof(range_power), 0, NULL, NULL);
        snprintf(buf, sizeof(buf), "range%d", range_power);
        xbeeapp_send_msg(range_dstaddr, buf, strlen(buf), 0);
 
@@ -134,14 +133,8 @@ static void rc_send_cb(int fd, short event, void *arg)
 {
        struct cmdline *cl = arg;
        struct timeval tv;
-       struct rc_proto_channel rc_chan;
-       int i;
 
-       rc_chan.type = RC_PROTO_TYPE_CHANNEL;
-       for (i = 0; i< AXIS_NUMBER; i++){
-               rc_chan.axis[i] = htons(joyinfo.axis[i]);
-       }
-       xbeeapp_send_msg(rc_send_dstaddr, &rc_chan, sizeof(rc_chan), 0);
+       rc_proto_send_channels();
 
        evtimer_set(&rc_send_event, rc_send_cb, cl);
        tv.tv_sec = 0;
@@ -790,7 +783,7 @@ struct cmd_ping_result {
 /* function called when cmd_ping is parsed successfully */
 static void cmd_ping_parsed(void *parsed_result, struct cmdline *cl, void *data)
 {
-       xbeeapp_send_atcmd("VL", NULL, 0, 1);
+       xbeeapp_send_atcmd("VL", NULL, 0, 1, NULL, NULL);
 }
 
 cmdline_parse_token_string_t cmd_ping_ping =
@@ -980,7 +973,7 @@ static void cmd_read_parsed(void *parsed_result, struct cmdline *cl,
                            void *data)
 {
        struct cmd_read_result *res = parsed_result;
-       xbeeapp_send_atcmd(res->cmd->name, NULL, 0, 1);
+       xbeeapp_send_atcmd(res->cmd->name, NULL, 0, 1, NULL, NULL);
 }
 
 cmdline_parse_token_string_t cmd_read_read =
@@ -1044,7 +1037,7 @@ static void cmd_write_parsed(void *parsed_result, struct cmdline *cl,
                printf("Unknown argument type\n");
                return;
        }
-       xbeeapp_send_atcmd(res->cmd->name, param, len, 1);
+       xbeeapp_send_atcmd(res->cmd->name, param, len, 1, NULL, NULL);
 }
 
 cmdline_parse_token_string_t cmd_write_write =