Use pointers when passing references according to Google style guidelines "runtime/references"
This commit is contained in:
parent
3dcc7a04ba
commit
1ac3fc25e0
21 changed files with 28 additions and 28 deletions
|
@ -126,10 +126,10 @@ int DeviceManager::getDeviceMethods(int deviceId, int methodsSupported) {
|
||||||
|
|
||||||
int DeviceManager::getDeviceMethods(int deviceId) {
|
int DeviceManager::getDeviceMethods(int deviceId) {
|
||||||
std::set<int> duplicateDeviceIds;
|
std::set<int> duplicateDeviceIds;
|
||||||
return DeviceManager::getDeviceMethods(deviceId, duplicateDeviceIds);
|
return DeviceManager::getDeviceMethods(deviceId, &duplicateDeviceIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
int DeviceManager::getDeviceMethods(int deviceId, std::set<int> &duplicateDeviceIds) {
|
int DeviceManager::getDeviceMethods(int deviceId, std::set<int> *duplicateDeviceIds) {
|
||||||
int type = 0;
|
int type = 0;
|
||||||
int methods = 0;
|
int methods = 0;
|
||||||
std::wstring deviceIds;
|
std::wstring deviceIds;
|
||||||
|
@ -162,16 +162,16 @@ int DeviceManager::getDeviceMethods(int deviceId, std::set<int> &duplicateDevice
|
||||||
std::wstringstream devicesstream(deviceIds);
|
std::wstringstream devicesstream(deviceIds);
|
||||||
methods = 0;
|
methods = 0;
|
||||||
|
|
||||||
duplicateDeviceIds.insert(deviceId);
|
duplicateDeviceIds->insert(deviceId);
|
||||||
|
|
||||||
while(std::getline(devicesstream, deviceIdBuffer, L',')) {
|
while(std::getline(devicesstream, deviceIdBuffer, L',')) {
|
||||||
int deviceIdInGroup = TelldusCore::wideToInteger(deviceIdBuffer);
|
int deviceIdInGroup = TelldusCore::wideToInteger(deviceIdBuffer);
|
||||||
if(duplicateDeviceIds.count(deviceIdInGroup) == 1) {
|
if(duplicateDeviceIds->count(deviceIdInGroup) == 1) {
|
||||||
// action for device already executed, or will execute, do nothing to avoid infinite loop
|
// action for device already executed, or will execute, do nothing to avoid infinite loop
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
duplicateDeviceIds.insert(deviceIdInGroup);
|
duplicateDeviceIds->insert(deviceIdInGroup);
|
||||||
|
|
||||||
int deviceMethods = getDeviceMethods(deviceIdInGroup, duplicateDeviceIds);
|
int deviceMethods = getDeviceMethods(deviceIdInGroup, duplicateDeviceIds);
|
||||||
if(deviceMethods > 0) {
|
if(deviceMethods > 0) {
|
||||||
|
|
|
@ -52,7 +52,7 @@ public:
|
||||||
private:
|
private:
|
||||||
void handleSensorMessage(const ControllerMessage &msg);
|
void handleSensorMessage(const ControllerMessage &msg);
|
||||||
void setSensorValueAndSignal( const std::string &dataType, int dataTypeId, Sensor *sensor, const ControllerMessage &msg, time_t timestamp) const;
|
void setSensorValueAndSignal( const std::string &dataType, int dataTypeId, Sensor *sensor, const ControllerMessage &msg, time_t timestamp) const;
|
||||||
int getDeviceMethods(int deviceId, std::set<int> &duplicateDeviceIds);
|
int getDeviceMethods(int deviceId, std::set<int> *duplicateDeviceIds);
|
||||||
int doGroupAction(const std::wstring deviceIds, int action, unsigned char data, const int type, int groupDeviceId, std::set<int> *duplicateDeviceIds);
|
int doGroupAction(const std::wstring deviceIds, int action, unsigned char data, const int type, int groupDeviceId, std::set<int> *duplicateDeviceIds);
|
||||||
int executeScene(std::wstring singledevice, int groupDeviceId);
|
int executeScene(std::wstring singledevice, int groupDeviceId);
|
||||||
bool triggerDeviceStateChange(int deviceId, int intDeviceState, const std::wstring &strDeviceStateValue );
|
bool triggerDeviceStateChange(int deviceId, int intDeviceState, const std::wstring &strDeviceStateValue );
|
||||||
|
|
|
@ -61,7 +61,7 @@ void Protocol::setModel(const std::wstring &model) {
|
||||||
d->model = model;
|
d->model = model;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Protocol::setParameters(ParameterMap ¶meterList) {
|
void Protocol::setParameters(const ParameterMap ¶meterList) {
|
||||||
d->parameterList = parameterList;
|
d->parameterList = parameterList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ public:
|
||||||
virtual int methods() const = 0;
|
virtual int methods() const = 0;
|
||||||
std::wstring model() const;
|
std::wstring model() const;
|
||||||
void setModel(const std::wstring &model);
|
void setModel(const std::wstring &model);
|
||||||
void setParameters(ParameterMap ¶meterList);
|
void setParameters(const ParameterMap ¶meterList);
|
||||||
|
|
||||||
virtual std::string getStringForMethod(int method, unsigned char data, Controller *controller) = 0;
|
virtual std::string getStringForMethod(int method, unsigned char data, Controller *controller) = 0;
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ unsigned int ProtocolEverflourish::calculateChecksum(unsigned int x) {
|
||||||
int i;
|
int i;
|
||||||
unsigned int lo, hi;
|
unsigned int lo, hi;
|
||||||
|
|
||||||
if ((x&0x3) == 3) {
|
if ((x & 0x3) == 3) {
|
||||||
lo = x & 0x00ff;
|
lo = x & 0x00ff;
|
||||||
hi = x & 0xff00;
|
hi = x & 0xff00;
|
||||||
lo += 4;
|
lo += 4;
|
||||||
|
@ -85,7 +85,7 @@ unsigned int ProtocolEverflourish::calculateChecksum(unsigned int x) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i = 0; i < 16; i++) {
|
for(i = 0; i < 16; i++) {
|
||||||
if (x&bit) {
|
if (x & bit) {
|
||||||
res = res ^ bits[i];
|
res = res ^ bits[i];
|
||||||
}
|
}
|
||||||
bit = bit << 1;
|
bit = bit << 1;
|
||||||
|
@ -94,7 +94,7 @@ unsigned int ProtocolEverflourish::calculateChecksum(unsigned int x) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ProtocolEverflourish::decodeData(ControllerMessage &dataMsg) {
|
std::string ProtocolEverflourish::decodeData(const 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;
|
||||||
|
|
|
@ -15,7 +15,7 @@ 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);
|
||||||
static std::string decodeData(ControllerMessage &dataMsg);
|
static std::string decodeData(const ControllerMessage &dataMsg);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static unsigned int calculateChecksum(unsigned int x);
|
static unsigned int calculateChecksum(unsigned int x);
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "common/Strings.h"
|
#include "common/Strings.h"
|
||||||
|
|
||||||
std::string ProtocolFineoffset::decodeData(ControllerMessage &dataMsg) {
|
std::string ProtocolFineoffset::decodeData(const ControllerMessage &dataMsg) {
|
||||||
std::string data = dataMsg.getParameter("data");
|
std::string data = dataMsg.getParameter("data");
|
||||||
if (data.length() < 8) {
|
if (data.length() < 8) {
|
||||||
return "";
|
return "";
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
class ProtocolFineoffset : public Protocol {
|
class ProtocolFineoffset : public Protocol {
|
||||||
public:
|
public:
|
||||||
static std::string decodeData(ControllerMessage &dataMsg);
|
static std::string decodeData(const ControllerMessage &dataMsg);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TELLDUS_CORE_SERVICE_PROTOCOLFINEOFFSET_H_
|
#endif // TELLDUS_CORE_SERVICE_PROTOCOLFINEOFFSET_H_
|
||||||
|
|
|
@ -26,8 +26,8 @@ std::string ProtocolHasta::getStringForMethod(int method, unsigned char, Control
|
||||||
strReturn.append(1, 190);
|
strReturn.append(1, 190);
|
||||||
strReturn.append(1, 190);
|
strReturn.append(1, 190);
|
||||||
|
|
||||||
strReturn.append(convertByte( (house&0xFF) ));
|
strReturn.append(convertByte( (house & 0xFF) ));
|
||||||
strReturn.append(convertByte( (house>>8)&0xFF ));
|
strReturn.append(convertByte( (house>>8) & 0xFF ));
|
||||||
|
|
||||||
int byte = unit&0x0F;
|
int byte = unit&0x0F;
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "common/Strings.h"
|
#include "common/Strings.h"
|
||||||
|
|
||||||
std::string ProtocolMandolyn::decodeData(ControllerMessage &dataMsg) {
|
std::string ProtocolMandolyn::decodeData(const 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);
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
class ProtocolMandolyn : public Protocol {
|
class ProtocolMandolyn : public Protocol {
|
||||||
public:
|
public:
|
||||||
static std::string decodeData(ControllerMessage &dataMsg);
|
static std::string decodeData(const ControllerMessage &dataMsg);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TELLDUS_CORE_SERVICE_PROTOCOLMANDOLYN_H_
|
#endif // TELLDUS_CORE_SERVICE_PROTOCOLMANDOLYN_H_
|
||||||
|
|
|
@ -164,7 +164,7 @@ std::string ProtocolNexa::getStringSelflearningForCode(int intHouse, int intCode
|
||||||
return strMessage;
|
return strMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ProtocolNexa::decodeData(ControllerMessage& dataMsg) {
|
std::string ProtocolNexa::decodeData(const ControllerMessage& dataMsg) {
|
||||||
uint32_t allData = 0;
|
uint32_t allData = 0;
|
||||||
|
|
||||||
sscanf(dataMsg.getParameter("data").c_str(), "%lx", (long*)&allData); // NOLINT(runtime/int)
|
sscanf(dataMsg.getParameter("data").c_str(), "%lx", (long*)&allData); // NOLINT(runtime/int)
|
||||||
|
|
|
@ -16,7 +16,7 @@ class ProtocolNexa : public Protocol {
|
||||||
public:
|
public:
|
||||||
virtual int methods() const;
|
virtual 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);
|
||||||
static std::string decodeData(ControllerMessage& dataMsg);
|
static std::string decodeData(const ControllerMessage &dataMsg);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::string getStringSelflearning(int method, unsigned char data);
|
std::string getStringSelflearning(int method, unsigned char data);
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "common/Strings.h"
|
#include "common/Strings.h"
|
||||||
|
|
||||||
std::string ProtocolOregon::decodeData(ControllerMessage &dataMsg) {
|
std::string ProtocolOregon::decodeData(const ControllerMessage &dataMsg) {
|
||||||
std::string data = dataMsg.getParameter("data");
|
std::string data = dataMsg.getParameter("data");
|
||||||
|
|
||||||
std::wstring model = dataMsg.model();
|
std::wstring model = dataMsg.model();
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
class ProtocolOregon : public Protocol {
|
class ProtocolOregon : public Protocol {
|
||||||
public:
|
public:
|
||||||
static std::string decodeData(ControllerMessage &dataMsg);
|
static std::string decodeData(const ControllerMessage &dataMsg);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static std::string decodeEA4C(const std::string &data);
|
static std::string decodeEA4C(const std::string &data);
|
||||||
|
|
|
@ -41,7 +41,7 @@ std::string ProtocolSartano::getStringForCode(const std::wstring &strCode, int m
|
||||||
return strReturn;
|
return strReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ProtocolSartano::decodeData(ControllerMessage &dataMsg) {
|
std::string ProtocolSartano::decodeData(const 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;
|
||||||
|
|
|
@ -15,7 +15,7 @@ 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);
|
||||||
static std::string decodeData(ControllerMessage &dataMsg);
|
static std::string decodeData(const ControllerMessage &dataMsg);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::string getStringForCode(const std::wstring &code, int method);
|
std::string getStringForCode(const std::wstring &code, int method);
|
||||||
|
|
|
@ -24,7 +24,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(const ControllerMessage& dataMsg) {
|
||||||
uint32_t allData = 0;
|
uint32_t allData = 0;
|
||||||
unsigned int house = 0;
|
unsigned int house = 0;
|
||||||
unsigned int unit = 0;
|
unsigned int unit = 0;
|
||||||
|
|
|
@ -14,7 +14,7 @@ class ProtocolWaveman : public ProtocolNexa {
|
||||||
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);
|
||||||
static std::string decodeData(ControllerMessage& dataMsg);
|
static std::string decodeData(const ControllerMessage &dataMsg);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual std::string getOffCode() const;
|
virtual std::string getOffCode() const;
|
||||||
|
|
|
@ -113,7 +113,7 @@ std::string ProtocolX10::getStringForMethod(int method, unsigned char data, Cont
|
||||||
return strReturn;
|
return strReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ProtocolX10::decodeData(ControllerMessage& dataMsg) {
|
std::string ProtocolX10::decodeData(const ControllerMessage& dataMsg) {
|
||||||
int intData = 0, currentBit = 31;
|
int intData = 0, currentBit = 31;
|
||||||
bool method = 0;
|
bool method = 0;
|
||||||
sscanf(dataMsg.getParameter("data").c_str(), "%X", &intData);
|
sscanf(dataMsg.getParameter("data").c_str(), "%X", &intData);
|
||||||
|
|
|
@ -16,7 +16,7 @@ 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);
|
||||||
|
|
||||||
static std::string decodeData(ControllerMessage& dataMsg);
|
static std::string decodeData(const ControllerMessage &dataMsg);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TELLDUS_CORE_SERVICE_PROTOCOLX10_H_
|
#endif // TELLDUS_CORE_SERVICE_PROTOCOLX10_H_
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue