Subversion Repositories HomeAutomation

Rev

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

Rev 1592 Rev 1593
Line 29... Line 29...
29
namespace net {
29
namespace net {
30
 
30
 
31
Client::Client(boost::asio::io_service& io_service, ClientId id, ServerId server_id)
31
Client::Client(boost::asio::io_service& io_service, ClientId id, ServerId server_id)
32
{
32
{
33
    this->server_id_ = server_id;
33
    this->server_id_ = server_id;
34
    this->id = id;
34
    this->id_ = id;
35
}
35
}
36
 
36
 
37
Client::~Client()
37
Client::~Client()
38
{
38
{
39
}
39
}
Line 44... Line 44...
44
    this->signal_on_new_data_.connect(slot_on_new_data);
44
    this->signal_on_new_data_.connect(slot_on_new_data);
45
}
45
}
46
 
46
 
47
ClientId Client::GetId()
47
ClientId Client::GetId()
48
{
48
{
49
    return this->id;
49
    return this->id_;
50
}
50
}
51
 
51
 
52
ServerId Client::GetServerId()
52
ServerId Client::GetServerId()
53
{
53
{
54
    return this->server_id_;
54
    return this->server_id_;
Line 69... Line 69...
69
    {
69
    {
70
        this->Disconnect();
70
        this->Disconnect();
71
    }
71
    }
72
    else
72
    else
73
    {
73
    {
74
        this->signal_on_new_data_(this->id, this->buffer_);
74
        this->signal_on_new_data_(this->id_, this->server_id_, this->buffer_);
75
       
75
       
76
        this->Read();
76
        this->Read();
77
    }
77
    }
78
}
78
}
79
 
79
 
80
void Client::Disconnect()
80
void Client::Disconnect()
81
{
81
{
82
    this->signal_on_new_state_(this->id, CLIENT_STATE_DISCONNECTED);
82
    this->signal_on_new_state_(this->id_, this->server_id_, CLIENT_STATE_DISCONNECTED);
83
}
83
}
84
   
84
   
85
}; // namespace net
85
}; // namespace net
86
}; // namespace atom
86
}; // namespace atom