Subversion Repositories HomeAutomation

Rev

Rev 1990 | Rev 2066 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 1990 Rev 1999
Line 296... Line 296...
296
   
296
 
297
    static bool have_start = false;
297
  static bool have_start = false;
298
   
298
 
299
    for (unsigned int n = 0; n < data.size(); n++)
299
  for (unsigned int n = 0; n < data.size(); n++)
300
    {
300
  {
301
      log::Debug(log_module_, "data[%u]=%u", n, (unsigned int)data[n]);
301
    log::Debug(log_module_, "data[%u] = %u, have_start = %s, this->buffer_.size() = %u", n, (unsigned int)data[n], have_start ? "true" : "false", this->buffer_.size());
302
     
302
   
303
        if (have_start)
303
    if (have_start)
304
        {
304
    {
305
          log::Debug(log_module_, "have_start, this->buffer_.size() = %u", this->buffer_.size());
-
 
306
         
-
 
307
            if (data[n] == PACKET_END && this->buffer_.size() == 15)
305
      if (data[n] == PACKET_END)
308
            {
306
      {
309
              log::Debug(log_module_, "PACKET_END");
307
        log::Debug(log_module_, "PACKET_END");
-
 
308
       
-
 
309
        while (this->buffer_.size() < 15)
310
             
310
        {
-
 
311
          this->buffer_.push_back(0);
-
 
312
        }
-
 
313
       
-
 
314
        for (unsigned int k = 0; k < this->buffer_.size(); k++)
-
 
315
        {
-
 
316
          log::Debug(log_module_, "this->buffer_[%u]=%u", k, (unsigned int)this->buffer_[k]);
-
 
317
        }
-
 
318
       
311
                this->ProcessBuffer();
319
        this->ProcessBuffer();
-
 
320
       
312
                have_start = false;
321
        have_start = false;
313
            }
322
      }
314
            else
323
      else
315
            {
324
      {
316
                this->buffer_.push_back(data[n]);
325
        this->buffer_.push_back(data[n]);
317
            }
326
      }
318
        }
327
    }
319
        else if (data[n] == PACKET_START)
328
    else if (data[n] == PACKET_START)
320
        {
329
    {
-
 
330
      log::Debug(log_module_, "PACKET_START");
-
 
331
     
321
          common::Byteset empty_vector;
332
      common::Byteset empty_vector;
322
          this->buffer_.swap(empty_vector);
333
      this->buffer_.swap(empty_vector);
323
 
334
 
324
          have_start = true;
335
      have_start = true;
325
        }
336
    }
326
        else if (data[n] == PACKET_PING)
337
    else if (data[n] == PACKET_PING)
327
        {
338
    {
328
            LOG.Info("Received pong.");
339
      log::Info(log_module_, "Got Pong!");
329
        }
340
    }
330
    }
341
  }
331
}
342
}
332
 
343
 
333
void Network::SlotOnNewClientHandler(net::SocketId id, net::SocketId server_id)
344
void Network::SlotOnNewClientHandler(net::SocketId id, net::SocketId server_id)