Project

General

Profile

Revision 334

Added by Greg Tress over 16 years ago

Added battery request functionaltiy. It works, but is kind of a hack. I will be cleaning it up so the format is the same as other requests.

View differences:

ColonetServer.cpp
145 145
  if (type == COLONET_RESPONSE) {
146 146
    printf("response\n");
147 147

  
148
    /*
149
    //Eugene's code
148 150
    char buffer[WRITE_BUFFER_SIZE];
149 151

  
150 152
    int value = (int)(data[0]);
151 153
    snprintf(buffer, WRITE_BUFFER_SIZE, "%d\n", value);
152 154

  
153 155
    int buflen = strlen(buffer);
156
    */
157

  
158
    //Greg's code
159
    char * buffer = (char *) &(data[5]);
160
    int buflen = strlen(buffer);
161
    buffer[buflen] = '\n';
162
    buflen++;
163

  
154 164
    if (connection_pool.write_to_client(dest, buffer, buflen) == ERROR_INVALID_CLIENT_ID) {
155 165
      printf("The robot wanted to pass the data to a client not in the pool.\n");
156 166
      return -1;

Also available in: Unified diff