Skip to content

Commit 3cbd21c

Browse files
committed
Merge remote-tracking branch 'origin/master' into
refactor_webserver_server_class # Conflicts: # main/mainworker.cpp # webserver/cWebem.cpp
2 parents 3e035c3 + f42a1df commit 3cbd21c

File tree

156 files changed

+10687
-7819
lines changed

Some content is hidden

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

156 files changed

+10687
-7819
lines changed

CMakeLists.txt

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,6 @@ hardware/SBFSpot.cpp
290290
hardware/serial/serial.cpp
291291
hardware/serial/impl/unix.cpp
292292
hardware/SolarEdgeAPI.cpp
293-
hardware/SolarEdgeBase.cpp
294-
hardware/SolarEdgeTCP.cpp
295293
hardware/SolarMaxTCP.cpp
296294
hardware/TCPProxy/tcpproxy_server.cpp
297295
hardware/TE923.cpp
@@ -567,10 +565,26 @@ else()
567565
message(STATUS "Not found telldus-core (telldus-core.h), not adding tellstick support")
568566
endif (TELLDUSCORE_INCLUDE)
569567

568+
# Under FreeBSD sys/sysinfo?h exist using a separate pkg
569+
IF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
570+
find_path(SYSINFO_INCLUDE NAMES sys/sysinfo.h)
571+
if (SYSINFO_INCLUDE)
572+
message(STATUS "Found sys/sysinfo.h at : ${SYSINFO_INCLUDE}")
573+
find_library(SYSINFO_LIBRARIES NAMES libsysinfo.so)
574+
if(SYSINFO_LIBRARIES)
575+
message(STATUS "Found libsysinfo.so at : ${SYSINFO_LIBRARIES}")
576+
else(SYSINFO_LIBRARIES)
577+
message(FATAL_ERROR "Cannot find libsysinfo, please install it with 'pkg install libsysinfo'")
578+
endif(SYSINFO_LIBRARIES)
579+
else()
580+
message(FATAL_ERROR "Cannot find sysinfo.h, please install it with 'pkg install libsysinfo'")
581+
endif()
582+
ENDIF()
583+
570584
IF(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
571585
target_link_libraries(domoticz ${Boost_LIBRARIES} ${ZLIB_LIBRARIES} ${CURL_LIBRARIES} pthread ${LUA_LIBRARIES} ${MQTT_LIBRARIES} ${SQLite_LIBRARIES} ${CMAKE_DL_LIBS} ${TELLDUS_LIBRARIES})
572586
else()
573-
target_link_libraries(domoticz -lrt ${Boost_LIBRARIES} ${ZLIB_LIBRARIES} ${CURL_LIBRARIES} pthread ${LUA_LIBRARIES} ${MQTT_LIBRARIES} ${SQLite_LIBRARIES} ${CMAKE_DL_LIBS} ${TELLDUS_LIBRARIES})
587+
target_link_libraries(domoticz -lrt ${Boost_LIBRARIES} ${ZLIB_LIBRARIES} ${CURL_LIBRARIES} pthread ${LUA_LIBRARIES} ${MQTT_LIBRARIES} ${SQLite_LIBRARIES} ${CMAKE_DL_LIBS} ${TELLDUS_LIBRARIES} ${SYSINFO_LIBRARIES})
574588
ENDIF()
575589

576590
ADD_PRECOMPILED_HEADER(domoticz "main/stdafx.h")

History.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ Version 2.4xxx
8181
- Fixed: Fix missing Selector switch levels in MQTT device info response by returning all device options (#459)
8282
- Fixed: Fix dead code in the AsyncSerial::close method causing the method not to stop or close the background resources.
8383
- Fixed: Fix a security issue (DOS) in webserver to prevent a remote_endpoint exception to be thrown to the WebServer class causing the webserver to be down (no possible stop and no possible connection). Now, the webserver can be scanned using the nmap tool (for the SSL configuration purpose).
84+
- Fixed: Under FreeBSD Hardware Monitor works, but it needs the libsysinfo package to work.
8485
- Updated: OpenZWave, configuration files
8586

8687
Version 2.3530 (November 1th 2015)

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: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ m_UserName(CURLEncode::URLEncode(Username)),
5555
m_Password(CURLEncode::URLEncode(Password))
5656
{
5757
m_HwdID=ID;
58-
m_ThermostatID = "";
5958
Init();
6059
GetMeterDetails();
6160
}
@@ -139,7 +138,7 @@ bool CAnnaThermostat::WriteToHardware(const char *pdata, const unsigned char len
139138
if (m_Password.size() == 0)
140139
return false;
141140

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

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());

0 commit comments

Comments
 (0)