-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdevice.cpp
More file actions
37 lines (32 loc) · 784 Bytes
/
Copy pathdevice.cpp
File metadata and controls
37 lines (32 loc) · 784 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "device.h"
Device::Device() :
currentState(DEVICE_STATE::DISCONNECTED)
{
}
void Device::setState(const DEVICE_STATE &_state, const std::string &_status)
{
if(currentState == _state && status.compare(_status)){
LOG(__PRETTY_FUNCTION__, " no change ", _state);
return;
}
LOG(__PRETTY_FUNCTION__, " ", _state);
currentState = _state;
status = _status;
DeviceStateMessage msg(currentState, status, name);
messaging::send<DeviceStateMessage>(this,msg);
}
DEVICE_STATE Device::getState()
{
LOG(__PRETTY_FUNCTION__);
return currentState;
}
void Device::setName(const std::string &_name)
{
LOG(__PRETTY_FUNCTION__);
name = _name;
}
std::string& Device::getName()
{
LOG(__PRETTY_FUNCTION__);
return name;
}