Project

General

Profile

Revision 118

updated server for new wl library changes

View differences:

client.cpp
24 24

  
25 25

  
26 26
/* Public functions */
27
int wirelessMessageHandler(ColonetPacket* pkt)
28
{
29
  printf("Received wireless message!!!\n");
30
  if (!pkt) {
31
    printf("The packet pointer was null.\n");
32
    return -1;
33
  }
27
int wirelessMessageHandler(unsigned char type, short source, int dest,
28
                           unsigned char* data, int len) {
29
  printf("Server received wireless message!!!\n");
34 30

  
35
  if ((int)pkt->msg_type == COLONET_RESPONSE) {
31
  if (type == COLONET_RESPONSE) {
36 32
    printf("response\n");
37 33

  
38
    int dest = (int)(pkt->msg_dest);
39 34
    char buffer[WRITE_BUFFER_SIZE];
40 35
          
41
    int value = (int)(pkt->data[0]);
36
    int value = (int)(data[0]);
42 37
    snprintf(buffer, WRITE_BUFFER_SIZE, "%d\n", value);
43 38
          
44
    int len = strlen(buffer);
45
    if (connection_pool->write_to_client(dest, buffer, len) == ERROR_INVALID_CLIENT_ID) {
46
      printf("The robot wanted to pass the data to a client not in the pool.\n");
39
    int buflen = strlen(buffer);
40
    if (connection_pool->write_to_client(dest, buffer, buflen)
41
        == ERROR_INVALID_CLIENT_ID) {
42
      printf("The robot wanted to pass the data to a client not in the "
43
             "pool.\n");
47 44
      return -1;
48 45
    }
49 46

  
......
52 49
    printf("not a response\n");
53 50
  }
54 51

  
55
  pkt = 0;
56 52
  return 0;
57 53
}

Also available in: Unified diff