Subversion Repositories HomeAutomation

Rev

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

Rev 1959 Rev 1963
Line 21... Line 21...
21
#include "Subscriber.h"
21
#include "Subscriber.h"
22
 
22
 
23
#include <boost/bind.hpp>
23
#include <boost/bind.hpp>
24
 
24
 
25
#include "Manager.h"
25
#include "Manager.h"
-
 
26
#include "common/log.h"
26
 
27
 
27
namespace atom {
28
namespace atom {
28
namespace net {
29
namespace net {
-
 
30
 
-
 
31
static const std::string log_module_ = "net::subscriber";
29
 
32
 
30
Subscriber::Subscriber()
33
Subscriber::Subscriber()
31
{
34
{
-
 
35
  LOG_DEBUG_ENTER;
-
 
36
 
32
    Manager::Instance()->ConnectSlots(Manager::SignalOnNewState::slot_type(&Subscriber::SlotOnNewState, this, _1, _2, _3).track(this->tracker_),
37
  Manager::Instance()->ConnectSlots(Manager::SignalOnNewState::slot_type(&Subscriber::SlotOnNewState, this, _1, _2, _3).track(this->tracker_),
33
                                      Manager::SignalOnNewData::slot_type(&Subscriber::SlotOnNewData, this, _1, _2, _3).track(this->tracker_));
38
                                    Manager::SignalOnNewData::slot_type(&Subscriber::SlotOnNewData, this, _1, _2, _3).track(this->tracker_));
-
 
39
 
-
 
40
  LOG_DEBUG_EXIT;
34
}
41
}
35
 
42
 
36
Subscriber::~Subscriber()
43
Subscriber::~Subscriber()
37
{
44
{
-
 
45
  LOG_DEBUG_ENTER;
-
 
46
  LOG_DEBUG_EXIT;
38
}
47
}
39
 
48
 
40
void Subscriber::SlotOnNewData(SocketId client_id, SocketId server_id, common::Byteset data)
49
void Subscriber::SlotOnNewData(SocketId client_id, SocketId server_id, common::Byteset data)
41
{
50
{
42
    common::Byteset temp_buffer(data);
51
  LOG_DEBUG_ENTER;
-
 
52
 
43
    this->io_service_.post(boost::bind(&Subscriber::SlotOnNewDataHandler, this, client_id, server_id, temp_buffer));
53
  this->io_service_.post(boost::bind(&Subscriber::SlotOnNewDataHandler, this, client_id, server_id, data));
-
 
54
 
-
 
55
  LOG_DEBUG_EXIT;
44
}
56
}
45
 
57
 
46
void Subscriber::SlotOnNewState(SocketId client_id, SocketId server_id, ClientState client_state)
58
void Subscriber::SlotOnNewState(SocketId client_id, SocketId server_id, ClientState client_state)
47
{
59
{
-
 
60
  LOG_DEBUG_ENTER;
-
 
61
 
48
    this->io_service_.post(boost::bind(&Subscriber::SlotOnNewStateHandler, this, client_id, server_id, client_state));
62
  this->io_service_.post(boost::bind(&Subscriber::SlotOnNewStateHandler, this, client_id, server_id, client_state));
-
 
63
 
-
 
64
  LOG_DEBUG_EXIT;
49
}
65
}
-
 
66
 
50
 
67
 
51
}; // namespace net
68
}; // namespace net
52
}; // namespace atom
69
}; // namespace atom