{ should almost always be at the end of the previous line, according to Google style guidelines "whitespace/braces"
This commit is contained in:
parent
78444e20b9
commit
e1608f94a8
58 changed files with 323 additions and 403 deletions
|
@ -12,8 +12,7 @@
|
|||
using namespace TelldusCore;
|
||||
|
||||
TDEventDispatcher::TDEventDispatcher(EventDataRef cbd, CallbackStruct *cb, EventRef cbDone)
|
||||
:Thread(), doneRunning(false), callbackData(cbd), callback(cb), callbackExecuted(cbDone)
|
||||
{
|
||||
:Thread(), doneRunning(false), callbackData(cbd), callback(cb), callbackExecuted(cbDone) {
|
||||
this->startAndLock(&callback->mutex);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,8 +29,7 @@ public:
|
|||
};
|
||||
|
||||
CallbackMainDispatcher::CallbackMainDispatcher()
|
||||
:Thread()
|
||||
{
|
||||
:Thread() {
|
||||
d = new PrivateData;
|
||||
d->stopEvent = d->eventHandler.addEvent();
|
||||
d->generalCallbackEvent = d->eventHandler.addEvent();
|
||||
|
@ -89,7 +88,6 @@ int CallbackMainDispatcher::unregisterCallback(int callbackId) {
|
|||
}
|
||||
|
||||
void CallbackMainDispatcher::run() {
|
||||
|
||||
while(!d->stopEvent->isSignaled()) {
|
||||
if (!d->eventHandler.waitForAny()) {
|
||||
continue;
|
||||
|
|
|
@ -29,8 +29,7 @@ public:
|
|||
Client *Client::instance = 0;
|
||||
|
||||
Client::Client()
|
||||
: Thread()
|
||||
{
|
||||
: Thread() {
|
||||
d = new PrivateData;
|
||||
d->running = true;
|
||||
d->sensorCached = false;
|
||||
|
@ -88,7 +87,6 @@ void Client::run(){
|
|||
d->eventSocket.connect(L"TelldusEvents");
|
||||
|
||||
while(d->running) {
|
||||
|
||||
if(!d->eventSocket.isConnected()) {
|
||||
d->eventSocket.connect(L"TelldusEvents"); // try to reconnect to service
|
||||
if(!d->eventSocket.isConnected()) {
|
||||
|
|
|
@ -13,8 +13,7 @@
|
|||
#include "common/Thread.h"
|
||||
|
||||
namespace TelldusCore {
|
||||
class Client : public Thread
|
||||
{
|
||||
class Client : public Thread {
|
||||
public:
|
||||
~Client(void);
|
||||
|
||||
|
|
|
@ -15,13 +15,11 @@ using namespace TelldusCore;
|
|||
|
||||
|
||||
Message::Message()
|
||||
: std::wstring()
|
||||
{
|
||||
: std::wstring() {
|
||||
}
|
||||
|
||||
Message::Message(const std::wstring &functionName)
|
||||
:std::wstring()
|
||||
{
|
||||
:std::wstring() {
|
||||
this->addArgument(functionName);
|
||||
}
|
||||
|
||||
|
|
|
@ -77,8 +77,7 @@ void LoggedMutex::unlock() {
|
|||
}
|
||||
|
||||
MutexLocker::MutexLocker(Mutex *m)
|
||||
:mutex(m)
|
||||
{
|
||||
:mutex(m) {
|
||||
mutex->lock();
|
||||
}
|
||||
|
||||
|
|
|
@ -17,8 +17,7 @@
|
|||
#endif
|
||||
|
||||
namespace TelldusCore {
|
||||
class Socket
|
||||
{
|
||||
class Socket {
|
||||
public:
|
||||
Socket();
|
||||
explicit Socket(SOCKET_T hPipe);
|
||||
|
|
|
@ -39,8 +39,7 @@ Socket::Socket() {
|
|||
FD_ZERO(&d->infds);
|
||||
}
|
||||
|
||||
Socket::Socket(SOCKET_T socket)
|
||||
{
|
||||
Socket::Socket(SOCKET_T socket) {
|
||||
d = new PrivateData;
|
||||
d->socket = socket;
|
||||
FD_ZERO(&d->infds);
|
||||
|
|
|
@ -21,12 +21,10 @@ public:
|
|||
};
|
||||
|
||||
ClientCommunicationHandler::ClientCommunicationHandler() {
|
||||
|
||||
}
|
||||
|
||||
ClientCommunicationHandler::ClientCommunicationHandler(TelldusCore::Socket *clientSocket, TelldusCore::EventRef event, DeviceManager *deviceManager, TelldusCore::EventRef deviceUpdateEvent, ControllerManager *controllerManager)
|
||||
:Thread()
|
||||
{
|
||||
:Thread() {
|
||||
d = new PrivateData;
|
||||
d->clientSocket = clientSocket;
|
||||
d->event = event;
|
||||
|
@ -36,8 +34,7 @@ ClientCommunicationHandler::ClientCommunicationHandler(TelldusCore::Socket *clie
|
|||
d->controllerManager = controllerManager;
|
||||
}
|
||||
|
||||
ClientCommunicationHandler::~ClientCommunicationHandler(void)
|
||||
{
|
||||
ClientCommunicationHandler::~ClientCommunicationHandler(void) {
|
||||
wait();
|
||||
delete(d->clientSocket);
|
||||
delete d;
|
||||
|
@ -75,7 +72,6 @@ bool ClientCommunicationHandler::isDone(){
|
|||
|
||||
|
||||
void ClientCommunicationHandler::parseMessage(const std::wstring &clientMessage, int *intReturn, std::wstring *wstringReturn) {
|
||||
|
||||
(*intReturn) = 0;
|
||||
(*wstringReturn) = L"";
|
||||
std::wstring msg(clientMessage); //Copy
|
||||
|
@ -128,7 +124,6 @@ void ClientCommunicationHandler::parseMessage(const std::wstring &clientMessage,
|
|||
(*wstringReturn) = d->deviceManager->getDeviceStateValue(deviceId);
|
||||
|
||||
} else if(function == L"tdGetNumberOfDevices") {
|
||||
|
||||
(*intReturn) = d->deviceManager->getNumberOfDevices();
|
||||
|
||||
} else if (function == L"tdGetDeviceId") {
|
||||
|
@ -262,7 +257,6 @@ void ClientCommunicationHandler::parseMessage(const std::wstring &clientMessage,
|
|||
}
|
||||
|
||||
void ClientCommunicationHandler::sendDeviceSignal(int deviceId, int eventDeviceChanges, int eventChangeType) {
|
||||
|
||||
EventUpdateData *eventData = new EventUpdateData();
|
||||
eventData->messageType = L"TDDeviceChangeEvent";
|
||||
eventData->deviceId = deviceId;
|
||||
|
|
|
@ -14,8 +14,7 @@
|
|||
#include "service/DeviceManager.h"
|
||||
#include "service/ControllerManager.h"
|
||||
|
||||
class ClientCommunicationHandler : public TelldusCore::Thread
|
||||
{
|
||||
class ClientCommunicationHandler : public TelldusCore::Thread {
|
||||
public:
|
||||
ClientCommunicationHandler();
|
||||
ClientCommunicationHandler(
|
||||
|
|
|
@ -25,8 +25,7 @@ public:
|
|||
bool running;
|
||||
};
|
||||
|
||||
ConnectionListener::ConnectionListener(const std::wstring &name, TelldusCore::EventRef waitEvent)
|
||||
{
|
||||
ConnectionListener::ConnectionListener(const std::wstring &name, TelldusCore::EventRef waitEvent) {
|
||||
d = new PrivateData;
|
||||
d->waitEvent = waitEvent;
|
||||
|
||||
|
|
|
@ -213,7 +213,6 @@ void ControllerManager::loadStoredControllers() {
|
|||
}
|
||||
|
||||
void ControllerManager::queryControllerStatus() {
|
||||
|
||||
std::list<TellStick *> tellStickControllers;
|
||||
|
||||
{
|
||||
|
|
|
@ -23,8 +23,7 @@ public:
|
|||
};
|
||||
|
||||
Device::Device(int id)
|
||||
:Mutex()
|
||||
{
|
||||
:Mutex() {
|
||||
d = new PrivateData;
|
||||
d->protocol = 0;
|
||||
d->preferredControllerId = 0;
|
||||
|
@ -41,7 +40,6 @@ Device::~Device(void) {
|
|||
*/
|
||||
|
||||
int Device::getLastSentCommand(int methodsSupported) {
|
||||
|
||||
int lastSentCommand = Device::maskUnsupportedMethods(d->state, methodsSupported);
|
||||
|
||||
if (lastSentCommand == TELLSTICK_BELL) {
|
||||
|
|
|
@ -13,8 +13,7 @@
|
|||
#include <string>
|
||||
#include <list>
|
||||
|
||||
class Device : public TelldusCore::Mutex
|
||||
{
|
||||
class Device : public TelldusCore::Mutex {
|
||||
public:
|
||||
explicit Device(int id);
|
||||
~Device(void);
|
||||
|
|
|
@ -87,8 +87,7 @@ int DeviceManager::getDeviceLastSentCommand(int deviceId, int methodsSupported){
|
|||
return TELLSTICK_ERROR_DEVICE_NOT_FOUND;
|
||||
}
|
||||
|
||||
int DeviceManager::setDeviceLastSentCommand(int deviceId, int command, const std::wstring &value)
|
||||
{
|
||||
int DeviceManager::setDeviceLastSentCommand(int deviceId, int command, const std::wstring &value) {
|
||||
TelldusCore::MutexLocker deviceListLocker(&d->lock);
|
||||
if (!d->devices.size()) {
|
||||
return TELLSTICK_ERROR_DEVICE_NOT_FOUND;
|
||||
|
@ -156,7 +155,6 @@ int DeviceManager::getDeviceMethods(int deviceId, std::set<int> &duplicateDevice
|
|||
return 0;
|
||||
}
|
||||
if(type == TELLSTICK_TYPE_GROUP) {
|
||||
|
||||
// get all methods that some device in the groups supports
|
||||
std::wstring deviceIdBuffer;
|
||||
std::wstringstream devicesstream(deviceIds);
|
||||
|
@ -183,7 +181,6 @@ int DeviceManager::getDeviceMethods(int deviceId, std::set<int> &duplicateDevice
|
|||
}
|
||||
|
||||
std::wstring DeviceManager::getDeviceModel(int deviceId) {
|
||||
|
||||
TelldusCore::MutexLocker deviceListLocker(&d->lock);
|
||||
if (!d->devices.size()) {
|
||||
return L"UNKNOWN";
|
||||
|
@ -196,8 +193,7 @@ std::wstring DeviceManager::getDeviceModel(int deviceId){
|
|||
return L"UNKNOWN";
|
||||
}
|
||||
|
||||
int DeviceManager::setDeviceModel(int deviceId, const std::wstring &model)
|
||||
{
|
||||
int DeviceManager::setDeviceModel(int deviceId, const std::wstring &model) {
|
||||
TelldusCore::MutexLocker deviceListLocker(&d->lock);
|
||||
if (!d->devices.size()) {
|
||||
return TELLSTICK_ERROR_DEVICE_NOT_FOUND;
|
||||
|
@ -219,7 +215,6 @@ int DeviceManager::setDeviceModel(int deviceId, const std::wstring &model)
|
|||
}
|
||||
|
||||
std::wstring DeviceManager::getDeviceName(int deviceId) {
|
||||
|
||||
TelldusCore::MutexLocker deviceListLocker(&d->lock);
|
||||
if (!d->devices.size()) {
|
||||
return L"UNKNOWN";
|
||||
|
@ -233,7 +228,6 @@ std::wstring DeviceManager::getDeviceName(int deviceId){
|
|||
}
|
||||
|
||||
int DeviceManager::setDeviceName(int deviceId, const std::wstring &name) {
|
||||
|
||||
TelldusCore::MutexLocker deviceListLocker(&d->lock);
|
||||
if (!d->devices.size()) {
|
||||
return TELLSTICK_ERROR_DEVICE_NOT_FOUND;
|
||||
|
@ -255,7 +249,6 @@ int DeviceManager::setDeviceName(int deviceId, const std::wstring &name){
|
|||
}
|
||||
|
||||
std::wstring DeviceManager::getDeviceParameter(int deviceId, const std::wstring &name, const std::wstring &defaultValue) {
|
||||
|
||||
TelldusCore::MutexLocker deviceListLocker(&d->lock);
|
||||
if (!d->devices.size()) {
|
||||
return defaultValue;
|
||||
|
@ -271,8 +264,7 @@ std::wstring DeviceManager::getDeviceParameter(int deviceId, const std::wstring
|
|||
return defaultValue;
|
||||
}
|
||||
|
||||
int DeviceManager::setDeviceParameter(int deviceId, const std::wstring &name, const std::wstring &value)
|
||||
{
|
||||
int DeviceManager::setDeviceParameter(int deviceId, const std::wstring &name, const std::wstring &value) {
|
||||
TelldusCore::MutexLocker deviceListLocker(&d->lock);
|
||||
if (!d->devices.size()) {
|
||||
return TELLSTICK_ERROR_DEVICE_NOT_FOUND;
|
||||
|
@ -294,7 +286,6 @@ int DeviceManager::setDeviceParameter(int deviceId, const std::wstring &name, co
|
|||
}
|
||||
|
||||
std::wstring DeviceManager::getDeviceProtocol(int deviceId) {
|
||||
|
||||
TelldusCore::MutexLocker deviceListLocker(&d->lock);
|
||||
if (!d->devices.size()) {
|
||||
return L"UNKNOWN";
|
||||
|
@ -307,8 +298,7 @@ std::wstring DeviceManager::getDeviceProtocol(int deviceId){
|
|||
return L"UNKNOWN";
|
||||
}
|
||||
|
||||
int DeviceManager::setDeviceProtocol(int deviceId, const std::wstring &protocol)
|
||||
{
|
||||
int DeviceManager::setDeviceProtocol(int deviceId, const std::wstring &protocol) {
|
||||
TelldusCore::MutexLocker deviceListLocker(&d->lock);
|
||||
if (!d->devices.size()) {
|
||||
return TELLSTICK_ERROR_DEVICE_NOT_FOUND;
|
||||
|
@ -335,7 +325,6 @@ int DeviceManager::getNumberOfDevices(){
|
|||
}
|
||||
|
||||
int DeviceManager::addDevice() {
|
||||
|
||||
int id = d->set.addNode(Settings::Device);
|
||||
if(id < 0) {
|
||||
return id;
|
||||
|
@ -354,7 +343,6 @@ int DeviceManager::getDeviceId(int deviceIndex) {
|
|||
}
|
||||
|
||||
int DeviceManager::getDeviceType(int deviceId) {
|
||||
|
||||
TelldusCore::MutexLocker deviceListLocker(&d->lock);
|
||||
if (!d->devices.size()) {
|
||||
return TELLSTICK_ERROR_DEVICE_NOT_FOUND;
|
||||
|
@ -368,7 +356,6 @@ int DeviceManager::getDeviceType(int deviceId){
|
|||
}
|
||||
|
||||
int DeviceManager::getPreferredControllerId(int deviceId) {
|
||||
|
||||
TelldusCore::MutexLocker deviceListLocker(&d->lock);
|
||||
|
||||
if (!d->devices.size()) {
|
||||
|
@ -485,7 +472,6 @@ int DeviceManager::doGroupAction(const std::wstring devices, const int action, c
|
|||
duplicateDeviceIds->insert(groupDeviceId);
|
||||
|
||||
while(std::getline(devicesstream, singledevice, L',')) {
|
||||
|
||||
int deviceId = TelldusCore::wideToInteger(singledevice);
|
||||
|
||||
if(duplicateDeviceIds->count(deviceId) == 1) {
|
||||
|
@ -539,7 +525,6 @@ int DeviceManager::doGroupAction(const std::wstring devices, const int action, c
|
|||
}
|
||||
|
||||
int DeviceManager::executeScene(std::wstring singledevice, int groupDeviceId) {
|
||||
|
||||
std::wstringstream devicestream(singledevice);
|
||||
|
||||
const int deviceParameterLength = 3;
|
||||
|
@ -576,7 +561,6 @@ int DeviceManager::executeScene(std::wstring singledevice, int groupDeviceId){
|
|||
}
|
||||
|
||||
int DeviceManager::removeDevice(int deviceId) {
|
||||
|
||||
Device *device = 0;
|
||||
{
|
||||
int ret = d->set.removeNode(Settings::Device, deviceId); //remove from register/settings
|
||||
|
@ -745,7 +729,6 @@ void DeviceManager::setSensorValueAndSignal( const std::string &dataType, int da
|
|||
}
|
||||
|
||||
int DeviceManager::sendRawCommand(const std::wstring &command, int reserved) {
|
||||
|
||||
Controller *controller = d->controllerManager->getBestControllerById(-1);
|
||||
|
||||
if(!controller) {
|
||||
|
|
|
@ -16,8 +16,7 @@
|
|||
|
||||
class Sensor;
|
||||
|
||||
class DeviceManager
|
||||
{
|
||||
class DeviceManager {
|
||||
public:
|
||||
DeviceManager(ControllerManager *controllerManager, TelldusCore::EventRef deviceUpdateEvent);
|
||||
~DeviceManager(void);
|
||||
|
|
|
@ -25,8 +25,7 @@ public:
|
|||
};
|
||||
|
||||
EventUpdateManager::EventUpdateManager()
|
||||
:Thread()
|
||||
{
|
||||
:Thread() {
|
||||
d = new PrivateData;
|
||||
d->stopEvent = d->eventHandler.addEvent();
|
||||
d->updateEvent = d->eventHandler.addEvent();
|
||||
|
@ -47,12 +46,10 @@ EventUpdateManager::~EventUpdateManager(void) {
|
|||
}
|
||||
|
||||
TelldusCore::EventRef EventUpdateManager::retrieveUpdateEvent() {
|
||||
|
||||
return d->updateEvent;
|
||||
}
|
||||
|
||||
void EventUpdateManager::run() {
|
||||
|
||||
while(!d->stopEvent->isSignaled()) {
|
||||
if (!d->eventHandler.waitForAny()) {
|
||||
continue;
|
||||
|
@ -78,7 +75,6 @@ void EventUpdateManager::run(){
|
|||
}
|
||||
|
||||
void EventUpdateManager::sendMessageToClients(EventUpdateData *data) {
|
||||
|
||||
int connected = 0;
|
||||
for(SocketList::iterator it = d->clients.begin(); it != d->clients.end();) {
|
||||
if((*it)->isConnected()) {
|
||||
|
|
|
@ -29,8 +29,7 @@ public:
|
|||
int timestamp;
|
||||
};
|
||||
|
||||
class EventUpdateManager : public TelldusCore::Thread
|
||||
{
|
||||
class EventUpdateManager : public TelldusCore::Thread {
|
||||
public:
|
||||
EventUpdateManager(void);
|
||||
~EventUpdateManager(void);
|
||||
|
|
|
@ -31,8 +31,7 @@ public:
|
|||
Log *Log::PrivateData::instance = 0;
|
||||
|
||||
Log::Log()
|
||||
:d(new PrivateData)
|
||||
{
|
||||
:d(new PrivateData) {
|
||||
#if defined(_LINUX)
|
||||
setlogmask(LOG_UPTO(LOG_INFO));
|
||||
openlog("telldusd", LOG_CONS, LOG_USER);
|
||||
|
|
|
@ -38,7 +38,6 @@ public:
|
|||
};
|
||||
|
||||
Protocol::Protocol() {
|
||||
|
||||
d = new PrivateData;
|
||||
}
|
||||
|
||||
|
@ -97,7 +96,6 @@ bool Protocol::checkBit(int data, int bitno) {
|
|||
|
||||
|
||||
Protocol *Protocol::getProtocolInstance(const std::wstring &protocolname) {
|
||||
|
||||
if(TelldusCore::comparei(protocolname, L"arctech")) {
|
||||
return new ProtocolNexa();
|
||||
|
||||
|
|
|
@ -16,8 +16,7 @@ typedef std::map<std::wstring, std::wstring> ParameterMap;
|
|||
|
||||
class Controller;
|
||||
|
||||
class Protocol
|
||||
{
|
||||
class Protocol {
|
||||
public:
|
||||
Protocol();
|
||||
virtual ~Protocol(void);
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
#include <string>
|
||||
#include "service/Protocol.h"
|
||||
|
||||
class ProtocolBrateck : public Protocol
|
||||
{
|
||||
class ProtocolBrateck : public Protocol {
|
||||
public:
|
||||
int methods() const;
|
||||
virtual std::string getStringForMethod(int method, unsigned char data, Controller *controller);
|
||||
|
|
|
@ -94,8 +94,7 @@ unsigned int ProtocolEverflourish::calculateChecksum(unsigned int x) {
|
|||
return res;
|
||||
}
|
||||
|
||||
std::string ProtocolEverflourish::decodeData(ControllerMessage &dataMsg)
|
||||
{
|
||||
std::string ProtocolEverflourish::decodeData(ControllerMessage &dataMsg) {
|
||||
std::string data = dataMsg.getParameter("data");
|
||||
unsigned int allData;
|
||||
unsigned int house = 0;
|
||||
|
|
|
@ -11,8 +11,7 @@
|
|||
#include "service/Protocol.h"
|
||||
#include "service/ControllerMessage.h"
|
||||
|
||||
class ProtocolEverflourish : public Protocol
|
||||
{
|
||||
class ProtocolEverflourish : public Protocol {
|
||||
public:
|
||||
int methods() const;
|
||||
virtual std::string getStringForMethod(int method, unsigned char data, Controller *controller);
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
std::string ProtocolFineoffset::decodeData(ControllerMessage &dataMsg)
|
||||
{
|
||||
std::string ProtocolFineoffset::decodeData(ControllerMessage &dataMsg) {
|
||||
std::string data = dataMsg.getParameter("data");
|
||||
if (data.length() < 8) {
|
||||
return "";
|
||||
|
|
|
@ -11,8 +11,7 @@
|
|||
#include "service/Protocol.h"
|
||||
#include "service/ControllerMessage.h"
|
||||
|
||||
class ProtocolFineoffset : public Protocol
|
||||
{
|
||||
class ProtocolFineoffset : public Protocol {
|
||||
public:
|
||||
static std::string decodeData(ControllerMessage &dataMsg);
|
||||
};
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
#include <string>
|
||||
#include "service/Protocol.h"
|
||||
|
||||
class ProtocolFuhaote : public Protocol
|
||||
{
|
||||
class ProtocolFuhaote : public Protocol {
|
||||
public:
|
||||
int methods() const;
|
||||
virtual std::string getStringForMethod(int method, unsigned char data, Controller *controller);
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
#include <string>
|
||||
#include "service/Protocol.h"
|
||||
|
||||
class ProtocolHasta : public Protocol
|
||||
{
|
||||
class ProtocolHasta : public Protocol {
|
||||
public:
|
||||
int methods() const;
|
||||
virtual std::string getStringForMethod(int method, unsigned char data, Controller *controller);
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
#include <string>
|
||||
#include "service/Protocol.h"
|
||||
|
||||
class ProtocolIkea : public Protocol
|
||||
{
|
||||
class ProtocolIkea : public Protocol {
|
||||
public:
|
||||
int methods() const;
|
||||
virtual std::string getStringForMethod(int method, unsigned char data, Controller *controller);
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
std::string ProtocolMandolyn::decodeData(ControllerMessage &dataMsg)
|
||||
{
|
||||
std::string ProtocolMandolyn::decodeData(ControllerMessage &dataMsg) {
|
||||
std::string data = dataMsg.getParameter("data");
|
||||
uint32_t value = (uint32_t)TelldusCore::hexTo64l(data);
|
||||
|
||||
|
|
|
@ -11,8 +11,7 @@
|
|||
#include "service/Protocol.h"
|
||||
#include "service/ControllerMessage.h"
|
||||
|
||||
class ProtocolMandolyn : public Protocol
|
||||
{
|
||||
class ProtocolMandolyn : public Protocol {
|
||||
public:
|
||||
static std::string decodeData(ControllerMessage &dataMsg);
|
||||
};
|
||||
|
|
|
@ -163,8 +163,7 @@ std::string ProtocolNexa::getStringSelflearningForCode(int intHouse, int intCode
|
|||
return strMessage;
|
||||
}
|
||||
|
||||
std::string ProtocolNexa::decodeData(ControllerMessage& dataMsg)
|
||||
{
|
||||
std::string ProtocolNexa::decodeData(ControllerMessage& dataMsg) {
|
||||
unsigned long allData = 0;
|
||||
|
||||
sscanf(dataMsg.getParameter("data").c_str(), "%lx", &allData);
|
||||
|
@ -219,7 +218,6 @@ std::string ProtocolNexa::decodeDataSelfLearning(long allData){
|
|||
}
|
||||
|
||||
std::string ProtocolNexa::decodeDataCodeSwitch(long allData) {
|
||||
|
||||
unsigned int house = 0;
|
||||
unsigned int unit = 0;
|
||||
unsigned int method = 0;
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
std::string ProtocolOregon::decodeData(ControllerMessage &dataMsg)
|
||||
{
|
||||
std::string ProtocolOregon::decodeData(ControllerMessage &dataMsg) {
|
||||
std::string data = dataMsg.getParameter("data");
|
||||
|
||||
std::wstring model = dataMsg.model();
|
||||
|
|
|
@ -11,8 +11,7 @@
|
|||
#include "service/Protocol.h"
|
||||
#include "service/ControllerMessage.h"
|
||||
|
||||
class ProtocolOregon : public Protocol
|
||||
{
|
||||
class ProtocolOregon : public Protocol {
|
||||
public:
|
||||
static std::string decodeData(ControllerMessage &dataMsg);
|
||||
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
#include <string>
|
||||
#include "service/Protocol.h"
|
||||
|
||||
class ProtocolRisingSun : public Protocol
|
||||
{
|
||||
class ProtocolRisingSun : public Protocol {
|
||||
public:
|
||||
int methods() const;
|
||||
virtual std::string getStringForMethod(int method, unsigned char data, Controller *controller);
|
||||
|
|
|
@ -41,8 +41,7 @@ std::string ProtocolSartano::getStringForCode(const std::wstring &strCode, int m
|
|||
|
||||
}
|
||||
|
||||
std::string ProtocolSartano::decodeData(ControllerMessage &dataMsg)
|
||||
{
|
||||
std::string ProtocolSartano::decodeData(ControllerMessage &dataMsg) {
|
||||
std::string data = dataMsg.getParameter("data");
|
||||
signed int allDataIn;
|
||||
signed int allData = 0;
|
||||
|
|
|
@ -11,8 +11,7 @@
|
|||
#include "service/Protocol.h"
|
||||
#include "service/ControllerMessage.h"
|
||||
|
||||
class ProtocolSartano : public Protocol
|
||||
{
|
||||
class ProtocolSartano : public Protocol {
|
||||
public:
|
||||
int methods() const;
|
||||
virtual std::string getStringForMethod(int method, unsigned char data, Controller *controller);
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
#include <string>
|
||||
#include "service/Protocol.h"
|
||||
|
||||
class ProtocolSilvanChip : public Protocol
|
||||
{
|
||||
class ProtocolSilvanChip : public Protocol {
|
||||
public:
|
||||
int methods() const;
|
||||
virtual std::string getStringForMethod(int method, unsigned char data, Controller *controller);
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
#include <string>
|
||||
#include "service/Protocol.h"
|
||||
|
||||
class ProtocolUpm : public Protocol
|
||||
{
|
||||
class ProtocolUpm : public Protocol {
|
||||
public:
|
||||
int methods() const;
|
||||
virtual std::string getStringForMethod(int method, unsigned char data, Controller *controller);
|
||||
|
|
|
@ -22,8 +22,7 @@ std::string ProtocolWaveman::getOffCode() const {
|
|||
return "$k$k$k$k$k$k$k$k$k+";
|
||||
}
|
||||
|
||||
std::string ProtocolWaveman::decodeData(ControllerMessage& dataMsg)
|
||||
{
|
||||
std::string ProtocolWaveman::decodeData(ControllerMessage& dataMsg) {
|
||||
unsigned long allData = 0;
|
||||
unsigned int house = 0;
|
||||
unsigned int unit = 0;
|
||||
|
@ -62,8 +61,8 @@ std::string ProtocolWaveman::decodeData(ControllerMessage& dataMsg)
|
|||
|
||||
if(method == 0) {
|
||||
retString << ";unit:" << unit << ";method:turnoff;";
|
||||
}
|
||||
else if(method == 14){
|
||||
|
||||
} else if(method == 14) {
|
||||
retString << ";unit:" << unit << ";method:turnon;";
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -11,8 +11,7 @@
|
|||
#include "service/Protocol.h"
|
||||
#include "service/ControllerMessage.h"
|
||||
|
||||
class ProtocolX10 : public Protocol
|
||||
{
|
||||
class ProtocolX10 : public Protocol {
|
||||
public:
|
||||
int methods() const;
|
||||
virtual std::string getStringForMethod(int method, unsigned char data, Controller *controller);
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
#include <string>
|
||||
#include "service/ProtocolSartano.h"
|
||||
|
||||
class ProtocolYidong : public ProtocolSartano
|
||||
{
|
||||
class ProtocolYidong : public ProtocolSartano {
|
||||
public:
|
||||
virtual std::string getStringForMethod(int method, unsigned char data, Controller *controller);
|
||||
};
|
||||
|
|
|
@ -18,8 +18,7 @@ public:
|
|||
};
|
||||
|
||||
Sensor::Sensor(const std::wstring &protocol, const std::wstring &model, int id)
|
||||
:Mutex()
|
||||
{
|
||||
:Mutex() {
|
||||
d = new PrivateData;
|
||||
d->protocol = protocol;
|
||||
d->model = model;
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
#include "common/Mutex.h"
|
||||
#include <string>
|
||||
|
||||
class Sensor : public TelldusCore::Mutex
|
||||
{
|
||||
class Sensor : public TelldusCore::Mutex {
|
||||
public:
|
||||
Sensor(const std::wstring &protocol, const std::wstring &model, int id);
|
||||
~Sensor();
|
||||
|
|
|
@ -32,8 +32,7 @@ const char* VAR_CONFIG_FILE = VAR_CONFIG_PATH "/telldus-core.conf";
|
|||
/*
|
||||
* Constructor
|
||||
*/
|
||||
Settings::Settings(void)
|
||||
{
|
||||
Settings::Settings(void) {
|
||||
TelldusCore::MutexLocker locker(&mutex);
|
||||
d = new PrivateData;
|
||||
readConfig(&d->cfg);
|
||||
|
@ -43,8 +42,7 @@ Settings::Settings(void)
|
|||
/*
|
||||
* Destructor
|
||||
*/
|
||||
Settings::~Settings(void)
|
||||
{
|
||||
Settings::~Settings(void) {
|
||||
TelldusCore::MutexLocker locker(&mutex);
|
||||
if (d->cfg > 0) {
|
||||
cfg_free(d->cfg);
|
||||
|
|
|
@ -40,8 +40,7 @@ public:
|
|||
};
|
||||
|
||||
TellStick::TellStick(int controllerId, TelldusCore::EventRef event, TelldusCore::EventRef updateEvent, const TellStickDescriptor &td )
|
||||
:Controller(controllerId, event, updateEvent)
|
||||
{
|
||||
:Controller(controllerId, event, updateEvent) {
|
||||
d = new PrivateData;
|
||||
d->open = false;
|
||||
d->vid = td.vid;
|
||||
|
|
|
@ -25,8 +25,7 @@ public:
|
|||
TelldusCore::EventRef stopEvent, controllerChangeEvent;
|
||||
};
|
||||
|
||||
TelldusMain::TelldusMain(void)
|
||||
{
|
||||
TelldusMain::TelldusMain(void) {
|
||||
d = new PrivateData;
|
||||
d->stopEvent = d->eventHandler.addEvent();
|
||||
d->controllerChangeEvent = d->eventHandler.addEvent();
|
||||
|
|
|
@ -7,8 +7,7 @@
|
|||
#ifndef TELLDUS_CORE_SERVICE_TELLDUSMAIN_H_
|
||||
#define TELLDUS_CORE_SERVICE_TELLDUSMAIN_H_
|
||||
|
||||
class TelldusMain
|
||||
{
|
||||
class TelldusMain {
|
||||
public:
|
||||
TelldusMain(void);
|
||||
~TelldusMain(void);
|
||||
|
|
|
@ -28,8 +28,7 @@ public:
|
|||
};
|
||||
|
||||
Timer::Timer(TelldusCore::EventRef event)
|
||||
:TelldusCore::Thread(), d(new PrivateData)
|
||||
{
|
||||
:TelldusCore::Thread(), d(new PrivateData) {
|
||||
d->event = event;
|
||||
#ifdef _WINDOWS
|
||||
d->cond = CreateEventW(NULL, false, false, NULL);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue