Skip to content

Commit caf5d26

Browse files
committed
Merged changes with master
2 parents 9f006ef + c22cfad commit caf5d26

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+611
-1463
lines changed

CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,6 @@ hardware/SBFSpot.cpp
291291
hardware/serial/serial.cpp
292292
hardware/serial/impl/unix.cpp
293293
hardware/SolarEdgeAPI.cpp
294-
hardware/SolarEdgeBase.cpp
295-
hardware/SolarEdgeTCP.cpp
296294
hardware/SolarMaxTCP.cpp
297295
hardware/TCPProxy/tcpproxy_server.cpp
298296
hardware/TE923.cpp

hardware/1Wire.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ void C1Wire::Do_Work()
139139

140140
bool C1Wire::WriteToHardware(const char *pdata, const unsigned char length)
141141
{
142-
tRBUF *pSen=(tRBUF*)pdata;
142+
const tRBUF *pSen= reinterpret_cast<const tRBUF*>(pdata);
143143

144144
if (!m_system)
145145
return false;//no 1-wire support

hardware/1Wire/1WireByKernel.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class C1WireByKernel : public I_1WireSystem
4545
class DeviceState
4646
{
4747
public:
48-
DeviceState(_t1WireDevice device) : m_Device(device) {}
48+
explicit DeviceState(_t1WireDevice device) : m_Device(device) {}
4949
_t1WireDevice GetDevice() const {return m_Device;}
5050
union
5151
{
@@ -64,7 +64,7 @@ class C1WireByKernel : public I_1WireSystem
6464
class Locker:boost::lock_guard<boost::mutex>
6565
{
6666
public:
67-
Locker(const boost::mutex& mutex):boost::lock_guard<boost::mutex>(*(const_cast<boost::mutex*>(&mutex))){}
67+
explicit Locker(const boost::mutex& mutex):boost::lock_guard<boost::mutex>(*(const_cast<boost::mutex*>(&mutex))){}
6868
virtual ~Locker(){}
6969
};
7070
typedef std::map<std::string,DeviceState*> DeviceCollection;
@@ -80,15 +80,15 @@ class C1WireByKernel : public I_1WireSystem
8080
private:
8181
std::list<DeviceState>& m_List;
8282
public:
83-
IsPendingChanges(std::list<DeviceState>& list):m_List(list){}
83+
explicit IsPendingChanges(std::list<DeviceState>& list):m_List(list){}
8484
bool operator()() const {return !m_List.empty();}
8585
};
8686
};
8787

8888
class OneWireReadErrorException : public std::exception
8989
{
9090
public:
91-
OneWireReadErrorException(const std::string& deviceFileName) : m_Message("1-Wire system : error reading value from ") {m_Message.append(deviceFileName);}
91+
explicit OneWireReadErrorException(const std::string& deviceFileName) : m_Message("1-Wire system : error reading value from ") {m_Message.append(deviceFileName);}
9292
virtual ~OneWireReadErrorException() throw() {}
9393
virtual const char* what() const throw() {return m_Message.c_str();}
9494
protected:
@@ -98,7 +98,7 @@ class OneWireReadErrorException : public std::exception
9898
class OneWireWriteErrorException : public std::exception
9999
{
100100
public:
101-
OneWireWriteErrorException(const std::string& deviceFileName) : m_Message("1-Wire system : error writing value from ") {m_Message.append(deviceFileName);}
101+
explicit OneWireWriteErrorException(const std::string& deviceFileName) : m_Message("1-Wire system : error writing value from ") {m_Message.append(deviceFileName);}
102102
virtual ~OneWireWriteErrorException() throw() {}
103103
virtual const char* what() const throw() {return m_Message.c_str();}
104104
protected:

hardware/1Wire/1WireForWindows.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class C1WireForWindows : public I_1WireSystem
4242
class C1WireForWindowsReadException : public std::exception
4343
{
4444
public:
45-
C1WireForWindowsReadException(const std::string& message) : m_Message("1-Wire system : error reading value, ") {m_Message.append(message);}
45+
explicit C1WireForWindowsReadException(const std::string& message) : m_Message("1-Wire system : error reading value, ") {m_Message.append(message);}
4646
virtual ~C1WireForWindowsReadException() throw() {}
4747
virtual const char* what() const throw() {return m_Message.c_str();}
4848
protected:

hardware/AnnaThermostat.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ CAnnaThermostat::CAnnaThermostat(const int ID, const std::string &IPAddress, con
5252
m_IPAddress(IPAddress),
5353
m_IPPort(usIPPort),
5454
m_UserName(CURLEncode::URLEncode(Username)),
55-
m_Password(CURLEncode::URLEncode(Password))
55+
m_Password(CURLEncode::URLEncode(Password)),
56+
m_ThermostatID("")
5657
{
5758
m_HwdID=ID;
58-
m_ThermostatID = "";
5959
Init();
6060
GetMeterDetails();
6161
}
@@ -139,7 +139,7 @@ bool CAnnaThermostat::WriteToHardware(const char *pdata, const unsigned char len
139139
if (m_Password.size() == 0)
140140
return false;
141141

142-
tRBUF *pCmd = (tRBUF *)pdata;
142+
const tRBUF *pCmd = reinterpret_cast<const tRBUF *>(pdata);
143143
if (pCmd->LIGHTING2.packettype != pTypeLighting2)
144144
return false; //later add RGB support, if someone can provide access
145145

hardware/BMP085.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,11 @@ and does not require smbus or wire libs
7878

7979
const unsigned char BMPx8x_OverSampling = 3;
8080

81-
CBMP085::CBMP085(const int ID)
81+
CBMP085::CBMP085(const int ID) :
82+
m_ActI2CBus("/dev/i2c-1")
8283
{
8384
m_stoprequested=false;
8485
m_HwdID=ID;
85-
m_ActI2CBus = "/dev/i2c-1";
8686
if (!i2c_test(m_ActI2CBus.c_str()))
8787
{
8888
m_ActI2CBus = "/dev/i2c-0";

hardware/Comm5TCP.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ m_szIPAddress(IPAddress)
4141
m_usIPPort=usIPPort;
4242
lastKnownSensorState = 0;
4343
initSensorData = true;
44+
reqState = Idle;
45+
notificationEnabled = false;
46+
m_bReceiverStarted = false;
4447
}
4548

4649
bool Comm5TCP::StartHardware()
@@ -185,10 +188,10 @@ void Comm5TCP::enableNotifications()
185188

186189
bool Comm5TCP::WriteToHardware(const char *pdata, const unsigned char length)
187190
{
188-
tRBUF *pSen = (tRBUF*)pdata;
191+
const tRBUF *pSen = reinterpret_cast<const tRBUF*>(pdata);
189192

190193
unsigned char packettype = pSen->ICMND.packettype;
191-
unsigned char subtype = pSen->ICMND.subtype;
194+
//unsigned char subtype = pSen->ICMND.subtype;
192195

193196
if (!mIsConnected)
194197
return false;

hardware/DavisLoggerSerial.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,15 @@
2424

2525
#define round(a) ( int ) ( a + .5 )
2626

27-
CDavisLoggerSerial::CDavisLoggerSerial(const int ID, const std::string& devname, unsigned int baud_rate)
27+
CDavisLoggerSerial::CDavisLoggerSerial(const int ID, const std::string& devname, unsigned int baud_rate) :
28+
m_szSerialPort(devname)
2829
{
2930
m_HwdID=ID;
30-
m_szSerialPort=devname;
3131
m_iBaudRate=baud_rate;
3232
m_stoprequested=false;
33+
m_retrycntr = RETRY_DELAY;
34+
m_statecounter = 0;
35+
m_state = DSTATE_WAKEUP;
3336
}
3437

3538
CDavisLoggerSerial::~CDavisLoggerSerial(void)
@@ -218,7 +221,7 @@ bool CDavisLoggerSerial::HandleLoopData(const unsigned char *data, size_t len)
218221
(data[97]!=0x0d)
219222
)
220223
return false;
221-
bool bIsRevA = (data[4]=='P');
224+
//bool bIsRevA = (data[4]=='P');
222225
#else
223226
// FILE *fOut=fopen("davisrob.bin","wb+");
224227
// fwrite(data,1,len,fOut);

hardware/DomoticzHardware.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,6 @@ void CDomoticzHardwareBase::SendSwitchIfNotExists(const int NodeID, const int Ch
516516

517517
void CDomoticzHardwareBase::SendSwitch(const int NodeID, const int ChildID, const int BatteryLevel, const bool bOn, const double Level, const std::string &defaultname)
518518
{
519-
bool bDeviceExits = true;
520519
double rlevel = (15.0 / 100)*Level;
521520
int level = int(rlevel);
522521

@@ -531,11 +530,7 @@ void CDomoticzHardwareBase::SendSwitch(const int NodeID, const int ChildID, cons
531530
std::vector<std::vector<std::string> > result;
532531
result = m_sql.safe_query("SELECT Name,nValue,sValue FROM DeviceStatus WHERE (HardwareID==%d) AND (DeviceID=='%q') AND (Unit == %d) AND (Type==%d) AND (Subtype==%d)",
533532
m_HwdID, szIdx, ChildID, int(pTypeLighting2), int(sTypeAC));
534-
if (result.size() < 1)
535-
{
536-
bDeviceExits = false;
537-
}
538-
else
533+
if (!result.empty())
539534
{
540535
//check if we have a change, if not do not update it
541536
int nvalue = atoi(result[0][1].c_str());

hardware/DomoticzTCP.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ m_username(username), m_password(password), m_szIPAddress(IPAddress)
2323
b_ProxyConnected = false;
2424
#endif
2525
m_bIsStarted = false;
26+
m_retrycntr = RETRY_DELAY;
2627
}
2728

2829
DomoticzTCP::~DomoticzTCP(void)
@@ -421,10 +422,8 @@ bool DomoticzTCP::isConnectedProxy()
421422
void DomoticzTCP::writeProxy(const char *data, size_t size)
422423
{
423424
/* send data to slave */
424-
http::server::CProxyClient *proxy;
425-
426425
if (isConnectedProxy()) {
427-
proxy = m_webservers.GetProxyForMaster(this);
426+
http::server::CProxyClient *proxy = m_webservers.GetProxyForMaster(this);
428427
if (proxy) {
429428
proxy->WriteMasterData(token, data, size);
430429
}

0 commit comments

Comments
 (0)