Subversion Repositories HomeAutomation

Rev

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

Rev 1596 Rev 1599
Line 32... Line 32...
32
    this->id_ = id;
32
    this->id_ = id;
33
}
33
}
34
 
34
 
35
Client::~Client()
35
Client::~Client()
36
{
36
{
-
 
37
    this->Stop();
37
}
38
}
38
 
39
 
39
void Client::ConnectSlots(const SignalOnNewState::slot_type& slot_on_new_state, const SignalOnNewData::slot_type& slot_on_new_data)
40
void Client::ConnectSlots(const SignalOnNewState::slot_type& slot_on_new_state, const SignalOnNewData::slot_type& slot_on_new_data)
40
{
41
{
41
    this->signal_on_new_state_.connect(slot_on_new_state);
42
    this->signal_on_new_state_.connect(slot_on_new_state);
Line 63... Line 64...
63
    {
64
    {
64
        //std::cout << error.message() << std::endl;
65
        //std::cout << error.message() << std::endl;
65
    }
66
    }
66
    else if (size == 0)
67
    else if (size == 0)
67
    {
68
    {
68
        //std::cout << "ReadHandler size 0" << std::endl;
-
 
69
        this->Disconnect();
69
        this->Disconnect();
70
    }
70
    }
71
    else
71
    else
72
    {
72
    {
73
        this->buffer_.SetSize(size);
73
        this->buffer_.SetSize(size);
74
       
74
       
75
        this->signal_on_new_data_(this->id_, this->server_id_, this->buffer_);
75
        this->signal_on_new_data_(this->id_, this->server_id_, this->buffer_);
76
       
76
       
77
        this->Read();
77
        this->Read();
78
    }
78
    }
-
 
79
}
-
 
80
 
-
 
81
void Client::Stop()
-
 
82
{
79
}
83
}
80
 
84
 
81
void Client::Disconnect()
85
void Client::Disconnect()
82
{
86
{
-
 
87
    this->Stop();
83
    this->signal_on_new_state_(this->id_, this->server_id_, CLIENT_STATE_DISCONNECTED);
88
    this->signal_on_new_state_(this->id_, this->server_id_, CLIENT_STATE_DISCONNECTED);
84
}
89
}
85
   
90
   
86
}; // namespace net
91
}; // namespace net
87
}; // namespace atom
92
}; // namespace atom