Revision 175
robot actually does stuff. Moves, but GUI control is off.
colonet_wireless.cpp | ||
---|---|---|
77 | 77 |
return 0; |
78 | 78 |
} |
79 | 79 |
|
80 |
void colonet_wl_send(int client_source, short dest,
|
|
80 |
void colonet_wl_send(short client_source, short dest,
|
|
81 | 81 |
ColonetMessageType msg_type, unsigned char msg_code, |
82 | 82 |
unsigned char* args) { |
83 |
printf("colonet_wl_send: client_source:%d, dest:%d, msg_code:%d\n", |
|
84 |
client_source, dest, msg_code); |
|
85 |
|
|
83 | 86 |
ColonetRobotServerPacket pkt; |
84 | 87 |
pkt.client_id = client_source; |
85 | 88 |
pkt.msg_code = msg_code; |
... | ... | |
88 | 91 |
pkt.data[i] = args[i]; |
89 | 92 |
} |
90 | 93 |
|
91 |
char pkt_buffer[40]; |
|
92 |
memcpy(pkt_buffer, (char*)(&pkt), sizeof(ColonetRobotServerPacket)); |
|
93 |
|
|
94 | 94 |
if (dest == GLOBAL_DEST) { |
95 | 95 |
printf("sending to global dest\n"); |
96 |
wl_send_global_packet(COLONET_PACKET_GROUP_ID, (char)msg_type, pkt_buffer, |
|
97 |
1 + PACKET_DATA_LEN, 0); |
|
96 |
|
|
97 |
wl_send_global_packet(COLONET_PACKET_GROUP_ID, (char)msg_type, |
|
98 |
(char*)(&pkt), sizeof(ColonetRobotServerPacket), 0); |
|
98 | 99 |
} else { |
99 | 100 |
printf("sending to specific robot.\n"); |
100 |
wl_send_robot_to_robot_global_packet(COLONET_PACKET_GROUP_ID, (char)msg_type, |
|
101 |
pkt_buffer, 1 + PACKET_DATA_LEN, dest, |
|
101 |
wl_send_robot_to_robot_global_packet(COLONET_PACKET_GROUP_ID, |
|
102 |
(char)msg_type, (char*)(&pkt), |
|
103 |
sizeof(ColonetRobotServerPacket), |
|
104 |
dest, |
|
102 | 105 |
COLONET_RESPONSE_PACKET_FRAME_ID); |
103 | 106 |
} |
104 | 107 |
} |
Also available in: Unified diff