Subversion Repositories HomeAutomation

Rev

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

Rev 1914 Rev 1916
Line 54... Line 54...
54
void CanDaemon::SlotOnMessageHandler(broker::Message::Pointer message)
54
void CanDaemon::SlotOnMessageHandler(broker::Message::Pointer message)
55
{
55
{
56
    if (message->GetType() == broker::Message::CAN_RAW_MESSAGE)
56
    if (message->GetType() == broker::Message::CAN_RAW_MESSAGE)
57
    {
57
    {
58
      std::string* payload_str;
58
    std::string* payload_str;
-
 
59
     
59
      payload_str = static_cast<std::string*>(message->GetPayload().get());
60
    payload_str = static_cast<std::string*>(message->GetPayload().get());
60
      std::string line = *payload_str;
61
    std::string line = *payload_str;
61
     //std::string line2 = line.substr(0, 15)+"\n"; //line += *payload_str;
-
 
62
      //line 
62
   
63
        net::Manager::Instance()->SendToAll(this->server_id_, common::Byteset(line));
63
        net::Manager::Instance()->SendToAll(this->server_id_, common::Byteset(line, true));
64
    }
64
    }
65
}
65
}
66
 
66
 
67
 
67
 
68
void CanDaemon::SlotOnNewDataHandler(net::ClientId client_id, net::ServerId server_id, common::Byteset data)
68
void CanDaemon::SlotOnNewDataHandler(net::ClientId client_id, net::ServerId server_id, common::Byteset data)
Line 97... Line 97...
97
        LOG.Info("Client " + boost::lexical_cast<std::string>(client_id) + " has disconnected.");
97
        LOG.Info("Client " + boost::lexical_cast<std::string>(client_id) + " has disconnected.");
98
    }
98
    }
99
    else if (client_state == net::CLIENT_STATE_CONNECTED)
99
    else if (client_state == net::CLIENT_STATE_CONNECTED)
100
    {
100
    {
101
        LOG.Info("Client " + boost::lexical_cast<std::string>(client_id) + " has connected.");
101
        LOG.Info("Client " + boost::lexical_cast<std::string>(client_id) + " has connected.");
102
        net::Manager::Instance()->SendTo(client_id, common::Byteset("Welcome to Atom canDaemon emulator\n"));
-
 
103
    }
102
    }
104
    else
103
    else
105
    {
104
    {
106
        LOG.Debug("Got state: " + boost::lexical_cast<std::string>((int)client_state));
105
        LOG.Debug("Got state: " + boost::lexical_cast<std::string>((int)client_state));
107
    }
106
    }