Subversion Repositories HomeAutomation

Rev

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

Rev 1627 Rev 1642
Line 93... Line 93...
93
    }
93
    }
94
   
94
   
95
    this->signal_on_new_state_(client_id, server_id, client_state);
95
    this->signal_on_new_state_(client_id, server_id, client_state);
96
}
96
}
97
 
97
 
98
void Manager::SlotOnNewData(ClientId client_id, ServerId server_id, type::Byteset data)
98
void Manager::SlotOnNewData(ClientId client_id, ServerId server_id, common::Byteset data)
99
{
99
{
100
    this->signal_on_new_data_(client_id, server_id, data);
100
    this->signal_on_new_data_(client_id, server_id, data);
101
}
101
}
102
 
102
 
103
ServerId Manager::GetFreeServerId()
103
ServerId Manager::GetFreeServerId()
Line 187... Line 187...
187
    this->clients_[client->GetId()] = client;
187
    this->clients_[client->GetId()] = client;
188
   
188
   
189
    return client->GetId();
189
    return client->GetId();
190
}
190
}
191
 
191
 
192
void Manager::SendToAll(ServerId server_id, type::Byteset data)
192
void Manager::SendToAll(ServerId server_id, common::Byteset data)
193
{
193
{
194
    this->io_service_.post(boost::bind(&Manager::SendToAllHandler, this, server_id, data));
194
    this->io_service_.post(boost::bind(&Manager::SendToAllHandler, this, server_id, data));
195
}
195
}
196
 
196
 
197
void Manager::SendTo(ClientId client_id, type::Byteset data)
197
void Manager::SendTo(ClientId client_id, common::Byteset data)
198
{
198
{
199
    this->io_service_.post(boost::bind(&Manager::SendToHandler, this, client_id, data));
199
    this->io_service_.post(boost::bind(&Manager::SendToHandler, this, client_id, data));
200
}
200
}
201
 
201
 
202
void Manager::StopServer(ServerId server_id)
202
void Manager::StopServer(ServerId server_id)
Line 207... Line 207...
207
void Manager::Disconnect(ClientId client_id)
207
void Manager::Disconnect(ClientId client_id)
208
{
208
{
209
    this->io_service_.post(boost::bind(&Manager::DisconnectHandler, this, client_id));
209
    this->io_service_.post(boost::bind(&Manager::DisconnectHandler, this, client_id));
210
}
210
}
211
 
211
 
212
void Manager::SendToAllHandler(ServerId server_id, type::Byteset data)
212
void Manager::SendToAllHandler(ServerId server_id, common::Byteset data)
213
{
213
{
214
    for (ClientList::iterator it = this->clients_.begin(); it != this->clients_.end(); it++)
214
    for (ClientList::iterator it = this->clients_.begin(); it != this->clients_.end(); it++)
215
    {
215
    {
216
        if (it->second->GetServerId() == server_id)
216
        if (it->second->GetServerId() == server_id)
217
        {
217
        {
218
            it->second->Send(data);
218
            it->second->Send(data);
219
        }
219
        }
220
    }
220
    }
221
}
221
}
222
 
222
 
223
void Manager::SendToHandler(ClientId client_id, type::Byteset data)
223
void Manager::SendToHandler(ClientId client_id, common::Byteset data)
224
{
224
{
225
    ClientList::iterator it = this->clients_.find(client_id);
225
    ClientList::iterator it = this->clients_.find(client_id);
226
 
226
 
227
    if (it != this->clients_.end())
227
    if (it != this->clients_.end())
228
    {
228
    {