Subversion Repositories HomeAutomation

Rev

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

Rev 1642 Rev 1646
Line 209... Line 209...
209
            }
209
            }
210
        }
210
        }
211
       
211
       
212
        //LOG.Debug(databits.ToDebugString());
212
        //LOG.Debug(databits.ToDebugString());
213
       
213
       
214
        unsigned int length = ceil((float)highest_bit / 8.0f);
214
        unsigned int length = std::min((int)ceil((float)highest_bit / 8.0f), 8);
215
       
215
       
216
        data[5] = 1;
216
        data[5] = 1;
217
        data[6] = 0;
217
        data[6] = 0;
218
       
218
       
219
        data[7] = length;
219
        data[7] = length;
Line 276... Line 276...
276
   
276
   
277
    if (client_state == net::CLIENT_STATE_DISCONNECTED)
277
    if (client_state == net::CLIENT_STATE_DISCONNECTED)
278
    {
278
    {
279
        LOG.Warning("Got disconnected, setting reconnect timer...");
279
        LOG.Warning("Got disconnected, setting reconnect timer...");
280
       
280
       
281
        this->timer_id_ = timer::Manager::Instance()->Set(10000, true);
281
        this->timer_id_ = timer::Manager::Instance()->SetTimer(10000, true);
282
        this->client_id_ = 0;
282
        this->client_id_ = 0;
283
    }
283
    }
284
    else
284
    else
285
    {
285
    {
286
        LOG.Debug("Got state: " + boost::lexical_cast<std::string>((int)client_state));
286
        LOG.Debug("Got state: " + boost::lexical_cast<std::string>((int)client_state));
Line 331... Line 331...
331
            direction_name = Protocol::Instance()->LookupDirectionFlag(direction_flag);
331
            direction_name = Protocol::Instance()->LookupDirectionFlag(direction_flag);
332
           
332
           
333
            unsigned int module_id = this->buffer_[2];
333
            unsigned int module_id = this->buffer_[2];
334
            //LOG.Debug("module_id=" + boost::lexical_cast<std::string>(module_id));
334
            //LOG.Debug("module_id=" + boost::lexical_cast<std::string>(module_id));
335
            module_name = Protocol::Instance()->LookupModuleName(module_id);
335
            module_name = Protocol::Instance()->LookupModuleName(module_id);
336
           
336
            //LOG.Debug("module_name=" + module_name);
337
            id = this->buffer_[1];
337
            id = this->buffer_[1];
338
           
338
           
339
            unsigned int command_id = this->buffer_[0];
339
            unsigned int command_id = this->buffer_[0];
340
            //LOG.Debug("command_id=" + boost::lexical_cast<std::string>(command_id));
340
            //LOG.Debug("command_id=" + boost::lexical_cast<std::string>(command_id));
341
            command_name = Protocol::Instance()->LookupCommandName(command_id, module_name);
341
            command_name = Protocol::Instance()->LookupCommandName(command_id, module_name);
-
 
342
            //LOG.Debug("command_name=" + command_name);
342
        }
343
        }
343
 
344
 
344
        Message* payload = new Message(class_name, direction_name, module_name, id, command_name);
345
        Message* payload = new Message(class_name, direction_name, module_name, id, command_name);
345
 
346
 
346
        unsigned int length = this->buffer_[6];
347
        unsigned int length = this->buffer_[6];