{ should almost always be at the end of the previous line, according to Google style guidelines "whitespace/braces"

This commit is contained in:
Micke Prag 2012-02-28 22:19:02 +01:00
parent 78444e20b9
commit e1608f94a8
58 changed files with 323 additions and 403 deletions

View file

@ -12,8 +12,7 @@
using namespace TelldusCore; using namespace TelldusCore;
TDEventDispatcher::TDEventDispatcher(EventDataRef cbd, CallbackStruct *cb, EventRef cbDone) 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); this->startAndLock(&callback->mutex);
} }

View file

@ -29,8 +29,7 @@ public:
}; };
CallbackMainDispatcher::CallbackMainDispatcher() CallbackMainDispatcher::CallbackMainDispatcher()
:Thread() :Thread() {
{
d = new PrivateData; d = new PrivateData;
d->stopEvent = d->eventHandler.addEvent(); d->stopEvent = d->eventHandler.addEvent();
d->generalCallbackEvent = d->eventHandler.addEvent(); d->generalCallbackEvent = d->eventHandler.addEvent();
@ -89,7 +88,6 @@ int CallbackMainDispatcher::unregisterCallback(int callbackId) {
} }
void CallbackMainDispatcher::run() { void CallbackMainDispatcher::run() {
while(!d->stopEvent->isSignaled()) { while(!d->stopEvent->isSignaled()) {
if (!d->eventHandler.waitForAny()) { if (!d->eventHandler.waitForAny()) {
continue; continue;

View file

@ -29,8 +29,7 @@ public:
Client *Client::instance = 0; Client *Client::instance = 0;
Client::Client() Client::Client()
: Thread() : Thread() {
{
d = new PrivateData; d = new PrivateData;
d->running = true; d->running = true;
d->sensorCached = false; d->sensorCached = false;
@ -88,7 +87,6 @@ void Client::run(){
d->eventSocket.connect(L"TelldusEvents"); d->eventSocket.connect(L"TelldusEvents");
while(d->running) { while(d->running) {
if(!d->eventSocket.isConnected()) { if(!d->eventSocket.isConnected()) {
d->eventSocket.connect(L"TelldusEvents"); // try to reconnect to service d->eventSocket.connect(L"TelldusEvents"); // try to reconnect to service
if(!d->eventSocket.isConnected()) { if(!d->eventSocket.isConnected()) {

View file

@ -13,8 +13,7 @@
#include "common/Thread.h" #include "common/Thread.h"
namespace TelldusCore { namespace TelldusCore {
class Client : public Thread class Client : public Thread {
{
public: public:
~Client(void); ~Client(void);

View file

@ -15,13 +15,11 @@ using namespace TelldusCore;
Message::Message() Message::Message()
: std::wstring() : std::wstring() {
{
} }
Message::Message(const std::wstring &functionName) Message::Message(const std::wstring &functionName)
:std::wstring() :std::wstring() {
{
this->addArgument(functionName); this->addArgument(functionName);
} }

View file

@ -77,8 +77,7 @@ void LoggedMutex::unlock() {
} }
MutexLocker::MutexLocker(Mutex *m) MutexLocker::MutexLocker(Mutex *m)
:mutex(m) :mutex(m) {
{
mutex->lock(); mutex->lock();
} }

View file

@ -17,8 +17,7 @@
#endif #endif
namespace TelldusCore { namespace TelldusCore {
class Socket class Socket {
{
public: public:
Socket(); Socket();
explicit Socket(SOCKET_T hPipe); explicit Socket(SOCKET_T hPipe);

View file

@ -39,8 +39,7 @@ Socket::Socket() {
FD_ZERO(&d->infds); FD_ZERO(&d->infds);
} }
Socket::Socket(SOCKET_T socket) Socket::Socket(SOCKET_T socket) {
{
d = new PrivateData; d = new PrivateData;
d->socket = socket; d->socket = socket;
FD_ZERO(&d->infds); FD_ZERO(&d->infds);

View file

@ -21,12 +21,10 @@ public:
}; };
ClientCommunicationHandler::ClientCommunicationHandler() { ClientCommunicationHandler::ClientCommunicationHandler() {
} }
ClientCommunicationHandler::ClientCommunicationHandler(TelldusCore::Socket *clientSocket, TelldusCore::EventRef event, DeviceManager *deviceManager, TelldusCore::EventRef deviceUpdateEvent, ControllerManager *controllerManager) ClientCommunicationHandler::ClientCommunicationHandler(TelldusCore::Socket *clientSocket, TelldusCore::EventRef event, DeviceManager *deviceManager, TelldusCore::EventRef deviceUpdateEvent, ControllerManager *controllerManager)
:Thread() :Thread() {
{
d = new PrivateData; d = new PrivateData;
d->clientSocket = clientSocket; d->clientSocket = clientSocket;
d->event = event; d->event = event;
@ -36,8 +34,7 @@ ClientCommunicationHandler::ClientCommunicationHandler(TelldusCore::Socket *clie
d->controllerManager = controllerManager; d->controllerManager = controllerManager;
} }
ClientCommunicationHandler::~ClientCommunicationHandler(void) ClientCommunicationHandler::~ClientCommunicationHandler(void) {
{
wait(); wait();
delete(d->clientSocket); delete(d->clientSocket);
delete d; delete d;
@ -75,7 +72,6 @@ bool ClientCommunicationHandler::isDone(){
void ClientCommunicationHandler::parseMessage(const std::wstring &clientMessage, int *intReturn, std::wstring *wstringReturn) { void ClientCommunicationHandler::parseMessage(const std::wstring &clientMessage, int *intReturn, std::wstring *wstringReturn) {
(*intReturn) = 0; (*intReturn) = 0;
(*wstringReturn) = L""; (*wstringReturn) = L"";
std::wstring msg(clientMessage); //Copy std::wstring msg(clientMessage); //Copy
@ -128,7 +124,6 @@ void ClientCommunicationHandler::parseMessage(const std::wstring &clientMessage,
(*wstringReturn) = d->deviceManager->getDeviceStateValue(deviceId); (*wstringReturn) = d->deviceManager->getDeviceStateValue(deviceId);
} else if(function == L"tdGetNumberOfDevices") { } else if(function == L"tdGetNumberOfDevices") {
(*intReturn) = d->deviceManager->getNumberOfDevices(); (*intReturn) = d->deviceManager->getNumberOfDevices();
} else if (function == L"tdGetDeviceId") { } 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) { void ClientCommunicationHandler::sendDeviceSignal(int deviceId, int eventDeviceChanges, int eventChangeType) {
EventUpdateData *eventData = new EventUpdateData(); EventUpdateData *eventData = new EventUpdateData();
eventData->messageType = L"TDDeviceChangeEvent"; eventData->messageType = L"TDDeviceChangeEvent";
eventData->deviceId = deviceId; eventData->deviceId = deviceId;

View file

@ -14,8 +14,7 @@
#include "service/DeviceManager.h" #include "service/DeviceManager.h"
#include "service/ControllerManager.h" #include "service/ControllerManager.h"
class ClientCommunicationHandler : public TelldusCore::Thread class ClientCommunicationHandler : public TelldusCore::Thread {
{
public: public:
ClientCommunicationHandler(); ClientCommunicationHandler();
ClientCommunicationHandler( ClientCommunicationHandler(

View file

@ -25,8 +25,7 @@ public:
bool running; bool running;
}; };
ConnectionListener::ConnectionListener(const std::wstring &name, TelldusCore::EventRef waitEvent) ConnectionListener::ConnectionListener(const std::wstring &name, TelldusCore::EventRef waitEvent) {
{
d = new PrivateData; d = new PrivateData;
d->waitEvent = waitEvent; d->waitEvent = waitEvent;

View file

@ -213,7 +213,6 @@ void ControllerManager::loadStoredControllers() {
} }
void ControllerManager::queryControllerStatus() { void ControllerManager::queryControllerStatus() {
std::list<TellStick *> tellStickControllers; std::list<TellStick *> tellStickControllers;
{ {

View file

@ -23,8 +23,7 @@ public:
}; };
Device::Device(int id) Device::Device(int id)
:Mutex() :Mutex() {
{
d = new PrivateData; d = new PrivateData;
d->protocol = 0; d->protocol = 0;
d->preferredControllerId = 0; d->preferredControllerId = 0;
@ -41,7 +40,6 @@ Device::~Device(void) {
*/ */
int Device::getLastSentCommand(int methodsSupported) { int Device::getLastSentCommand(int methodsSupported) {
int lastSentCommand = Device::maskUnsupportedMethods(d->state, methodsSupported); int lastSentCommand = Device::maskUnsupportedMethods(d->state, methodsSupported);
if (lastSentCommand == TELLSTICK_BELL) { if (lastSentCommand == TELLSTICK_BELL) {

View file

@ -13,8 +13,7 @@
#include <string> #include <string>
#include <list> #include <list>
class Device : public TelldusCore::Mutex class Device : public TelldusCore::Mutex {
{
public: public:
explicit Device(int id); explicit Device(int id);
~Device(void); ~Device(void);

View file

@ -87,8 +87,7 @@ int DeviceManager::getDeviceLastSentCommand(int deviceId, int methodsSupported){
return TELLSTICK_ERROR_DEVICE_NOT_FOUND; 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); TelldusCore::MutexLocker deviceListLocker(&d->lock);
if (!d->devices.size()) { if (!d->devices.size()) {
return TELLSTICK_ERROR_DEVICE_NOT_FOUND; return TELLSTICK_ERROR_DEVICE_NOT_FOUND;
@ -156,7 +155,6 @@ int DeviceManager::getDeviceMethods(int deviceId, std::set<int> &duplicateDevice
return 0; return 0;
} }
if(type == TELLSTICK_TYPE_GROUP) { if(type == TELLSTICK_TYPE_GROUP) {
// get all methods that some device in the groups supports // get all methods that some device in the groups supports
std::wstring deviceIdBuffer; std::wstring deviceIdBuffer;
std::wstringstream devicesstream(deviceIds); std::wstringstream devicesstream(deviceIds);
@ -183,7 +181,6 @@ int DeviceManager::getDeviceMethods(int deviceId, std::set<int> &duplicateDevice
} }
std::wstring DeviceManager::getDeviceModel(int deviceId) { std::wstring DeviceManager::getDeviceModel(int deviceId) {
TelldusCore::MutexLocker deviceListLocker(&d->lock); TelldusCore::MutexLocker deviceListLocker(&d->lock);
if (!d->devices.size()) { if (!d->devices.size()) {
return L"UNKNOWN"; return L"UNKNOWN";
@ -196,8 +193,7 @@ std::wstring DeviceManager::getDeviceModel(int deviceId){
return L"UNKNOWN"; 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); TelldusCore::MutexLocker deviceListLocker(&d->lock);
if (!d->devices.size()) { if (!d->devices.size()) {
return TELLSTICK_ERROR_DEVICE_NOT_FOUND; 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) { std::wstring DeviceManager::getDeviceName(int deviceId) {
TelldusCore::MutexLocker deviceListLocker(&d->lock); TelldusCore::MutexLocker deviceListLocker(&d->lock);
if (!d->devices.size()) { if (!d->devices.size()) {
return L"UNKNOWN"; return L"UNKNOWN";
@ -233,7 +228,6 @@ std::wstring DeviceManager::getDeviceName(int deviceId){
} }
int DeviceManager::setDeviceName(int deviceId, const std::wstring &name) { int DeviceManager::setDeviceName(int deviceId, const std::wstring &name) {
TelldusCore::MutexLocker deviceListLocker(&d->lock); TelldusCore::MutexLocker deviceListLocker(&d->lock);
if (!d->devices.size()) { if (!d->devices.size()) {
return TELLSTICK_ERROR_DEVICE_NOT_FOUND; 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) { std::wstring DeviceManager::getDeviceParameter(int deviceId, const std::wstring &name, const std::wstring &defaultValue) {
TelldusCore::MutexLocker deviceListLocker(&d->lock); TelldusCore::MutexLocker deviceListLocker(&d->lock);
if (!d->devices.size()) { if (!d->devices.size()) {
return defaultValue; return defaultValue;
@ -271,8 +264,7 @@ std::wstring DeviceManager::getDeviceParameter(int deviceId, const std::wstring
return defaultValue; 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); TelldusCore::MutexLocker deviceListLocker(&d->lock);
if (!d->devices.size()) { if (!d->devices.size()) {
return TELLSTICK_ERROR_DEVICE_NOT_FOUND; 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) { std::wstring DeviceManager::getDeviceProtocol(int deviceId) {
TelldusCore::MutexLocker deviceListLocker(&d->lock); TelldusCore::MutexLocker deviceListLocker(&d->lock);
if (!d->devices.size()) { if (!d->devices.size()) {
return L"UNKNOWN"; return L"UNKNOWN";
@ -307,8 +298,7 @@ std::wstring DeviceManager::getDeviceProtocol(int deviceId){
return L"UNKNOWN"; 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); TelldusCore::MutexLocker deviceListLocker(&d->lock);
if (!d->devices.size()) { if (!d->devices.size()) {
return TELLSTICK_ERROR_DEVICE_NOT_FOUND; return TELLSTICK_ERROR_DEVICE_NOT_FOUND;
@ -335,7 +325,6 @@ int DeviceManager::getNumberOfDevices(){
} }
int DeviceManager::addDevice() { int DeviceManager::addDevice() {
int id = d->set.addNode(Settings::Device); int id = d->set.addNode(Settings::Device);
if(id < 0) { if(id < 0) {
return id; return id;
@ -354,7 +343,6 @@ int DeviceManager::getDeviceId(int deviceIndex) {
} }
int DeviceManager::getDeviceType(int deviceId) { int DeviceManager::getDeviceType(int deviceId) {
TelldusCore::MutexLocker deviceListLocker(&d->lock); TelldusCore::MutexLocker deviceListLocker(&d->lock);
if (!d->devices.size()) { if (!d->devices.size()) {
return TELLSTICK_ERROR_DEVICE_NOT_FOUND; return TELLSTICK_ERROR_DEVICE_NOT_FOUND;
@ -368,7 +356,6 @@ int DeviceManager::getDeviceType(int deviceId){
} }
int DeviceManager::getPreferredControllerId(int deviceId) { int DeviceManager::getPreferredControllerId(int deviceId) {
TelldusCore::MutexLocker deviceListLocker(&d->lock); TelldusCore::MutexLocker deviceListLocker(&d->lock);
if (!d->devices.size()) { if (!d->devices.size()) {
@ -485,7 +472,6 @@ int DeviceManager::doGroupAction(const std::wstring devices, const int action, c
duplicateDeviceIds->insert(groupDeviceId); duplicateDeviceIds->insert(groupDeviceId);
while(std::getline(devicesstream, singledevice, L',')) { while(std::getline(devicesstream, singledevice, L',')) {
int deviceId = TelldusCore::wideToInteger(singledevice); int deviceId = TelldusCore::wideToInteger(singledevice);
if(duplicateDeviceIds->count(deviceId) == 1) { 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) { int DeviceManager::executeScene(std::wstring singledevice, int groupDeviceId) {
std::wstringstream devicestream(singledevice); std::wstringstream devicestream(singledevice);
const int deviceParameterLength = 3; const int deviceParameterLength = 3;
@ -576,7 +561,6 @@ int DeviceManager::executeScene(std::wstring singledevice, int groupDeviceId){
} }
int DeviceManager::removeDevice(int deviceId) { int DeviceManager::removeDevice(int deviceId) {
Device *device = 0; Device *device = 0;
{ {
int ret = d->set.removeNode(Settings::Device, deviceId); //remove from register/settings 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) { int DeviceManager::sendRawCommand(const std::wstring &command, int reserved) {
Controller *controller = d->controllerManager->getBestControllerById(-1); Controller *controller = d->controllerManager->getBestControllerById(-1);
if(!controller) { if(!controller) {

View file

@ -16,8 +16,7 @@
class Sensor; class Sensor;
class DeviceManager class DeviceManager {
{
public: public:
DeviceManager(ControllerManager *controllerManager, TelldusCore::EventRef deviceUpdateEvent); DeviceManager(ControllerManager *controllerManager, TelldusCore::EventRef deviceUpdateEvent);
~DeviceManager(void); ~DeviceManager(void);

View file

@ -25,8 +25,7 @@ public:
}; };
EventUpdateManager::EventUpdateManager() EventUpdateManager::EventUpdateManager()
:Thread() :Thread() {
{
d = new PrivateData; d = new PrivateData;
d->stopEvent = d->eventHandler.addEvent(); d->stopEvent = d->eventHandler.addEvent();
d->updateEvent = d->eventHandler.addEvent(); d->updateEvent = d->eventHandler.addEvent();
@ -47,12 +46,10 @@ EventUpdateManager::~EventUpdateManager(void) {
} }
TelldusCore::EventRef EventUpdateManager::retrieveUpdateEvent() { TelldusCore::EventRef EventUpdateManager::retrieveUpdateEvent() {
return d->updateEvent; return d->updateEvent;
} }
void EventUpdateManager::run() { void EventUpdateManager::run() {
while(!d->stopEvent->isSignaled()) { while(!d->stopEvent->isSignaled()) {
if (!d->eventHandler.waitForAny()) { if (!d->eventHandler.waitForAny()) {
continue; continue;
@ -78,7 +75,6 @@ void EventUpdateManager::run(){
} }
void EventUpdateManager::sendMessageToClients(EventUpdateData *data) { void EventUpdateManager::sendMessageToClients(EventUpdateData *data) {
int connected = 0; int connected = 0;
for(SocketList::iterator it = d->clients.begin(); it != d->clients.end();) { for(SocketList::iterator it = d->clients.begin(); it != d->clients.end();) {
if((*it)->isConnected()) { if((*it)->isConnected()) {

View file

@ -29,8 +29,7 @@ public:
int timestamp; int timestamp;
}; };
class EventUpdateManager : public TelldusCore::Thread class EventUpdateManager : public TelldusCore::Thread {
{
public: public:
EventUpdateManager(void); EventUpdateManager(void);
~EventUpdateManager(void); ~EventUpdateManager(void);

View file

@ -31,8 +31,7 @@ public:
Log *Log::PrivateData::instance = 0; Log *Log::PrivateData::instance = 0;
Log::Log() Log::Log()
:d(new PrivateData) :d(new PrivateData) {
{
#if defined(_LINUX) #if defined(_LINUX)
setlogmask(LOG_UPTO(LOG_INFO)); setlogmask(LOG_UPTO(LOG_INFO));
openlog("telldusd", LOG_CONS, LOG_USER); openlog("telldusd", LOG_CONS, LOG_USER);

View file

@ -38,7 +38,6 @@ public:
}; };
Protocol::Protocol() { Protocol::Protocol() {
d = new PrivateData; d = new PrivateData;
} }
@ -97,7 +96,6 @@ bool Protocol::checkBit(int data, int bitno) {
Protocol *Protocol::getProtocolInstance(const std::wstring &protocolname) { Protocol *Protocol::getProtocolInstance(const std::wstring &protocolname) {
if(TelldusCore::comparei(protocolname, L"arctech")) { if(TelldusCore::comparei(protocolname, L"arctech")) {
return new ProtocolNexa(); return new ProtocolNexa();

View file

@ -16,8 +16,7 @@ typedef std::map<std::wstring, std::wstring> ParameterMap;
class Controller; class Controller;
class Protocol class Protocol {
{
public: public:
Protocol(); Protocol();
virtual ~Protocol(void); virtual ~Protocol(void);

View file

@ -10,8 +10,7 @@
#include <string> #include <string>
#include "service/Protocol.h" #include "service/Protocol.h"
class ProtocolBrateck : public Protocol class ProtocolBrateck : public Protocol {
{
public: public:
int methods() const; int methods() const;
virtual std::string getStringForMethod(int method, unsigned char data, Controller *controller); virtual std::string getStringForMethod(int method, unsigned char data, Controller *controller);

View file

@ -94,8 +94,7 @@ unsigned int ProtocolEverflourish::calculateChecksum(unsigned int x) {
return res; return res;
} }
std::string ProtocolEverflourish::decodeData(ControllerMessage &dataMsg) std::string ProtocolEverflourish::decodeData(ControllerMessage &dataMsg) {
{
std::string data = dataMsg.getParameter("data"); std::string data = dataMsg.getParameter("data");
unsigned int allData; unsigned int allData;
unsigned int house = 0; unsigned int house = 0;

View file

@ -11,8 +11,7 @@
#include "service/Protocol.h" #include "service/Protocol.h"
#include "service/ControllerMessage.h" #include "service/ControllerMessage.h"
class ProtocolEverflourish : public Protocol class ProtocolEverflourish : public Protocol {
{
public: public:
int methods() const; int methods() const;
virtual std::string getStringForMethod(int method, unsigned char data, Controller *controller); virtual std::string getStringForMethod(int method, unsigned char data, Controller *controller);

View file

@ -10,8 +10,7 @@
#include <sstream> #include <sstream>
#include <iomanip> #include <iomanip>
std::string ProtocolFineoffset::decodeData(ControllerMessage &dataMsg) std::string ProtocolFineoffset::decodeData(ControllerMessage &dataMsg) {
{
std::string data = dataMsg.getParameter("data"); std::string data = dataMsg.getParameter("data");
if (data.length() < 8) { if (data.length() < 8) {
return ""; return "";

View file

@ -11,8 +11,7 @@
#include "service/Protocol.h" #include "service/Protocol.h"
#include "service/ControllerMessage.h" #include "service/ControllerMessage.h"
class ProtocolFineoffset : public Protocol class ProtocolFineoffset : public Protocol {
{
public: public:
static std::string decodeData(ControllerMessage &dataMsg); static std::string decodeData(ControllerMessage &dataMsg);
}; };

View file

@ -10,8 +10,7 @@
#include <string> #include <string>
#include "service/Protocol.h" #include "service/Protocol.h"
class ProtocolFuhaote : public Protocol class ProtocolFuhaote : public Protocol {
{
public: public:
int methods() const; int methods() const;
virtual std::string getStringForMethod(int method, unsigned char data, Controller *controller); virtual std::string getStringForMethod(int method, unsigned char data, Controller *controller);

View file

@ -10,8 +10,7 @@
#include <string> #include <string>
#include "service/Protocol.h" #include "service/Protocol.h"
class ProtocolHasta : public Protocol class ProtocolHasta : public Protocol {
{
public: public:
int methods() const; int methods() const;
virtual std::string getStringForMethod(int method, unsigned char data, Controller *controller); virtual std::string getStringForMethod(int method, unsigned char data, Controller *controller);

View file

@ -10,8 +10,7 @@
#include <string> #include <string>
#include "service/Protocol.h" #include "service/Protocol.h"
class ProtocolIkea : public Protocol class ProtocolIkea : public Protocol {
{
public: public:
int methods() const; int methods() const;
virtual std::string getStringForMethod(int method, unsigned char data, Controller *controller); virtual std::string getStringForMethod(int method, unsigned char data, Controller *controller);

View file

@ -10,8 +10,7 @@
#include <sstream> #include <sstream>
#include <iomanip> #include <iomanip>
std::string ProtocolMandolyn::decodeData(ControllerMessage &dataMsg) std::string ProtocolMandolyn::decodeData(ControllerMessage &dataMsg) {
{
std::string data = dataMsg.getParameter("data"); std::string data = dataMsg.getParameter("data");
uint32_t value = (uint32_t)TelldusCore::hexTo64l(data); uint32_t value = (uint32_t)TelldusCore::hexTo64l(data);

View file

@ -11,8 +11,7 @@
#include "service/Protocol.h" #include "service/Protocol.h"
#include "service/ControllerMessage.h" #include "service/ControllerMessage.h"
class ProtocolMandolyn : public Protocol class ProtocolMandolyn : public Protocol {
{
public: public:
static std::string decodeData(ControllerMessage &dataMsg); static std::string decodeData(ControllerMessage &dataMsg);
}; };

View file

@ -163,8 +163,7 @@ std::string ProtocolNexa::getStringSelflearningForCode(int intHouse, int intCode
return strMessage; return strMessage;
} }
std::string ProtocolNexa::decodeData(ControllerMessage& dataMsg) std::string ProtocolNexa::decodeData(ControllerMessage& dataMsg) {
{
unsigned long allData = 0; unsigned long allData = 0;
sscanf(dataMsg.getParameter("data").c_str(), "%lx", &allData); sscanf(dataMsg.getParameter("data").c_str(), "%lx", &allData);
@ -219,7 +218,6 @@ std::string ProtocolNexa::decodeDataSelfLearning(long allData){
} }
std::string ProtocolNexa::decodeDataCodeSwitch(long allData) { std::string ProtocolNexa::decodeDataCodeSwitch(long allData) {
unsigned int house = 0; unsigned int house = 0;
unsigned int unit = 0; unsigned int unit = 0;
unsigned int method = 0; unsigned int method = 0;

View file

@ -10,8 +10,7 @@
#include <sstream> #include <sstream>
#include <iomanip> #include <iomanip>
std::string ProtocolOregon::decodeData(ControllerMessage &dataMsg) std::string ProtocolOregon::decodeData(ControllerMessage &dataMsg) {
{
std::string data = dataMsg.getParameter("data"); std::string data = dataMsg.getParameter("data");
std::wstring model = dataMsg.model(); std::wstring model = dataMsg.model();

View file

@ -11,8 +11,7 @@
#include "service/Protocol.h" #include "service/Protocol.h"
#include "service/ControllerMessage.h" #include "service/ControllerMessage.h"
class ProtocolOregon : public Protocol class ProtocolOregon : public Protocol {
{
public: public:
static std::string decodeData(ControllerMessage &dataMsg); static std::string decodeData(ControllerMessage &dataMsg);

View file

@ -10,8 +10,7 @@
#include <string> #include <string>
#include "service/Protocol.h" #include "service/Protocol.h"
class ProtocolRisingSun : public Protocol class ProtocolRisingSun : public Protocol {
{
public: public:
int methods() const; int methods() const;
virtual std::string getStringForMethod(int method, unsigned char data, Controller *controller); virtual std::string getStringForMethod(int method, unsigned char data, Controller *controller);

View file

@ -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"); std::string data = dataMsg.getParameter("data");
signed int allDataIn; signed int allDataIn;
signed int allData = 0; signed int allData = 0;

View file

@ -11,8 +11,7 @@
#include "service/Protocol.h" #include "service/Protocol.h"
#include "service/ControllerMessage.h" #include "service/ControllerMessage.h"
class ProtocolSartano : public Protocol class ProtocolSartano : public Protocol {
{
public: public:
int methods() const; int methods() const;
virtual std::string getStringForMethod(int method, unsigned char data, Controller *controller); virtual std::string getStringForMethod(int method, unsigned char data, Controller *controller);

View file

@ -10,8 +10,7 @@
#include <string> #include <string>
#include "service/Protocol.h" #include "service/Protocol.h"
class ProtocolSilvanChip : public Protocol class ProtocolSilvanChip : public Protocol {
{
public: public:
int methods() const; int methods() const;
virtual std::string getStringForMethod(int method, unsigned char data, Controller *controller); virtual std::string getStringForMethod(int method, unsigned char data, Controller *controller);

View file

@ -10,8 +10,7 @@
#include <string> #include <string>
#include "service/Protocol.h" #include "service/Protocol.h"
class ProtocolUpm : public Protocol class ProtocolUpm : public Protocol {
{
public: public:
int methods() const; int methods() const;
virtual std::string getStringForMethod(int method, unsigned char data, Controller *controller); virtual std::string getStringForMethod(int method, unsigned char data, Controller *controller);

View file

@ -22,8 +22,7 @@ std::string ProtocolWaveman::getOffCode() const {
return "$k$k$k$k$k$k$k$k$k+"; 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 long allData = 0;
unsigned int house = 0; unsigned int house = 0;
unsigned int unit = 0; unsigned int unit = 0;
@ -62,8 +61,8 @@ std::string ProtocolWaveman::decodeData(ControllerMessage& dataMsg)
if(method == 0) { if(method == 0) {
retString << ";unit:" << unit << ";method:turnoff;"; retString << ";unit:" << unit << ";method:turnoff;";
}
else if(method == 14){ } else if(method == 14) {
retString << ";unit:" << unit << ";method:turnon;"; retString << ";unit:" << unit << ";method:turnon;";
} }
else { else {

View file

@ -11,8 +11,7 @@
#include "service/Protocol.h" #include "service/Protocol.h"
#include "service/ControllerMessage.h" #include "service/ControllerMessage.h"
class ProtocolX10 : public Protocol class ProtocolX10 : public Protocol {
{
public: public:
int methods() const; int methods() const;
virtual std::string getStringForMethod(int method, unsigned char data, Controller *controller); virtual std::string getStringForMethod(int method, unsigned char data, Controller *controller);

View file

@ -10,8 +10,7 @@
#include <string> #include <string>
#include "service/ProtocolSartano.h" #include "service/ProtocolSartano.h"
class ProtocolYidong : public ProtocolSartano class ProtocolYidong : public ProtocolSartano {
{
public: public:
virtual std::string getStringForMethod(int method, unsigned char data, Controller *controller); virtual std::string getStringForMethod(int method, unsigned char data, Controller *controller);
}; };

View file

@ -18,8 +18,7 @@ public:
}; };
Sensor::Sensor(const std::wstring &protocol, const std::wstring &model, int id) Sensor::Sensor(const std::wstring &protocol, const std::wstring &model, int id)
:Mutex() :Mutex() {
{
d = new PrivateData; d = new PrivateData;
d->protocol = protocol; d->protocol = protocol;
d->model = model; d->model = model;

View file

@ -10,8 +10,7 @@
#include "common/Mutex.h" #include "common/Mutex.h"
#include <string> #include <string>
class Sensor : public TelldusCore::Mutex class Sensor : public TelldusCore::Mutex {
{
public: public:
Sensor(const std::wstring &protocol, const std::wstring &model, int id); Sensor(const std::wstring &protocol, const std::wstring &model, int id);
~Sensor(); ~Sensor();

View file

@ -32,8 +32,7 @@ const char* VAR_CONFIG_FILE = VAR_CONFIG_PATH "/telldus-core.conf";
/* /*
* Constructor * Constructor
*/ */
Settings::Settings(void) Settings::Settings(void) {
{
TelldusCore::MutexLocker locker(&mutex); TelldusCore::MutexLocker locker(&mutex);
d = new PrivateData; d = new PrivateData;
readConfig(&d->cfg); readConfig(&d->cfg);
@ -43,8 +42,7 @@ Settings::Settings(void)
/* /*
* Destructor * Destructor
*/ */
Settings::~Settings(void) Settings::~Settings(void) {
{
TelldusCore::MutexLocker locker(&mutex); TelldusCore::MutexLocker locker(&mutex);
if (d->cfg > 0) { if (d->cfg > 0) {
cfg_free(d->cfg); cfg_free(d->cfg);

View file

@ -40,8 +40,7 @@ public:
}; };
TellStick::TellStick(int controllerId, TelldusCore::EventRef event, TelldusCore::EventRef updateEvent, const TellStickDescriptor &td ) 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 = new PrivateData;
d->open = false; d->open = false;
d->vid = td.vid; d->vid = td.vid;

View file

@ -25,8 +25,7 @@ public:
TelldusCore::EventRef stopEvent, controllerChangeEvent; TelldusCore::EventRef stopEvent, controllerChangeEvent;
}; };
TelldusMain::TelldusMain(void) TelldusMain::TelldusMain(void) {
{
d = new PrivateData; d = new PrivateData;
d->stopEvent = d->eventHandler.addEvent(); d->stopEvent = d->eventHandler.addEvent();
d->controllerChangeEvent = d->eventHandler.addEvent(); d->controllerChangeEvent = d->eventHandler.addEvent();

View file

@ -7,8 +7,7 @@
#ifndef TELLDUS_CORE_SERVICE_TELLDUSMAIN_H_ #ifndef TELLDUS_CORE_SERVICE_TELLDUSMAIN_H_
#define TELLDUS_CORE_SERVICE_TELLDUSMAIN_H_ #define TELLDUS_CORE_SERVICE_TELLDUSMAIN_H_
class TelldusMain class TelldusMain {
{
public: public:
TelldusMain(void); TelldusMain(void);
~TelldusMain(void); ~TelldusMain(void);

View file

@ -28,8 +28,7 @@ public:
}; };
Timer::Timer(TelldusCore::EventRef event) Timer::Timer(TelldusCore::EventRef event)
:TelldusCore::Thread(), d(new PrivateData) :TelldusCore::Thread(), d(new PrivateData) {
{
d->event = event; d->event = event;
#ifdef _WINDOWS #ifdef _WINDOWS
d->cond = CreateEventW(NULL, false, false, NULL); d->cond = CreateEventW(NULL, false, false, NULL);