merge 2013-11-13 branch into trunk

This commit is contained in:
Justin Hammond 2014-02-14 13:46:51 +00:00
parent b38e81fcc8
commit 4e0a719d10
148 changed files with 9046 additions and 4471 deletions

82
INSTALL Normal file
View file

@ -0,0 +1,82 @@
Minimal Install Guide for OpenZWave!
For Unix's (including Mac, bsd's etc)
=================
execute Make in the Top Level Directory
make
Libraries to link to (Static and Dynamic) will be in top level directory as
well (but you can change that as detailed below with LIBDIR)
To Install:
make install
Some Options you can set:
"BUILD=(release|debug)" - Build a Release or Debug Version of the Library
(Release is default)
"PREFIX=(path)" - Prefix to install the shared library into - Defaults to
/usr/local
"LIBDIR=/tmp" - Path to place the libraries into after complication. A poor
mans "make install" for simple Applications.
To use the options, specify them on the commandline when executing make eg:
"BUILD=debug PREFIX=/opt/local make"
What Gets installed:
When make install is called the following happens:
* Documentation:
if you have DoxyGen, API documentation is installed into
(PREFIX)/share/doc/openzwave-(version)/
* Shared Libary (libopenzwave.so.*):
The Shared Library is installed into either (prefix)/lib64 (on 64
bit platforms) or (prefix)/lib/ on 32 bit platforms)
* Header Files:
Installed into (prefix)/include/openzwave/
* pkg-config file:
Installed into (prefix)/lib(64)/pkgconfig/libopenzwave.pc
* Config files and Device Databases (manufacturer_specific.xml et al)
Installed into (prefix)/etc/openzwave/
* MinOZW example program:
Installed into (prefix)/bin/ directory
The Static Version of the library is never installed, but will be created in
cpp/lib directory after a successfull make.
Windows Versions
================
Visual Studio Solution Files and Mingw32 Makefiles are present in
cpp/build/windows/. Select the correct Visual Studio or Mingw32 directory
depending on the versions you have.
(Note, if building DLL's on Windows (currently a option in the vs2010
solution) - You have to ensure you application is compiled with exactly the
same compiler options and versions as OpenZWave - Otherwise strange things
might happen)
For the .NET dll, the solution files exist in the dotnet/build/ directory
Sample Programs
===============
For all platforms, there is a simple example program that will print out
events as they happen on your ZWave network. This sample is called MinOZW
and you can find the source in the cpp/examples directory. By default, these
examples are built during the Make Install Stage. If you want compile them
separately, you can use the "make examples" target.
For the .NET wrapper, there is a OZWForm application in
dotnet/examples/OZWForm/. Please read the README file in that directory for
further instructions

46
Makefile Normal file
View file

@ -0,0 +1,46 @@
#
# Makefile for OpenzWave Mac OS X applications
# Greg Satz
# GNU make only
# requires libudev-dev
.SUFFIXES: .d .cpp .o .a
.PHONY: default clean install
top_srcdir := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
top_builddir ?= $(CURDIR)
export top_builddir
PREFIX ?= /usr/local
export PREFIX
all:
$(MAKE) -C $(top_srcdir)/cpp/build/ -$(MAKEFLAGS)
$(MAKE) -C $(top_srcdir)/cpp/examples/MinOZW/ -$(MAKEFLAGS)
install:
$(MAKE) -C $(top_srcdir)/cpp/build/ -$(MAKEFLAGS) $(MAKECMDGOALS)
$(MAKE) -C $(top_srcdir)/cpp/examples/MinOZW/ -$(MAKEFLAGS) $(MAKECMDGOALS)
clean:
$(MAKE) -C $(top_srcdir)/cpp/build/ -$(MAKEFLAGS) $(MAKECMDGOALS)
$(MAKE) -C $(top_srcdir)/cpp/examples/MinOZW/ -$(MAKEFLAGS) $(MAKECMDGOALS)
cpp/src/vers.cpp:
$(MAKE) -C $(top_srcdir)/cpp/build/ -$(MAKEFLAGS) cpp/src/vers.cpp
check:
include $(top_srcdir)/cpp/build/support.mk
dist-update:
@echo "Updating List of Distribition Files"
@$(SVN) --xml -v st > .distfiles
@$(top_srcdir)/makedist
DIST_FORMATS ?= gzip
include $(top_srcdir)/distfiles.mk
include $(top_srcdir)/dist.mk

View file

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<Product xmlns='http://code.google.com/p/open-zwave/'>
<!-- COMMAND_CLASS_ALARM AlarmCmd_Get not supported -->
<CommandClass id="113" getsupported="false" />
<!-- Configuration -->
<CommandClass id="112">
<Value type="byte" genre="config" instance="1" index="1" label="Set to Default" value="-1">
<Help>Set all configuration values to default values (factory settings)</Help>
</Value>
<Value type="byte" genre="config" instance="1" index="2" label="Destination routine enabled" value="255">
<Help>Enables an internal routine that periodically checks the Z-Wave device in assocication group 2</Help>
</Value>
<Value type="byte" genre="config" instance="1" index="3" label="Destination routine success time" value="60">
<Help>Configure the time that the AlarmSound sends a new frame when previous frame was send successful</Help>
</Value>
<Value type="byte" genre="config" instance="1" index="4" label="Destination routine failed time" value="240">
<Help>Configure the time that the AlarmSound sends a few frame when previous frame was send not successful</Help>
</Value>
<Value type="byte" genre="config" instance="1" index="5" label="Temperature calibration offset (byte 1)" value="0">
<Help>A (signed) offset to calibrate the onboard temperature sensor</Help>
</Value>
<Value type="byte" genre="config" instance="1" index="6" label="Temperature calibration offset (byte 2)" value="0">
<Help>A (signed) offset to calibrate the onboard temperature sensor</Help>
</Value>
<Value type="byte" genre="config" instance="1" index="7" label="Select index sound/light mode" value="1">
<Help>The index of the sound mode when a switch binary/basic set frame is received</Help>
</Value>
<Value type="byte" genre="config" instance="1" index="8" label="Power offline sound/light mode" value="6">
<Help>The index of the sound mode when the AlarmSound will start when it is unplugged</Help>
</Value>
<Value type="byte" genre="config" instance="1" index="9" label="Error sound/light mode" value="5">
<Help>The index of the sound mode when the AlarmSound will play when it is unable to reach the device in association group 2</Help>
</Value>
<Value type="byte" genre="config" instance="1" index="10" label="Sound/Light index 1" value="-1">
<Help>Params 10 until 27 are the values to configure the sound and light thtat are played when index 1 is selected</Help>
</Value>
<Value type="byte" genre="config" instance="1" index="28" label="Sound/Light index 2" value="-1">
<Help>Params 28 until 45 are the values to configure the sound and light thtat are played when index 2 is selected</Help>
</Value>
<Value type="byte" genre="config" instance="1" index="46" label="Sound/Light index 3" value="-1">
<Help>Params 46 until 63 are the values to configure the sound and light thtat are played when index 3 is selected</Help>
</Value>
<Value type="byte" genre="config" instance="1" index="64" label="Sound/Light index 4" value="-1">
<Help>Params 64 until 81 are the values to configure the sound and light thtat are played when index 4 is selected</Help>
</Value>
<Value type="byte" genre="config" instance="1" index="82" label="Sound/Light index 5" value="-1">
<Help>Params 82 until 99 are the values to configure the sound and light thtat are played when index 5 is selected</Help>
</Value>
<Value type="byte" genre="config" instance="1" index="100" label="Sound/Light index 6" value="-1">
<Help>Params 100 until 117 are the values to configure the sound and light thtat are played when index 6 is selected</Help>
</Value>
</CommandClass>
<!-- Association Groups -->
<CommandClass id="133">
<Associations num_groups="2">
<Group index="1" max_associations="1" label="Group 1" auto="false"/>
<Group index="2" max_associations="1" label="Group 2" auto="false"/>
</Associations>
</CommandClass>
</Product>

View file

@ -1,13 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Aeon Labs Door/Window Sensor -->
<Product xmlns='http://code.google.com/p/open-zwave/'>
<!-- Configuration Parameters not supported -->
<!-- Association Groups -->
<CommandClass id="133">
<!-- Information from http://www.pepper1.net/zwavedb/uploads/resources/1804efacf71a36402c53209c0991c04f20b31588.pdf -->
<!-- Or is original entry correct?: max_associations="5" label="Report" -->
<Associations num_groups="1">
<Group index="1" max_associations="6" label="Reports" auto="true"/>
</Associations>
</CommandClass>
<!-- Configuration -->
<CommandClass id="112">
<Value type="byte" genre="config" instance="1" index="1" label="Toggle the sensor binary report value when the Magnet switch is opened/closed." min="0" max="1" value="0">
<Help>0, Open: FF, Close: 00; 1, Open: 00, Close: FF
Default setting: 0
</Help>
</Value>
<Value type="byte" genre="config" instance="1" index="2" label="Enable wake up 10 minutes when the power is switched on." min="0" max="1" value="0">
<Help>0: Disable; 1: Enable
Default setting: 0
</Help>
</Value>
<Value type="byte" genre="config" instance="1" index="3" label="Toggle the basic set value when Magnet switch is opened/closed." min="0" max="1" value="0">
<Help>0, Open: FF, Close: 00; 1, Open: 00, Close: FF;
Default setting: 0
</Help>
</Value>
<Value type="int" genre="config" instance="1" index="121" label="Determines which report will be sent when Magnet switch is opened/ closed." min="0" max="1" value="256">
<Help>Which reports need to send automatically in timing intervals for group 1
Bitsets:
0 -> Battery report
4 -> Sensor Binary
8 -> Basic Set
Default setting: 0x00000100 (Basic Set)
</Help>
</Value>
<Value type="short" index="254" genre="config" label="Device Tag" units="" min="0" max="255" value="0">
<Help>Device Tag</Help>
</Value>
<Value type="button" index="255" genre="config" label="Reset configuration settings to factory defaults" write_only="true" value="0" >
<Help>Reset to factory defaults.</Help>
</Value>
</CommandClass>
<!-- Basic set as report -->
<CommandClass id="32" setasreport="true"/>
<!-- Association Groups -->
<CommandClass id="133">
<!-- Information from http://www.pepper1.net/zwavedb/uploads/resources/1804efacf71a36402c53209c0991c04f20b31588.pdf -->
<!-- Or is original entry correct?: max_associations="5" label="Report" -->
<Associations num_groups="1">
<Group index="1" max_associations="6" label="Reports" auto="true"/>
</Associations>
</CommandClass>
</Product>

View file

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<Product xmlns='http://code.google.com/p/open-zwave/'>
<CommandClass id="64" >
<Instance index="1" />
<Value type="list" genre="user" instance="1" index="0" label="Mode">
<Item label="Frost Protection" value="0" />
<Item label="Comfort" value="1" />
<Item label="Energy Saving" value="11" />
<Item label="Direct Valve Control" value="31" />
</Value>
<SupportedModes>
<Mode index="0" label="Frost Protection" />
<Mode index="1" label="Comfort" />
<Mode index="11" label="Energy Saving" />
<Mode index="31" label="Direct Valve Control" />
</SupportedModes>
</CommandClass>
<CommandClass id="67" base="0">
<Instance index="1" />
<Value type="int" genre="user" instance="1" index="1" label="Comfort setpoint" units="C" />
<Value type="int" genre="user" instance="1" index="11" label="Energy saving setpoint" units="C" />
<!-- <Value instance="1" index="7" action="remove" /> -->
</CommandClass>
</Product>

120
config/fibaro/fgfs101.xml Normal file
View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<Product xmlns='http://code.google.com/p/open-zwave/'>
<!-- Configuration -->
<CommandClass id="112">
<Value type="short" genre="config" instance="1" index="1" label="IN1 Alarm Cancellation Delay" min="0" max="3600" value="0">
<Help>Flood alarm cancellation delay. Additional delay after a flood alarm has ceased. The parameter allows you to specify additional time, after which the flood alarm is cancelled once its violation has ceased.</Help>
</Value>
<Value type="list" genre="config" instance="1" index="2" label="Acoustic and visual signals" value="3" size="1">
<Help>Acoustic and visual signals in case of flooding.</Help>
<Item label="Signals INACTIVE" value="0" />
<Item label="Acoustic INACTIVE, visual ACTIVE" value="1" />
<Item label="Acoustic ACTIVE, visual INACTIVE" value="2" />
<Item label="Acoustic ACTIVE, visual ACTIVE" value="3" />
</Value>
<Value type="list" genre="config" instance="1" index="5" label="Type of alarm frame for association group 1" value="255" size="1">
<Help>Type of alarm frame for association group 1, activated by flood sensor. The parameter allows to specify the type of alarm frame or to force transmission of control commands (BASIC_SET)</Help>
<Item label="ALARM WATER" value="0" />
<Item label="BASIC_SET" value="255" />
</Value>
<Value type="byte" genre="config" instance="1" index="7" label="Forced Level of Dimming group 1" min="1" max="255" value="255">
<Help>Value of the parameter specifying the forced level of dimming / opening sun blinds when comes "switch on" / "open" command to devices from association group no. 1.
In the case of alarm frames the alarm priority is specified. Possible parameter settings: (1 99) and 255. Value of 255 makes it possible to activate the device when using the Dimmer module it means activating the device and setting it to the previous stored condition, e.g. when Dimmer is set to 30%, then deactivated, and then reactivated using command 255, it will automatically be set to the previous condition, i.e. 30%.</Help>
</Value>
<Value type="list" genre="config" instance="1" index="9" label="Deactivate transmission of frame cancelling alarm" value="1" size="1">
<Help>Deactivating transmission of the frame cancelling the alarm or the control frame deactivating the device (Basic). It allows for disabling the deactivation function or the alarm cancellation function for devices associated with the appropriate input of the Fibaro Sensor. NOTE: Information concerning alarm violation or activation commands for devices from association groups are always sent.</Help>
<Item label="Alarm (flooding) cancellation INACTIVE" value="0" />
<Item label="Alarm (flooding) cancellation ACTIVE" value="1" />
</Value>
<Value type="short" genre="config" instance="1" index="10" label="Interval between successive readings of temperature sensors" min="1" max="65535" value="300">
<Help>Interval between successive readings of temperature from all sensors connected to the device in seconds. Note: taking temperature readings from the sensor does not result in sending a temperature condition report to the central hub.</Help>
</Value>
<Value type="short" genre="config" instance="1" index="12" label="Insensitiveness to temperature changes." min="1" max="1000" value="50">
<Help>Insensitiveness to temperature changes. This is the maximum acceptable difference between the last reported temperature and the current temperature taken from the sensor. If the temperatures differ by the set value or more, then a report with the current temperature value is sent to the device assigned to association group no. 3. Intervals between taking readings from sensors are specified by parameter no. 10.
Possible parameter settings:1 1000 [each 0.01oC] [0.01oC 10.00oC].</Help>
</Value>
<Value type="list" genre="config" instance="1" index="13" label="Transmitting the alarm or control frame broadcast mode" value="0" size="1">
<Help>Transmitting the alarm or control frame in "broadcast" mode (i.e. to all devices within range), information sent in this mode is not repeated by the mesh network. NOTE: If the broadcast mode of information transmission is activated for a given channel, then transmission of information in singlecast mode to devices assigned to the association group of this channel is deactivated.</Help>
<Item label="Broadcasts INACTIVE" value="0" />
<Item label="Flood ACTIVE, tamper INACTIVE" value="1" />
<Item label="Flood INACTIVE, tamper ACTIVE" value="2" />
<Item label="Flood ACTIVE, tamper ACTIVE" value="3" />
</Value>
<Value type="short" genre="config" instance="1" index="50" label="Low temperature alarm threshold." min="-10000" max="10000" value="1500">
<Help>The parameter stores a temperature value, below which LED indicator blinks with a colour determined by Parameter 61 settings. By default the LED indicator blinks blue.
Possible parameter settings:-10000 10000 [each 0.01oC] [-100oC 100oC].</Help>
</Value>
<Value type="short" genre="config" instance="1" index="51" label="High temperature alarm threshold." min="-10000" max="10000" value="3500">
<Help>The parameter stores a temperature value, above which LED indicator blinks with a colour determined by Parameter 62 settings. By default the LED indicator blinks red.
Possible parameter settings:-10000 10000 [each 0.01oC] [-100oC 100oC].</Help>
</Value>
<Value type="int" genre="config" instance="1" index="61" label="Low temperature alarm indicator colour." min="0" max="16777215" value="255">
<Help>The parameter stores RGB colour value.</Help>
</Value>
<Value type="int" genre="config" instance="1" index="62" label="High temperature alarm indicator colour." min="0" max="16777215" value="16711680">
<Help>The parameter stores RGB colour value.</Help>
</Value>
<Value type="list" genre="config" instance="1" index="63" label="Managing a LED indicator under standard operation." value="2" size="1">
<Help>Parameter determines LED indicator's operation. Set to 0 turns the indicator off, saving battery life.</Help>
<Item label="LED doesn't indicate temperature" value="0" />
<Item label="LED indicates temperature (blink) every Temperature Measurement Interval (Parameter 10, constant power + battery) or Wake Up Interval (battery)" value="1" />
<Item label="LED indicates temperature constantly, only in constant power mode." value="2" />
</Value>
<Value type="short" genre="config" instance="1" index="73" label="Temperature measurement compensation." min="-10000" max="10000" value="0">
<Help>Parameter stores a temperature value to be added to or deducted from the current temperature measured by the internal temperature sensor in order to compensate the difference between air temperature and the temperature at floor level.
Possible parameter settings:-10000 10000 [each 0.01oC] [-100oC 100oC].</Help>
</Value>
<Value type="list" genre="config" instance="1" index="74" label="Alarm frame sent to group 2 (tamper/tilt)." value="2" size="1">
<Help>The device is able to turn on alarms resulting from sensors vibrations, e.g. when the sensor is moved, or the TMP button is released. Group 2 association alarms are not cancelled.</Help>
<Item label="Tamper alarms INACTIVE" value="0" />
<Item label="Button tamper alarm ACTIVE" value="1" />
<Item label="Movement tamper alarm ACTIVE" value="2" />
<Item label="Button and movement tamper alarms ACTIVE" value="3" />
</Value>
<Value type="short" genre="config" instance="1" index="75" label="Visual and audible alarm duration" min="0" max="65535" value="0">
<Help>Parameter determines a time period after which alarm will become 'quiet' - still active but the device will go into battery saving mode. Visual or acoustic alarm will be reactivated after time period specified in Parameter 76. When alarm status ceases, alarm will be turned off immediately.
Value of 0 means visual and acoustic alarms are active indefinitely. In battery power mode the device will never go to sleep which may shorten battery life significantly.</Help>
</Value>
<Value type="short" genre="config" instance="1" index="76" label="Alarm frame/basic set frame retransmission time" min="0" max="65535" value="0">
<Help>Parameter determines a time period after which an alarm frame will be retransmitted.
Value of 0 cancels an alarm frame retransmission.</Help>
</Value>
<Value type="list" genre="config" instance="1" index="77" label="Flood sensor functionality turned off." value="0" size="1">
<Help>Allows for turning off the internal flood sensor. Tamper and internal temperature sensors will remain active.</Help>
<Item label="Default flood sensor operation (ACTIVE)" value="0" />
<Item label="Flood sensor INACTIVE" value="1" />
</Value>
</CommandClass>
<CommandClass id="96" mapping="endpoints" />
<!-- Association Groups -->
<CommandClass id="133">
<Associations num_groups="3">
<Group index="1" max_associations="5" label="Flood Alarm" auto="true"/>
<Group index="2" max_associations="5" label="Tamper Alarm" auto="true" />
<Group index="3" max_associations="5" label="Device Status" auto="true"/>
</Associations>
</CommandClass>
</Product>

82
config/fibaro/fgrm222.xml Normal file
View file

@ -0,0 +1,82 @@
<?xml version="1.0" encoding="utf-8"?>
<Product xmlns='http://code.google.com/p/open-zwave/'>
<!-- Configuration -->
<CommandClass id="112">
<Value type="list" genre="config" instance="1" index="1" label="Activate / deactivate functions ALL ON / ALL OFF" value="0" size="1">
<Help> </Help>
<Item label="ALL ON disabled/ ALL OFF disable - Default" value="0" />
<Item label="ALL ON disabled/ ALL OFF active" value="1" />
<Item label="ALL ON active / ALL OFF disabled" value="2" />
<Item label="ALL ON active / ALL OFF active" value="255" />
</Value>
<Value type="list" genre="config" instance="1" index="10" label="Turning off the shutter positioning function" value="0" size="1">
<Help> </Help>
<Item label="Turning on the shutter positioning function - Default" value="0"/>
<Item label="Turning off the shutter positioning function" value="1"/>
</Value>
<Value type="list" genre="config" instance="1" index="14" label="14. Inputs Button/Switch configuration" value="0" size="1">
<Help>Binary inputs type configuration</Help>
<Item label="Mono-stable switch (button) - Default" value="0"/>
<Item label="Bi-stable switch (switch)" value="1"/>
<Item label="Single Mono-stable switch" value="2"/>
</Value>
<Value type="byte" genre="config" instance="1" index="20" label="Saving the position Favourites" value="16" size="1">
<Help>Options for changing parameter 1-99, default 16</Help>
</Value>
<Value type="list" genre="config" instance="1" index="30" label="General Alarm, set for shutter no. 1" value="2" size="1">
<Help> </Help>
<Item label="DEACTIVATION - the device does not respond to alarm data frames" value="0"/>
<Item label="OPEN SHUTTER ALARM - the device closes the roller shutter after detecting an alarm" value="1"/>
<Item label="CLOSED SHUTTER ALARM - the device opens the roller shutter after detecting an alarm - Default" value="2"/>
</Value>
<Value type="list" genre="config" instance="1" index="31" label="Alarm of flooding with water, set for relay the shutter." value="0" size="1">
<Help> </Help>
<Item label="DEACTIVATION - the device does not respond to alarm data frames - Default" value="0"/>
<Item label="OPEN SHUTTER ALARM - the device closes the roller shutter after detecting an alarm" value="1"/>
<Item label="CLOSED SHUTTER ALARM - the device opens the roller shutter after detecting an alarm" value="2"/>
</Value>
<Value type="list" genre="config" instance="1" index="32" label="Smoke, CO, CO2 Alarm. Set for the roller shutter." value="1" size="1">
<Help> </Help>
<Item label="DEACTIVATION - the device does not respond to alarm data frames" value="0"/>
<Item label="OPEN SHUTTER ALARM - the device closes the roller shutter after detecting an alarm - Default" value="1"/>
<Item label="CLOSED SHUTTER ALARM - the device opens the roller shutter after detecting an alarm" value="2"/>
</Value>
<Value type="list" genre="config" instance="1" index="33" label="Temperature Alarm, set for roller shutter" value="1" size="1">
<Help> </Help>
<Item label="DEACTIVATION - the device does not respond to alarm data frames" value="0"/>
<Item label="OPEN SHUTTER ALARM - the device closes the roller shutter after detecting an alarm - Default" value="1"/>
<Item label="CLOSED SHUTTER ALARM - the device opens the roller shutter after detecting an alarm" value="2"/>
</Value>
<Value type="byte" genre="config" instance="1" index="41" label="Scene activation functionality" value="0" size="1">
<Help> Only valid for the 1.9 version of FGR221. The device offers the possibility of sending commands compatible with Command class scene activation. Information is sent to devices assigned to association group no. 3. Controllers such as Home Center 2 are able to interpret such commands and based on these commands they activate scenes, to which specific scene IDs have been assigned. The user may expand the functionality of the button connected to inputs S1 and S2 by distinguishing the actions of keys connected to those inputs. For example: double click would activate the scene goodnight and triple click would activate the scene morning.
</Help>
<Item label="Deactivation of functionality - Default" value="0"/>
<Item label="Activation of functionality" value="1"/>
</Value>
<Value type="list" genre="config" instance="1" index="29" label="Start Calibration" value="0" size="1">
<Help> Start a Calibration Cycle on the device</Help>
<Item label="No" value="0"/>
<Item label="Yes" value="1"/>
</Value>
</CommandClass>
<!--
<CommandClass id="96" mapping="endpoints" />
-->
<!-- Association Groups -->
<CommandClass id="133">
<Associations num_groups="3">
<Group index="1" max_associations="16" label="Group 1" auto="false"/>
<Group index="2" max_associations="16" label="Group 2" auto="false" />
<Group index="3" max_associations="1" label="Send updates" auto="true"/>
</Associations>
</CommandClass>
</Product>

144
config/fibaro/fgss101.xml Normal file
View file

@ -0,0 +1,144 @@
<?xml version="1.0" encoding="utf-8"?>
<Product xmlns='http://code.google.com/p/open-zwave/'>
<!-- Configuration -->
<CommandClass id="112">
<Value type="short" genre="config" instance="1" index="1" label="Smoke alarm cancellation delay" min="0" max="65535" value="0">
<Help>The time between when the smoke disappears and the Fibaro Smoke Sensor stops sending the alarm signal.
0: no delay, immediate cancellation,
65535: alarm cancellation inactive - Smoke Sensor will keep indicating smoke alarm after the smoke will have disappeared. The smoke alarm can be only ceased manually, by entering 2nd menu level (see section XIII).
Default setting: 0
</Help>
</Value>
<Value type="list" genre="config" instance="1" index="2" label="LED indicator and acoustic alarm turned ON / OFF at any alarm type" min="0" max="3" value="3" size="1">
<Help>Allows for deactivating the LED indicator and the acoustic alarm, in case of detecting an alarm of any type. This doesnt affect the communication with the Z-Wave network controller, i.e. the sensor will keep sending alarms, reports and all information to the associated devices. Modifying this parameter settings helps extending the battery life.</Help>
<Item label="Acoustic and visual alarms inactive" value="0" />
<Item label="Acoustic alarm inactive, visual alarm active" value="1" />
<Item label="Acoustic alarm active, visual alarm inactive" value="2" />
<Item label="Acoustic and visual alarms active" value="3" />
</Value>
<Value type="list" genre="config" instance="1" index="5" label="Type of alarm frame for association group 1" value="255" size="1">
<Help>Type of alarm frame for association group 1, activated by smoke sensor. The parameter allows to specify the type of alarm frame or to force transmission of control commands (BASIC_SET)</Help>
<Item label="ALARM SMOKE" value="0" />
<Item label="BASIC_SET" value="255" />
</Value>
<Value type="byte" genre="config" instance="1" index="7" label="Forced Level of Dimming group 1" min="1" max="255" value="255">
<Help>Value of the parameter specifying the forced level of dimming / opening sun blinds when comes "switch on" / "open" command to devices from association group no. 1.
In the case of alarm frames the alarm priority is specified. Possible parameter settings: (1 99) and 255. Value of 255 makes it possible to activate the device when using the Dimmer module it means activating the device and setting it to the previous stored condition, e.g. when Dimmer is set to 30%, then deactivated, and then reactivated using command 255, it will automatically be set to the previous condition, i.e. 30%.</Help>
</Value>
<Value type="short" genre="config" instance="1" index="10" label="Temperature report interval" min="1" max="17280" value="0">
<Help>Interval between successive readings of temperature from all sensors connected to the device in seconds. Note: taking temperature readings from the sensor does not result in sending a temperature condition report to the central hub.</Help>
</Value>
<Value type="short" genre="config" instance="1" index="12" label="Temperature report hysteresis" min="1" max="100" value="20">
<Help>The temperature report will only be sent if there is a difference in temperature value from the previous value reported, defined in this parameter (hysteresis).
Temparature reports can be also sent as a result of polling.
Available settings:0 100 (in 0,1C steps)
0 temperature change reporting inactive
Default setting: 20 (2C)
Possible parameter settings:1 - 1000 (0.01C - 10.00C)</Help>
</Value>
<Value type="list" genre="config" instance="1" index="13" label="Alarm broadcast" value="0" size="1">
<Help>Transmitting the alarm or control frame in "broadcast" mode (i.e. to all devices within range), information sent in this mode is not repeated by the mesh network. NOTE: If the broadcast mode of information transmission is activated for a given channel, then transmission of information in singlecast mode to devices assigned to the association group of this channel is deactivated.</Help>
<Item label="Broadcasts INACTIVE" value="0" />
<Item label="Smoke ACTIVE, tamper INACTIVE" value="1" />
<Item label="Smoke INACTIVE, tamper ACTIVE" value="2" />
<Item label="Smoke ACTIVE, tamper ACTIVE" value="3" />
</Value>
<Value type="short" genre="config" instance="1" index="73" label="Temperature measurement compensation" min="-10000" max="10000" value="0" size="2">
<Help>Parameter stores a temperature value to be added to or deducted from the current temperature measured by the internal temperature sensor in order to compensate the difference between air temperature and the temperature at floor level.
Possible parameter settings:-10000 - 10000 [each 0.01C] (-100C - 100C).</Help>
</Value>
<Value type="short" genre="config" instance="1" index="80" label="Z-Wave range test interval" value="1" min="0" max="144" size="1">
<Help>Time period between the consecutive Z-Wave network range tests.
In battery powering mode, Z-Wave network range test is carried out at the wake up
interval. The value of 0 turns off the Z-Wave range test, regardless of the powering mode chosen.
Available settings: 0 144 (10min multiplier) [10min-24h]
0 Z-Wave network range test inactive
Default setting: 1 (10min)
</Help>
</Value>
<Value type="short" genre="config" instance="1" index="81" label="Temperature alarm threshold" value="54" min="0" max="100" size="1">
<Help>Temperature value, measured by the built-in temperature sensor, above which the temperature alarm is sent.
Available settings: 0, 2 - 100
0: temperature alarm inactive.
2 - 100 (2 - 100C)
Default setting: 54 (54C)
</Help>
</Value>
<Value type="list" genre="config" instance="1" index="82" label="Smoke Sensor sensitivity" value="2" min="1" max="3" size="1">
<Help>There are 3 levels of sensitivity to smoke presence. Level 1 means the highest sensitivity.</Help>
<Item label="High" value="1" />
<Item label="Medium" value="2" />
<Item label="Low" value="3" />
</Value>
<Value type="list" genre="config" instance="1" index="83" label="Black Box sensitivity level" value="2" min="1" max="3" size="1">
<Help>This parameter allows for specifying the moment in which the Black Box starts recording data. After the specified smoke and temperature values will be exceeded, the Fibaro Smoke Sensors Black Box will record them.</Help>
<Item label="High" value="1" />
<Item label="Medium" value="2" />
<Item label="Low" value="3" />
</Value>
<Value type="byte" genre="config" instance="1" index="84" label="Malfunction alarm" value="10" min="0" max="255" size="1">
<Help>Time interval in which malfuntion alarm, if detected, is repeated using visual and acoustic alarms.
Available settings: 1 - 255 (100 ms multiplier) [100ms-25,5s]
Default setting: 10 (1s)</Help>
</Value>
<Value type="byte" genre="config" instance="1" index="85" label="Temperature alarm" value="5" min="0" max="255" size="1">
<Help>Time interval in which temperature alarm, if detected, is repeated using visual and acoustic alarms.
Available settings: 1 - 255 (100 ms multiplier) [100ms-25,5s]
Default setting: 10 (1s)</Help>
</Value>
<Value type="short" genre="config" instance="1" index="86" label="Lack of the Z-Wave range alarm" value="360" min="0" max="17280" size="2">
<Help>Time interval in which lack of the Z-Wave network alarm, if detected, is repeated using visual and acoustic alarms.
Available settings: 1 - 17280 (5s multiplier) [5s-24h]
Default setting: 360 (30min)</Help>
</Value>
<Value type="short" genre="config" instance="1" index="87" label="Low battery alarm" value="360" min="1" max="17280" size="2">
<Help>Time interval in which low battery alarm, if detected, is repeated using visual and acoustic alarms.
Available settings: 1 - 17280 (5s multiplier) [5s-24h]
Default setting: 360 (30min)</Help>
</Value>
<Value type="list" genre="config" instance="1" index="88" label="Consider temperature measurement compensation" value="0" size="1">
<Help>This parameter allows for specifying the moment in which the Black Box starts recording data. After the specified smoke and temperature values will be exceeded, the Fibaro Smoke Sensors Black Box will record them.</Help>
<Item label="Ignore temperature compensation" value="0" />
<Item label="Include temperature compensation" value="1" />
</Value>
<Value type="list" genre="config" instance="1" index="89" label="Tamper alarm" value="2" min="0" max="2" size="1">
<Help>default setting: tamper alarm active, with cancellation option available</Help>
<Item label="tamper alarm inactive" value="0" />
<Item label="tamper alarm active, with cancellation option available" value="1" />
<Item label="tamper alarm active, without cancellation option" value="2" />
</Value>
</CommandClass>
<!-- Basic set as report -->
<CommandClass id="32" setasreport="true"/>
<!-- Association Groups -->
<CommandClass id="133">
<Associations num_groups="3">
<Group index="1" max_associations="5" label="Smoke Alarm" auto="true"/>
<Group index="2" max_associations="5" label="Tamper Alarm" auto="true" />
<Group index="3" max_associations="1" label="Device Status" auto="true"/>
</Associations>
</CommandClass>
</Product>

View file

@ -1,6 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<Product xmlns='http://code.google.com/p/open-zwave/'>
<!-- COMMAND_CLASS_ALARM AlarmCmd_Get not supported -->
<CommandClass id="113" getsupported="false" />
<!-- COMMAND_CLASS_SWITCH_ALL SwitchAllCmd_Get not supported -->
<CommandClass id="39" getsupported="false" />
<!-- Configuration -->
<CommandClass id="112">
@ -63,7 +69,7 @@
<Item label="Cyclically change device state, each 1second" value="2" />
</Value>
<Value type="byte" genre="config" instance="1" index="39" label="39. Alarm duration" value="600" size="2">
<Value type="short" genre="config" instance="1" index="39" label="39. Alarm duration" value="600" size="2">
<Help>Wall Plug's alarm mode duration. If a device sending an alarm frame through the Z-Wave network sets alarm duration as well, this parameter's settings are ignored.</Help>
</Value>
@ -100,7 +106,7 @@
</Help>
</Value>
<Value type="byte" genre="config" instance="1" index="47" label="47. Time period between reports on power load and energy consumption." value="3600" size="2">
<Value type="short" genre="config" instance="1" index="47" label="47. Time period between reports on power load and energy consumption." value="3600" size="2">
<Help>Parameter defines time period between reports sent when changes
in power load have not been recorded. By default, if power load
changes have not been recorded, reports are sent every hour.
@ -115,11 +121,11 @@
<Item label="function inactive" value="1" />
</Value>
<Value type="byte" genre="config" instance="1" index="50" label="50. DOWN value" value="300" size="2">
<Value type="short" genre="config" instance="1" index="50" label="50. DOWN value" value="300" size="2">
<Help>Lower power threshold, used in parameter 52. Default setting: 300 (30 W) Available settings: 0 - 25 000 (0,0W - 2 500W) DOWN value cannot be higher than a value specified in parameter 51.</Help>
</Value>
<Value type="byte" genre="config" instance="1" index="51" label="51. UP value " value="500" size="2">
<Value type="short" genre="config" instance="1" index="51" label="51. UP value " value="500" size="2">
<Help>Upper power threshold, used in parameter 52. Default setting: 500 (50 W) Available settings: 1 - 25 000 (0,1W - 2 500W) UP value cannot be lower than a value specified in parameter 50.</Help>
</Value>
@ -156,7 +162,7 @@
</Value>
<Value type="byte" genre="config" instance="1" index="60" label="60. Power load, which when exceeded, makes the LED ring flash violet." value="25000" size="2">
<Value type="short" genre="config" instance="1" index="60" label="60. Power load, which when exceeded, makes the LED ring flash violet." value="25000" size="2">
<Help>Function is active only when parameter 61 is set to 0 or 1.Default setting: 25 000 (2 500W) Available settings: 1 000 - 32 000 (100W - 3200W).</Help>
</Value>
@ -215,7 +221,7 @@
<Item label="illumination turned off completely" value="9" />
</Value>
<Value type="byte" genre="config" instance="1" index="70" label="70. Oveload safety switch" value="65535" size="2">
<Value type="short" genre="config" instance="1" index="70" label="70. Oveload safety switch" value="65535" size="2">
<Help>This function allows for turning off the controlled device in case of exceeding the defined power. Controlled device will be turned off even if "always on" function is active (parameter 1).
Controlled device can be turned back on via B-button or sending a
control frame. By default this function is inactive.

View file

@ -60,6 +60,7 @@
</Manufacturer>
<Manufacturer id="008a" name="BeNext">
<Product type="0004" id="0100" name="Door Sensor" config="BeNext/DoorSensor.xml"/>
<Product type="0005" id="0101" name="Alarm Sound" config="BeNext/AlarmSound.xml"/>
<Product type="0006" id="0101" name="Energy Switch" config="BeNext/EnergySwitch.xml"/>
<Product type="0007" id="0101" name="Tag Reader" config="BeNext/TagReader.xml"/>
<Product type="0008" id="0101" name="Power Switch"/>
@ -118,6 +119,9 @@
</Manufacturer>
<Manufacturer id="0035" name="Embedit A/S">
</Manufacturer>
<Manufacturer id="0148" name="EUROtronic">
<Product type="0001" id="0001" name="EUR_STELLAZ Wall Radiator Thermostat Valve Control" config="eurotronic/eur_stellaz.xml"/>
</Manufacturer>
<Manufacturer id="0060" name="Everspring">
<Product type="0003" id="0001" name="AD142 Plug-in Dimmer Module"/>
<Product type="0104" id="0001" name="AN145 Lamp Screw In Module" config="everspring/an145.xml"/>
@ -152,10 +156,12 @@
<Product type="0100" id="0104" name="FGD211 Universal Dimmer 500W" />
<Product type="0100" id="0107" name="FGD211 Universal Dimmer 500W" config="fibaro/fgd211.xml" />
<Product type="0100" id="0109" name="FGD211 Universal Dimmer 500W" config="fibaro/fgd211.xml" />
<Product type="0100" id="100a" name="FGD211 Universal Dimmer 500W" config="fibaro/fgd211.xml" />
<Product type="0700" id="1000" name="FGK101 Door Opening Sensor" config="fibaro/fgk001.xml" />
<Product type="0300" id="100a" name="FGR221 Roller Shutter Controller" config="fibaro/fgr221.xml"/>
<Product type="0300" id="0106" name="FGR221 Roller Shutter Controller" config="fibaro/fgr221.xml"/>
<Product type="0300" id="0107" name="FGR221 Roller Shutter Controller" config="fibaro/fgr221.xml"/>
<Product type="0301" id="1001" name="FGRM222 Roller Shutter Controller 2" config="fibaro/fgrm222.xml"/>
<Product type="0400" id="0104" name="FGS211 Switch 3kW" config="fibaro/fgs211.xml" />
<Product type="0400" id="0105" name="FGS211 Switch 3kW" config="fibaro/fgs211.xml" />
<Product type="0400" id="0106" name="FGS211 Switch 3kW" config="fibaro/fgs211.xml" />
@ -170,8 +176,10 @@
<Product type="0200" id="0109" name="FGS221 Double Relay Switch 2x1.5kW" config="fibaro/fgs221.xml" />
<Product type="0200" id="100a" name="FGS221 Double Relay Switch 2x1.5kW" config="fibaro/fgs221.xml" />
<Product type="0600" id="1000" name="FGWPE Wall Plug" config="fibaro/fgwpe.xml" />
<Product type="0900" id="1000" name="FGRGBWM441 RGBW Controller" config="fibaro/fgrgbwm441.xml" />
</Manufacturer>
<Product type="0b00" id="3001" name="FGFS101 Flood Sensor" config ="fibaro/fgfs101.xml" />
<Product type="0900" id="1000" name="FGRGBWM441 RGBW Controller" config="fibaro/fgrgbwm441.xml" />
<Product type="0c00" id="1000" name="FGSS101 Smoke Sensor" config="fibaro/fgss101.xml" />
</Manufacturer>
<Manufacturer id="0037" name="Foard Sys">
</Manufacturer>
<Manufacturer id="0110" name="Frostdale">
@ -205,6 +213,7 @@
<Manufacturer id="001e" name="Homeseer">
<Product type="0001" id="0002" name="ZTroller" config="homeseer/ztroller.xml"/>
<Product type="0002" id="0001" name="HSM100 Wireless Multi-Sensor" config="homeseer/hsm100.xml"/>
<Product type="0002" id="0002" name="EZMotion+ 3-in-1 Sensor" config="homeseer/hsm100.xml"/>
</Manufacturer>
<Manufacturer id="0039" name="Honeywell">
<Product type="0011" id="0001" name="TH8320ZW1000 Touchscreen Thermostat" config="honeywell/th8320zw1000.xml"/>
@ -312,6 +321,9 @@
</Manufacturer>
<Manufacturer id="0041" name="OpenPeak Inc.">
</Manufacturer>
<Manufacturer id="013c" name="Philio Technology Corporation">
<Product type="0001" id="0004" name="In Wall Dual Relay (1 Way) Switch Module (PAN06-1)" />
</Manufacturer>
<Manufacturer id="0064" name="Popp / Duwi">
<Product type="0001" id="0000" name="ZW EDAN 300 Flush Mounted Dimmer" />
<Product type="1001" id="0000" name="Plugin Dimmer" />
@ -319,6 +331,7 @@
<Product type="3001" id="0000" name="ZW ZS 3500 Plugin Switch" />
<Product type="3002" id="0000" name="ZW ZSA 3500 Plugin Switch" />
<Product type="4001" id="0000" name="ZW ESJ Blind Control" />
<Product type="5002" id="0000" name="Wireless Flush Mounted Switch" />
</Manufacturer>
<Manufacturer id="0016" name="PowerLynx">
</Manufacturer>
@ -332,6 +345,7 @@
</Manufacturer>
<Manufacturer id="5254" name="Remotec">
<Product type="0000" id="531f" name="Z-URC" config="remotec/zurc.xml"/>
<Product type="0101" id="8377" name="ZXT-120" config="remotec/zxt-120.xml" />
</Manufacturer>
<Manufacturer id="0010" name="RCS">
<Product type="0001" id="0002" name="TZ43 Thermostat" />
@ -407,6 +421,7 @@
<Product type="0007" id="0020" name="WDTC-20 Thermostat" config="waynedalton/WDTC-20.xml"/>
</Manufacturer>
<Manufacturer id="0118" name="Wenzhou TKB Control System">
<Product type="0001" id="0001" name="TZ88 Smart Energy Plug-in Switch" config="wenzhou/tz88.xml"/>
</Manufacturer>
<Manufacturer id="004c" name="Woodward Labs">
</Manufacturer>
@ -419,9 +434,12 @@
<Manufacturer id="0000" name="Zensys">
<Product type="0001" id="0001" name="Controller"/>
</Manufacturer>
<Manufacturer id="0109" name="Vision">
<Product type="1001" id="0101" name="Z-Wave USB Stick"/>
</Manufacturer>
<Manufacturer id="0115" name="Z-Wave.Me">
<Product type="1000" id="0002" name="ZME_06433 Wall Flush-Mountable Dimmer" config="zwave.me/ZME_06433.xml"/>
<Product type="1000" id="0003" name="ZME_06435 Motor Control"/>
<Product type="1000" id="0003" name="ZME_06436 Motor Control" config="zwave.me/ZME_06436.xml" />
<Product type="1000" id="0004" name="ZME_064435 Wall Controller"/>
<Product type="0100" id="0001" name="ZME_KFOB 4 Button Key Fob" config="zwave.me/kfob.xml"/>
<Product type="1000" id="0001" name="ZME_054313Z Flush-Mountable Switch" />

View file

@ -4,6 +4,6 @@
<Option name="logging" value="true" />
<Option name="Associate" value="true" />
<Option name="NotifyTransactions" value="false" />
<Option name="DriverMaxAttempts" value="0" />
<Option name="DriverMaxAttempts" value="5" />
<Option name="SaveConfiguration" value="true" />
</Options>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Product xmlns='http://code.google.com/p/open-zwave/'>
<!-- This thermostat's setpoint descriptions are 0 based, not 1 -->
<CommandClass id="67" base="0" />
</Product>

13
config/wenzhou/tz88.xml Normal file
View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Product xmlns='http://code.google.com/p/open-zwave/'>
<!-- Configuration -->
<CommandClass id="112">
<Value type="byte" genre="config" instance="1" index="1" label="Watt meter report period" min="1" max="32767" units="5 sec" value="1">
<Help>If the setting is configured for 1 hour (value=720), the TZ88 will report its instant power consumption every 1 hour.</Help>
</Value>
<Value type="byte" genre="config" instance="1" index="2" label="kWh meter report period" min="1" max="32767" units="10 min" value="6">
<Help>If the setting is configured for 1 hour (value=6), the TZ88 will report its accumulated power consumption (kWh) every 1 hour.</Help>
</Value>
</CommandClass>
</Product>

View file

@ -0,0 +1,97 @@
<?xml version="1.0" encoding="utf-8"?>
<!--Taken from http://en.z-wave.me/docs/ZME_0643x_UserManual.pdf-->
<Product xmlns='http://code.google.com/p/open-zwave/'>
<!-- Configuration Parameters -->
<!--IMPORTANT: Controllers may only allow to configure signed values.
In order to set values in the range 128?255 for parameters 4, 5 and 6 the
value sent in the application shall be the desired value minus 256.
For example: to set parameter 4 in Window Blind to 200? sit may be needed
to set a value of 200?256=?56.
Similar rule applies to parameter 2: to set values in range 32768?65535
use value equal to desired value minus 65536. For example, to set auto
switch off period to 10 hours =36000s it may be needed to set a value
36000?65536=?29536.-->
<CommandClass id="112">
<Value type="list" index="1" genre="config" label="Set LED indication mode" units="" min="1" max="99" value="3" size="1">
<Item label="Disabled" value="0" />
<Item label="Show switch/dimmer state / when in motion or inactive (for blinds)" value="1" />
<Item label="Night mode (inverted switch state)" value="2" />
<Item label="Operated by Indicator Command Class (default)" value="3" />
<Item label="Show if not closed (for blinds only)" value="4" />
</Value>
<Value type="int" index="2" genre="config" label="Automatically open or close after" units="seconds" min="0" max="65535" value="0">
<Help>If not zero, automatically switch off/close blind after a user defined time</Help>
</Value>
<Value type="list" index="3" genre="config" label="What to do on RF off command" value="0" size="1">
<Help>If not zero, automatically switch off/close blind after a user defined time</Help>
<Item label="Switch off (default)" value="0" />
<Item label="Ignore" value="1" />
<Item label="Switch on" value="2" />
</Value>
<Value type="byte" index="4" genre="config" label="Full close time" units="Second" min="0" max="255" value="60" size="1">
<Help>Time to go from opened to closed state. Used to estimate the current level. Note that in Permanent motion mode the reported value would a be Closed or Opened, while all Basic and Multilevel Set values (1-99, 255) would Open except 0 value that would Close.</Help>
</Value>
<Value type="byte" index="5" genre="config" label="Full open time" units="Second" min="0" max="255" value="60" size="1">
<Help>Time to go from closed to open state. This value may differ from Full close time for some blinds due to gravity. Used to estimate the current level. Note that in Permanent motion mode the reported value would a be Closed or Opened, while all Basic and Multilevel Set values (1-99, 255) would Open except 0 value that would Close.</Help>
</Value>
<Value type="byte" index="6" genre="config" label="Node Id of the blocking device" min="0" max="232" value="0">
<Help>Id of the device which commands would be interpreted not as Open/Close, but as block/unblock. Usefull with door opening detector: if the door is open, block the blind not to break shades while they move.</Help>
</Value>
<Value type="list" index="7" genre="config" label="On which command from blocking node to enable the protection" min="0" max="1" value="0" size="1">
<Help>Defines which command from blocking device to interpret as closed door and hence, unprotected.</Help>
<Item label="on On (default)" value="0" />
<Item label="on Off" value="1" />
</Value>
<Value type="list" index="8" genre="config" label="Stop or Revert if opposite button is pressed" units="" min="0" max="2" value="0">
<Help>Defines behaviour on open press while closing and vice versa. To allow Stop behavior when switched by remote, use Stop by Basic</Help>
<Item label="Stop (by buttons and Binary) (Default)" value="0" />
<Item label="Stop (by buttons, Binary and Basic)" value="1" />
<Item label="Revert" value="2" />
</Value>
<Value type="list" index="9" genre="config" label="Invert open and close relays" units="" min="0" max="1" value="0">
<Help>Allow exchanging open and close relays if blind control is wired to the motor incorrectly</Help>
<Item label="No (default)" value="0" />
<Item label="Yes" value="1" />
</Value>
<Value type="byte" index="10" genre="config" label="Typical click timeout" units="x 10 milliseconds" min="1" max="100" value="50">
<Help>Typical time used to differentiate click, hold, double and triple clicks.</Help>
</Value>
<Value type="list" index="11" genre="config" label="Invert buttons" value="0" size="1">
<Item label="No default)" value="0" />
<Item label="Yes" value="1" />
</Value>
<Value type="list" index="12" genre="config" label="Switch by buttons" value="1" size="1">
<Help>If disabled, the local operations by buttons will not switch the load, but only send commands to On/Off association group. In this mode buttons are not linked with the switch anymore. They can be used separately: buttons to control remote device, switch will operate by RF commands only. </Help>
<Item label="No" value="0" />
<Item label="By single press and hold (default)" value="1" />
<Item label="By double press and hold" value="1" />
</Value>
<Value type="list" index="13" genre="config" label="Action on button single press or hold" value="1" size="1">
<Help>Defines which command should be sent on button single press or hold. Basic commands are sent to Association group. Switch All commands are sent broadcast. </Help>
<Item label="Disabled" value="0" />
<Item label="Switch On, Off and dim using Basic Set(default)" value="1" />
<Item label="Switch All On/Off" value="1" />
</Value>
<Value type="list" index="13" genre="config" label="Action on button double press or hold" value="0" size="1">
<Help>Defines which command should be sent on button double press or press-hold. Basic commands are sent to Association group. Switch All commands are sent broadcast. If not disabled, the device will wait for a click timeout to see if the second click would be pressed. This will introduce a small delay for single click commands.</Help>
<Item label="Disabled (don't wait for double click,default)" value="0" />
<Item label="Switch On, Off and dim using Basic Set" value="1" />
<Item label="Switch All On/Off" value="1" />
</Value>
<Value type="list" index="15" genre="config" label="Send the following Switch All commands" value="1" size="1">
<Item label="Switch All Off only (default)" value="1" />
<Item label="Switch All On only" value="1" />
<Item label="Switch All On and Off" value="255" />
</Value>
</CommandClass>
<!-- Association Groups -->
<CommandClass id="133">
<Associations num_groups="3">
<Group index="1" max_associations="8" label="Group 1" auto="false"/>
<Group index="2" max_associations="8" label="Group 2" auto="false" />
<Group index="3" max_associations="8" label="Send updates" auto="true"/>
</Associations>
</CommandClass>
</Product>

191
cpp/build/Makefile Normal file
View file

@ -0,0 +1,191 @@
#
# Makefile for OpenZWave Linux build
# Greg Satz
# GNU make only
# Linux requires libudev-dev
# FreeBSD requires port misc/e2fsprogs-libuuid
#these variables can be modified by the user if needed
# what flags we will use for compiling in debug mode
DEBUG_CFLAGS := -Wall -Wno-unknown-pragmas -Wno-inline -Wno-format -Werror -g -DDEBUG -fPIC -DSYSCONFDIR="\"$(PREFIX)/etc/openzwave/\""
# what flags we will use for compiling in release mode
RELEASE_CFLAGS := -Wall -Wno-unknown-pragmas -Werror -Wno-format -O3 -DNDEBUG -fPIC -DSYSCONFDIR="\"$(PREFIX)/etc/openzwave/\""
#what flags we will use for linking in debug mode
DEBUG_LDFLAGS := -g
top_srcdir := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))../../)
include $(top_srcdir)/cpp/build/support.mk
#if we are on a Mac, add these flags and libs to the compile and link phases
ifeq ($(UNAME),Darwin)
CFLAGS += -c -DDARWIN -arch i386 -arch x86_64
LDFLAGS += -arch i386 -arch x86_64
LIBS += -framework IOKit -framework CoreFoundation -arch i386 -arch x86_64
else ifeq ($(UNAME),FreeBSD)
CFLAGS += -I/usr/local/include
else
LDFLAGS += -Wl,-soname,libopenzwave.so.$(VERSION)
LIBS += -ludev
endif
#where to put the temporary library
LIBDIR ?= $(top_builddir)
INCLUDES := -I $(top_srcdir)/cpp/src -I $(top_srcdir)/cpp/src/command_classes/ -I $(top_srcdir)/cpp/src/value_classes/ \
-I $(top_srcdir)/cpp/src/platform/ -I $(top_srcdir)/cpp/src/platform/unix -I $(top_srcdir)/cpp/tinyxml/ -I $(top_srcdir)/cpp/hidapi/hidapi/
ifeq ($(UNAME),Darwin)
SOURCES_HIDAPI =$(top_srcdir)/cpp/hidapi/mac
else ifeq ($(UNAME),FreeBSD)
SOURCES_HIDAPI =$(top_srcdir)/cpp/hidapi/libusb
else
SOURCES_HIDAPI =$(top_srcdir)/cpp/hidapi/linux
endif
SOURCES := $(top_srcdir)/cpp/src $(top_srcdir)/cpp/src/command_classes $(top_srcdir)/cpp/tinyxml \
$(top_srcdir)/cpp/src/value_classes $(top_srcdir)/cpp/src/platform $(top_srcdir)/cpp/src/platform/unix $(SOURCES_HIDAPI)
VPATH = $(top_srcdir)/cpp/src:$(top_srcdir)/cpp/src/command_classes:$(top_srcdir)/cpp/tinyxml:\
$(top_srcdir)/cpp/src/value_classes:$(top_srcdir)/cpp/src/platform:$(top_srcdir)/cpp/src/platform/unix:$(SOURCES_HIDAPI)
tinyxml := $(notdir $(wildcard $(top_srcdir)/cpp/tinyxml/*.cpp))
ifeq ($(UNAME),Darwin)
hidapi := $(notdir $(wildcard $(top_srcdir)/cpp/hidapi/mac/*.c))
else ifeq ($(UNAME),FreeBSD)
hidapi := $(notdir $(wildcard $(top_srcdir)/cpp/hidapi/libusb/*.c))
else
hidapi := $(notdir $(wildcard $(top_srcdir)/cpp/hidapi/linux/*.c)) # we do not want the libusb version
endif
cclasses := $(notdir $(wildcard $(top_srcdir)/cpp/src/command_classes/*.cpp))
vclasses := $(notdir $(wildcard $(top_srcdir)/cpp/src/value_classes/*.cpp))
pform := $(notdir $(wildcard $(top_srcdir)/cpp/src/platform/*.cpp)) \
$(notdir $(wildcard $(top_srcdir)/cpp/src/platform/unix/*.cpp))
indep := $(notdir $(filter-out $(top_srcdir)/cpp/src/vers.cpp, $(wildcard $(top_srcdir)/cpp/src/*.cpp)))
default: $(LIBDIR)/libopenzwave.a $(LIBDIR)/libopenzwave.so.$(VERSION)
clean:
@rm -rf $(DEPDIR) $(OBJDIR) $(LIBDIR)/libopenzwave.so* $(LIBDIR)/libopenzwave.a $(top_builddir)/libopenzwave.pc $(top_builddir)/docs/api $(top_builddir)/Doxyfile
ifeq ($(XMLLINT),)
xmltest: $(XMLLINT)
$(error xmllint command not found.)
else
xmltest: $(XMLLINT)
@$(XMLLINT) --noout --schema ../../config/device_classes.xsd ../../config/device_classes.xml
@$(XMLLINT) --noout --schema ../../config/options.xsd ../../config/options.xml
@$(XMLLINT) --noout --schema ../../config/manufacturer_specific.xsd ../../config/manufacturer_specific.xml
@$(XMLLINT) --noout --schema ../../config/device_configuration.xsd ../../config/*/*.xml
endif
-include $(patsubst %.cpp,$(DEPDIR)/%.d,$(tinyxml))
-include $(patsubst %.c,$(DEPDIR)/%.d,$(hidapi))
-include $(patsubst %.cpp,$(DEPDIR)/%.d,$(cclasses))
-include $(patsubst %.cpp,$(DEPDIR)/%.d,$(vclasses))
-include $(patsubst %.cpp,$(DEPDIR)/%.d,$(pform))
-include $(patsubst %.cpp,$(DEPDIR)/%.d,$(indep))
#create a vers.cpp file that contains our version and subversion revisions
$(top_srcdir)/cpp/src/vers.cpp:
@echo "Creating $(top_srcdir)/cpp/src/vers.cpp file"
@echo '#include "Defs.h"' > $(top_srcdir)/cpp/src/vers.cpp
@echo 'uint16_t ozw_vers_major = $(VERSION_MAJ);' >> $(top_srcdir)/cpp/src/vers.cpp
@echo 'uint16_t ozw_vers_minor = $(VERSION_MIN);' >> $(top_srcdir)/cpp/src/vers.cpp
@echo 'uint16_t ozw_vers_revision = $(VERSION_REV);' >> $(top_srcdir)/cpp/src/vers.cpp
#$(OBJDIR)/vers.o: $(top_builddir)/vers.cpp
$(LIBDIR)/libopenzwave.a: $(patsubst %.cpp,$(OBJDIR)/%.o,$(tinyxml)) \
$(patsubst %.c,$(OBJDIR)/%.o,$(hidapi)) \
$(patsubst %.cpp,$(OBJDIR)/%.o,$(cclasses)) \
$(patsubst %.cpp,$(OBJDIR)/%.o,$(vclasses)) \
$(patsubst %.cpp,$(OBJDIR)/%.o,$(pform)) \
$(patsubst %.cpp,$(OBJDIR)/%.o,$(indep)) \
$(OBJDIR)/vers.o
@echo "Linking Static Library"
@$(AR) $@ $+
@$(RANLIB) $@
$(LIBDIR)/libopenzwave.so.$(VERSION): $(patsubst %.cpp,$(OBJDIR)/%.o,$(tinyxml)) \
$(patsubst %.c,$(OBJDIR)/%.o,$(hidapi)) \
$(patsubst %.cpp,$(OBJDIR)/%.o,$(cclasses)) \
$(patsubst %.cpp,$(OBJDIR)/%.o,$(vclasses)) \
$(patsubst %.cpp,$(OBJDIR)/%.o,$(pform)) \
$(patsubst %.cpp,$(OBJDIR)/%.o,$(indep)) \
$(OBJDIR)/vers.o
@echo "Linking Shared Library"
@$(LD) $(LDFLAGS) -shared -o $@ $+ $(LIBS)
@ln -sf libopenzwave.so.$(VERSION) $(LIBDIR)/libopenzwave.so
ifeq ($(PKGCONFIG),)
$(top_builddir)/libopenzwave.pc: $(top_srcdir)/cpp/build/libopenzwave.pc.in
$(warning Not Installing Package Config File)
else
$(top_builddir)/libopenzwave.pc: $(top_srcdir)/cpp/build/libopenzwave.pc.in $(PKGCONFIG)
@echo "Making libopenzwave pkg-config file"
@$(SED) \
-e 's|[@]prefix@|$(PREFIX)|g' \
-e 's|[@]exec_prefix@|$(PREFIX)/bin|g' \
-e 's|[@]libdir@|$(instlibdir)|g' \
-e 's|[@]includedir@|$(PREFIX)/include/openzwave/|g' \
-e 's|[@]VERSION@|$(VERSION)|g' \
< "$<" > "$@"
endif
$(top_builddir)/Doxyfile: $(top_srcdir)/docs/Doxyfile.in
@mkdir -p $(top_builddir)/docs/api/
@$(SED) \
-e 's|[@]OUTPUT_DIR@|$(top_builddir)/docs/api/|g' \
-e 's|[@]TOPSRC_DIR@|$(top_srcdir)|g' \
< "$<" > "$@"
ifeq ($(DOXYGEN),)
doc:
$(warning Documentation not being built)
else
doc: $(top_builddir)/Doxyfile
@echo "Creating Documentation at $(top_builddir)/docs/api/"
@mkdir -p $(top_builddir)/docs/api/
@cd $(top_builddir); $(DOXYGEN)
endif
install: $(LIBDIR)/libopenzwave.so.$(VERSION) doc $(top_builddir)/libopenzwave.pc
install -d $(DESTDIR)/$(instlibdir)/
cp $(LIBDIR)/libopenzwave.so.$(VERSION) $(DESTDIR)/$(instlibdir)/libopenzwave.so.$(VERSION)
ln -sf libopenzwave.so.$(VERSION) $(DESTDIR)/$(instlibdir)/libopenzwave.so
install -d $(DESTDIR)/$(includedir)
install -m 0644 $(top_srcdir)/cpp/src/*.h $(DESTDIR)/$(includedir)
install -d $(DESTDIR)/$(includedir)/command_classes/
install -m 0644 $(top_srcdir)/cpp/src/command_classes/*.h $(DESTDIR)/$(includedir)/command_classes/
install -d $(DESTDIR)/$(includedir)/value_classes/
install -m 0644 $(top_srcdir)/cpp/src/value_classes/*.h $(DESTDIR)/$(includedir)/value_classes/
install -d $(DESTDIR)/$(includedir)/platform/
install -m 0644 $(top_srcdir)/cpp/src/platform/*.h $(DESTDIR)/$(includedir)/platform/
install -d $(DESTDIR)/$(includedir)/platform/unix/
install -m 0644 $(top_srcdir)/cpp/src/platform/unix/*.h $(DESTDIR)/$(includedir)/platform/unix/
install -d $(DESTDIR)/$(sysconfdir)/
cp -r $(top_srcdir)/config/* $(DESTDIR)/$(sysconfdir)
install -d $(DESTDIR)/$(docdir)/
cp -r $(top_srcdir)/docs/* $(DESTDIR)/$(docdir)
if [ -d "$(top_builddir)/docs/html/" ]; then cp -r $(top_builddir)/docs/html/* $(DESTDIR)/$(docdir); fi
install -d $(DESTDIR)/$(instlibdir)/pkgconfig/
if [ -f "$(PKGCONFIG)" ]; then install -d $(DESTDIR)/$(instlibdir)/pkgconfig/; cp $(top_builddir)/libopenzwave.pc $(DESTDIR)/$(instlibdir)/pkgconfig/; fi
.SUFFIXES: .d .cpp .o .a
.PHONY: default clean install doc

View file

@ -0,0 +1,11 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: libopenzwave
Description: A Open Source implementation of the ZWave Serial API
URL: http://www.openzwave.org/
Version: @VERSION@
Libs: -L${libdir} -lopenzwave
Cflags: -I${includedir} -I${includedir}/command_classes/ -I${includedir}/value_classes/ -I${includedir}/platform/

View file

@ -1,101 +0,0 @@
#
# Makefile for OpenZWave Linux build
# Greg Satz
# GNU make only
# Requires libudev-dev
.SUFFIXES: .d .cpp .o .a
.PHONY: default clean verscheck
CC := $(CROSS_COMPILE)gcc
CXX := $(CROSS_COMPILE)g++
LD := $(CROSS_COMPILE)g++
AR := $(CROSS_COMPILE)ar rc
RANLIB := $(CROSS_COMPILE)ranlib
DEBUG_CFLAGS := -Wall -Wno-unknown-pragmas -Wno-inline -Wno-format -Werror -g -DDEBUG -DLOG_STDERR -fPIC
RELEASE_CFLAGS := -Wall -Wno-unknown-pragmas -Werror -Wno-format -O3 -DNDEBUG -fPIC
DEBUG_LDFLAGS := -g
# Change for DEBUG or RELEASE
CFLAGS := -c $(DEBUG_CFLAGS)
LDFLAGS := $(DEBUG_LDFLAGS)
LIBDIR := ../../lib/linux
INCLUDES := -I ../../src -I ../../src/command_classes/ -I ../../src/value_classes/ \
-I ../../src/platform/ -I ../../src/platform/unix -I ../../tinyxml/ -I ../../hidapi/hidapi/
SOURCES := ../../src ../../src/command_classes ../../tinyxml ../../hidapi/linux \
../../src/value_classes ../../src/platform ../../src/platform/unix
VPATH = ../../src:../../src/command_classes:../../tinyxml:../../hidapi/linux:\
../../src/value_classes:../../src/platform:../../src/platform/unix
%.d : %.cpp
@set -e; rm -f $@; \
$(CXX) -MM $(INCLUDES) $< > $@.$$$$; \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
tinyxml := $(notdir $(wildcard ../../tinyxml/*.cpp))
hidapi := $(notdir $(wildcard ../../hidapi/linux/hid.c)) # we do not want the libusb version
cclasses := $(notdir $(wildcard ../../src/command_classes/*.cpp))
vclasses := $(notdir $(wildcard ../../src/value_classes/*.cpp))
pform := $(notdir $(wildcard ../../src/platform/*.cpp)) \
$(notdir $(wildcard ../../src/platform/unix/*.cpp))
indep := $(notdir $(wildcard ../../src/*.cpp))
%.o : %.cpp
$(CXX) $(CFLAGS) $(INCLUDES) -o $@ $<
%.o : %.c
$(CC) $(CFLAGS) $(INCLUDES) -o $@ $<
default: $(LIBDIR)/libopenzwave.a $(LIBDIR)/libopenzwave.so
clean:
rm -f *.d *.d.* *.o vers.c
XMLLINT := $(shell which xmllint)
ifeq ($(XMLLINT),)
xmltest: $(XMLLINT)
$(error xmllint command not found.)
else
xmltest: $(XMLLINT)
@$(XMLLINT) --noout --schema ../../../config/device_classes.xsd ../../../config/device_classes.xml
@$(XMLLINT) --noout --schema ../../../config/options.xsd ../../../config/options.xml
@$(XMLLINT) --noout --schema ../../../config/manufacturer_specific.xsd ../../../config/manufacturer_specific.xml
@$(XMLLINT) --noout --schema ../../../config/device_configuration.xsd ../../../config/*/*.xml
endif
-include $(tinyxml:.cpp=.d)
-include $(hidapi:.c=.d)
-include $(cclasses:.cpp=.d)
-include $(vclasses:.cpp=.d)
-include $(pform:.cpp=.d)
-include $(indep:.cpp=.d)
vers.c: verscheck
echo 'char ozw_vers[] = "OpenZWave version 1.0.'`svnversion ../..`'";' > vers.c
vers.o: vers.c
$(LIBDIR)/libopenzwave.a: $(patsubst %.cpp,%.o,$(tinyxml)) \
$(patsubst %.c,%.o,$(hidapi)) \
$(patsubst %.cpp,%.o,$(cclasses)) \
$(patsubst %.cpp,%.o,$(vclasses)) \
$(patsubst %.cpp,%.o,$(pform)) \
$(patsubst %.cpp,%.o,$(indep)) vers.o
$(AR) $@ $?
$(LIBDIR)/libopenzwave.so: $(patsubst %.cpp,%.o,$(tinyxml)) \
$(patsubst %.c,%.o,$(hidapi)) \
$(patsubst %.cpp,%.o,$(cclasses)) \
$(patsubst %.cpp,%.o,$(vclasses)) \
$(patsubst %.cpp,%.o,$(pform)) \
$(patsubst %.cpp,%.o,$(indep)) vers.o
$(LD) -shared -Wl,-soname,libopenzwave.so -o $@ $+

View file

@ -1,102 +0,0 @@
#
# Makefile for OpenZWave Mac OS X build
# Greg Satz
# GNU make only
.SUFFIXES: .d .cpp .o .a
.PHONY: default clean verscheck
CC := gcc
CXX := g++
LD := g++
AR := ar crc
RANLIB := ranlib
DEBUG_CFLAGS := -Wall -Wno-unknown-pragmas -Wno-inline -Werror -Wno-format -g -DDEBUG -DLOG_STDERR -fPIC
RELEASE_CFLAGS := -Wall -Wno-unknown-pragmas -Werror -Wno-format -O3 -DNDEBUG -fPIC
DEBUG_LDFLAGS := -g
# Change for DEBUG or RELEASE
ARCH := -arch i386 -arch x86_64
CFLAGS := -c -DDARWIN $(ARCH) $(DEBUG_CFLAGS)
LDFLAGS := $(DEBUG_LDFLAGS) $(ARCH)
LIBDIR := ../../lib/mac
INCLUDES := -I ../../src -I ../../src/command_classes/ -I ../../src/value_classes/ \
-I ../../src/platform/ -I ../../src/platform/unix -I ../../tinyxml/ -I ../../hidapi/hidapi/
SOURCES := ../../src ../../src/command_classes ../../tinyxml ../../hidapi/mac\
../../src/value_classes ../../src/platform ../../src/platform/unix
VPATH = ../../src:../../src/command_classes:../../tinyxml:../../hidapi/mac:\
../../src/value_classes:../../src/platform:../../src/platform/unix
%.d : %.cpp
@set -e; rm -f $@; \
$(CXX) -MM $(INCLUDES) $< > $@.$$$$; \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
tinyxml := $(notdir $(wildcard ../../tinyxml/*.cpp))
hidapi := $(notdir $(wildcard ../../hidapi/mac/*.c))
cclasses := $(notdir $(wildcard ../../src/command_classes/*.cpp))
vclasses := $(notdir $(wildcard ../../src/value_classes/*.cpp))
pform := $(notdir $(wildcard ../../src/platform/*.cpp)) \
$(notdir $(wildcard ../../src/platform/unix/*.cpp))
indep := $(notdir $(wildcard ../../src/*.cpp))
%.o : %.cpp
$(CXX) $(CFLAGS) $(INCLUDES) -o $@ $<
%.o : %.c
$(CC) $(CFLAGS) $(INCLUDES) -o $@ $<
default: $(LIBDIR)/libopenzwave.a $(LIBDIR)/libopenzwave.so
clean:
rm -f *.d *.d.* *.o vers.c
XMLLINT := $(shell whereis xmllint)
ifeq ($(XMLLINT),)
xmltest: $(XMLLINT)
$(error xmllint command not found.)
else
xmltest: $(XMLLINT)
@$(XMLLINT) --noout --schema ../../../config/device_classes.xsd ../../../config/device_classes.xml
@$(XMLLINT) --noout --schema ../../../config/options.xsd ../../../config/options.xml
@$(XMLLINT) --noout --schema ../../../config/manufacturer_specific.xsd ../../../config/manufacturer_specific.xml
@$(XMLLINT) --noout --schema ../../../config/device_configuration.xsd ../../../config/*/*.xml
endif
-include $(tinyxml:.cpp=.d)
-include $(hidapi:.c=.d)
-include $(cclasses:.cpp=.d)
-include $(vclasses:.cpp=.d)
-include $(pform:.cpp=.d)
-include $(indep:.cpp=.d)
vers.c: verscheck
echo 'char ozw_vers[] = "OpenZWave version 1.0.'`svnversion ../..`'";' > vers.c
vers.o: vers.c
$(LIBDIR)/libopenzwave.a: $(patsubst %.cpp,%.o,$(tinyxml)) \
$(patsubst %.c,%.o,$(hidapi)) \
$(patsubst %.cpp,%.o,$(cclasses)) \
$(patsubst %.cpp,%.o,$(vclasses)) \
$(patsubst %.cpp,%.o,$(pform)) \
$(patsubst %.cpp,%.o,$(indep)) vers.o
rm -f $@
$(AR) $@ *.o
$(RANLIB) $@
$(LIBDIR)/libopenzwave.so: $(patsubst %.cpp,%.o,$(tinyxml)) \
$(patsubst %.c,%.o,$(hidapi)) \
$(patsubst %.cpp,%.o,$(cclasses)) \
$(patsubst %.cpp,%.o,$(vclasses)) \
$(patsubst %.cpp,%.o,$(pform)) \
$(patsubst %.cpp,%.o,$(indep)) vers.o
$(LD) -shared $(ARCH) -o $@ $+ -framework IOKit -framework CoreFoundation

113
cpp/build/support.mk Normal file
View file

@ -0,0 +1,113 @@
#The Major Version Number
VERSION_MAJ ?= 1
#The Minor Version Number
VERSION_MIN ?= 0
#the build type we are making (release or debug)
BUILD ?= release
#the prefix to install the library into
PREFIX ?= /usr/local
#The Location of the svnversion command for determining the repository version
SVNVERSION := $(shell which svnversion)
#the System we are building on
UNAME := $(shell uname -s)
#the location of Doxygen to generate our api documentation
DOXYGEN := $(shell which doxygen)
#the machine type we are building on (i686 or x86_64)
MACHINE := $(shell uname -m)
#the location of xmllink for checking our config files
XMLLINT := $(shell which xmllint)
#temp directory to build our tarfile for make dist target
TMP := /tmp
#pkg-config binary for package config files
PKGCONFIG := $(shell which pkg-config)
#svn binary for doing a make dist export
SVN := $(shell which svn)
# if svnversion is not installed, then set the revision to 0
ifeq ($(SVNVERSION),)
VERSION_REV ?= 0
else
VERSION_REV ?= $(shell $(SVNVERSION) $(top_srcdir)|awk -F'[^0-9]*' '$$0=$$1')
endif
ifeq ($(VERSION_REV),)
VERSION_REV ?= 0
endif
# version number to use on the shared library
VERSION := $(VERSION_MAJ).$(VERSION_MIN)
# support Cross Compiling options
CC := $(CROSS_COMPILE)gcc
CXX := $(CROSS_COMPILE)g++
LD := $(CROSS_COMPILE)g++
ifeq ($(UNAME),Darwin)
AR := libtool -static -o
RANLIB := ranlib
else
AR := $(CROSS_COMPILE)ar rc
RANLIB := $(CROSS_COMPILE)ranlib
endif
SED := sed
#determine if we are release or debug Build and set appropriate flags
ifeq ($(BUILD), release)
CFLAGS := -c $(RELEASE_CFLAGS)
LDFLAGS := $(RELEASE_LDFLAGS)
else
CFLAGS := -c $(DEBUG_CFLAGS)
LDFLAGS := $(DEBUG_LDFLAGS)
endif
#if /lib64 exists, then setup x86_64 library path to lib64 (good indication if a linux has /lib and lib64).
#Else, if it doesnt, then set as /lib. This is used in the make install target
ifeq ($(wildcard /lib64),)
instlibdir.x86_64 = /lib/
else
instlibdir.x86_64 = /lib64/
endif
instlibdir.default = /lib/
#our actual install location for the library
ifneq ($(instlibdir.$(MACHINE)),)
instlibdir ?= $(PREFIX)$(instlibdir.$(MACHINE))
else
instlibdir ?= $(PREFIX)$(instlibdir.default)
endif
sysconfdir ?= $(PREFIX)/etc/openzwave/
includedir ?= $(PREFIX)/include/openzwave/
docdir ?= $(PREFIX)/share/doc/openzwave-$(VERSION).$(VERSION_REV)
top_builddir ?= $(CURDIR)
export top_builddir
OBJDIR = $(top_builddir)/.lib
DEPDIR = $(top_builddir)/.dep
$(OBJDIR)/%.o : %.cpp
@echo "Building $(notdir $@)"
@$(CXX) $(CFLAGS) $(INCLUDES) -o $@ $<
$(OBJDIR)/%.o : %.c
@echo "Building $(notdir $@)"
@$(CC) $(CFLAGS) $(INCLUDES) -o $@ $<
$(DEPDIR)/%.d : %.cpp
@set -e; rm -f $@; \
$(CXX) -MM $(INCLUDES) $< > $@.$$$$; \
$(SED) 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
$(DEPDIR)/%.d : %.c
@set -e; rm -f $@; \
$(CXX) -MM $(INCLUDES) $< > $@.$$$$; \
$(SED) 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
dummy := $(shell test -d $(OBJDIR) || mkdir -p $(OBJDIR))
dummy := $(shell test -d $(DEPDIR) || mkdir -p $(DEPDIR))

View file

@ -0,0 +1,8 @@
msbuild ..\..\..\examples\windows\MinOZW\vs2010\MinOZW.sln /t:Rebuild /p:Configuration="Debug"
msbuild ..\..\..\examples\windows\MinOZW\vs2010\MinOZW.sln /t:Rebuild /p:Configuration="DebugDLL"
msbuild ..\..\..\examples\windows\MinOZW\vs2010\MinOZW.sln /t:Rebuild /p:Configuration="Release"
msbuild ..\..\..\examples\windows\MinOZW\vs2010\MinOZW.sln /t:Rebuild /p:Configuration="ReleaseDLL"
copy ..\..\..\..\dotnet\examples/OZWForm\build\vs2010\*.sln ..\..\..\..\dotnet\examples\OZWForm\src\
copy ..\..\..\..\dotnet\examples/OZWForm\build\vs2010\*.csproj ..\..\..\..\dotnet\examples\OZWForm\src\
msbuild ..\..\..\..\dotnet\examples\OZWForm\src\OZWForm.sln /t:Rebuild /p:Configuration="Debug"
msbuild ..\..\..\..\dotnet\examples\OZWForm\src\OZWForm.sln /t:Rebuild /p:Configuration="Release"

View file

@ -0,0 +1,68 @@
installDir "$PROGRAMFILES\OpenZWave"
Name "OpenZWave"
outFile "setup.exe"
Page license
Page components
Page directory
Page instfiles
UninstPage uninstConfirm
UninstPage instfiles
LicenseData ..\..\..\..\license\lgpl.txt
Section "Core Files"
SectionIn RO
setOutPath "$INSTDIR"
File ..\..\..\..\license\lgpl.txt
File ..\..\..\examples\windows\MinOZW\vs2010\ReleaseDLL\OpenZWave.dll
setOutPath "$INSTDIR\docs\"
File ..\..\..\..\docs\default.htm
setOutPath "$INSTDIR\docs\images+css\"
File ..\..\..\..\docs\images+css\*
setOutPath "$INSTDIR\docs\general\"
File ..\..\..\..\docs\general\*
createShortCut "$SMPROGRAMS\OpenZWave\Getting Started.lnk" "$INSTDIR\docs\default.htm"
SectionEnd
Section /o "Development Files"
setOutPath "$INSTDIR\development\DebugDLL"
File ..\..\..\examples\windows\MinOZW\vs2010\DebugDLL\OpenZWaved.dll
File ..\..\..\examples\windows\MinOZW\vs2010\DebugDLL\OpenZWaved.lib
setOutPath "$INSTDIR\development\Debug"
File ..\..\..\..\dotnet\examples\OZWForm\src\Debug\OpenZWave.lib
setOutPath "$INSTDIR\development\ReleaseDLL"
File ..\..\..\examples\windows\MinOZW\vs2010\ReleaseDLL\OpenZWave.dll
File ..\..\..\examples\windows\MinOZW\vs2010\ReleaseDLL\OpenZWave.lib
setOutPath "$INSTDIR\development\Release"
File ..\..\..\..\dotnet\examples\OZWForm\src\Release\OpenZWave.lib
setOutPath "$INSTDIR\development\include\openzwave\"
File ..\..\..\src\*.h
setOutPath "$INSTDIR\development\include\openzwave\command_classes\"
file ..\..\..\src\command_classes\*.h
setOutPath "$INSTDIR\development\include\openzwave\value_classes\"
file ..\..\..\src\value_classes\*.h
setOutPath "$INSTDIR\development\include\openzwave\platform\"
file ..\..\..\src\platform\*.h
setOutPath "$INSTDIR\development\include\openzwave\platform\windows\"
file ..\..\..\src\platform\windows\*.h
SectionEnd
Section ".Net Component"
SectionIn RO
setOutPath "$INSTDIR\dotnet\"
File ..\..\..\..\dotnet\examples\OZWForm\src\Debug\OpenZWaveDotNetd.dll
File ..\..\..\..\dotnet\examples\OZWForm\src\Debug\OpenZWaveDotNetd.lib
File ..\..\..\..\dotnet\examples\OZWForm\src\Release\OpenZWaveDotNet.dll
File ..\..\..\..\dotnet\examples\OZWForm\src\Release\OpenZWaveDotNet.lib
SectionEnd
Section "Examples"
setOutPath "$INSTDIR\dotnet\"
File ..\..\..\examples\windows\MinOZW\vs2010\ReleaseDLL\MinOZW.exe
File ..\..\..\..\dotnet\examples\OZWForm\src\bin\x86\Release\OZWForm.exe
createShortCut "$SMPROGRAMS\OpenZWave\OpenZWave Form.lnk" "$INSTDIR\OZWForm.exe"
SectionEnd

View file

@ -6,11 +6,17 @@ EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
DLL_Debug|Win32 = DLL_Debug|Win32
DLL_Release|Win32 = DLL_Release|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{497F9828-DEC2-4C80-B9E0-AD066CCB587C}.Debug|Win32.ActiveCfg = Debug|Win32
{497F9828-DEC2-4C80-B9E0-AD066CCB587C}.Debug|Win32.Build.0 = Debug|Win32
{497F9828-DEC2-4C80-B9E0-AD066CCB587C}.DLL_Debug|Win32.ActiveCfg = DLL_Debug|Win32
{497F9828-DEC2-4C80-B9E0-AD066CCB587C}.DLL_Debug|Win32.Build.0 = DLL_Debug|Win32
{497F9828-DEC2-4C80-B9E0-AD066CCB587C}.DLL_Release|Win32.ActiveCfg = DLL_Release|Win32
{497F9828-DEC2-4C80-B9E0-AD066CCB587C}.DLL_Release|Win32.Build.0 = DLL_Release|Win32
{497F9828-DEC2-4C80-B9E0-AD066CCB587C}.Release|Win32.ActiveCfg = Release|Win32
{497F9828-DEC2-4C80-B9E0-AD066CCB587C}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Version="9,00"
Name="OpenZWave"
ProjectGUID="{497F9828-DEC2-4C80-B9E0-AD066CCB587C}"
RootNamespace="OpenZWave"
@ -144,6 +144,147 @@
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="DLL_Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\src;..\..\..\src\command_classes;..\..\..\src\value_classes;..\..\..\src\platform;..\..\..\src\platform\windows;..\..\..\tinyxml;..\..\..\hidapi\hidapi"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;OPENZWAVE_MAKEDLL"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="Setupapi.lib"
OutputFile="$(OutDir)\$(ProjectName).dll"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="DLL_Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="..\..\..\src;..\..\..\src\command_classes;..\..\..\src\value_classes;..\..\..\src\platform;..\..\..\src\platform\windows;..\..\..\tinyxml;..\..\..\hidapi\hidapi"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;OPENZWAVE_MAKEDLL"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="Setupapi.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>

View file

@ -1,18 +1,24 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
# Visual C++ Express 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OpenZWave", "OpenZWave.vcxproj", "{497F9828-DEC2-4C80-B9E0-AD066CCB587C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
DebugDLL|Win32 = DebugDLL|Win32
Release|Win32 = Release|Win32
ReleaseDLL|Win32 = ReleaseDLL|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{497F9828-DEC2-4C80-B9E0-AD066CCB587C}.Debug|Win32.ActiveCfg = Debug|Win32
{497F9828-DEC2-4C80-B9E0-AD066CCB587C}.Debug|Win32.Build.0 = Debug|Win32
{497F9828-DEC2-4C80-B9E0-AD066CCB587C}.DebugDLL|Win32.ActiveCfg = DebugDLL|Win32
{497F9828-DEC2-4C80-B9E0-AD066CCB587C}.DebugDLL|Win32.Build.0 = DebugDLL|Win32
{497F9828-DEC2-4C80-B9E0-AD066CCB587C}.Release|Win32.ActiveCfg = Release|Win32
{497F9828-DEC2-4C80-B9E0-AD066CCB587C}.Release|Win32.Build.0 = Release|Win32
{497F9828-DEC2-4C80-B9E0-AD066CCB587C}.ReleaseDLL|Win32.ActiveCfg = ReleaseDLL|Win32
{497F9828-DEC2-4C80-B9E0-AD066CCB587C}.ReleaseDLL|Win32.Build.0 = ReleaseDLL|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View file

@ -1,10 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="DebugDLL|Win32">
<Configuration>DebugDLL</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="ReleaseDLL|Win32">
<Configuration>ReleaseDLL</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
@ -25,6 +33,14 @@
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugDLL|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseDLL|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
@ -34,18 +50,36 @@
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugDLL|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseDLL|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='DebugDLL|Win32'">$(Configuration)\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='ReleaseDLL|Win32'">$(Configuration)\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='DebugDLL|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='ReleaseDLL|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='DebugDLL|Win32'" />
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='ReleaseDLL|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='DebugDLL|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='ReleaseDLL|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectName)</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='DebugDLL|Win32'">$(ProjectName)d</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='ReleaseDLL|Win32'">$(ProjectName)</TargetName>
<TargetExt Condition="'$(Configuration)|$(Platform)'=='ReleaseDLL|Win32'">.dll</TargetExt>
<TargetExt Condition="'$(Configuration)|$(Platform)'=='DebugDLL|Win32'">.dll</TargetExt>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
@ -65,6 +99,86 @@
<AdditionalDependencies>setupapi.lib</AdditionalDependencies>
<TargetMachine>MachineX86</TargetMachine>
</Lib>
<PreBuildEvent>
<Command>"$(ProgramFiles)\TortoiseSVN\bin\subwcrev.exe" . ..\winversion.ini ..\winversion.cpp
if %ERRORLEVEL% GTR 0 (
echo Using Default WinVersion.cpp Version as we could not find a copy of TortoiseSVN in your Program Files
copy ..\winversion.tmpl ..\winversion.cpp
)
exit 0</Command>
</PreBuildEvent>
<PreBuildEvent>
<Message>Export SVN Revision</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugDLL|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\..\src;..\..\..\src\command_classes;..\..\..\src\value_classes;..\..\..\src\platform;..\..\..\src\platform\windows;..\..\..\tinyxml;..\..\..\hidapi\hidapi;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;OPENZWAVE_MAKEDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4251</DisableSpecificWarnings>
</ClCompile>
<Lib>
<OutputFile>$(OutDir)\$(ProjectName).dll</OutputFile>
<AdditionalDependencies>setupapi.lib</AdditionalDependencies>
<TargetMachine>MachineX86</TargetMachine>
</Lib>
<Link>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<AdditionalDependencies>Setupapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<PreBuildEvent>
<Command>"$(ProgramFiles)\TortoiseSVN\bin\subwcrev.exe" . ..\winversion.ini ..\winversion.cpp
if %ERRORLEVEL% GTR 0 (
echo Using Default WinVersion.cpp Version as we could not find a copy of TortoiseSVN in your Program Files
copy ..\winversion.tmpl ..\winversion.cpp
)
exit 0</Command>
</PreBuildEvent>
<PreBuildEvent>
<Message>Export SVN Revision</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseDLL|Win32'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>..\..\..\src;..\..\..\src\command_classes;..\..\..\src\value_classes;..\..\..\src\platform;..\..\..\src\platform\windows;..\..\..\tinyxml;..\..\..\hidapi\hidapi;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_LIB;OPENZWAVE_MAKEDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4251</DisableSpecificWarnings>
</ClCompile>
<Lib>
<OutputFile>$(OutDir)\$(ProjectName).lib</OutputFile>
<AdditionalDependencies>setupapi.lib</AdditionalDependencies>
<TargetMachine>MachineX86</TargetMachine>
</Lib>
<Link>
<AdditionalDependencies>Setupapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PreBuildEvent />
<PreBuildEvent>
<Message>Export SVN Revision</Message>
<Command>"$(ProgramFiles)\TortoiseSVN\bin\subwcrev.exe" . ..\winversion.ini ..\winversion.cpp
if %ERRORLEVEL% GTR 0 (
echo Using Default WinVersion.cpp Version as we could not find a copy of TortoiseSVN in your Program Files
copy ..\winversion.tmpl ..\winversion.cpp
)
exit 0</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
@ -83,6 +197,17 @@
<OutputFile>$(OutDir)\$(ProjectName).lib</OutputFile>
<AdditionalDependencies>setupapi.lib</AdditionalDependencies>
</Lib>
<PreBuildEvent>
<Command>"$(ProgramFiles)\TortoiseSVN\bin\subwcrev.exe" . ..\winversion.ini ..\winversion.cpp
if %ERRORLEVEL% GTR 0 (
echo Using Default WinVersion.cpp Version as we could not find a copy of TortoiseSVN in your Program Files
copy ..\winversion.tmpl ..\winversion.cpp
)
exit 0</Command>
</PreBuildEvent>
<PreBuildEvent>
<Message>Export SVN Revision</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\..\..\hidapi\hidapi\hidapi.h" />
@ -270,6 +395,7 @@
<ClCompile Include="..\..\..\src\command_classes\ThermostatSetpoint.cpp" />
<ClCompile Include="..\..\..\src\command_classes\Version.cpp" />
<ClCompile Include="..\..\..\src\command_classes\WakeUp.cpp" />
<ClCompile Include="..\winversion.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">

View file

@ -584,5 +584,8 @@
<ClCompile Include="..\..\..\src\command_classes\UserCode.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\winversion.cpp">
<Filter>Main</Filter>
</ClCompile>
</ItemGroup>
</Project>

View file

@ -0,0 +1,3 @@
unsigned short ozw_vers_minor = 1;
unsigned short ozw_vers_major = 0;
unsigned short ozw_vers_revision = $WCREV$;

View file

@ -0,0 +1,3 @@
unsigned short ozw_vers_minor = 1;
unsigned short ozw_vers_major = 0;
unsigned short ozw_vers_revision = 0;

View file

@ -254,11 +254,14 @@ int main( int argc, char* argv[] )
pthread_mutex_lock( &initMutex );
printf("Starting MinOZW with OpenZWave Version %s\n", Manager::getVersionAsString().c_str());
// Create the OpenZWave Manager.
// The first argument is the path to the config files (where the manufacturer_specific.xml file is located
// The second argument is the path for saved Z-Wave network state and the log file. If you leave it NULL
// the log file will appear in the program's working directory.
Options::Create( "../../../../config/", "", "" );
Options::Create( "../../../config/", "", "" );
Options::Get()->AddOptionInt( "SaveLogLevel", LogLevel_Detail );
Options::Get()->AddOptionInt( "QueueLogLevel", LogLevel_Debug );
Options::Get()->AddOptionInt( "DumpTrigger", LogLevel_Error );
@ -278,7 +281,13 @@ int main( int argc, char* argv[] )
// Add a Z-Wave Driver
// Modify this line to set the correct serial port for your PC interface.
#ifdef DARWIN
string port = "/dev/cu.usbserial";
#elif WIN32
string port = "\\\\.\\COM6";
#else
string port = "/dev/ttyUSB0";
#endif
if ( argc > 1 )
{
port = argv[1];

View file

@ -0,0 +1,68 @@
#
# Makefile for OpenzWave Mac OS X applications
# Greg Satz
# GNU make only
# requires libudev-dev
.SUFFIXES: .d .cpp .o .a
.PHONY: default clean
DEBUG_CFLAGS := -Wall -Wno-format -g -DDEBUG
RELEASE_CFLAGS := -Wall -Wno-unknown-pragmas -Wno-format -O3
DEBUG_LDFLAGS := -g
top_srcdir := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))../../../)
INCLUDES := -I $(top_srcdir)/cpp/src -I $(top_srcdir)/cpp/src/command_classes/ -I $(top_srcdir)/cpp/src/value_classes/ \
-I $(top_srcdir)/cpp/src/platform/ -I $(top_srcdir)/cpp/src/platform/unix -I $(top_srcdir)/cpp/tinyxml/ -I $(top_srcdir)/cpp/hidapi/hidapi/
LIBS = $(wildcard $(LIBDIR)/*.so $(top_builddir)/*.so $(top_builddir)/cpp/build/*.so )
LIBSDIR = $(abspath $(dir $(firstword $(LIBS))))
minozwsrc := $(notdir $(wildcard $(top_srcdir)/cpp/examples/MinOZW/*.cpp))
VPATH := $(top_srcdir)/cpp/examples/MinOZW
top_builddir ?= $(CURDIR)
default: $(top_builddir)/MinOZW
include $(top_srcdir)/cpp/build/support.mk
-include $(patsubst %.cpp,$(DEPDIR)/%.d,$(minozwsrc))
#if we are on a Mac, add these flags and libs to the compile and link phases
ifeq ($(UNAME),Darwin)
CFLAGS += -DDARWIN
endif
$(OBJDIR)/MinOZW: $(patsubst %.cpp,$(OBJDIR)/%.o,$(minozwsrc))
@echo "Linking $(OBJDIR)/MinOZW"
$(LD) $(LDFLAGS) -o $@ $< $(LIBS) -pthread
$(top_builddir)/MinOZW: $(top_srcdir)/cpp/examples/MinOZW/MinOZW.in $(OBJDIR)/MinOZW
@echo "Creating Temporary Shell Launch Script"
@$(SED) \
-e 's|[@]LDPATH@|$(LIBSDIR)|g' \
< "$<" > "$@"
@chmod +x $(top_builddir)/MinOZW
clean:
@rm -rf $(DEPDIR) $(OBJDIR) $(top_builddir)/MinOZW
ifeq ($(XMLLINT),)
xmltest: $(XMLLINT)
$(error xmllint command not found.)
else
xmltest: $(XMLLINT)
@$(XMLLINT) --noout --schema ../../../config/zwcfg.xsd zwcfg_*.xml
@$(XMLLINT) --noout --schema ../../../config/zwscene.xsd zwscene.xml
endif
install: $(OBJDIR)/MinOZW
@echo "Installing into Prefix: $(PREFIX)"
@install -d $(DESTDIR)/$(PREFIX)/bin/
@cp $(OBJDIR)/MinOZW $(DESTDIR)/$(PREFIX)/bin/MinOZW
@chmod 755 $(DESTDIR)/$(PREFIX)/bin/MinOZW

View file

@ -0,0 +1,9 @@
#!/bin/sh
LD_PATH=@LDPATH@
if test $# -gt 0; then
if test $1 == "gdb"; then
LD_LIBRARY_PATH="$LD_PATH:$LD_LIBRARY_PATH" gdb .lib/MinOZW
fi
else
LD_LIBRARY_PATH="$LD_PATH:$LD_LIBRARY_PATH" .lib/MinOZW
fi

View file

@ -1,53 +0,0 @@
#
# Makefile for OpenzWave Mac OS X applications
# Greg Satz
# GNU make only
# requires libudev-dev
.SUFFIXES: .cpp .o .a .s
CC := $(CROSS_COMPILE)gcc
CXX := $(CROSS_COMPILE)g++
LD := $(CROSS_COMPILE)g++
AR := $(CROSS_COMPILE)ar rc
RANLIB := $(CROSS_COMPILE)ranlib
DEBUG_CFLAGS := -Wall -Wno-format -g -DDEBUG
RELEASE_CFLAGS := -Wall -Wno-unknown-pragmas -Wno-format -O3
DEBUG_LDFLAGS := -g
# Change for DEBUG or RELEASE
CFLAGS := -c $(DEBUG_CFLAGS)
LDFLAGS := $(DEBUG_LDFLAGS)
INCLUDES := -I ../../../src -I ../../../src/command_classes/ -I ../../../src/value_classes/ \
-I ../../../src/platform/ -I ../../../h/platform/unix -I ../../../tinyxml/ -I ../../../hidapi/hidapi/
LIBS = $(wildcard ../../../lib/linux/*.a)
%.o : %.cpp
$(CXX) $(CFLAGS) $(INCLUDES) -o $@ $<
all: test
lib:
$(MAKE) -C ../../../build/linux
test: Main.o lib
$(LD) -o $@ $(LDFLAGS) $< $(LIBS) -pthread -ludev
clean:
rm -f test Main.o
XMLLINT := $(shell whereis -b xmllint | cut -c10-)
ifeq ($(XMLLINT),)
xmltest: $(XMLLINT)
$(error xmllint command not found.)
else
xmltest: $(XMLLINT)
@$(XMLLINT) --noout --schema ../../../../config/zwcfg.xsd zwcfg_*.xml
@$(XMLLINT) --noout --schema ../../../../config/zwscene.xsd zwscene.xml
endif

View file

@ -1,370 +0,0 @@
//-----------------------------------------------------------------------------
//
// Main.cpp
//
// Minimal application to test OpenZWave.
//
// Creates an OpenZWave::Driver and the waits. In Debug builds
// you should see verbose logging to the console, which will
// indicate that communications with the Z-Wave network are working.
//
// Copyright (c) 2010 Mal Lansell <mal@openzwave.com>
//
//
// SOFTWARE NOTICE AND LICENSE
//
// This file is part of OpenZWave.
//
// OpenZWave is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// OpenZWave is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
#include <unistd.h>
#include <pthread.h>
#include "Options.h"
#include "Manager.h"
#include "Driver.h"
#include "Node.h"
#include "Group.h"
#include "Notification.h"
#include "ValueStore.h"
#include "Value.h"
#include "ValueBool.h"
#include "Log.h"
using namespace OpenZWave;
static uint32 g_homeId = 0;
static bool g_initFailed = false;
typedef struct
{
uint32 m_homeId;
uint8 m_nodeId;
bool m_polled;
list<ValueID> m_values;
}NodeInfo;
static list<NodeInfo*> g_nodes;
static pthread_mutex_t g_criticalSection;
static pthread_cond_t initCond = PTHREAD_COND_INITIALIZER;
static pthread_mutex_t initMutex = PTHREAD_MUTEX_INITIALIZER;
//-----------------------------------------------------------------------------
// <GetNodeInfo>
// Return the NodeInfo object associated with this notification
//-----------------------------------------------------------------------------
NodeInfo* GetNodeInfo
(
Notification const* _notification
)
{
uint32 const homeId = _notification->GetHomeId();
uint8 const nodeId = _notification->GetNodeId();
for( list<NodeInfo*>::iterator it = g_nodes.begin(); it != g_nodes.end(); ++it )
{
NodeInfo* nodeInfo = *it;
if( ( nodeInfo->m_homeId == homeId ) && ( nodeInfo->m_nodeId == nodeId ) )
{
return nodeInfo;
}
}
return NULL;
}
//-----------------------------------------------------------------------------
// <OnNotification>
// Callback that is triggered when a value, group or node changes
//-----------------------------------------------------------------------------
void OnNotification
(
Notification const* _notification,
void* _context
)
{
// Must do this inside a critical section to avoid conflicts with the main thread
pthread_mutex_lock( &g_criticalSection );
switch( _notification->GetType() )
{
case Notification::Type_ValueAdded:
{
if( NodeInfo* nodeInfo = GetNodeInfo( _notification ) )
{
// Add the new value to our list
nodeInfo->m_values.push_back( _notification->GetValueID() );
}
break;
}
case Notification::Type_ValueRemoved:
{
if( NodeInfo* nodeInfo = GetNodeInfo( _notification ) )
{
// Remove the value from out list
for( list<ValueID>::iterator it = nodeInfo->m_values.begin(); it != nodeInfo->m_values.end(); ++it )
{
if( (*it) == _notification->GetValueID() )
{
nodeInfo->m_values.erase( it );
break;
}
}
}
break;
}
case Notification::Type_ValueChanged:
{
// One of the node values has changed
if( NodeInfo* nodeInfo = GetNodeInfo( _notification ) )
{
nodeInfo = nodeInfo; // placeholder for real action
}
break;
}
case Notification::Type_Group:
{
// One of the node's association groups has changed
if( NodeInfo* nodeInfo = GetNodeInfo( _notification ) )
{
nodeInfo = nodeInfo; // placeholder for real action
}
break;
}
case Notification::Type_NodeAdded:
{
// Add the new node to our list
NodeInfo* nodeInfo = new NodeInfo();
nodeInfo->m_homeId = _notification->GetHomeId();
nodeInfo->m_nodeId = _notification->GetNodeId();
nodeInfo->m_polled = false;
g_nodes.push_back( nodeInfo );
break;
}
case Notification::Type_NodeRemoved:
{
// Remove the node from our list
uint32 const homeId = _notification->GetHomeId();
uint8 const nodeId = _notification->GetNodeId();
for( list<NodeInfo*>::iterator it = g_nodes.begin(); it != g_nodes.end(); ++it )
{
NodeInfo* nodeInfo = *it;
if( ( nodeInfo->m_homeId == homeId ) && ( nodeInfo->m_nodeId == nodeId ) )
{
g_nodes.erase( it );
delete nodeInfo;
break;
}
}
break;
}
case Notification::Type_NodeEvent:
{
// We have received an event from the node, caused by a
// basic_set or hail message.
if( NodeInfo* nodeInfo = GetNodeInfo( _notification ) )
{
nodeInfo = nodeInfo; // placeholder for real action
}
break;
}
case Notification::Type_PollingDisabled:
{
if( NodeInfo* nodeInfo = GetNodeInfo( _notification ) )
{
nodeInfo->m_polled = false;
}
break;
}
case Notification::Type_PollingEnabled:
{
if( NodeInfo* nodeInfo = GetNodeInfo( _notification ) )
{
nodeInfo->m_polled = true;
}
break;
}
case Notification::Type_DriverReady:
{
g_homeId = _notification->GetHomeId();
break;
}
case Notification::Type_DriverFailed:
{
g_initFailed = true;
pthread_cond_broadcast(&initCond);
break;
}
case Notification::Type_AwakeNodesQueried:
case Notification::Type_AllNodesQueried:
case Notification::Type_AllNodesQueriedSomeDead:
{
pthread_cond_broadcast(&initCond);
break;
}
case Notification::Type_DriverReset:
case Notification::Type_Notification:
case Notification::Type_NodeNaming:
case Notification::Type_NodeProtocolInfo:
case Notification::Type_NodeQueriesComplete:
default:
{
}
}
pthread_mutex_unlock( &g_criticalSection );
}
//-----------------------------------------------------------------------------
// <main>
// Create the driver and then wait
//-----------------------------------------------------------------------------
int main( int argc, char* argv[] )
{
pthread_mutexattr_t mutexattr;
pthread_mutexattr_init ( &mutexattr );
pthread_mutexattr_settype( &mutexattr, PTHREAD_MUTEX_RECURSIVE );
pthread_mutex_init( &g_criticalSection, &mutexattr );
pthread_mutexattr_destroy( &mutexattr );
pthread_mutex_lock( &initMutex );
// Create the OpenZWave Manager.
// The first argument is the path to the config files (where the manufacturer_specific.xml file is located
// The second argument is the path for saved Z-Wave network state and the log file. If you leave it NULL
// the log file will appear in the program's working directory.
Options::Create( "../../../../config/", "", "" );
Options::Get()->AddOptionInt( "SaveLogLevel", LogLevel_Detail );
Options::Get()->AddOptionInt( "QueueLogLevel", LogLevel_Debug );
Options::Get()->AddOptionInt( "DumpTrigger", LogLevel_Error );
Options::Get()->AddOptionInt( "PollInterval", 500 );
Options::Get()->AddOptionBool( "IntervalBetweenPolls", true );
Options::Get()->AddOptionBool("ValidateValueChanges", true);
Options::Get()->Lock();
Manager::Create();
// Add a callback handler to the manager. The second argument is a context that
// is passed to the OnNotification method. If the OnNotification is a method of
// a class, the context would usually be a pointer to that class object, to
// avoid the need for the notification handler to be a static.
Manager::Get()->AddWatcher( OnNotification, NULL );
// Add a Z-Wave Driver
// Modify this line to set the correct serial port for your PC interface.
string port = "/dev/cu.usbserial";
if( argc > 1 )
{
port = argv[1];
}
if( strcasecmp( port.c_str(), "usb") == 0 )
{
Manager::Get()->AddDriver( "HID Controller", Driver::ControllerInterface_Hid );
}
else
{
Manager::Get()->AddDriver( port );
}
// Now we just wait for either the AwakeNodesQueried or AllNodesQueried notification,
// then write out the config file.
// In a normal app, we would be handling notifications and building a UI for the user.
pthread_cond_wait( &initCond, &initMutex );
// Since the configuration file contains command class information that is only
// known after the nodes on the network are queried, wait until all of the nodes
// on the network have been queried (at least the "listening" ones) before
// writing the configuration file. (Maybe write again after sleeping nodes have
// been queried as well.)
if( !g_initFailed )
{
Manager::Get()->WriteConfig( g_homeId );
// The section below demonstrates setting up polling for a variable. In this simple
// example, it has been hardwired to poll COMMAND_CLASS_BASIC on the each node that
// supports this setting.
pthread_mutex_lock( &g_criticalSection );
for( list<NodeInfo*>::iterator it = g_nodes.begin(); it != g_nodes.end(); ++it )
{
NodeInfo* nodeInfo = *it;
// skip the controller (most likely node 1)
if( nodeInfo->m_nodeId == 1) continue;
for( list<ValueID>::iterator it2 = nodeInfo->m_values.begin(); it2 != nodeInfo->m_values.end(); ++it2 )
{
ValueID v = *it2;
if( v.GetCommandClassId() == 0x20 )
{
Manager::Get()->EnablePoll( v, 2 ); // enables polling with "intensity" of 2, though this is irrelevant with only one value polled
break;
}
}
}
pthread_mutex_unlock( &g_criticalSection );
// If we want to access our NodeInfo list, that has been built from all the
// notification callbacks we received from the library, we have to do so
// from inside a Critical Section. This is because the callbacks occur on other
// threads, and we cannot risk the list being changed while we are using it.
// We must hold the critical section for as short a time as possible, to avoid
// stalling the OpenZWave drivers.
// At this point, the program just waits for 3 minutes (to demonstrate polling),
// then exits
for( int i = 0; i < 60*3; i++ )
{
pthread_mutex_lock( &g_criticalSection );
// but NodeInfo list and similar data should be inside critical section
pthread_mutex_unlock( &g_criticalSection );
sleep(1);
}
Driver::DriverData data;
Manager::Get()->GetDriverStatistics( g_homeId, &data );
printf("SOF: %d ACK Waiting: %d Read Aborts: %d Bad Checksums: %d\n", data.m_SOFCnt, data.m_ACKWaiting, data.m_readAborts, data.m_badChecksum);
printf("Reads: %d Writes: %d CAN: %d NAK: %d ACK: %d Out of Frame: %d\n", data.m_readCnt, data.m_writeCnt, data.m_CANCnt, data.m_NAKCnt, data.m_ACKCnt, data.m_OOFCnt);
printf("Dropped: %d Retries: %d\n", data.m_dropped, data.m_retries);
}
// program exit (clean up)
if( strcasecmp( port.c_str(), "usb") == 0 )
{
Manager::Get()->RemoveDriver( "HID Controller" );
}
else
{
Manager::Get()->RemoveDriver( port );
}
Manager::Get()->RemoveWatcher( OnNotification, NULL );
Manager::Destroy();
Options::Destroy();
pthread_mutex_destroy( &g_criticalSection );
return 0;
}

View file

@ -1,52 +0,0 @@
#
# Makefile for OpenzWave Mac OS X applications
# Greg Satz
# GNU make only
.SUFFIXES: .cpp .o .a
CC := gcc
CXX := g++
LD := g++
AR := ar rc
RANLIB := ranlib
DEBUG_CFLAGS := -Wall -Wno-unknown-pragmas -Wno-inline -Werror -Wno-format -g -DDEBUG
RELEASE_CFLAGS := -Wall -Wno-unknown-pragmas -Werror -Wno-format -O3 -DNDEBUG
DEBUG_LDFLAGS := -g
# Change for DEBUG or RELEASE
ARCH := -arch i386 -arch x86_64
CFLAGS := -c -DDARWIN $(DEBUG_CFLAGS) $(ARCH)
LDFLAGS := $(DEBUG_LDFLAGS)
INCLUDES := -I ../../../src -I ../../../src/command_classes/ -I ../../../src/value_classes/ \
-I ../../../src/platform/ -I ../../../h/platform/unix -I ../../../tinyxml/ -I ../../../hidapi/hidapi/
LIBS = $(wildcard ../../../lib/mac/*.a)
%.o : %.cpp
$(CXX) $(CFLAGS) $(INCLUDES) -o $@ $<
all: test
lib:
$(MAKE) -C ../../../build/mac
test: Main.o #lib
$(LD) -o $@ $(LDFLAGS) $< $(LIBS) -pthread -framework IOKit -framework CoreFoundation $(ARCH)
clean:
rm -f test Main.o
XMLLINT := $(shell whereis xmllint)
ifeq ($(XMLLINT),)
xmltest: $(XMLLINT)
$(error xmllint command not found.)
else
xmltest: $(XMLLINT)
@$(XMLLINT) --noout --schema ../../../../config/zwcfg.xsd zwcfg_*.xml
@$(XMLLINT) --noout --schema ../../../../config/zwscene.xsd zwscene.xml
endif

View file

@ -245,7 +245,7 @@ int main( int argc, char* argv[] )
// The first argument is the path to the config files (where the manufacturer_specific.xml file is located
// The second argument is the path for saved Z-Wave network state and the log file. If you leave it NULL
// the log file will appear in the program's working directory.
Options::Create( "../../../../../config/", "", "" );
Options::Create( "../../../../../../config/", "", "" );
Options::Get()->AddOptionInt( "SaveLogLevel", LogLevel_Detail );
Options::Get()->AddOptionInt( "QueueLogLevel", LogLevel_Debug );
Options::Get()->AddOptionInt( "DumpTrigger", LogLevel_Error );

View file

@ -11,15 +11,25 @@ EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
DLL_Debug|Win32 = DLL_Debug|Win32
DLL_Release|Win32 = DLL_Release|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{22847D76-B1CF-4921-8B7A-61E248412C4A}.Debug|Win32.ActiveCfg = Debug|Win32
{22847D76-B1CF-4921-8B7A-61E248412C4A}.Debug|Win32.Build.0 = Debug|Win32
{22847D76-B1CF-4921-8B7A-61E248412C4A}.DLL_Debug|Win32.ActiveCfg = DLL_Debug|Win32
{22847D76-B1CF-4921-8B7A-61E248412C4A}.DLL_Debug|Win32.Build.0 = DLL_Debug|Win32
{22847D76-B1CF-4921-8B7A-61E248412C4A}.DLL_Release|Win32.ActiveCfg = DLL_Release|Win32
{22847D76-B1CF-4921-8B7A-61E248412C4A}.DLL_Release|Win32.Build.0 = DLL_Release|Win32
{22847D76-B1CF-4921-8B7A-61E248412C4A}.Release|Win32.ActiveCfg = Release|Win32
{22847D76-B1CF-4921-8B7A-61E248412C4A}.Release|Win32.Build.0 = Release|Win32
{497F9828-DEC2-4C80-B9E0-AD066CCB587C}.Debug|Win32.ActiveCfg = Debug|Win32
{497F9828-DEC2-4C80-B9E0-AD066CCB587C}.Debug|Win32.Build.0 = Debug|Win32
{497F9828-DEC2-4C80-B9E0-AD066CCB587C}.DLL_Debug|Win32.ActiveCfg = DLL_Debug|Win32
{497F9828-DEC2-4C80-B9E0-AD066CCB587C}.DLL_Debug|Win32.Build.0 = DLL_Debug|Win32
{497F9828-DEC2-4C80-B9E0-AD066CCB587C}.DLL_Release|Win32.ActiveCfg = DLL_Release|Win32
{497F9828-DEC2-4C80-B9E0-AD066CCB587C}.DLL_Release|Win32.Build.0 = DLL_Release|Win32
{497F9828-DEC2-4C80-B9E0-AD066CCB587C}.Release|Win32.ActiveCfg = Release|Win32
{497F9828-DEC2-4C80-B9E0-AD066CCB587C}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Version="9,00"
Name="MinOZW"
ProjectGUID="{22847D76-B1CF-4921-8B7A-61E248412C4A}"
RootNamespace="MinOZW"
@ -117,7 +117,7 @@
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="..\..\..\..\src;..\..\..\..\src\value_classes"
AdditionalIncludeDirectories="..\..\..\..\src;..\..\..\..\src\value_classes;..\..\..\..\src\platform"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
@ -166,6 +166,156 @@
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="DLL_Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\src;..\..\..\..\src\value_classes;..\..\..\..\src\platform"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;OPENZWAVE_USEDLL"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="&quot;$(OutDir)\OpenZWave.lib&quot;"
OutputFile="$(OutDir)\$(ProjectName).exe"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="DLL_Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="..\..\..\..\src;..\..\..\..\src\value_classes;..\..\..\..\src\platform"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;OPENZWAVE_USEDLL"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="&quot;$(OutDir)\OpenZWave.lib&quot;"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>

View file

@ -1,6 +1,6 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
# Visual C++ Express 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MinOZW", "MinOZW.vcxproj", "{22847D76-B1CF-4921-8B7A-61E248412C4A}"
ProjectSection(ProjectDependencies) = postProject
{497F9828-DEC2-4C80-B9E0-AD066CCB587C} = {497F9828-DEC2-4C80-B9E0-AD066CCB587C}
@ -11,17 +11,27 @@ EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
DebugDLL|Win32 = DebugDLL|Win32
Release|Win32 = Release|Win32
ReleaseDLL|Win32 = ReleaseDLL|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{22847D76-B1CF-4921-8B7A-61E248412C4A}.Debug|Win32.ActiveCfg = Debug|Win32
{22847D76-B1CF-4921-8B7A-61E248412C4A}.Debug|Win32.Build.0 = Debug|Win32
{22847D76-B1CF-4921-8B7A-61E248412C4A}.DebugDLL|Win32.ActiveCfg = DebugDLL|Win32
{22847D76-B1CF-4921-8B7A-61E248412C4A}.DebugDLL|Win32.Build.0 = DebugDLL|Win32
{22847D76-B1CF-4921-8B7A-61E248412C4A}.Release|Win32.ActiveCfg = Release|Win32
{22847D76-B1CF-4921-8B7A-61E248412C4A}.Release|Win32.Build.0 = Release|Win32
{22847D76-B1CF-4921-8B7A-61E248412C4A}.ReleaseDLL|Win32.ActiveCfg = ReleaseDLL|Win32
{22847D76-B1CF-4921-8B7A-61E248412C4A}.ReleaseDLL|Win32.Build.0 = ReleaseDLL|Win32
{497F9828-DEC2-4C80-B9E0-AD066CCB587C}.Debug|Win32.ActiveCfg = Debug|Win32
{497F9828-DEC2-4C80-B9E0-AD066CCB587C}.Debug|Win32.Build.0 = Debug|Win32
{497F9828-DEC2-4C80-B9E0-AD066CCB587C}.DebugDLL|Win32.ActiveCfg = DebugDLL|Win32
{497F9828-DEC2-4C80-B9E0-AD066CCB587C}.DebugDLL|Win32.Build.0 = DebugDLL|Win32
{497F9828-DEC2-4C80-B9E0-AD066CCB587C}.Release|Win32.ActiveCfg = Release|Win32
{497F9828-DEC2-4C80-B9E0-AD066CCB587C}.Release|Win32.Build.0 = Release|Win32
{497F9828-DEC2-4C80-B9E0-AD066CCB587C}.ReleaseDLL|Win32.ActiveCfg = ReleaseDLL|Win32
{497F9828-DEC2-4C80-B9E0-AD066CCB587C}.ReleaseDLL|Win32.Build.0 = ReleaseDLL|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View file

@ -1,10 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="DebugDLL|Win32">
<Configuration>DebugDLL</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="ReleaseDLL|Win32">
<Configuration>ReleaseDLL</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
@ -21,34 +29,60 @@
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseDLL|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugDLL|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseDLL|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugDLL|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='DebugDLL|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='DebugDLL|Win32'">$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='DebugDLL|Win32'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='ReleaseDLL|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='ReleaseDLL|Win32'">$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='ReleaseDLL|Win32'">false</LinkIncremental>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='DebugDLL|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='DebugDLL|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='DebugDLL|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='ReleaseDLL|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='ReleaseDLL|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='ReleaseDLL|Win32'" />
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
@ -70,11 +104,32 @@
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugDLL|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\..\..\src;..\..\..\..\src\platform;..\..\..\..\src\value_classes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;OPENZWAVE_USEDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<DisableSpecificWarnings>4251</DisableSpecificWarnings>
</ClCompile>
<Link>
<AdditionalDependencies>$(OutDir)\OpenZWaved.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>..\..\..\..\src;..\..\..\..\src\value_classes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\..\..\..\src;..\..\..\..\src\platform;..\..\..\..\src\value_classes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
@ -92,6 +147,29 @@
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseDLL|Win32'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>..\..\..\..\src;..\..\..\..\src\platform;..\..\..\..\src\value_classes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;OPENZWAVE_USEDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4251</DisableSpecificWarnings>
</ClCompile>
<Link>
<AdditionalDependencies>$(OutDir)\OpenZWave.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\Main.cpp" />
</ItemGroup>

View file

@ -338,12 +338,15 @@ end:
int HID_API_EXPORT hid_init(void)
{
const char *locale;
/* Refer to http://code.google.com/p/open-zwave/issues/detail?id=254
* We should not be setting the Locale and let the application set it
*/
// const char *locale;
/* Set the locale if it's not set. */
locale = setlocale(LC_CTYPE, NULL);
if (!locale)
setlocale(LC_CTYPE, "");
// locale = setlocale(LC_CTYPE, NULL);
// if (!locale)
// setlocale(LC_CTYPE, "");
return 0;
}

View file

@ -1,160 +1,162 @@
//-----------------------------------------------------------------------------
//
// Bitfield.h
//
// Variable length bitfield implementation
//
// Copyright (c) 2011 Mal Lansell <openzwave@lansell.org>
//
// SOFTWARE NOTICE AND LICENSE
//
// This file is part of OpenZWave.
//
// OpenZWave is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// OpenZWave is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
#ifndef _Bitfield_H
#define _Bitfield_H
#include <vector>
#include "Defs.h"
namespace OpenZWave
{
class Bitfield
{
friend class Iterator;
public:
Bitfield():m_numSetBits(0){}
~Bitfield(){}
void Set( uint32 _idx )
{
if( !IsSet(_idx) )
{
uint32 newSize = (_idx>>5)+1;
if( newSize > m_bits.size() )
{
m_bits.resize( newSize, 0 );
}
m_bits[_idx>>5] |= (1<<(_idx&0x1f));
++m_numSetBits;
}
}
void Clear( uint32 _idx )
{
if( IsSet(_idx) )
{
m_bits[_idx>>5] &= ~(1<<(_idx&0x1f));
--m_numSetBits;
}
}
bool IsSet( uint32 _idx )const
{
if( (_idx>>5) < m_bits.size() )
{
return( ( m_bits[_idx>>5] & (1<<(_idx&0x1f)) ) !=0 );
}
return false;
}
uint32 GetNumSetBits()const{ return m_numSetBits; }
class Iterator
{
friend class Bitfield;
public:
uint32 operator *() const
{
return m_idx;
}
Iterator& operator++()
{
// Search forward to next set bit
NextSetBit();
return *this;
}
Iterator operator++(int)
{
Iterator tmp = *this;
++tmp;
return tmp;
}
bool operator ==(const Iterator &rhs)
{
return m_idx == rhs.m_idx;
}
bool operator !=(const Iterator &rhs)
{
return m_idx != rhs.m_idx;
}
private:
Iterator( Bitfield const* _bitfield, uint32 _idx ): m_idx( _idx ), m_bitfield( _bitfield )
{
// If this is a begin iterator, move it to the first set bit
if( ( _idx == 0 ) && ( !m_bitfield->IsSet(0) ) )
{
NextSetBit();
}
}
void NextSetBit()
{
while( ((++m_idx)>>5)<m_bitfield->m_bits.size() )
{
// See if there are any bits left to find in the current uint32
if( ( m_bitfield->m_bits[m_idx>>5] & ~((1<<(m_idx&0x1f))-1) ) == 0 )
{
// No more bits - move on to next uint32 (or rather one less than
// the next uint32 because of the preincrement in the while statement)
m_idx = (m_idx&0xffffffe0)+31;
}
else
{
if( (m_bitfield->m_bits[m_idx>>5] & (1<<(m_idx&0x1f))) !=0 )
{
// This bit is set
return;
}
}
}
}
uint32 m_idx;
Bitfield const* m_bitfield;
};
Iterator Begin()const{ return Iterator( this, 0 ); }
Iterator End()const{ return Iterator( this, m_bits.size()<<5 ); }
private:
vector<uint32> m_bits;
uint32 m_numSetBits;
};
} // namespace OpenZWave
#endif
//-----------------------------------------------------------------------------
//
// Bitfield.h
//
// Variable length bitfield implementation
//
// Copyright (c) 2011 Mal Lansell <openzwave@lansell.org>
//
// SOFTWARE NOTICE AND LICENSE
//
// This file is part of OpenZWave.
//
// OpenZWave is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// OpenZWave is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
#ifndef _Bitfield_H
#define _Bitfield_H
#include <vector>
#include "Defs.h"
namespace OpenZWave
{
class OPENZWAVE_EXPORT Bitfield
{
friend class Iterator;
public:
Bitfield():m_numSetBits(0){}
~Bitfield(){}
void Set( uint32 _idx )
{
if( !IsSet(_idx) )
{
uint32 newSize = (_idx>>5)+1;
if( newSize > m_bits.size() )
{
m_bits.resize( newSize, 0 );
}
m_bits[_idx>>5] |= (1<<(_idx&0x1f));
++m_numSetBits;
}
}
void Clear( uint32 _idx )
{
if( IsSet(_idx) )
{
m_bits[_idx>>5] &= ~(1<<(_idx&0x1f));
--m_numSetBits;
}
}
bool IsSet( uint32 _idx )const
{
if( (_idx>>5) < m_bits.size() )
{
return( ( m_bits[_idx>>5] & (1<<(_idx&0x1f)) ) !=0 );
}
return false;
}
uint32 GetNumSetBits()const{ return m_numSetBits; }
class Iterator
{
friend class Bitfield;
public:
uint32 operator *() const
{
return m_idx;
}
Iterator& operator++()
{
// Search forward to next set bit
NextSetBit();
return *this;
}
Iterator operator++(int)
{
Iterator tmp = *this;
++tmp;
return tmp;
}
bool operator ==(const Iterator &rhs)
{
return m_idx == rhs.m_idx;
}
bool operator !=(const Iterator &rhs)
{
return m_idx != rhs.m_idx;
}
private:
Iterator( Bitfield const* _bitfield, uint32 _idx ): m_idx( _idx ), m_bitfield( _bitfield )
{
// If this is a begin iterator, move it to the first set bit
if( ( _idx == 0 ) && ( !m_bitfield->IsSet(0) ) )
{
NextSetBit();
}
}
void NextSetBit()
{
while( ((++m_idx)>>5)<m_bitfield->m_bits.size() )
{
// See if there are any bits left to find in the current uint32
if( ( m_bitfield->m_bits[m_idx>>5] & ~((1<<(m_idx&0x1f))-1) ) == 0 )
{
// No more bits - move on to next uint32 (or rather one less than
// the next uint32 because of the preincrement in the while statement)
m_idx = (m_idx&0xffffffe0)+31;
}
else
{
if( (m_bitfield->m_bits[m_idx>>5] & (1<<(m_idx&0x1f))) !=0 )
{
// This bit is set
return;
}
}
}
}
uint32 m_idx;
Bitfield const* m_bitfield;
};
Iterator Begin()const{ return Iterator( this, 0 ); }
Iterator End()const{ return Iterator( this, m_bits.size()<<5 ); }
private:
OPENZWAVE_EXPORT_WARNINGS_OFF
vector<uint32> m_bits;
OPENZWAVE_EXPORT_WARNINGS_ON
uint32 m_numSetBits;
};
} // namespace OpenZWave
#endif

View file

@ -28,7 +28,30 @@
#ifndef _Defs_H
#define _Defs_H
#include <assert.h>
#include <list>
#include <stdio.h>
#include <string>
#include <stdint.h>
// Compilation export flags
#if (defined _WINDOWS || defined WIN32 || defined _MSC_VER) && !defined MINGW
# if defined OPENZWAVE_MAKEDLL // Create the dynamic library.
# define OPENZWAVE_EXPORT __declspec(dllexport)
# elif defined OPENZWAVE_USEDLL // Use the dynamic library
# define OPENZWAVE_EXPORT __declspec(dllimport)
# else // Create/Use the static library
# define OPENZWAVE_EXPORT
# endif
// Disable export warnings
# define OPENZWAVE_EXPORT_WARNINGS_OFF __pragma( warning(push) )\
__pragma( warning(disable: 4251) )
# define OPENZWAVE_EXPORT_WARNINGS_ON __pragma( warning(pop) )
#else
# define OPENZWAVE_EXPORT
# define OPENZWAVE_EXPORT_WARNINGS_OFF
# define OPENZWAVE_EXPORT_WARNINGS_ON
#endif
#ifdef NULL
#undef NULL
@ -58,6 +81,60 @@ typedef unsigned long long uint64;
typedef float float32;
typedef double float64;
typedef struct ozwversion {
uint32_t _v; /* major << 16 | minor */
} ozwversion;
/**
* \brief version_major - return the major version of the given struct
* \param v: the version number to obtain the major number from
* \return the Major Version Number
*/
static inline uint16_t version_major(struct ozwversion v) {
return (v._v & 0xFFFF0000) >> 16;
}
/**
* \brief version_minor - return the minor version of the given struct
* \param v: the version number to obtain the minor number from
* \return the Minor Version Number
*/
static inline uint16_t version_minor(const struct ozwversion &v) {
return v._v & 0xFFFF;
}
/**
* \brief version - create a new version number
* \param major: major version number
* \param minor: minor version number
* \return the Version Number Struct
*/
static inline struct ozwversion version(uint16_t major, uint16_t minor)
{
struct ozwversion v;
v._v = (uint32_t)(major << 16) | (uint32_t)minor;
return v;
}
/**
* \brief version_cmp - compare two versions
* \param a: the first version number
* \param b: the second version number
* \return a number greater, equal, or less than 0 if a is greater, equal or
* less than b, respectively
*
* Example:
* struct version a = version(1, 0);
* struct version b = version(1, 3);
* if (version_cmp(a, b) < 0)
* printf("b is smaller than b\n");
*/
static inline int version_cmp(struct ozwversion a, struct ozwversion b)
{
return (a._v == b._v) ? 0 : (a._v > b._v) ? 1 : - 1;
}
// Declare the OpenZWave namespace
namespace std {}
namespace OpenZWave
@ -194,7 +271,7 @@ namespace OpenZWave
#define REMOVE_NODE_CONTROLLER 0x02
#define REMOVE_NODE_SLAVE 0x03
#define REMOVE_NODE_STOP 0x05
#define REMOVE_NODE_STATUS_LEARN_READY 0x01
#define REMOVE_NODE_STATUS_NODE_FOUND 0x02
#define REMOVE_NODE_STATUS_REMOVING_SLAVE 0x03
@ -211,7 +288,7 @@ namespace OpenZWave
#define CONTROLLER_CHANGE_STOP_FAILED 0x06
#define LEARN_MODE_STARTED 0x01
#define LEARN_MODE_DONE 0x06
#define LEARN_MODE_DONE 0x06
#define LEARN_MODE_FAILED 0x07
#define LEARN_MODE_DELETED 0x80

View file

@ -894,7 +894,7 @@ void Driver::RetryQueryStageComplete
m_sendMutex->Lock();
for( list<MsgQueueItem>::iterator it = m_msgQueue[MsgQueue_Query].begin(); it != m_msgQueue[MsgQueue_Query].end(); it++ )
for( list<MsgQueueItem>::iterator it = m_msgQueue[MsgQueue_Query].begin(); it != m_msgQueue[MsgQueue_Query].end(); ++it )
{
if( *it == item )
{
@ -1069,7 +1069,7 @@ bool Driver::WriteNextMsg
//-----------------------------------------------------------------------------
bool Driver::WriteMsg
(
string const msg
string const &msg
)
{
if( !m_currentMsg )
@ -3264,6 +3264,10 @@ void Driver::HandleApplicationCommandHandlerRequest
{
node->m_receivedUnsolicited++;
}
if ( !node->IsNodeAlive() )
{
node->SetNodeAlive( true );
}
}
if( ApplicationStatus::StaticGetCommandClassId() == classId )
{
@ -3661,7 +3665,7 @@ void Driver::CommonAddNodeStatusRequestHandler
//-----------------------------------------------------------------------------
bool Driver::EnablePoll
(
ValueID const _valueId,
ValueID const &_valueId,
uint8 const _intensity
)
{
@ -3714,11 +3718,15 @@ bool Driver::EnablePoll
// allow the poll thread to continue
m_pollMutex->Unlock();
ReleaseNodes();
Log::Write( LogLevel_Info, nodeId, "EnablePoll failed - value not found for node %d", nodeId );
return false;
}
// allow the poll thread to continue
m_pollMutex->Unlock();
Log::Write( LogLevel_Info, "EnablePoll failed - node %d not found", nodeId );
return false;
}
@ -3729,7 +3737,7 @@ bool Driver::EnablePoll
//-----------------------------------------------------------------------------
bool Driver::DisablePoll
(
ValueID const _valueId
ValueID const &_valueId
)
{
// make sure the polling thread doesn't lock the node while we're in this function
@ -3786,7 +3794,7 @@ bool Driver::DisablePoll
//-----------------------------------------------------------------------------
bool Driver::isPolled
(
ValueID const _valueId
ValueID const &_valueId
)
{
bool bPolled;
@ -3862,7 +3870,7 @@ bool Driver::isPolled
//-----------------------------------------------------------------------------
void Driver::SetPollIntensity
(
ValueID const _valueId,
ValueID const &_valueId,
uint8 const _intensity
)
{
@ -4921,7 +4929,7 @@ void Driver::DoControllerCommand
continue;
map<uint8,uint8>::iterator it = node->m_buttonMap.begin();
for( ; it != node->m_buttonMap.end(); it++ )
for( ; it != node->m_buttonMap.end(); ++it )
{
// is virtual node already in map?
if( it->second == n )
@ -5965,7 +5973,7 @@ void Driver::HandleApplicationSlaveCommandRequest
if( node != NULL && _data[5] == 3 && _data[6] == 0x20 && _data[7] == 0x01 ) // only support Basic Set for now
{
map<uint8,uint8>::iterator it = node->m_buttonMap.begin();
for( ; it != node->m_buttonMap.end(); it++ )
for( ; it != node->m_buttonMap.end(); ++it )
{
if( it->second == _data[3] )
break;

View file

@ -53,7 +53,7 @@ namespace OpenZWave
/** \brief The Driver class handles communication between OpenZWave
* and a device attached via a serial port (typically a controller).
*/
class Driver
class OPENZWAVE_EXPORT Driver
{
friend class Manager;
friend class Node;
@ -345,10 +345,10 @@ namespace OpenZWave
private:
int32 GetPollInterval(){ return m_pollInterval ; }
void SetPollInterval( int32 _milliseconds, bool _bIntervalBetweenPolls ){ m_pollInterval = _milliseconds; m_bIntervalBetweenPolls = _bIntervalBetweenPolls; }
bool EnablePoll( ValueID _valueId, uint8 _intensity = 1 );
bool DisablePoll( ValueID _valueId );
bool isPolled( ValueID _valueId );
void SetPollIntensity( ValueID _valueId, uint8 _intensity );
bool EnablePoll( const ValueID &_valueId, uint8 _intensity = 1 );
bool DisablePoll( const ValueID &_valueId );
bool isPolled( const ValueID &_valueId );
void SetPollIntensity( const ValueID &_valueId, uint8 _intensity );
static void PollThreadEntryPoint( Event* _exitEvent, void* _context );
void PollThreadProc( Event* _exitEvent );
@ -358,7 +358,9 @@ namespace OpenZWave
ValueID m_id;
uint8 m_pollCounter;
};
OPENZWAVE_EXPORT_WARNINGS_OFF
list<PollEntry> m_pollList; // List of nodes that need to be polled
OPENZWAVE_EXPORT_WARNINGS_ON
Mutex* m_pollMutex; // Serialize access to the polling list
int32 m_pollInterval; // Time interval during which all nodes must be polled
bool m_bIntervalBetweenPolls; // if true, the library intersperses m_pollInterval between polls; if false, the library attempts to complete all polls within m_pollInterval
@ -615,7 +617,7 @@ namespace OpenZWave
* RemoveNodeQuery, Node::AllQueriesCompleted
*/
bool WriteNextMsg( MsgQueue const _queue ); // Extracts the first message from the queue, and makes it the current one.
bool WriteMsg( string const str); // Sends the current message to the Z-Wave network
bool WriteMsg( string const &str); // Sends the current message to the Z-Wave network
void RemoveCurrentMsg(); // Deletes the current message and cleans up the callback etc states
bool MoveMessagesToWakeUpQueue( uint8 const _targetNodeId, bool const _move ); // If a node does not respond, and is of a type that can sleep, this method is used to move all its pending messages to another queue ready for when it mext wakes up.
bool HandleErrorResponse( uint8 const _error, uint8 const _nodeId, char const* _funcStr, bool _sleepCheck = false ); // Handle data errors and process consistently. If message is moved to wake-up queue, return true.
@ -700,7 +702,9 @@ namespace OpenZWave
ControllerCommandItem* m_cci;
};
OPENZWAVE_EXPORT_WARNINGS_OFF
list<MsgQueueItem> m_msgQueue[MsgQueue_Count];
OPENZWAVE_EXPORT_WARNINGS_ON
Event* m_queueEvent[MsgQueue_Count]; // Events for each queue, which are signalled when the queue is not empty
Mutex* m_sendMutex; // Serialize access to the queues
Msg* m_currentMsg;
@ -768,7 +772,9 @@ namespace OpenZWave
void QueueNotification( Notification* _notification ); // Adds a notification to the list. Notifications are queued until a point in the thread where we know we do not have any nodes locked.
void NotifyWatchers(); // Passes the notifications to all the registered watcher callbacks in turn.
OPENZWAVE_EXPORT_WARNINGS_OFF
list<Notification*> m_notifications;
OPENZWAVE_EXPORT_WARNINGS_ON
Event* m_notificationsEvent;
//-----------------------------------------------------------------------------

View file

@ -25,9 +25,9 @@
//
//-----------------------------------------------------------------------------
#include <algorithm>
#include <string>
#include <locale.h>
#include <algorithm>
#include <string>
#include <sstream>
#include "Defs.h"
#include "Manager.h"
@ -60,7 +60,9 @@
using namespace OpenZWave;
Manager* Manager::s_instance = NULL;
extern uint16_t ozw_vers_major;
extern uint16_t ozw_vers_minor;
extern uint16_t ozw_vers_revision;
//-----------------------------------------------------------------------------
// Construction
@ -102,6 +104,23 @@ void Manager::Destroy
s_instance = NULL;
}
//-----------------------------------------------------------------------------
// <Manager::getVersion>
// Static method to get the Version of OZW as a string.
//-----------------------------------------------------------------------------
std::string Manager::getVersionAsString() {
std::ostringstream versionstream;
versionstream << ozw_vers_major << "." << ozw_vers_minor << "." << ozw_vers_revision;
return versionstream.str();
}
//-----------------------------------------------------------------------------
// <Manager::getVersion>
// Static method to get the Version of OZW.
//-----------------------------------------------------------------------------
ozwversion Manager::getVersion() {
return version(ozw_vers_major, ozw_vers_minor);
}
//-----------------------------------------------------------------------------
// <Manager::Manager>
// Constructor
@ -111,9 +130,6 @@ Manager::Manager
):
m_notificationMutex( new Mutex() )
{
// Set the locale
::setlocale( LC_ALL, "" );
// Ensure the singleton instance is set
s_instance = this;
@ -173,7 +189,7 @@ Manager::~Manager
delete it->second;
m_readyDrivers.erase( it );
}
m_notificationMutex->Release();
// Clear the watchers list
@ -235,7 +251,7 @@ bool Manager::AddDriver
)
{
// Make sure we don't already have a driver for this controller
// Search the pending list
for( list<Driver*>::iterator pit = m_pendingDrivers.begin(); pit != m_pendingDrivers.end(); ++pit )
{
@ -357,13 +373,13 @@ void Manager::SetDriverReady
// Notify the watchers
Notification* notification = new Notification(success ? Notification::Type_DriverReady : Notification::Type_DriverFailed );
notification->SetHomeAndNodeIds( _driver->GetHomeId(), _driver->GetNodeId() );
_driver->QueueNotification( notification );
_driver->QueueNotification( notification );
}
}
//-----------------------------------------------------------------------------
// <Manager::GetControllerNodeId>
//
//
//-----------------------------------------------------------------------------
uint8 Manager::GetControllerNodeId
(
@ -381,7 +397,7 @@ uint8 Manager::GetControllerNodeId
//-----------------------------------------------------------------------------
// <Manager::GetSUCNodeId>
//
//
//-----------------------------------------------------------------------------
uint8 Manager::GetSUCNodeId
(
@ -399,7 +415,7 @@ uint8 Manager::GetSUCNodeId
//-----------------------------------------------------------------------------
// <Manager::IsPrimaryController>
//
//
//-----------------------------------------------------------------------------
bool Manager::IsPrimaryController
(
@ -417,7 +433,7 @@ bool Manager::IsPrimaryController
//-----------------------------------------------------------------------------
// <Manager::IsStaticUpdateController>
//
//
//-----------------------------------------------------------------------------
bool Manager::IsStaticUpdateController
(
@ -435,7 +451,7 @@ bool Manager::IsStaticUpdateController
//-----------------------------------------------------------------------------
// <Manager::IsBridgeController>
//
//
//-----------------------------------------------------------------------------
bool Manager::IsBridgeController
(
@ -453,7 +469,7 @@ bool Manager::IsBridgeController
//-----------------------------------------------------------------------------
// <Manager::GetLibraryVersion>
//
//
//-----------------------------------------------------------------------------
string Manager::GetLibraryVersion
(
@ -471,7 +487,7 @@ string Manager::GetLibraryVersion
//-----------------------------------------------------------------------------
// <Manager::GetLibraryTypeName>
//
//
//-----------------------------------------------------------------------------
string Manager::GetLibraryTypeName
(
@ -489,7 +505,7 @@ string Manager::GetLibraryTypeName
//-----------------------------------------------------------------------------
// <Manager::GetSendQueueCount>
//
//
//-----------------------------------------------------------------------------
int32 Manager::GetSendQueueCount
(
@ -558,7 +574,7 @@ string Manager::GetControllerPath
//-----------------------------------------------------------------------------
// Polling Z-Wave values
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// <Manager::GetPollInterval>
// Return the polling interval
@ -605,8 +621,8 @@ void Manager::SetPollInterval
// Enable polling of a value
//-----------------------------------------------------------------------------
bool Manager::EnablePoll
(
ValueID const _valueId,
(
ValueID const &_valueId,
uint8 const _intensity
)
{
@ -624,8 +640,8 @@ bool Manager::EnablePoll
// Disable polling of a value
//-----------------------------------------------------------------------------
bool Manager::DisablePoll
(
ValueID const _valueId
(
ValueID const &_valueId
)
{
if( Driver* driver = GetDriver( _valueId.GetHomeId() ) )
@ -642,8 +658,8 @@ bool Manager::DisablePoll
// Check polling status of a value
//-----------------------------------------------------------------------------
bool Manager::isPolled
(
ValueID const _valueId
(
ValueID const &_valueId
)
{
if( Driver* driver = GetDriver( _valueId.GetHomeId() ) )
@ -660,8 +676,8 @@ bool Manager::isPolled
// Change the intensity with which this value is polled
//-----------------------------------------------------------------------------
void Manager::SetPollIntensity
(
ValueID const _valueId,
(
ValueID const &_valueId,
uint8 const _intensity
)
{
@ -673,6 +689,29 @@ void Manager::SetPollIntensity
Log::Write( LogLevel_Error, "mgr, SetPollIntensity failed - Driver with Home ID 0x%.8x is not available", _valueId.GetHomeId() );
}
//-----------------------------------------------------------------------------
// <Manager::GetPollIntensity>
// Change the intensity with which this value is polled
//-----------------------------------------------------------------------------
uint8 Manager::GetPollIntensity
(
ValueID const &_valueId
)
{
uint8 intensity = 0;
if( Driver* driver = GetDriver( _valueId.GetHomeId() ) )
{
driver->LockNodes();
if( Value* value = driver->GetValue( _valueId ) )
{
intensity = value->GetPollIntensity();
value->Release();
}
driver->ReleaseNodes();
}
return intensity;
}
//-----------------------------------------------------------------------------
// Retrieving Node information
@ -1249,9 +1288,9 @@ bool Manager::IsNodeInfoReceived
result = node->NodeInfoReceived();
}
driver->ReleaseNodes();
driver->ReleaseNodes();
}
return result;
}
@ -1269,7 +1308,7 @@ bool Manager::GetNodeClassInformation
)
{
bool result = false;
if( Driver* driver = GetDriver( _homeId ) )
{
Node *node;
@ -1297,7 +1336,7 @@ bool Manager::GetNodeClassInformation
driver->ReleaseNodes();
}
return result;
}
@ -1403,7 +1442,7 @@ void Manager::SetNodeLevel
// Gets the user-friendly label for the value
//-----------------------------------------------------------------------------
string Manager::GetValueLabel
(
(
ValueID const& _id
)
{
@ -1427,7 +1466,7 @@ string Manager::GetValueLabel
// Sets the user-friendly label for the value
//-----------------------------------------------------------------------------
void Manager::SetValueLabel
(
(
ValueID const& _id,
string const& _value
)
@ -1449,7 +1488,7 @@ void Manager::SetValueLabel
// Gets the units that the value is measured in
//-----------------------------------------------------------------------------
string Manager::GetValueUnits
(
(
ValueID const& _id
)
{
@ -1473,7 +1512,7 @@ string Manager::GetValueUnits
// Sets the units that the value is measured in
//-----------------------------------------------------------------------------
void Manager::SetValueUnits
(
(
ValueID const& _id,
string const& _value
)
@ -1495,7 +1534,7 @@ void Manager::SetValueUnits
// Gets a help string describing the value's purpose and usage
//-----------------------------------------------------------------------------
string Manager::GetValueHelp
(
(
ValueID const& _id
)
{
@ -1519,7 +1558,7 @@ string Manager::GetValueHelp
// Sets a help string describing the value's purpose and usage
//-----------------------------------------------------------------------------
void Manager::SetValueHelp
(
(
ValueID const& _id,
string const& _value
)
@ -1541,7 +1580,7 @@ void Manager::SetValueHelp
// Gets the minimum for a value
//-----------------------------------------------------------------------------
int32 Manager::GetValueMin
(
(
ValueID const& _id
)
{
@ -1565,7 +1604,7 @@ int32 Manager::GetValueMin
// Gets the maximum for a value
//-----------------------------------------------------------------------------
int32 Manager::GetValueMax
(
(
ValueID const& _id
)
{
@ -1589,7 +1628,7 @@ int32 Manager::GetValueMax
// Test whether the value is read-only
//-----------------------------------------------------------------------------
bool Manager::IsValueReadOnly
(
(
ValueID const& _id
)
{
@ -1613,7 +1652,7 @@ bool Manager::IsValueReadOnly
// Test whether the value is write-only
//-----------------------------------------------------------------------------
bool Manager::IsValueWriteOnly
(
(
ValueID const& _id
)
{
@ -1637,7 +1676,7 @@ bool Manager::IsValueWriteOnly
// Test whether the value has been set by a status message from the device
//-----------------------------------------------------------------------------
bool Manager::IsValueSet
(
(
ValueID const& _id
)
{
@ -1661,7 +1700,7 @@ bool Manager::IsValueSet
// Test whether the value is currently being polled
//-----------------------------------------------------------------------------
bool Manager::IsValuePolled
(
(
ValueID const& _id
)
{
@ -1914,7 +1953,7 @@ bool Manager::GetValueAsString
if( Driver* driver = GetDriver( _id.GetHomeId() ) )
{
driver->LockNodes();
switch( _id.GetType() )
{
case ValueID::ValueType_Bool:
@ -1974,7 +2013,7 @@ bool Manager::GetValueAsString
{
if( ValueRaw* value = static_cast<ValueRaw*>( driver->GetValue( _id ) ) )
{
*o_value = value->GetAsString().c_str();
*o_value = value->GetAsString();
value->Release();
res = true;
}
@ -2166,8 +2205,8 @@ bool Manager::GetValueFloatPrecision
// Sets the value from a bool
//-----------------------------------------------------------------------------
bool Manager::SetValue
(
ValueID const& _id,
(
ValueID const& _id,
bool const _value
)
{
@ -2198,8 +2237,8 @@ bool Manager::SetValue
// Sets the value from a byte
//-----------------------------------------------------------------------------
bool Manager::SetValue
(
ValueID const& _id,
(
ValueID const& _id,
uint8 const _value
)
{
@ -2230,8 +2269,8 @@ bool Manager::SetValue
// Sets the value from a floating point number
//-----------------------------------------------------------------------------
bool Manager::SetValue
(
ValueID const& _id,
(
ValueID const& _id,
float const _value
)
{
@ -2256,7 +2295,7 @@ bool Manager::SetValue
{
for( nLen = strlen( str ) - 1; nLen > 0; nLen-- )
{
if( str[nLen] == '0' )
if( str[nLen] == '0' )
str[nLen] = 0;
else
break;
@ -2282,8 +2321,8 @@ bool Manager::SetValue
// Sets the value from a 32-bit signed integer
//-----------------------------------------------------------------------------
bool Manager::SetValue
(
ValueID const& _id,
(
ValueID const& _id,
int32 const _value
)
{
@ -2314,8 +2353,8 @@ bool Manager::SetValue
// Sets the value from a collection of bytes
//-----------------------------------------------------------------------------
bool Manager::SetValue
(
ValueID const& _id,
(
ValueID const& _id,
uint8 const* _value,
uint8 const _length
)
@ -2347,8 +2386,8 @@ bool Manager::SetValue
// Sets the value from a 16-bit signed integer
//-----------------------------------------------------------------------------
bool Manager::SetValue
(
ValueID const& _id,
(
ValueID const& _id,
int16 const _value
)
{
@ -2400,7 +2439,7 @@ bool Manager::SetValueListSelection
}
driver->ReleaseNodes();
}
}
}
@ -2412,8 +2451,8 @@ bool Manager::SetValueListSelection
// Sets the value from a string
//-----------------------------------------------------------------------------
bool Manager::SetValue
(
ValueID const& _id,
(
ValueID const& _id,
string const& _value
)
{
@ -2424,7 +2463,7 @@ bool Manager::SetValue
if( _id.GetNodeId() != driver->GetNodeId() )
{
driver->LockNodes();
switch( _id.GetType() )
{
case ValueID::ValueType_Bool:
@ -2586,7 +2625,7 @@ void Manager::SetChangeVerified
// Starts an activity in a device.
//-----------------------------------------------------------------------------
bool Manager::PressButton
(
(
ValueID const& _id
)
{
@ -2614,7 +2653,7 @@ bool Manager::PressButton
// Stops an activity in a device.
//-----------------------------------------------------------------------------
bool Manager::ReleaseButton
(
(
ValueID const& _id
)
{
@ -2760,13 +2799,13 @@ void Manager::ClearSwitchPoints
}
}
}
//-----------------------------------------------------------------------------
// <Manager::GetSwitchPoint>
// Gets switch point data from the schedule
//-----------------------------------------------------------------------------
bool Manager::GetSwitchPoint
(
(
ValueID const& _id,
uint8 const _idx,
uint8* o_hours,
@ -2837,7 +2876,7 @@ void Manager::SwitchAllOff
//-----------------------------------------------------------------------------
bool Manager::SetConfigParam
(
uint32 const _homeId,
uint32 const _homeId,
uint8 const _nodeId,
uint8 const _param,
int32 _value,
@ -2858,7 +2897,7 @@ bool Manager::SetConfigParam
//-----------------------------------------------------------------------------
void Manager::RequestConfigParam
(
uint32 const _homeId,
uint32 const _homeId,
uint8 const _nodeId,
uint8 const _param
)
@ -2875,7 +2914,7 @@ void Manager::RequestConfigParam
//-----------------------------------------------------------------------------
void Manager::RequestAllConfigParams
(
uint32 const _homeId,
uint32 const _homeId,
uint8 const _nodeId
)
{
@ -2900,7 +2939,7 @@ void Manager::RequestAllConfigParams
//-----------------------------------------------------------------------------
uint8 Manager::GetNumGroups
(
uint32 const _homeId,
uint32 const _homeId,
uint8 const _nodeId
)
{
@ -2917,7 +2956,7 @@ uint8 Manager::GetNumGroups
// Gets the associations for a group
//-----------------------------------------------------------------------------
uint32 Manager::GetAssociations
(
(
uint32 const _homeId,
uint8 const _nodeId,
uint8 const _groupIdx,
@ -2937,7 +2976,7 @@ uint32 Manager::GetAssociations
// Gets the maximum number of associations for a group
//-----------------------------------------------------------------------------
uint8 Manager::GetMaxAssociations
(
(
uint32 const _homeId,
uint8 const _nodeId,
uint8 const _groupIdx
@ -2956,7 +2995,7 @@ uint8 Manager::GetMaxAssociations
// Gets the label for a particular group
//-----------------------------------------------------------------------------
string Manager::GetGroupLabel
(
(
uint32 const _homeId,
uint8 const _nodeId,
uint8 const _groupIdx
@ -3059,6 +3098,7 @@ bool Manager::RemoveWatcher
m_notificationMutex->Unlock();
return true;
}
++it;
}
m_notificationMutex->Unlock();
@ -3132,7 +3172,7 @@ void Manager::SoftReset
//-----------------------------------------------------------------------------
bool Manager::BeginControllerCommand
(
uint32 const _homeId,
uint32 const _homeId,
Driver::ControllerCommand _command,
Driver::pfnControllerCallback_t _callback, // = NULL
void* _context, // = NULL
@ -3524,7 +3564,7 @@ bool Manager::RemoveSceneValue
//-----------------------------------------------------------------------------
// <Manager::SceneGetValues>
// Return a scene's Value ID
// Return a scene's Value ID
//-----------------------------------------------------------------------------
int Manager::SceneGetValues
(

View file

@ -71,8 +71,8 @@ namespace OpenZWave
* the low-level details of the Z-Wave protocol.
* <p>
* All Z-Wave functionality is accessed via the Manager class. While this
* does not make for the most efficient code structure, it does enable
* the library to handle potentially complex and hard-to-debug issues
* does not make for the most efficient code structure, it does enable
* the library to handle potentially complex and hard-to-debug issues
* such as multi-threading and object lifespans behind the scenes.
* Application development is therefore simplified and less prone to bugs.
* <p>
@ -88,24 +88,24 @@ namespace OpenZWave
* notifications of Z-Wave network changes and updates to device values, and is
* an essential element of OpenZWave.
* <p>
* Next, a call should be made to Manager::AddDriver for each Z-Wave controller
* attached to the PC. Each Driver will handle the sending and receiving of
* Next, a call should be made to Manager::AddDriver for each Z-Wave controller
* attached to the PC. Each Driver will handle the sending and receiving of
* messages for all the devices in its controller's Z-Wave network. The Driver
* will read any previously saved configuration and then query the Z-Wave controller
* for any missing information. Once that process is complete, a DriverReady
* notification callback will be sent containing the Home ID of the controller,
* which is required by most of the other Manager class methods.
* <p>
* [After the DriverReady notification is sent, the Driver will poll each node on
* [After the DriverReady notification is sent, the Driver will poll each node on
* the network to update information about each node. After all "awake" nodes
* have been polled, an "AllAwakeNodesQueried" notification is sent. This is when
* a client application can expect all of the node information (both static
* information, like the physical device's capabilities, session information
* (like [associations and/or names] and dynamic information (like temperature or
* (like [associations and/or names] and dynamic information (like temperature or
* on/off state) to be available. Finally, after all nodes (whether listening or
* sleeping) have been polled, an "AllNodesQueried" notification is sent.]
*/
class Manager
class OPENZWAVE_EXPORT Manager
{
friend class Driver;
friend class CommandClass;
@ -127,10 +127,10 @@ namespace OpenZWave
/*@{*/
public:
/**
* \brief Creates the Manager singleton object.
* The Manager provides the public interface to OpenZWave, exposing all the functionality required
* to add Z-Wave support to an application. There can be only one Manager in an OpenZWave application.
* An Options object must be created and Locked first, otherwise the call to Manager::Create will
* \brief Creates the Manager singleton object.
* The Manager provides the public interface to OpenZWave, exposing all the functionality required
* to add Z-Wave support to an application. There can be only one Manager in an OpenZWave application.
* An Options object must be created and Locked first, otherwise the call to Manager::Create will
* fail. Once the Manager has been created, call AddWatcher to install a notification callback handler,
* and then call the AddDriver method for each attached PC Z-Wave controller in turn.
* \param _options a locked Options object containing all the application's configurable option values.
@ -145,12 +145,24 @@ namespace OpenZWave
* \see Create, Destroy
*/
static Manager* Get(){ return s_instance; }
/**
* \brief Deletes the Manager and cleans up any associated objects.
* \brief Deletes the Manager and cleans up any associated objects.
* \see Create, Get
*/
static void Destroy();
/**
* \brief Get the Version Number of OZW as a string
* \return a String representing the version number as MAJOR.MINOR.REVISION
*/
static std::string getVersionAsString();
/**
* \brief Get the Version Number as the Version Struct (Only Major/Minor returned)
* \return the version struct representing the version
*/
static ozwversion getVersion();
/*@}*/
private:
@ -164,7 +176,7 @@ namespace OpenZWave
// Configuration
//-----------------------------------------------------------------------------
/** \name Configuration
* For saving the Z-Wave network configuration so that the entire network does not need to be
* For saving the Z-Wave network configuration so that the entire network does not need to be
* polled every time the application starts.
*/
/*@{*/
@ -173,7 +185,7 @@ namespace OpenZWave
* \brief Saves the configuration of a PC Controller's Z-Wave network to the application's user data folder.
* This method does not normally need to be called, since OpenZWave will save the state automatically
* during the shutdown process. It is provided here only as an aid to development.
* The configuration of each PC Controller's Z-Wave network is stored in a separate file. The filename
* The configuration of each PC Controller's Z-Wave network is stored in a separate file. The filename
* consists of the 8 digit hexadecimal version of the controller's Home ID, prefixed with the string 'zwcfg_'.
* This convention allows OpenZWave to find the correct configuration file for a controller, even if it is
* attached to a different serial port, USB device path, etc.
@ -191,7 +203,7 @@ namespace OpenZWave
private:
Options* m_options; // Pointer to the locked Options object that was passed in during creation.
//-----------------------------------------------------------------------------
// Drivers
//-----------------------------------------------------------------------------
@ -202,7 +214,7 @@ namespace OpenZWave
public:
/**
* \brief Creates a new driver for a Z-Wave controller.
* This method creates a Driver object for handling communications with a single Z-Wave controller. In the background, the
* This method creates a Driver object for handling communications with a single Z-Wave controller. In the background, the
* driver first tries to read configuration data saved during a previous run. It then queries the controller directly for any
* missing information, and a refresh of the list of nodes that it controls. Once this information
* has been received, a DriverReady notification callback is sent, containing the Home ID of the controller. This Home ID is
@ -241,7 +253,7 @@ namespace OpenZWave
* \brief Query if the controller is a primary controller.
* The primary controller is the main device used to configure and control a Z-Wave network.
* There can only be one primary controller - all other controllers are secondary controllers.
* <p>
* <p>
* The only difference between a primary and secondary controller is that the primary is the
* only one that can be used to add or remove other devices. For this reason, it is usually
* better for the promary controller to be portable, since most devices must be added when
@ -284,7 +296,7 @@ namespace OpenZWave
* - Static Controller
* - Controller
* - Enhanced Slave
* - Slave
* - Slave
* - Installer
* - Routing Slave
* - Bridge Controller
@ -328,8 +340,10 @@ namespace OpenZWave
Driver* GetDriver( uint32 const _homeId ); /**< Get a pointer to a Driver object from the HomeID. Only to be used by OpenZWave. */
void SetDriverReady( Driver* _driver, bool success ); /**< Indicate that the Driver is ready to be used, and send the notification callback. */
OPENZWAVE_EXPORT_WARNINGS_OFF
list<Driver*> m_pendingDrivers; /**< Drivers that are in the process of reading saved data and querying their Z-Wave network for basic information. */
map<uint32,Driver*> m_readyDrivers; /**< Drivers that are ready to be used by the application. */
OPENZWAVE_EXPORT_WARNINGS_ON
//-----------------------------------------------------------------------------
// Polling Z-Wave devices
@ -364,27 +378,35 @@ namespace OpenZWave
* \param _valueId The ID of the value to start polling.
* \return True if polling was enabled.
*/
bool EnablePoll( ValueID const _valueId, uint8 const _intensity = 1 );
bool EnablePoll( ValueID const &_valueId, uint8 const _intensity = 1 );
/**
* \brief Disable the polling of a device's state.
* \param _valueId The ID of the value to stop polling.
* \return True if polling was disabled.
*/
bool DisablePoll( ValueID const _valueId );
bool DisablePoll( ValueID const &_valueId );
/**
* \brief Determine the polling of a device's state.
* \param _valueId The ID of the value to check polling.
* \return True if polling is active.
*/
bool isPolled( ValueID const _valueId );
bool isPolled( ValueID const &_valueId );
/**
* \brief Set the frequency of polling (0=none, 1=every time through the list, 2-every other time, etc)
* \param _valueId The ID of the value whose intensity should be set
*/
void SetPollIntensity( ValueID const _valueId, uint8 const _intensity );
void SetPollIntensity( ValueID const &_valueId, uint8 const _intensity );
/**
* \brief Get the polling intensity of a device's state.
* \param _valueId The ID of the value to check polling.
* \return Intensity, number of polling for one polling interval.
*/
uint8 GetPollIntensity( ValueID const &_valueId );
/*@}*/
//-----------------------------------------------------------------------------
@ -399,7 +421,7 @@ namespace OpenZWave
* \brief Trigger the fetching of fixed data about a node.
* Causes the node's data to be obtained from the Z-Wave network in the same way as if it had just been added.
* This method would normally be called automatically by OpenZWave, but if you know that a node has been
* changed, calling this method will force a refresh of all of the data held by the library. This can be especially
* changed, calling this method will force a refresh of all of the data held by the library. This can be especially
* useful for devices that were asleep when the application was first run. This is the
* same as the query state starting from the beginning.
* \param _homeId The Home ID of the Z-Wave controller that manages the node.
@ -468,7 +490,7 @@ namespace OpenZWave
* \return true if security features implemented.
*/
bool IsNodeSecurityDevice( uint32 const _homeId, uint8 const _nodeId );
/**
* \brief Get the maximum baud rate of a node's communications
* \param _homeId The Home ID of the Z-Wave controller that manages the node.
@ -500,7 +522,7 @@ namespace OpenZWave
* \return the node's basic type.
*/
uint8 GetNodeBasic( uint32 const _homeId, uint8 const _nodeId );
/**
* \brief Get the generic type of a node.
* \param _homeId The Home ID of the Z-Wave controller that manages the node.
@ -508,7 +530,7 @@ namespace OpenZWave
* \return the node's generic type.
*/
uint8 GetNodeGeneric( uint32 const _homeId, uint8 const _nodeId );
/**
* \brief Get the specific type of a node.
* \param _homeId The Home ID of the Z-Wave controller that manages the node.
@ -596,7 +618,7 @@ namespace OpenZWave
* \brief Get the manufacturer ID of a device
* The manufacturer ID is a four digit hex code and would normally be handled by the Manufacturer
* Specific commmand class, but not all devices support it. Although the value reported by this
* method will be an empty string if the command class is not supported and cannot be set by the
* method will be an empty string if the command class is not supported and cannot be set by the
* user, the manufacturer ID is still stored with the node data (rather than being reported via a
* command class Value object) to retain a consistent approach with the other manufacturer specific data.
* \param _homeId The Home ID of the Z-Wave controller that manages the node.
@ -651,7 +673,7 @@ namespace OpenZWave
* \see GetNodeManufacturerName, GetNodeProductName, SetNodeProductName
*/
void SetNodeManufacturerName( uint32 const _homeId, uint8 const _nodeId, string const& _manufacturerName );
/**
* \brief Set the product name of a device
* The product name would normally be handled by the Manufacturer Specific commmand class,
@ -699,7 +721,7 @@ namespace OpenZWave
/**
* \brief Turns a node on
* This is a helper method to simplify basic control of a node. It is the equivalent of
* changing the level reported by the node's Basic command class to 255, and will generate a
* changing the level reported by the node's Basic command class to 255, and will generate a
* ValueChanged notification from that class. This command will turn on the device at its
* last known level, if supported by the device, otherwise it will turn it on at 100%.
* \param _homeId The Home ID of the Z-Wave controller that manages the node.
@ -722,7 +744,7 @@ namespace OpenZWave
/**
* \brief Sets the basic level of a node
* This is a helper method to simplify basic control of a node. It is the equivalent of
* changing the value reported by the node's Basic command class and will generate a
* changing the value reported by the node's Basic command class and will generate a
* ValueChanged notification from that class.
* \param _homeId The Home ID of the Z-Wave controller that manages the node.
* \param _nodeId The ID of the node to be changed.
@ -807,7 +829,7 @@ namespace OpenZWave
* \see ValueID
*/
string GetValueUnits( ValueID const& _id );
/**
* \brief Sets the units that the value is measured in.
* \param _id The unique identifier of the value.
@ -815,7 +837,7 @@ namespace OpenZWave
* \see ValueID
*/
void SetValueUnits( ValueID const& _id, string const& _value );
/**
* \brief Gets a help string describing the value's purpose and usage.
* \param _id The unique identifier of the value.
@ -851,7 +873,7 @@ namespace OpenZWave
/**
* \brief Test whether the value is read-only.
* \param _id The unique identifier of the value.
* \return true if the value cannot be changed by the user.
* \return true if the value cannot be changed by the user.
* \see ValueID
*/
bool IsValueReadOnly( ValueID const& _id );
@ -859,7 +881,7 @@ namespace OpenZWave
/**
* \brief Test whether the value is write-only.
* \param _id The unique identifier of the value.
* \return true if the value can only be written to and not read.
* \return true if the value can only be written to and not read.
* \see ValueID
*/
bool IsValueWriteOnly( ValueID const& _id );
@ -867,7 +889,7 @@ namespace OpenZWave
/**
* \brief Test whether the value has been set.
* \param _id The unique identifier of the value.
* \return true if the value has actually been set by a status message from the device, rather than simply being the default.
* \return true if the value has actually been set by a status message from the device, rather than simply being the default.
* \see ValueID
*/
bool IsValueSet( ValueID const& _id );
@ -875,7 +897,7 @@ namespace OpenZWave
/**
* \brief Test whether the value is currently being polled.
* \param _id The unique identifier of the value.
* \return true if the value is being polled, otherwise false.
* \return true if the value is being polled, otherwise false.
* \see ValueID
*/
bool IsValuePolled( ValueID const& _id );
@ -924,7 +946,7 @@ namespace OpenZWave
* \see ValueID::GetType, GetValueAsBool, GetValueAsByte, GetValueAsFloat, GetValueAsInt, GetValueAsString, GetValueListSelection, GetValueListItems, GetValueAsRaw
*/
bool GetValueAsShort( ValueID const& _id, int16* o_value );
/**
* \brief Gets a value as a string.
* Creates a string representation of a value, regardless of type.
@ -934,7 +956,7 @@ namespace OpenZWave
* \see ValueID::GetType, GetValueAsBool, GetValueAsByte, GetValueAsFloat, GetValueAsInt, GetValueAsShort, GetValueListSelection, GetValueListItems, GetValueAsRaw
*/
bool GetValueAsString( ValueID const& _id, string* o_value );
/**
* \brief Gets a value as a collection of bytes.
* \param _id The unique identifier of the value.
@ -944,7 +966,7 @@ namespace OpenZWave
* \see ValueID::GetType, GetValueAsBool, GetValueAsByte, GetValueAsFloat, GetValueAsInt, GetValueAsShort, GetValueListSelection, GetValueListItems, GetValueAsRaw
*/
bool GetValueAsRaw( ValueID const& _id, uint8** o_value, uint8* o_length );
/**
* \brief Gets the selected item from a list (as a string).
* \param _id The unique identifier of the value.
@ -977,7 +999,7 @@ namespace OpenZWave
* \param _id The unique identifier of the value.
* \param o_value Pointer to a uint8 that will be filled with the precision value.
* \return true if the value was obtained. Returns false if the value is not a ValueID::ValueType_Decimal. The type can be tested with a call to ValueID::GetType
* \see ValueID::GetType, GetValueAsBool, GetValueAsByte, GetValueAsInt, GetValueAsShort, GetValueAsString, GetValueListSelection, GetValueListItems
* \see ValueID::GetType, GetValueAsBool, GetValueAsByte, GetValueAsInt, GetValueAsShort, GetValueAsString, GetValueListSelection, GetValueListItems
*/
bool GetValueFloatPrecision( ValueID const& _id, uint8* o_value );
@ -1014,7 +1036,7 @@ namespace OpenZWave
* \return true if the value was set. Returns false if the value is not a ValueID::ValueType_Decimal. The type can be tested with a call to ValueID::GetType.
*/
bool SetValue( ValueID const& _id, float const _value );
/**
* \brief Sets the value of a 32-bit signed integer.
* Due to the possibility of a device being asleep, the command is assumed to suceed, and the value
@ -1156,7 +1178,7 @@ namespace OpenZWave
* the 24-hour clock, so this value must be between 0 and 23.
* \param _minutes The minutes part of the time when the switch point will trigger. This value must be
* between 0 and 59.
* \return true if successful. Returns false if the value is not a ValueID::ValueType_Schedule or if there
* \return true if successful. Returns false if the value is not a ValueID::ValueType_Schedule or if there
* is not switch point with the specified time values. The type can be tested with a call to ValueID::GetType.
* \see GetNumSwitchPoints, SetSwitchPoint, ClearSwitchPoints
*/
@ -1168,7 +1190,7 @@ namespace OpenZWave
* \see GetNumSwitchPoints, SetSwitchPoint, RemoveSwitchPoint
*/
void ClearSwitchPoints( ValueID const& _id );
/**
* \brief Gets switch point data from the schedule.
* Retrieves the time and setback values from a switch point in the schedule.
@ -1184,7 +1206,7 @@ namespace OpenZWave
* \see GetNumSwitchPoints
*/
bool GetSwitchPoint( ValueID const& _id, uint8 const _idx, uint8* o_hours, uint8* o_minutes, int8* o_setback );
/*@}*/
//-----------------------------------------------------------------------------
@ -1203,7 +1225,7 @@ namespace OpenZWave
* All devices that support the SwitchAll command class will be turned on.
*/
void SwitchAllOn( uint32 const _homeId );
/**
* \brief Switch all devices off.
* All devices that support the SwitchAll command class will be turned off.
@ -1224,7 +1246,7 @@ namespace OpenZWave
* parameters for every Z-Wave. See the config folder in the project source code for examples.
*/
/*@{*/
public:
public:
/**
* \brief Set the value of a configurable parameter in a device.
* Some devices have various parameters that can be configured to control the device behaviour.
@ -1247,11 +1269,11 @@ namespace OpenZWave
* Some devices have various parameters that can be configured to control the device behaviour.
* These are not reported by the device over the Z-Wave network, but can usually be found in
* the device's user manual.
* This method requests the value of a parameter from the device, and then returns immediately,
* without waiting for a response. If the parameter index is valid for this device, and the
* This method requests the value of a parameter from the device, and then returns immediately,
* without waiting for a response. If the parameter index is valid for this device, and the
* device is awake, the value will eventually be reported via a ValueChanged notification callback.
* The ValueID reported in the callback will have an index set the same as _param and a command class
* set to the same value as returned by a call to Configuration::StaticGetCommandClassId.
* set to the same value as returned by a call to Configuration::StaticGetCommandClassId.
* \param _homeId The Home ID of the Z-Wave controller that manages the node.
* \param _nodeId The ID of the node to configure.
* \param _param The index of the parameter.
@ -1275,10 +1297,10 @@ namespace OpenZWave
* Methods for accessing device association groups.
*/
/*@{*/
public:
public:
/**
* \brief Gets the number of association groups reported by this node
* In Z-Wave, groups are numbered starting from one. For example, if a call to GetNumGroups returns 4, the _groupIdx
* In Z-Wave, groups are numbered starting from one. For example, if a call to GetNumGroups returns 4, the _groupIdx
* value to use in calls to GetAssociations, AddAssociation and RemoveAssociation will be a number between 1 and 4.
* \param _homeId The Home ID of the Z-Wave controller that manages the node.
* \param _nodeId The ID of the node whose groups we are interested in.
@ -1397,7 +1419,9 @@ namespace OpenZWave
}
};
OPENZWAVE_EXPORT_WARNINGS_OFF
list<Watcher*> m_watchers; // List of all the registered watchers.
OPENZWAVE_EXPORT_WARNINGS_ON
Mutex* m_notificationMutex;
//-----------------------------------------------------------------------------
@ -1407,7 +1431,7 @@ namespace OpenZWave
* Commands for Z-Wave network management using the PC Controller.
*/
/*@{*/
public:
public:
/**
* \brief Hard Reset a PC Z-Wave Controller.
* Resets a controller and erases its network configuration settings. The controller becomes a primary controller ready to add devices to a new network.
@ -1431,14 +1455,14 @@ namespace OpenZWave
* \param _callback pointer to a function that will be called at various stages during the command process
* to notify the user of progress or to request actions on the user's part. Defaults to NULL.
* \param _context pointer to user defined data that will be passed into to the callback function. Defaults to NULL.
* \param _highPower used only with the AddDevice, AddController, RemoveDevice and RemoveController commands.
* \param _highPower used only with the AddDevice, AddController, RemoveDevice and RemoveController commands.
* Usually when adding or removing devices, the controller operates at low power so that the controller must
* be physically close to the device for security reasons. If _highPower is true, the controller will
* be physically close to the device for security reasons. If _highPower is true, the controller will
* operate at normal power levels instead. Defaults to false.
* \param _nodeId is the node ID used by the command if necessary.
* \param _arg is an optional argument, usually another node ID, that is used by the command.
* \return true if the command was accepted and has queued to be executed.
* \see CancelControllerCommand, HasNodeFailed, RemoveFailedNode, Driver::ControllerCommand, Driver::pfnControllerCallback_t,
* \see CancelControllerCommand, HasNodeFailed, RemoveFailedNode, Driver::ControllerCommand, Driver::pfnControllerCallback_t,
* <p> Commands
* - Driver::ControllerCommand_AddDevice - Add a new device or controller to the Z-Wave network.
* - Driver::ControllerCommand_CreateNewPrimary - Create a new primary controller when old primary fails. Requires SUC.
@ -1447,10 +1471,10 @@ namespace OpenZWave
* - Driver::ControllerCommand_RemoveFailedNode - Remove a node from the network. The node must not be responding
* and be on the controller's failed node list.
* - Driver::ControllerCommand_HasNodeFailed - Check whether a node is in the controller's failed nodes list.
* - Driver::ControllerCommand_ReplaceFailedNode - Replace a failed device with another. If the node is not in
* - Driver::ControllerCommand_ReplaceFailedNode - Replace a failed device with another. If the node is not in
* the controller's failed nodes list, or the node responds, this command will fail.
* - Driver:: ControllerCommand_TransferPrimaryRole - Add a new controller to the network and
* make it the primary. The existing primary will become a secondary controller.
* make it the primary. The existing primary will become a secondary controller.
* - Driver::ControllerCommand_RequestNetworkUpdate - Update the controller with network information from the SUC/SIS.
* - Driver::ControllerCommand_RequestNodeNeighborUpdate - Get a node to rebuild its neighbour list. This method also does RequestNodeNeighbors afterwards.
* - Driver::ControllerCommand_AssignReturnRoute - Assign a network return route to a device.
@ -1461,10 +1485,10 @@ namespace OpenZWave
* - Driver::ControllerCommand_DeleteButton - Delete a handheld button id.
* <p> Callbacks
* - Driver::ControllerState_Starting, the controller command has begun
* - Driver::ControllerState_Waiting, the controller is waiting for a user action. A notice should be displayed
* - Driver::ControllerState_Waiting, the controller is waiting for a user action. A notice should be displayed
* to the user at this point, telling them what to do next.
* For the add, remove, replace and transfer primary role commands, the user needs to be told to press the
* inclusion button on the device that is going to be added or removed. For ControllerCommand_ReceiveConfiguration,
* For the add, remove, replace and transfer primary role commands, the user needs to be told to press the
* inclusion button on the device that is going to be added or removed. For ControllerCommand_ReceiveConfiguration,
* they must set their other controller to send its data, and for ControllerCommand_CreateNewPrimary, set the other
* controller to learn new data.
* - Driver::ControllerState_InProgress - the controller is in the process of adding or removing the chosen node. It is now too late to cancel the command.
@ -1477,7 +1501,7 @@ namespace OpenZWave
* \brief Cancels any in-progress command running on a controller.
* \param _homeId The Home ID of the Z-Wave controller.
* \return true if a command was running and was cancelled.
* \see BeginControllerCommand
* \see BeginControllerCommand
*/
bool CancelControllerCommand( uint32 const _homeId );
/*@}*/
@ -1490,7 +1514,7 @@ namespace OpenZWave
* operations.
*/
/*@{*/
public:
public:
/**
* \brief Test network node.
* Sends a series of messages to a network node for testing network reliability.
@ -1536,7 +1560,7 @@ namespace OpenZWave
* Commands for Z-Wave scene interface.
*/
/*@{*/
public:
public:
/**
* \brief Gets the number of scenes that have been defined.
* \return The number of scenes.
@ -1874,7 +1898,7 @@ namespace OpenZWave
* Commands for Z-Wave statistics interface.
*/
/*@{*/
public:
public:
/**
* \brief Retrieve statistics from driver
* \param _homeId The Home ID of the driver to obtain counters

View file

@ -39,7 +39,7 @@ namespace OpenZWave
/** \brief Message object to be passed to and from devices on the Z-Wave network.
*/
class Msg
class OPENZWAVE_EXPORT Msg
{
public:
enum MessageFlags

View file

@ -39,7 +39,7 @@ namespace OpenZWave
* A notification object is only ever created or deleted internally by
* OpenZWave.
*/
class Notification
class OPENZWAVE_EXPORT Notification
{
friend class Manager;
friend class Driver;

View file

@ -25,8 +25,8 @@
//
//-----------------------------------------------------------------------------
#include <algorithm>
#include <string>
#include <algorithm>
#include <string>
#include "Defs.h"
#include "Options.h"
@ -45,7 +45,7 @@ Options* Options::s_instance = NULL;
// Static method to create an Options object
//-----------------------------------------------------------------------------
Options* Options::Create
(
(
string const& _configPath,
string const& _userPath,
string const& _commandLine
@ -70,8 +70,25 @@ Options* Options::Create
if( !FileOps::FolderExists( configPath ) )
{
Log::Create( "", false, true, LogLevel_Debug, LogLevel_Debug, LogLevel_None );
Log::Write( LogLevel_Error, "Cannot find a path to the configuration files at %s. Exiting...", configPath.c_str() );
exit( 1 );
/* Try some default directories */
if ( FileOps::FolderExists( "config/" ) )
{
Log::Write( LogLevel_Error, "Cannot find a path to the configuration files at %s, Using config/ instead...", configPath.c_str() );
configPath = "config/";
} else if (FileOps::FolderExists("/etc/openzwave/" ) )
{
Log::Write( LogLevel_Error, "Cannot find a path to the configuration files at %s, Using /etc/openzwave/ instead...", configPath.c_str() );
configPath = "/etc/openzwave/";
#ifdef SYSCONFDIR
} else if ( FileOps::FolderExists(SYSCONFDIR ) )
{
Log::Write( LogLevel_Error, "Cannot find a path to the configuration files at %s, Using %s instead...", configPath.c_str(), SYSCONFDIR);
configPath = SYSCONFDIR;
#endif
} else {
Log::Write( LogLevel_Error, "Cannot find a path to the configuration files at %s. Exiting...", configPath.c_str() );
exit( 1 );
}
}
FileOps::Destroy();
s_instance = new Options( configPath, userPath, _commandLine );
@ -165,7 +182,7 @@ Options::~Options
// Add a boolean option.
//-----------------------------------------------------------------------------
bool Options::AddOptionBool
(
(
string const& _name,
bool const _value
)
@ -173,6 +190,8 @@ bool Options::AddOptionBool
// get (or create) option
Option* option = AddOption( _name );
if (option == NULL) return false;
// set unique option members
option->m_type = Options::OptionType_Bool;
option->m_valueBool = _value;
@ -196,6 +215,8 @@ bool Options::AddOptionInt
// get (or create) option
Option* option = AddOption( _name );
if (option == NULL) return false;
// set unique option members
option->m_type = Options::OptionType_Int;
option->m_valueInt = _value;
@ -211,7 +232,7 @@ bool Options::AddOptionInt
// Add a string option.
//-----------------------------------------------------------------------------
bool Options::AddOptionString
(
(
string const& _name,
string const& _value,
bool const _append
@ -220,6 +241,8 @@ bool Options::AddOptionString
// get (or create) option
Option* option = AddOption( _name );
if (option == NULL) return false;
// set unique option members
option->m_type = Options::OptionType_String;
option->m_valueString = _value;
@ -236,9 +259,9 @@ bool Options::AddOptionString
// Get the value of a boolean option.
//-----------------------------------------------------------------------------
bool Options::GetOptionAsBool
(
string const& _name,
bool* o_value
(
string const& _name,
bool* o_value
)
{
Option* option = Find( _name );
@ -257,9 +280,9 @@ bool Options::GetOptionAsBool
// Get the value of an integer option.
//-----------------------------------------------------------------------------
bool Options::GetOptionAsInt
(
string const& _name,
int32* o_value
(
string const& _name,
int32* o_value
)
{
Option* option = Find( _name );
@ -278,9 +301,9 @@ bool Options::GetOptionAsInt
// Get the value of a string option.
//-----------------------------------------------------------------------------
bool Options::GetOptionAsString
(
string const& _name,
string* o_value
(
string const& _name,
string* o_value
)
{
Option* option = Find( _name );
@ -299,7 +322,7 @@ bool Options::GetOptionAsString
// Get the type of value stored in an option.
//-----------------------------------------------------------------------------
Options::OptionType Options::GetOptionType
(
(
string const& _name
)
{
@ -461,7 +484,7 @@ bool Options::ParseOptionsXML
{
char const* value = optionElement->Attribute( "value" );
if( value )
{
{
// Set the value
option->SetValueFromString( value );
}
@ -480,7 +503,7 @@ bool Options::ParseOptionsXML
// General setup for adding a specific option
//-----------------------------------------------------------------------------
Options::Option* Options::AddOption
(
(
string const& _name
)
{
@ -556,7 +579,7 @@ bool Options::Option::SetValueFromString
{
if( m_append && ( m_valueString.size() > 0 ) )
{
m_valueString += ( string(",") + _value );
m_valueString += ( string(",") + _value );
}
else
{

View file

@ -63,7 +63,7 @@ namespace OpenZWave
* so that no more calls aside from GetOptionAs may be made.
* 4) Create the OpenZWave Manager object.
*/
class Options
class OPENZWAVE_EXPORT Options
{
public:
enum OptionType
@ -239,7 +239,9 @@ namespace OpenZWave
Option* AddOption( string const& _name ); // check lock and create (or open existing) option
Option* Find( string const& _name );
OPENZWAVE_EXPORT_WARNINGS_OFF
map<string,Option*> m_options; // Map of option names to values.
OPENZWAVE_EXPORT_WARNINGS_ON
string m_xml; // Path to XML options file.
string m_commandLine; // String containing command line options.
bool m_locked; // If true, the options are final and AddOption can no longer be called.

View file

@ -65,7 +65,7 @@ namespace OpenZWave
static uint8 GetAllScenes( uint8** _sceneIds );
string const& GetLabel()const{ return m_label; }
void SetLabel( string const _label ){ m_label = _label; }
void SetLabel( string const &_label ){ m_label = _label; }
bool AddValue( ValueID const& _valueId, string const& _value );
bool RemoveValue( ValueID const& _valueId );

View file

@ -91,6 +91,8 @@ bool Alarm::RequestValue
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
} else {
Log::Write( LogLevel_Info, GetNodeId(), "AlarmCmd_Get Not Supported on this node");
}
return false;
}

View file

@ -53,10 +53,10 @@ enum AssociationCmd
// Constructor
//-----------------------------------------------------------------------------
Association::Association
(
(
uint32 const _homeId,
uint8 const _nodeId
):
):
CommandClass( _homeId, _nodeId ),
m_queryAll(false),
m_numGroups(0)
@ -69,7 +69,7 @@ Association::Association
// Read the saved association data
//-----------------------------------------------------------------------------
void Association::ReadXML
(
(
TiXmlElement const* _ccElement
)
{
@ -111,7 +111,7 @@ void Association::ReadXML
// Save the association data
//-----------------------------------------------------------------------------
void Association::WriteXML
(
(
TiXmlElement* _ccElement
)
{
@ -126,7 +126,7 @@ void Association::WriteXML
associationsElement->SetAttribute( "num_groups", str );
_ccElement->LinkEndChild( associationsElement );
node->WriteGroups( associationsElement );
node->WriteGroups( associationsElement );
}
}
@ -167,7 +167,6 @@ bool Association::RequestValue
// This command class doesn't work with multiple instances
return false;
}
// Request the supported group info
Msg* msg = new Msg( "Get Association Groupings", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->Append( GetNodeId() );
@ -195,7 +194,7 @@ void Association::RequestAllGroups
{
// We start with group 255, and will then move to group 1, 2 etc and stop when we find a group with a maxAssociations of zero.
Log::Write( LogLevel_Info, GetNodeId(), "Number of association groups reported for node %d is 255, which requires special case handling.", GetNodeId() );
QueryGroup( 0xff, _requestFlags );
QueryGroup( 0xff, _requestFlags );
}
else
{
@ -222,7 +221,7 @@ bool Association::HandleMsg
if( Node* node = GetNodeUnsafe() )
{
if( AssociationCmd_GroupingsReport == (AssociationCmd)_data[0] )
{
{
// Retrieve the number of groups this device supports.
// The groups will be queried with the session data.
m_numGroups = _data[1];
@ -326,17 +325,23 @@ void Association::QueryGroup
uint32 const _requestFlags
)
{
Log::Write( LogLevel_Info, GetNodeId(), "Get Associations for group %d of node %d", _groupIdx, GetNodeId() );
Msg* msg = new Msg( "Get Associations", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->Append( GetNodeId() );
msg->Append( 3 );
msg->Append( GetCommandClassId() );
msg->Append( AssociationCmd_Get );
msg->Append( _groupIdx );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, Driver::MsgQueue_Send );
if ( IsGetSupported() )
{
Log::Write( LogLevel_Info, GetNodeId(), "Get Associations for group %d of node %d", _groupIdx, GetNodeId() );
Msg* msg = new Msg( "Get Associations", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->Append( GetNodeId() );
msg->Append( 3 );
msg->Append( GetCommandClassId() );
msg->Append( AssociationCmd_Get );
msg->Append( _groupIdx );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, Driver::MsgQueue_Send );
return;
} else {
Log::Write( LogLevel_Info, GetNodeId(), "AssociationCmd_Get Not Supported on this node");
}
return;
}
//-----------------------------------------------------------------------------
// <Association::Set>
// Add an association between devices
@ -349,7 +354,7 @@ void Association::Set
{
Log::Write( LogLevel_Info, GetNodeId(), "Association::Set - Adding node %d to group %d of node %d", _targetNodeId, _groupIdx, GetNodeId() );
Msg* msg = new Msg( "Association Set", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true );
Msg* msg = new Msg( "Association Set", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true );
msg->Append( GetNodeId() );
msg->Append( 4 );
msg->Append( GetCommandClassId() );
@ -372,7 +377,7 @@ void Association::Remove
{
Log::Write( LogLevel_Info, GetNodeId(), "Association::Remove - Removing node %d from group %d of node %d", _targetNodeId, _groupIdx, GetNodeId() );
Msg* msg = new Msg( "Association Remove", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true );
Msg* msg = new Msg( "Association Remove", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true );
msg->Append( GetNodeId() );
msg->Append( 4 );
msg->Append( GetCommandClassId() );

View file

@ -59,8 +59,8 @@ enum
//-----------------------------------------------------------------------------
// <AssociationCommandConfiguration::RequestState>
// Request current state from the device
// <AssociationCommandConfiguration::RequestState>
// Request current state from the device
//-----------------------------------------------------------------------------
bool AssociationCommandConfiguration::RequestState
(
@ -78,8 +78,8 @@ bool AssociationCommandConfiguration::RequestState
}
//-----------------------------------------------------------------------------
// <AssociationCommandConfiguration::RequestValue>
// Request current value from the device
// <AssociationCommandConfiguration::RequestValue>
// Request current value from the device
//-----------------------------------------------------------------------------
bool AssociationCommandConfiguration::RequestValue
(
@ -106,8 +106,8 @@ bool AssociationCommandConfiguration::RequestValue
}
//-----------------------------------------------------------------------------
// <AssociationCommandConfiguration::RequestCommands>
// Request the command data
// <AssociationCommandConfiguration::RequestCommands>
// Request the command data
//-----------------------------------------------------------------------------
void AssociationCommandConfiguration::RequestCommands
(
@ -115,17 +115,21 @@ void AssociationCommandConfiguration::RequestCommands
uint8 const _nodeId
)
{
Msg* msg = new Msg( "AssociationCommandConfigurationCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->Append( GetNodeId() );
msg->Append( 4 );
msg->Append( GetCommandClassId() );
msg->Append( AssociationCommandConfigurationCmd_Get );
msg->Append( _groupIdx );
msg->Append( _nodeId );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, Driver::MsgQueue_Send );
if ( IsGetSupported() )
{
Msg* msg = new Msg( "AssociationCommandConfigurationCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->Append( GetNodeId() );
msg->Append( 4 );
msg->Append( GetCommandClassId() );
msg->Append( AssociationCommandConfigurationCmd_Get );
msg->Append( _groupIdx );
msg->Append( _nodeId );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, Driver::MsgQueue_Send );
} else {
Log::Write( LogLevel_Info, GetNodeId(), "AssociationCommandConfigurationCmd_Get Not Supported on this node");
}
}
//-----------------------------------------------------------------------------
// <AssociationCommandConfiguration::HandleMsg>
// Handle a message from the Z-Wave network
@ -186,7 +190,7 @@ bool AssociationCommandConfiguration::HandleMsg
}
return true;
}
if (AssociationCommandConfigurationCmd_Report == (AssociationCommandConfigurationCmd)_data[0])
{
uint8 groupIdx = _data[1];
@ -245,7 +249,7 @@ void AssociationCommandConfiguration::CreateVars
//-----------------------------------------------------------------------------
// <AssociationCommandConfiguration::SetCommand>
// Set a command for the association
// Set a command for the association
//-----------------------------------------------------------------------------
void AssociationCommandConfiguration::SetCommand
(

View file

@ -68,7 +68,7 @@ Basic::Basic
// Read configuration.
//-----------------------------------------------------------------------------
void Basic::ReadXML
(
(
TiXmlElement const* _ccElement
)
{
@ -101,7 +101,7 @@ void Basic::ReadXML
// Save changed configuration
//-----------------------------------------------------------------------------
void Basic::WriteXML
(
(
TiXmlElement* _ccElement
)
{
@ -155,15 +155,21 @@ bool Basic::RequestValue
Driver::MsgQueue const _queue
)
{
Msg* msg = new Msg( "BasicCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->SetInstance( this, _instance );
msg->Append( GetNodeId() );
msg->Append( 2 );
msg->Append( GetCommandClassId() );
msg->Append( BasicCmd_Get );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
if ( IsGetSupported() )
{
Msg* msg = new Msg( "BasicCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->SetInstance( this, _instance );
msg->Append( GetNodeId() );
msg->Append( 2 );
msg->Append( GetCommandClassId() );
msg->Append( BasicCmd_Get );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
} else {
Log::Write( LogLevel_Info, GetNodeId(), "BasicCmd_Get Not Supported on this node");
}
return false;
}
//-----------------------------------------------------------------------------
@ -236,9 +242,9 @@ bool Basic::SetValue
if( ValueID::ValueType_Byte == _value.GetID().GetType() )
{
ValueByte const* value = static_cast<ValueByte const*>(&_value);
Log::Write( LogLevel_Info, GetNodeId(), "Basic::Set - Setting node %d to level %d", GetNodeId(), value->GetValue() );
Msg* msg = new Msg( "Basic Set", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true );
Msg* msg = new Msg( "Basic Set", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true );
msg->SetInstance( this, _value.GetID().GetInstance() );
msg->Append( GetNodeId() );
msg->Append( 3 );

View file

@ -44,8 +44,8 @@ enum BatteryCmd
};
//-----------------------------------------------------------------------------
// <Battery::RequestState>
// Request current state from the device
// <Battery::RequestState>
// Request current state from the device
//-----------------------------------------------------------------------------
bool Battery::RequestState
(
@ -63,8 +63,8 @@ bool Battery::RequestState
}
//-----------------------------------------------------------------------------
// <Battery::RequestValue>
// Request current value from the device
// <Battery::RequestValue>
// Request current value from the device
//-----------------------------------------------------------------------------
bool Battery::RequestValue
(
@ -79,15 +79,20 @@ bool Battery::RequestValue
// This command class doesn't work with multiple instances
return false;
}
Msg* msg = new Msg( "BatteryCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->Append( GetNodeId() );
msg->Append( 2 );
msg->Append( GetCommandClassId() );
msg->Append( BatteryCmd_Get );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
if ( IsGetSupported() )
{
Msg* msg = new Msg( "BatteryCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->Append( GetNodeId() );
msg->Append( 2 );
msg->Append( GetCommandClassId() );
msg->Append( BatteryCmd_Get );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
} else {
Log::Write( LogLevel_Info, GetNodeId(), "BatteryCmd_Get Not Supported on this node");
}
return false;
}
//-----------------------------------------------------------------------------

View file

@ -52,7 +52,7 @@ enum
ClockIndex_Minute
};
static char const* c_dayNames[] =
static char const* c_dayNames[] =
{
"Invalid",
"Monday",
@ -95,15 +95,21 @@ bool Clock::RequestValue
Driver::MsgQueue const _queue
)
{
Msg* msg = new Msg( "ClockCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->SetInstance( this, _instance );
msg->Append( GetNodeId() );
msg->Append( 2 );
msg->Append( GetCommandClassId() );
msg->Append( ClockCmd_Get );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
if ( IsGetSupported() )
{
Msg* msg = new Msg( "ClockCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->SetInstance( this, _instance );
msg->Append( GetNodeId() );
msg->Append( 2 );
msg->Append( GetCommandClassId() );
msg->Append( ClockCmd_Get );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
} else {
Log::Write( LogLevel_Info, GetNodeId(), "ClockCmd_Get Not Supported on this node");
}
return false;
}
//-----------------------------------------------------------------------------
@ -114,7 +120,7 @@ bool Clock::HandleMsg
(
uint8 const* _data,
uint32 const _length,
uint32 const _instance // = 1
uint32 const _instance // = 1
)
{
if (ClockCmd_Report == (ClockCmd)_data[0])
@ -143,7 +149,7 @@ bool Clock::HandleMsg
}
return true;
}
return false;
}
@ -211,11 +217,11 @@ void Clock::CreateVars
{
vector<ValueList::Item> items;
for( int i=1; i<=7; ++i )
{
{
ValueList::Item item;
item.m_label = c_dayNames[i];
item.m_value = i;
items.push_back( item );
items.push_back( item );
}
node->CreateValueList( ValueID::ValueGenre_User, GetCommandClassId(), _instance, ClockIndex_Day, "Day", "", false, false, 1, items, 0, 0 );

View file

@ -408,7 +408,7 @@ string CommandClass::ExtractValue
if( precision == 0 )
{
// The precision is zero, so we can just print the number directly into the string.
snprintf( numBuf, 12, "%d", (signed long)value );
snprintf( numBuf, 12, "%d", (signed int)value );
res = numBuf;
}
else
@ -416,7 +416,7 @@ string CommandClass::ExtractValue
// We'll need to insert a decimal point and include any necessary leading zeros.
// Fill the buffer with the value padded with leading zeros.
snprintf( numBuf, 12, "%011d", (signed long)value );
snprintf( numBuf, 12, "%011d", (signed int)value );
// Calculate the position of the decimal point in the buffer
int32 decimal = 10-precision;

View file

@ -44,7 +44,7 @@ namespace OpenZWave
/** \brief Base class for all Z-Wave command classes.
*/
class CommandClass
class OPENZWAVE_EXPORT CommandClass
{
public:
@ -91,7 +91,7 @@ namespace OpenZWave
}
uint8 GetInstance( uint8 const _endPoint )
{
for( map<uint8,uint8>::iterator it = m_endPointMap.begin(); it != m_endPointMap.end(); it++ )
for( map<uint8,uint8>::iterator it = m_endPointMap.begin(); it != m_endPointMap.end(); ++it )
{
if( _endPoint == it->second )
{
@ -136,7 +136,9 @@ namespace OpenZWave
uint8 m_nodeId;
uint8 m_version;
Bitfield m_instances;
OPENZWAVE_EXPORT_WARNINGS_OFF
map<uint8,uint8> m_endPointMap;
OPENZWAVE_EXPORT_WARNINGS_ON
bool m_afterMark; // Set to true if the command class is listed after COMMAND_CLASS_MARK, and should not create any values.
bool m_createVars; // Do we want to create variables
int8 m_overridePrecision; // Override precision when writing values if >=0

View file

@ -71,9 +71,9 @@ bool Configuration::HandleMsg
paramValue |= (int32)_data[i+3];
}
if ( Value* value = GetValue( 1, parameter ) )
if ( Value* value = GetValue( 1, parameter ) )
{
switch ( value->GetID().GetType() )
switch ( value->GetID().GetType() )
{
case ValueID::ValueType_Bool:
{
@ -226,21 +226,25 @@ bool Configuration::RequestValue
// This command class doesn't work with multiple instances
return false;
}
Msg* msg = new Msg( "ConfigurationCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->Append( GetNodeId() );
msg->Append( 3 );
msg->Append( GetCommandClassId() );
msg->Append( ConfigurationCmd_Get );
msg->Append( _parameter );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
if ( IsGetSupported() )
{
Msg* msg = new Msg( "ConfigurationCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->Append( GetNodeId() );
msg->Append( 3 );
msg->Append( GetCommandClassId() );
msg->Append( ConfigurationCmd_Get );
msg->Append( _parameter );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
} else {
Log::Write( LogLevel_Info, GetNodeId(), "ConfigurationCmd_Get Not Supported on this node");
}
return false;
}
//-----------------------------------------------------------------------------
// <Configuration::Set>
// Set the device's
// Set the device's
//-----------------------------------------------------------------------------
void Configuration::Set
(
@ -263,7 +267,7 @@ void Configuration::Set
msg->Append( (uint8)( ( _value>>24 ) & 0xff ) );
msg->Append( (uint8)( ( _value>>16 ) & 0xff ) );
}
if( _size > 1 )
if( _size > 1 )
{
msg->Append( (uint8)( ( _value>>8 ) & 0xff ) );
}

View file

@ -43,7 +43,7 @@ enum EnergyProductionCmd
EnergyProductionCmd_Report = 0x03
};
enum
enum
{
EnergyProductionIndex_Instant = 0,
EnergyProductionIndex_Total,
@ -51,7 +51,7 @@ enum
EnergyProductionIndex_Time
};
static char const* c_energyParameterNames[] =
static char const* c_energyParameterNames[] =
{
"Instant energy production",
"Total energy production",
@ -60,8 +60,8 @@ static char const* c_energyParameterNames[] =
};
//-----------------------------------------------------------------------------
// <EnergyProduction::RequestState>
// Request current state from the device
// <EnergyProduction::RequestState>
// Request current state from the device
//-----------------------------------------------------------------------------
bool EnergyProduction::RequestState
(
@ -84,8 +84,8 @@ bool EnergyProduction::RequestState
}
//-----------------------------------------------------------------------------
// <EnergyProduction::RequestValue>
// Request current production from the device
// <EnergyProduction::RequestValue>
// Request current production from the device
//-----------------------------------------------------------------------------
bool EnergyProduction::RequestValue
(
@ -95,19 +95,24 @@ bool EnergyProduction::RequestValue
Driver::MsgQueue const _queue
)
{
Log::Write( LogLevel_Info, GetNodeId(), "Requesting the %s value", c_energyParameterNames[_valueEnum] );
Msg* msg = new Msg( "EnergyProductionCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->SetInstance( this, _instance );
msg->Append( GetNodeId() );
msg->Append( 3 );
msg->Append( GetCommandClassId() );
msg->Append( EnergyProductionCmd_Get );
msg->Append( _valueEnum );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
if ( IsGetSupported() )
{
Log::Write( LogLevel_Info, GetNodeId(), "Requesting the %s value", c_energyParameterNames[_valueEnum] );
Msg* msg = new Msg( "EnergyProductionCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->SetInstance( this, _instance );
msg->Append( GetNodeId() );
msg->Append( 3 );
msg->Append( GetCommandClassId() );
msg->Append( EnergyProductionCmd_Get );
msg->Append( _valueEnum );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
} else {
Log::Write( LogLevel_Info, GetNodeId(), "EnergyProductionCmd_Get Not Supported on this node");
}
return false;
}
//-----------------------------------------------------------------------------
// <EnergyProduction::HandleMsg>
// Handle a message from the Z-Wave network

View file

@ -45,8 +45,8 @@ enum IndicatorCmd
};
//-----------------------------------------------------------------------------
// <Indicator::RequestState>
// Request current state from the device
// <Indicator::RequestState>
// Request current state from the device
//-----------------------------------------------------------------------------
bool Indicator::RequestState
(
@ -64,8 +64,8 @@ bool Indicator::RequestState
}
//-----------------------------------------------------------------------------
// <Indicator::RequestValue>
// Request current value from the device
// <Indicator::RequestValue>
// Request current value from the device
//-----------------------------------------------------------------------------
bool Indicator::RequestValue
(
@ -75,17 +75,24 @@ bool Indicator::RequestValue
Driver::MsgQueue const _queue
)
{
Msg* msg = new Msg( "IndicatorCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->SetInstance( this, _instance );
msg->Append( GetNodeId() );
msg->Append( 2 );
msg->Append( GetCommandClassId() );
msg->Append( IndicatorCmd_Get );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
if ( IsGetSupported() )
{
Msg* msg = new Msg( "IndicatorCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->SetInstance( this, _instance );
msg->Append( GetNodeId() );
msg->Append( 2 );
msg->Append( GetCommandClassId() );
msg->Append( IndicatorCmd_Get );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
} else {
Log::Write( LogLevel_Info, GetNodeId(), "IndicatorCmd_Get Not Supported on this node");
}
return false;
}
//-----------------------------------------------------------------------------
// <Indicator::HandleMsg>
// Handle a message from the Z-Wave network
@ -114,7 +121,7 @@ bool Indicator::HandleMsg
//-----------------------------------------------------------------------------
// <Indicator::SetValue>
// Set the device's indicator value
// Set the device's indicator value
//-----------------------------------------------------------------------------
bool Indicator::SetValue
(
@ -126,7 +133,7 @@ bool Indicator::SetValue
ValueByte const* value = static_cast<ValueByte const*>(&_value);
Log::Write( LogLevel_Info, GetNodeId(), "Indicator::SetValue - Setting indicator to %d", value->GetValue());
Msg* msg = new Msg( "Basic Set", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true );
Msg* msg = new Msg( "Basic Set", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true );
msg->SetInstance( this, _value.GetID().GetInstance() );
msg->Append( GetNodeId() );
msg->Append( 3 );

View file

@ -51,8 +51,8 @@ enum
};
//-----------------------------------------------------------------------------
// <Language::RequestState>
// Request current state from the device
// <Language::RequestState>
// Request current state from the device
//-----------------------------------------------------------------------------
bool Language::RequestState
(
@ -70,8 +70,8 @@ bool Language::RequestState
}
//-----------------------------------------------------------------------------
// <Language::RequestValue>
// Request current value from the device
// <Language::RequestValue>
// Request current value from the device
//-----------------------------------------------------------------------------
bool Language::RequestValue
(
@ -86,15 +86,20 @@ bool Language::RequestValue
// This command class doesn't work with multiple instances
return false;
}
Msg* msg = new Msg( "LanguageCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->Append( GetNodeId() );
msg->Append( 2 );
msg->Append( GetCommandClassId() );
msg->Append( LanguageCmd_Get );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
if ( IsGetSupported() )
{
Msg* msg = new Msg( "LanguageCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->Append( GetNodeId() );
msg->Append( 2 );
msg->Append( GetCommandClassId() );
msg->Append( LanguageCmd_Get );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
} else {
Log::Write( LogLevel_Info, GetNodeId(), "LanguageCmd_Get Not Supported on this node");
}
return false;
}
//-----------------------------------------------------------------------------

View file

@ -45,8 +45,8 @@ enum LockCmd
};
//-----------------------------------------------------------------------------
// <Lock::RequestState>
// Request current state from the device
// <Lock::RequestState>
// Request current state from the device
//-----------------------------------------------------------------------------
bool Lock::RequestState
(
@ -64,8 +64,8 @@ bool Lock::RequestState
}
//-----------------------------------------------------------------------------
// <Lock::RequestValue>
// Request current value from the device
// <Lock::RequestValue>
// Request current value from the device
//-----------------------------------------------------------------------------
bool Lock::RequestValue
(
@ -75,17 +75,24 @@ bool Lock::RequestValue
Driver::MsgQueue const _queue
)
{
Msg* msg = new Msg( "LockCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->SetInstance( this, _instance );
msg->Append( GetNodeId() );
msg->Append( 2 );
msg->Append( GetCommandClassId() );
msg->Append( LockCmd_Get );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
if ( IsGetSupported() )
{
Msg* msg = new Msg( "LockCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->SetInstance( this, _instance );
msg->Append( GetNodeId() );
msg->Append( 2 );
msg->Append( GetCommandClassId() );
msg->Append( LockCmd_Get );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
} else {
Log::Write( LogLevel_Info, GetNodeId(), "LockCmd_Get Not Supported on this node");
}
return false;
}
//-----------------------------------------------------------------------------
// <Lock::HandleMsg>
// Handle a message from the Z-Wave network

View file

@ -54,8 +54,8 @@ map<int64,ManufacturerSpecific::Product*> ManufacturerSpecific::s_productMap;
bool ManufacturerSpecific::s_bXmlLoaded = false;
//-----------------------------------------------------------------------------
// <ManufacturerSpecific::RequestState>
// Request current state from the device
// <ManufacturerSpecific::RequestState>
// Request current state from the device
//-----------------------------------------------------------------------------
bool ManufacturerSpecific::RequestState
(
@ -73,8 +73,8 @@ bool ManufacturerSpecific::RequestState
}
//-----------------------------------------------------------------------------
// <ManufacturerSpecific::RequestValue>
// Request current value from the device
// <ManufacturerSpecific::RequestValue>
// Request current value from the device
//-----------------------------------------------------------------------------
bool ManufacturerSpecific::RequestValue
(
@ -89,15 +89,20 @@ bool ManufacturerSpecific::RequestValue
// This command class doesn't work with multiple instances
return false;
}
Msg* msg = new Msg( "ManufacturerSpecificCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->Append( GetNodeId() );
msg->Append( 2 );
msg->Append( GetCommandClassId() );
msg->Append( ManufacturerSpecificCmd_Get );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
if ( IsGetSupported() )
{
Msg* msg = new Msg( "ManufacturerSpecificCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->Append( GetNodeId() );
msg->Append( 2 );
msg->Append( GetCommandClassId() );
msg->Append( ManufacturerSpecificCmd_Get );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
} else {
Log::Write( LogLevel_Info, GetNodeId(), "ManufacturerSpecificCmd_Get Not Supported on this node");
}
return false;
}
string ManufacturerSpecific::SetProductDetails
@ -114,12 +119,12 @@ string ManufacturerSpecific::SetProductDetails
snprintf( str, sizeof(str), "Unknown: id=%.4x", manufacturerId );
string manufacturerName = str;
snprintf( str, sizeof(str), "Unknown: type=%.4x, id=%.4x", productType, productId );
string productName = str;
string productName = str;
string configPath = "";
// Try to get the real manufacturer and product names
map<uint16,string>::iterator mit = s_manufacturerMap.find( manufacturerId );
if( mit != s_manufacturerMap.end() )
@ -158,7 +163,7 @@ string ManufacturerSpecific::SetProductDetails
snprintf( str, sizeof(str), "%.4x", productId );
node->SetProductId( str );
return configPath;
}
@ -193,12 +198,12 @@ bool ManufacturerSpecific::HandleMsg
LoadConfigXML( node, configPath );
}
Log::Write( LogLevel_Info, GetNodeId(), "Received manufacturer specific report from node %d: Manufacturer=%s, Product=%s",
Log::Write( LogLevel_Info, GetNodeId(), "Received manufacturer specific report from node %d: Manufacturer=%s, Product=%s",
GetNodeId(), node->GetManufacturerName().c_str(), node->GetProductName().c_str() );
ClearStaticRequest( StaticRequest_Values );
node->m_manufacturerSpecificClassReceived = true;
}
// Notify the watchers of the name changes
Notification* notification = new Notification( Notification::Type_NodeNaming );
notification->SetHomeAndNodeIds( GetHomeId(), GetNodeId() );
@ -206,7 +211,7 @@ bool ManufacturerSpecific::HandleMsg
return true;
}
return false;
}
@ -229,7 +234,7 @@ bool ManufacturerSpecific::LoadProductXML
TiXmlDocument* pDoc = new TiXmlDocument();
if( !pDoc->LoadFile( filename.c_str(), TIXML_ENCODING_UTF8 ) )
{
delete pDoc;
delete pDoc;
Log::Write( LogLevel_Info, "Unable to load %s", filename.c_str() );
return false;
}
@ -238,7 +243,7 @@ bool ManufacturerSpecific::LoadProductXML
char const* str;
char* pStopChar;
TiXmlElement const* manufacturerElement = root->FirstChildElement();
while( manufacturerElement )
{
@ -262,7 +267,7 @@ bool ManufacturerSpecific::LoadProductXML
delete pDoc;
return false;
}
// Add this manufacturer to the map
s_manufacturerMap[manufacturerId] = str;
@ -277,16 +282,16 @@ bool ManufacturerSpecific::LoadProductXML
if( !str )
{
Log::Write( LogLevel_Info, "Error in manufacturer_specific.xml at line %d - missing product type attribute", productElement->Row() );
delete pDoc;
delete pDoc;
return false;
}
uint16 productType = (uint16)strtol( str, &pStopChar, 16 );
str = productElement->Attribute( "id" );
if( !str )
{
Log::Write( LogLevel_Info, "Error in manufacturer_specific.xml at line %d - missing product id attribute", productElement->Row() );
delete pDoc;
delete pDoc;
return false;
}
uint16 productId = (uint16)strtol( str, &pStopChar, 16 );
@ -295,7 +300,7 @@ bool ManufacturerSpecific::LoadProductXML
if( !str )
{
Log::Write( LogLevel_Info, "Error in manufacturer_specific.xml at line %d - missing product name attribute", productElement->Row() );
delete pDoc;
delete pDoc;
return false;
}
string productName = str;
@ -331,7 +336,7 @@ bool ManufacturerSpecific::LoadProductXML
manufacturerElement = manufacturerElement->NextSiblingElement();
}
delete pDoc;
delete pDoc;
return true;
}
@ -376,14 +381,14 @@ bool ManufacturerSpecific::LoadConfigXML
{
string configPath;
Options::Get()->GetOptionAsString( "ConfigPath", &configPath );
string filename = configPath + _configXML;
TiXmlDocument* doc = new TiXmlDocument();
Log::Write( LogLevel_Info, _node->GetNodeId(), " Opening config param file %s", filename.c_str() );
if( !doc->LoadFile( filename.c_str(), TIXML_ENCODING_UTF8 ) )
{
delete doc;
delete doc;
Log::Write( LogLevel_Info, _node->GetNodeId(), "Unable to find or load Config Param file %s", filename.c_str() );
return false;
}
@ -402,7 +407,7 @@ bool ManufacturerSpecific::LoadConfigXML
_node->ReadCommandClassesXML( doc->RootElement() );
}
delete doc;
delete doc;
return true;
}

View file

@ -67,7 +67,7 @@ enum
};
static char const* c_meterTypes[] =
static char const* c_meterTypes[] =
{
"Unknown",
"Electric",
@ -75,7 +75,7 @@ static char const* c_meterTypes[] =
"Water"
};
static char const* c_electricityUnits[] =
static char const* c_electricityUnits[] =
{
"kWh",
"kVAh",
@ -87,7 +87,7 @@ static char const* c_electricityUnits[] =
""
};
static char const* c_gasUnits[] =
static char const* c_gasUnits[] =
{
"cubic meters",
"cubic feet",
@ -99,7 +99,7 @@ static char const* c_gasUnits[] =
""
};
static char const* c_waterUnits[] =
static char const* c_waterUnits[] =
{
"cubic meters",
"cubic feet",
@ -111,7 +111,7 @@ static char const* c_waterUnits[] =
""
};
static char const* c_electricityLabels[] =
static char const* c_electricityLabels[] =
{
"Energy",
"Energy",
@ -124,7 +124,7 @@ static char const* c_electricityLabels[] =
};
//-----------------------------------------------------------------------------
// <Meter::Meter>
// <Meter::Meter>
// Constructor
//-----------------------------------------------------------------------------
Meter::Meter
@ -132,15 +132,14 @@ Meter::Meter
uint32 const _homeId,
uint8 const _nodeId
):
CommandClass( _homeId, _nodeId ),
m_scale( 0 )
CommandClass( _homeId, _nodeId )
{
SetStaticRequest( StaticRequest_Values );
}
//-----------------------------------------------------------------------------
// <Meter::RequestState>
// Request current state from the device
// <Meter::RequestState>
// Request current state from the device
//-----------------------------------------------------------------------------
bool Meter::RequestState
(
@ -175,8 +174,8 @@ bool Meter::RequestState
}
//-----------------------------------------------------------------------------
// <Meter::RequestValue>
// Request current value from the device
// <Meter::RequestValue>
// Request current value from the device
//-----------------------------------------------------------------------------
bool Meter::RequestValue
(
@ -187,6 +186,11 @@ bool Meter::RequestValue
)
{
bool res = false;
if ( !IsGetSupported())
{
Log::Write( LogLevel_Info, GetNodeId(), "MeterCmd_Get Not Supported on this node");
return false;
}
for( uint8 i=0; i<8; ++i )
{
uint8 baseIndex = i<<2;
@ -252,8 +256,6 @@ bool Meter::HandleSupportedReport
if( Node* node = GetNodeUnsafe() )
{
string msg;
string valueLabel;
msg = c_meterTypes[meterType];
msg += ": ";
// Create the list of supported scales
@ -381,7 +383,7 @@ bool Meter::HandleReport
string units;
switch( (MeterType)(_data[1] & 0x1f) )
{
{
case MeterType_Electric:
{
// Electricity Meter
@ -492,7 +494,7 @@ bool Meter::HandleReport
}
}
}
return true;
}
@ -511,7 +513,7 @@ bool Meter::SetValue
if( button->IsPressed() )
{
Msg* msg = new Msg( "MeterCmd_Reset", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true );
msg->SetInstance( this, _value.GetID().GetInstance() );
msg->SetInstance( this, _value.GetID().GetInstance() );
msg->Append( GetNodeId() );
msg->Append( 2 );
msg->Append( GetCommandClassId() );

View file

@ -63,7 +63,6 @@ namespace OpenZWave
bool HandleSupportedReport( uint8 const* _data, uint32 const _length, uint32 const _instance = 1 );
bool HandleReport( uint8 const* _data, uint32 const _length, uint32 const _instance = 1 );
uint32 m_scale;
};
} // namespace OpenZWave

View file

@ -44,8 +44,8 @@ enum MeterPulseCmd
};
//-----------------------------------------------------------------------------
// <MeterPulse::RequestState>
// Request current state from the device
// <MeterPulse::RequestState>
// Request current state from the device
//-----------------------------------------------------------------------------
bool MeterPulse::RequestState
(
@ -63,8 +63,8 @@ bool MeterPulse::RequestState
}
//-----------------------------------------------------------------------------
// <MeterPulse::RequestValue>
// Request current value from the device
// <MeterPulse::RequestValue>
// Request current value from the device
//-----------------------------------------------------------------------------
bool MeterPulse::RequestValue
(
@ -74,15 +74,21 @@ bool MeterPulse::RequestValue
Driver::MsgQueue const _queue
)
{
Msg* msg = new Msg( "MeterPulseCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->SetInstance( this, _instance );
msg->Append( GetNodeId() );
msg->Append( 2 );
msg->Append( GetCommandClassId() );
msg->Append( MeterPulseCmd_Get );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
if ( IsGetSupported() )
{
Msg* msg = new Msg( "MeterPulseCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->SetInstance( this, _instance );
msg->Append( GetNodeId() );
msg->Append( 2 );
msg->Append( GetCommandClassId() );
msg->Append( MeterPulseCmd_Get );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
} else {
Log::Write( LogLevel_Info, GetNodeId(), "MeterPulseCmd_Get Not Supported on this node");
}
return false;
}
//-----------------------------------------------------------------------------

View file

@ -99,7 +99,7 @@ MultiInstance::MultiInstance
// Class specific configuration
//-----------------------------------------------------------------------------
void MultiInstance::ReadXML
(
(
TiXmlElement const* _ccElement
)
{
@ -142,7 +142,7 @@ void MultiInstance::ReadXML
// Class specific configuration
//-----------------------------------------------------------------------------
void MultiInstance::WriteXML
(
(
TiXmlElement* _ccElement
)
{
@ -289,7 +289,7 @@ bool MultiInstance::HandleMsg
// Handle a message from the Z-Wave network
//-----------------------------------------------------------------------------
void MultiInstance::HandleMultiInstanceReport
(
(
uint8 const* _data,
uint32 const _length
)
@ -313,7 +313,7 @@ void MultiInstance::HandleMultiInstanceReport
// Handle a message from the Z-Wave network
//-----------------------------------------------------------------------------
void MultiInstance::HandleMultiInstanceEncap
(
(
uint8 const* _data,
uint32 const _length
)
@ -340,7 +340,7 @@ void MultiInstance::HandleMultiInstanceEncap
// Handle a message from the Z-Wave network
//-----------------------------------------------------------------------------
void MultiInstance::HandleMultiChannelEndPointReport
(
(
uint8 const* _data,
uint32 const _length
)
@ -375,7 +375,7 @@ void MultiInstance::HandleMultiChannelEndPointReport
// Since the end point finds do not appear to work this is the best estimate.
for( uint8 i = 1; i <= len; i++ )
{
// Send a single capability request to each endpoint
char str[128];
snprintf( str, sizeof( str ), "MultiChannelCmd_CapabilityGet for endpoint %d", i );
@ -395,15 +395,24 @@ void MultiInstance::HandleMultiChannelEndPointReport
// Handle a message from the Z-Wave network
//-----------------------------------------------------------------------------
void MultiInstance::HandleMultiChannelCapabilityReport
(
(
uint8 const* _data,
uint32 const _length
)
{
bool dynamic = ((_data[1] & 0x80)!=0);
/* if you having problems with Dynamic Devices not correctly
* updating the commandclasses, see this email thread:
* https://groups.google.com/d/topic/openzwave/IwepxScRAVo/discussion
*/
if (!dynamic && m_endPointCommandClasses.size() > 0)
return;
if( Node* node = GetNodeUnsafe() )
{
uint8 endPoint = _data[1] & 0x7f;
bool dynamic = ((_data[1] & 0x80)!=0);
Log::Write( LogLevel_Info, GetNodeId(), "Received MultiChannelCapabilityReport from node %d for endpoint %d", GetNodeId(), endPoint );
Log::Write( LogLevel_Info, GetNodeId(), " Endpoint is%sdynamic, and is a %s", dynamic ? " " : " not ", node->GetEndPointDeviceClassLabel( _data[2], _data[3] ).c_str() );
@ -466,7 +475,7 @@ void MultiInstance::HandleMultiChannelCapabilityReport
uint8 commandClassId = *it;
CommandClass* cc = node->GetCommandClass( commandClassId );
if( cc )
{
{
cc->SetInstance( i );
if( m_endPointMap != MultiInstanceMapAll || i != 1 )
{
@ -539,7 +548,7 @@ void MultiInstance::HandleMultiChannelCapabilityReport
// Handle a message from the Z-Wave network
//-----------------------------------------------------------------------------
void MultiInstance::HandleMultiChannelEndPointFindReport
(
(
uint8 const* _data,
uint32 const _length
)
@ -560,7 +569,7 @@ void MultiInstance::HandleMultiChannelEndPointFindReport
uint8 commandClassId = *it;
CommandClass* cc = node->GetCommandClass( commandClassId );
if( cc )
{
{
Log::Write( LogLevel_Info, GetNodeId(), " Endpoint %d: Adding %s", endPoint, cc->GetCommandClassName().c_str() );
cc->SetInstance( endPoint );
}
@ -617,7 +626,7 @@ void MultiInstance::HandleMultiChannelEndPointFindReport
// Handle a message from the Z-Wave network
//-----------------------------------------------------------------------------
void MultiInstance::HandleMultiChannelEncap
(
(
uint8 const* _data,
uint32 const _length
)

View file

@ -55,10 +55,10 @@ enum StringEncoding
};
// Mapping of characters 0x80 and above to Unicode.
uint16 const c_extendedAsciiToUnicode[] =
uint16 const c_extendedAsciiToUnicode[] =
{
0x20ac, // 0x80 - Euro Sign
0x0081, // 0x81 -
0x0081, // 0x81 -
0x201a, // 0x82 - Single Low-9 Quotation Mark
0x0192, // 0x83 - Latin Small Letter F With Hook
0x201e, // 0x84 - Double Low-9 Quotation Mark
@ -70,11 +70,11 @@ uint16 const c_extendedAsciiToUnicode[] =
0x0160, // 0x8a - Latin Capital Letter S With Caron
0x2039, // 0x8b - Single Left-Pointing Angle Quotation Mark
0x0152, // 0x8c - Latin Capital Ligature Oe
0x008d, // 0x8d -
0x008d, // 0x8d -
0x017d, // 0x8e - Latin Capital Letter Z With Caron
0x008f, // 0x8f -
0x008f, // 0x8f -
0x0090, // 0x90 -
0x0090, // 0x90 -
0x2018, // 0x91 - Left Single Quotation Mark
0x2019, // 0x92 - Right Single Quotation Mark
0x201c, // 0x93 - Left Double Quotation Mark
@ -87,7 +87,7 @@ uint16 const c_extendedAsciiToUnicode[] =
0x0161, // 0x9a - Latin Small Letter S With Caron
0x203a, // 0x9b - Single Right-Pointing Angle Quotation Mark
0x0153, // 0x9c - Latin Small Ligature Oe
0x009d, // 0x9d -
0x009d, // 0x9d -
0x017e, // 0x9e - Latin Small Letter Z With Caron
0x0178, // 0x9f - Latin Capital Letter Y With Diaeresis
@ -195,8 +195,8 @@ uint16 const c_extendedAsciiToUnicode[] =
};
//-----------------------------------------------------------------------------
// <NodeNaming::RequestState>
// Request current state from the device
// <NodeNaming::RequestState>
// Request current state from the device
//-----------------------------------------------------------------------------
bool NodeNaming::RequestState
(
@ -228,8 +228,8 @@ bool NodeNaming::RequestState
}
//-----------------------------------------------------------------------------
// <NodeNaming::RequestValue>
// Request current value from the device
// <NodeNaming::RequestValue>
// Request current value from the device
//-----------------------------------------------------------------------------
bool NodeNaming::RequestValue
(
@ -248,14 +248,20 @@ bool NodeNaming::RequestValue
Msg* msg;
if( _getTypeEnum == NodeNamingCmd_Get )
{
msg = new Msg( "NodeNamingCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->Append( GetNodeId() );
msg->Append( 2 );
msg->Append( GetCommandClassId() );
msg->Append( NodeNamingCmd_Get );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
if ( IsGetSupported() )
{
msg = new Msg( "NodeNamingCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->Append( GetNodeId() );
msg->Append( 2 );
msg->Append( GetCommandClassId() );
msg->Append( NodeNamingCmd_Get );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
} else {
Log::Write( LogLevel_Info, GetNodeId(), "NodeNamingCmd_Get Not Supported on this node");
}
return false;
}
if( _getTypeEnum == NodeNamingCmd_LocationGet )
@ -337,13 +343,13 @@ void NodeNaming::SetName
}
Log::Write( LogLevel_Info, GetNodeId(), "NodeNaming::Set - Naming to '%s'", _name.c_str() );
Msg* msg = new Msg( "NodeNaming Set", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true );
Msg* msg = new Msg( "NodeNaming Set", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true );
msg->Append( GetNodeId() );
msg->Append( (uint8)(length + 3) );
msg->Append( GetCommandClassId() );
msg->Append( NodeNamingCmd_Set );
msg->Append( (uint8)StringEncoding_ASCII );
for( uint32 i=0; i<length; ++i )
{
msg->Append( _name[i] );
@ -369,13 +375,13 @@ void NodeNaming::SetLocation
}
Log::Write( LogLevel_Info, GetNodeId(), "NodeNaming::SetLocation - Setting location to '%s'", _location.c_str() );
Msg* msg = new Msg( "NodeNaming Set", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true );
Msg* msg = new Msg( "NodeNaming Set", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true );
msg->Append( GetNodeId() );
msg->Append( (uint8)(length + 3) );
msg->Append( GetCommandClassId() );
msg->Append( NodeNamingCmd_LocationSet );
msg->Append( (uint8)StringEncoding_ASCII );
for( uint32 i=0; i<length; ++i )
{
msg->Append( _location[i] );
@ -400,7 +406,7 @@ string NodeNaming::ExtractString
uint32 pos = 0;
str[0] = 0;
StringEncoding encoding = (StringEncoding)( _data[1] & 0x07 );
StringEncoding encoding = (StringEncoding)( _data[1] & 0x07 );
if( _length >= 3 )
{
@ -410,7 +416,7 @@ string NodeNaming::ExtractString
{
numBytes = 16;
}
switch( encoding )
{
case StringEncoding_ASCII:

View file

@ -65,7 +65,7 @@ enum
PowerlevelIndex_TestAckFrames
};
static char const* c_powerLevelNames[] =
static char const* c_powerLevelNames[] =
{
"Normal",
"-1dB",
@ -79,7 +79,7 @@ static char const* c_powerLevelNames[] =
"-9dB"
};
static char const* c_powerLevelStatusNames[] =
static char const* c_powerLevelStatusNames[] =
{
"Failed",
"Success",
@ -120,15 +120,20 @@ bool Powerlevel::RequestValue
{
if( _index == 0 )
{
Msg* msg = new Msg( "Powerlevel_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->SetInstance( this, _instance );
msg->Append( GetNodeId() );
msg->Append( 2 );
msg->Append( GetCommandClassId() );
msg->Append( PowerlevelCmd_Get );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
if ( IsGetSupported() )
{
Msg* msg = new Msg( "Powerlevel_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->SetInstance( this, _instance );
msg->Append( GetNodeId() );
msg->Append( 2 );
msg->Append( GetCommandClassId() );
msg->Append( PowerlevelCmd_Get );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
} else {
Log::Write( LogLevel_Info, GetNodeId(), "Powerlevel_Get Not Supported on this node");
}
}
return false;
}
@ -237,7 +242,7 @@ bool Powerlevel::SetValue
button->Release();
}
break;
}
}
case PowerlevelIndex_TestNode:
{
if( ValueByte* value = static_cast<ValueByte*>( GetValue( instance, PowerlevelIndex_TestNode ) ) )
@ -445,7 +450,7 @@ void Powerlevel::CreateVars
{
item.m_label = c_powerLevelNames[i];
item.m_value = i;
items.push_back( item );
items.push_back( item );
}
node->CreateValueList( ValueID::ValueGenre_System, GetCommandClassId(), _instance, PowerlevelIndex_Powerlevel, "Powerlevel", "dB", false, false, 1, items, 0, 0 );
@ -462,7 +467,7 @@ void Powerlevel::CreateVars
{
item.m_label = c_powerLevelStatusNames[i];
item.m_value = i;
items.push_back( item );
items.push_back( item );
}
node->CreateValueList( ValueID::ValueGenre_System, GetCommandClassId(), _instance, PowerlevelIndex_TestStatus, "Test Status", "", true, false, 1, items, 0, 0 );
node->CreateValueShort( ValueID::ValueGenre_System, GetCommandClassId(), _instance, PowerlevelIndex_TestAckFrames, "Acked Frames", "", true, false, 0, 0 );

View file

@ -46,7 +46,7 @@ enum ProtectionCmd
ProtectionCmd_Report = 0x03
};
static char const* c_protectionStateNames[] =
static char const* c_protectionStateNames[] =
{
"Unprotected",
"Protection by Sequence",
@ -84,15 +84,21 @@ bool Protection::RequestValue
Driver::MsgQueue const _queue
)
{
Msg* msg = new Msg( "ProtectionCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->SetInstance( this, _instance );
msg->Append( GetNodeId() );
msg->Append( 2 );
msg->Append( GetCommandClassId() );
msg->Append( ProtectionCmd_Get );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
if ( IsGetSupported() )
{
Msg* msg = new Msg( "ProtectionCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->SetInstance( this, _instance );
msg->Append( GetNodeId() );
msg->Append( 2 );
msg->Append( GetCommandClassId() );
msg->Append( ProtectionCmd_Get );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
} else {
Log::Write( LogLevel_Info, GetNodeId(), "ProtectionCmd_Get Not Supported on this node");
}
return false;
}
//-----------------------------------------------------------------------------
@ -136,7 +142,7 @@ bool Protection::SetValue
ValueList::Item const& item = value->GetItem();
Log::Write( LogLevel_Info, GetNodeId(), "Protection::Set - Setting protection state to '%s'", item.m_label.c_str() );
Msg* msg = new Msg( "Protection Set", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true );
Msg* msg = new Msg( "Protection Set", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true );
msg->SetInstance( this, _value.GetID().GetInstance() );
msg->Append( GetNodeId() );
msg->Append( 3 );
@ -169,7 +175,7 @@ void Protection::CreateVars
{
item.m_label = c_protectionStateNames[i];
item.m_value = i;
items.push_back( item );
items.push_back( item );
}
node->CreateValueList( ValueID::ValueGenre_System, GetCommandClassId(), _instance, 0, "Protection", "", false, false, 1, items, 0, 0 );

View file

@ -45,7 +45,7 @@ enum SensorAlarmCmd
SensorAlarmCmd_SupportedReport = 0x04
};
static char const* c_alarmTypeName[] =
static char const* c_alarmTypeName[] =
{
"General",
"Smoke",
@ -67,7 +67,7 @@ SensorAlarm::SensorAlarm
):
CommandClass( _homeId, _nodeId )
{
SetStaticRequest( StaticRequest_Values );
SetStaticRequest( StaticRequest_Values );
}
//-----------------------------------------------------------------------------
@ -119,7 +119,7 @@ bool SensorAlarm::RequestValue
if( _alarmType == 0xff )
{
// Request the supported alarm types
Msg* msg = new Msg( "Request Supported Alarm Types", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
Msg* msg = new Msg( "SensorAlarmCmd_SupportedGet", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->SetInstance( this, _instance );
msg->Append( GetNodeId() );
msg->Append( 2 );
@ -127,21 +127,28 @@ bool SensorAlarm::RequestValue
msg->Append( SensorAlarmCmd_SupportedGet );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
}
else
{
// Request the alarm state
Msg* msg = new Msg( "Request alarm state", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->SetInstance( this, _instance );
msg->Append( GetNodeId() );
msg->Append( 3 );
msg->Append( GetCommandClassId() );
msg->Append( SensorAlarmCmd_Get );
msg->Append( _alarmType );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
if ( IsGetSupported() )
{
Msg* msg = new Msg( "SensorAlarmCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->SetInstance( this, _instance );
msg->Append( GetNodeId() );
msg->Append( 3 );
msg->Append( GetCommandClassId() );
msg->Append( SensorAlarmCmd_Get );
msg->Append( _alarmType );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
} else {
Log::Write( LogLevel_Info, GetNodeId(), "SensorAlarmCmd_Get Not Supported on this node");
}
}
return true;
return false;
}
//-----------------------------------------------------------------------------
@ -171,13 +178,13 @@ bool SensorAlarm::HandleMsg
return true;
}
if( SensorAlarmCmd_SupportedReport == (SensorAlarmCmd)_data[0] )
{
if( Node* node = GetNodeUnsafe() )
{
// We have received the supported alarm types from the Z-Wave device
Log::Write( LogLevel_Info, GetNodeId(), "Received supported alarm types" );
Log::Write( LogLevel_Info, GetNodeId(), "Received supported alarm types" );
// Parse the data for the supported alarm types
uint8 numBytes = _data[1];

View file

@ -75,15 +75,21 @@ bool SensorBinary::RequestValue
Driver::MsgQueue const _queue
)
{
Msg* msg = new Msg( "SensorBinaryCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->SetInstance( this, _instance );
msg->Append( GetNodeId() );
msg->Append( 2 );
msg->Append( GetCommandClassId() );
msg->Append( SensorBinaryCmd_Get );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
if ( IsGetSupported() )
{
Msg* msg = new Msg( "SensorBinaryCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->SetInstance( this, _instance );
msg->Append( GetNodeId() );
msg->Append( 2 );
msg->Append( GetCommandClassId() );
msg->Append( SensorBinaryCmd_Get );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
} else {
Log::Write( LogLevel_Info, GetNodeId(), "SensorBinaryCmd_Get Not Supported on this node");
}
return false;
}
//-----------------------------------------------------------------------------

View file

@ -83,7 +83,7 @@ enum SensorType
SensorType_MaxType
};
static char const* c_sensorTypeNames[] =
static char const* c_sensorTypeNames[] =
{
"Undefined",
"Temperature",
@ -119,14 +119,14 @@ static char const* c_sensorTypeNames[] =
"Moisture"
};
static char const* c_tankCapcityUnits[] =
static char const* c_tankCapcityUnits[] =
{
"l",
"cbm",
"gal"
};
static char const* c_distanceUnits[] =
static char const* c_distanceUnits[] =
{
"m",
"cm",
@ -201,8 +201,8 @@ bool SensorMultilevel::RequestState
}
//-----------------------------------------------------------------------------
// <SensorMultilevel::RequestValue>
// Request current value from the device
// <SensorMultilevel::RequestValue>
// Request current value from the device
//-----------------------------------------------------------------------------
bool SensorMultilevel::RequestValue
(
@ -213,6 +213,10 @@ bool SensorMultilevel::RequestValue
)
{
bool res = false;
if ( !IsGetSupported() ) {
Log::Write( LogLevel_Info, GetNodeId(), "SensorMultilevelCmd_Get Not Supported on this node");
return false;
}
if( GetVersion() < 5 )
{
Msg* msg = new Msg( "SensorMultilevelCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
@ -340,7 +344,7 @@ bool SensorMultilevel::HandleMsg
node->CreateValueDecimal( ValueID::ValueGenre_User, GetCommandClassId(), _instance, sensorType, c_sensorTypeNames[sensorType], units, true, false, "0.0", 0 );
value = static_cast<ValueDecimal*>( GetValue( _instance, sensorType ) );
}
else
else
{
value->SetUnits(units);
}

View file

@ -46,7 +46,7 @@ enum SwitchAllCmd
SwitchAllCmd_Off = 0x05
};
static char const* c_switchAllStateName[] =
static char const* c_switchAllStateName[] =
{
"Disabled",
"Off Enabled",
@ -85,15 +85,21 @@ bool SwitchAll::RequestValue
Driver::MsgQueue const _queue
)
{
Msg* msg = new Msg( "SwitchAllCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->SetInstance( this, _instance );
msg->Append( GetNodeId() );
msg->Append( 2 );
msg->Append( GetCommandClassId() );
msg->Append( SwitchAllCmd_Get );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
if ( IsGetSupported() )
{
Msg* msg = new Msg( "SwitchAllCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->SetInstance( this, _instance );
msg->Append( GetNodeId() );
msg->Append( 2 );
msg->Append( GetCommandClassId() );
msg->Append( SwitchAllCmd_Get );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
} else {
Log::Write( LogLevel_Info, GetNodeId(), "SwitchAllCmd_Get Not Supported on this node");
}
return false;
}
//-----------------------------------------------------------------------------
@ -123,7 +129,7 @@ bool SwitchAll::HandleMsg
//-----------------------------------------------------------------------------
// <SwitchAll::SetValue>
// Set the device's response to SWITCH_ALL commands
// Set the device's response to SWITCH_ALL commands
//-----------------------------------------------------------------------------
bool SwitchAll::SetValue
(
@ -136,7 +142,7 @@ bool SwitchAll::SetValue
ValueList::Item const& item = value->GetItem();
Log::Write( LogLevel_Info, GetNodeId(), "SwitchAll::Set - %s on node %d", item.m_label.c_str(), GetNodeId() );
Msg* msg = new Msg( "SwitchAllCmd_Set", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true );
Msg* msg = new Msg( "SwitchAllCmd_Set", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true );
msg->SetInstance( this, _value.GetID().GetInstance() );
msg->Append( GetNodeId() );
msg->Append( 3 );
@ -153,16 +159,16 @@ bool SwitchAll::SetValue
//-----------------------------------------------------------------------------
// <SwitchAll::Off>
// Send a command to switch all devices off
// Send a command to switch all devices off
//-----------------------------------------------------------------------------
void SwitchAll::Off
(
Driver* _driver,
uint8 const _nodeId
uint8 const _nodeId
)
{
Log::Write( LogLevel_Info, _nodeId, "SwitchAll::Off (Node=%d)", _nodeId );
Msg* msg = new Msg( "SwitchAllCmd_Off", _nodeId, REQUEST, FUNC_ID_ZW_SEND_DATA, true );
Msg* msg = new Msg( "SwitchAllCmd_Off", _nodeId, REQUEST, FUNC_ID_ZW_SEND_DATA, true );
msg->Append( _nodeId );
msg->Append( 2 );
msg->Append( StaticGetCommandClassId() );
@ -173,16 +179,16 @@ void SwitchAll::Off
//-----------------------------------------------------------------------------
// <SwitchAll::On>
// Send a command to switch all devices on
// Send a command to switch all devices on
//-----------------------------------------------------------------------------
void SwitchAll::On
(
Driver* _driver,
uint8 const _nodeId
uint8 const _nodeId
)
{
Log::Write( LogLevel_Info, _nodeId, "SwitchAll::On (Node=%d)", _nodeId );
Msg* msg = new Msg( "SwitchAllCmd_On", _nodeId, REQUEST, FUNC_ID_ZW_SEND_DATA, true );
Msg* msg = new Msg( "SwitchAllCmd_On", _nodeId, REQUEST, FUNC_ID_ZW_SEND_DATA, true );
msg->Append( _nodeId );
msg->Append( 2 );
msg->Append( StaticGetCommandClassId() );
@ -204,11 +210,11 @@ void SwitchAll::CreateVars
{
vector<ValueList::Item> items;
for( int i=0; i<4; ++i )
{
{
ValueList::Item item;
item.m_label = c_switchAllStateName[i];
item.m_value = (i==3) ? 0x000000ff : i;
items.push_back( item );
items.push_back( item );
}
node->CreateValueList( ValueID::ValueGenre_System, GetCommandClassId(), _instance, 0, "Switch All", "", false, false, 1, items, 0, 0 );

View file

@ -46,8 +46,8 @@ enum SwitchBinaryCmd
};
//-----------------------------------------------------------------------------
// <SwitchBinary::RequestState>
// Request current state from the device
// <SwitchBinary::RequestState>
// Request current state from the device
//-----------------------------------------------------------------------------
bool SwitchBinary::RequestState
(
@ -65,8 +65,8 @@ bool SwitchBinary::RequestState
}
//-----------------------------------------------------------------------------
// <SwitchBinary::RequestValue>
// Request current value from the device
// <SwitchBinary::RequestValue>
// Request current value from the device
//-----------------------------------------------------------------------------
bool SwitchBinary::RequestValue
(
@ -76,15 +76,21 @@ bool SwitchBinary::RequestValue
Driver::MsgQueue const _queue
)
{
Msg* msg = new Msg( "SwitchBinaryCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->SetInstance( this, _instance );
msg->Append( GetNodeId() );
msg->Append( 2 );
msg->Append( GetCommandClassId() );
msg->Append( SwitchBinaryCmd_Get );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
if ( IsGetSupported() )
{
Msg* msg = new Msg( "SwitchBinaryCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->SetInstance( this, _instance );
msg->Append( GetNodeId() );
msg->Append( 2 );
msg->Append( GetCommandClassId() );
msg->Append( SwitchBinaryCmd_Get );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
} else {
Log::Write( LogLevel_Info, GetNodeId(), "SwitchBinaryCmd_Get Not Supported on this node");
}
return false;
}
//-----------------------------------------------------------------------------
@ -127,7 +133,7 @@ bool SwitchBinary::SetValue
ValueBool const* value = static_cast<ValueBool const*>(&_value);
Log::Write( LogLevel_Info, GetNodeId(), "SwitchBinary::Set - Setting node %d to %s", GetNodeId(), value->GetValue() ? "On" : "Off" );
Msg* msg = new Msg( "SwitchBinary Set", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true );
Msg* msg = new Msg( "SwitchBinary Set", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true );
msg->SetInstance( this, _value.GetID().GetInstance() );
msg->Append( GetNodeId() );
msg->Append( 3 );

View file

@ -64,23 +64,23 @@ enum
SwitchMultilevelIndex_Dec
};
static uint8 c_directionParams[] =
{
0x18,
0x58,
0xc0,
0xc8
static uint8 c_directionParams[] =
{
0x18,
0x58,
0xc0,
0xc8
};
static char const* c_directionDebugLabels[] =
{
"Up",
"Down",
"Inc",
"Dec"
static char const* c_directionDebugLabels[] =
{
"Up",
"Down",
"Inc",
"Dec"
};
static char const* c_switchLabelsPos[] =
static char const* c_switchLabelsPos[] =
{
"Undefined",
"On",
@ -92,7 +92,7 @@ static char const* c_switchLabelsPos[] =
"Push"
};
static char const* c_switchLabelsNeg[] =
static char const* c_switchLabelsNeg[] =
{
"Undefined",
"Off",
@ -137,15 +137,20 @@ bool SwitchMultilevel::RequestValue
{
if( _index == SwitchMultilevelIndex_Level )
{
Msg* msg = new Msg( "SwitchMultilevelCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->SetInstance( this, _instance );
msg->Append( GetNodeId() );
msg->Append( 2 );
msg->Append( GetCommandClassId() );
msg->Append( SwitchMultilevelCmd_Get );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
if ( IsGetSupported() )
{
Msg* msg = new Msg( "SwitchMultilevelCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->SetInstance( this, _instance );
msg->Append( GetNodeId() );
msg->Append( 2 );
msg->Append( GetCommandClassId() );
msg->Append( SwitchMultilevelCmd_Get );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
} else {
Log::Write( LogLevel_Info, GetNodeId(), "SwitchMultilevelCmd_Get Not Supported on this node");
}
}
return false;
}
@ -177,7 +182,7 @@ bool SwitchMultilevel::HandleMsg
{
uint8 switchType1 = _data[1] & 0x1f;
uint8 switchType2 = _data[2] & 0x1f;
Log::Write( LogLevel_Info, GetNodeId(), "Received SwitchMultiLevel supported report: Switch1=%s/%s, Switch2=%s/%s", c_switchLabelsPos[switchType1], c_switchLabelsNeg[switchType1], c_switchLabelsPos[switchType2], c_switchLabelsNeg[switchType2] );
ClearStaticRequest( StaticRequest_Version );
@ -197,7 +202,7 @@ bool SwitchMultilevel::HandleMsg
button->Release();
}
}
if( switchType2 )
{
if( NULL != ( button = static_cast<ValueButton*>( GetValue( _instance, SwitchMultilevelIndex_Inc ) ) ) )
@ -425,10 +430,10 @@ bool SwitchMultilevel::SetLevel
)
{
Log::Write( LogLevel_Info, GetNodeId(), "SwitchMultilevel::Set - Setting to level %d", _level );
Msg* msg = new Msg( "SwitchMultiLevel Set", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true );
Msg* msg = new Msg( "SwitchMultiLevel Set", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true );
msg->SetInstance( this, _instance );
msg->Append( GetNodeId() );
if( ValueByte* durationValue = static_cast<ValueByte*>( GetValue( _instance, SwitchMultilevelIndex_Duration ) ) )
{
uint8 duration = durationValue->GetValue();
@ -520,8 +525,8 @@ bool SwitchMultilevel::StartLevelChange
Log::Write( LogLevel_Info, GetNodeId(), " Step Size: %d", step );
}
}
Msg* msg = new Msg( "SwitchMultilevel StartLevelChange", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true );
Msg* msg = new Msg( "SwitchMultilevel StartLevelChange", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true );
msg->SetInstance( this, _instance );
msg->Append( GetNodeId() );
msg->Append( length );
@ -555,7 +560,7 @@ bool SwitchMultilevel::StopLevelChange
)
{
Log::Write( LogLevel_Info, GetNodeId(), "SwitchMultilevel::StopLevelChange - Stopping the level change" );
Msg* msg = new Msg( "SwitchMultilevel StopLevelChange", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true );
Msg* msg = new Msg( "SwitchMultilevel StopLevelChange", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true );
msg->SetInstance( this, _instance );
msg->Append( GetNodeId() );
msg->Append( 2 );

View file

@ -45,8 +45,8 @@ enum SwitchToggleBinaryCmd
};
//-----------------------------------------------------------------------------
// <SwitchToggleBinary::RequestState>
// Request current state from the device
// <SwitchToggleBinary::RequestState>
// Request current state from the device
//-----------------------------------------------------------------------------
bool SwitchToggleBinary::RequestState
(
@ -64,8 +64,8 @@ bool SwitchToggleBinary::RequestState
}
//-----------------------------------------------------------------------------
// <SwitchToggleBinary::RequestValue>
// Request current value from the device
// <SwitchToggleBinary::RequestValue>
// Request current value from the device
//-----------------------------------------------------------------------------
bool SwitchToggleBinary::RequestValue
(
@ -75,15 +75,21 @@ bool SwitchToggleBinary::RequestValue
Driver::MsgQueue const _queue
)
{
Msg* msg = new Msg( "SwitchToggleBinaryCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->SetInstance( this, _instance );
msg->Append( GetNodeId() );
msg->Append( 2 );
msg->Append( GetCommandClassId() );
msg->Append( SwitchToggleBinaryCmd_Get );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
if ( IsGetSupported() )
{
Msg* msg = new Msg( "SwitchToggleBinaryCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->SetInstance( this, _instance );
msg->Append( GetNodeId() );
msg->Append( 2 );
msg->Append( GetCommandClassId() );
msg->Append( SwitchToggleBinaryCmd_Get );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
} else {
Log::Write( LogLevel_Info, GetNodeId(), "SwitchToggleBinaryCmd_Get Not Supported on this node");
}
return false;
}
//-----------------------------------------------------------------------------
@ -122,7 +128,7 @@ bool SwitchToggleBinary::SetValue
)
{
Log::Write( LogLevel_Info, GetNodeId(), "SwitchToggleBinary::Set - Toggling the state" );
Msg* msg = new Msg( "SwitchToggleBinary Set", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true );
Msg* msg = new Msg( "SwitchToggleBinary Set", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true );
msg->SetInstance( this, _value.GetID().GetInstance() );
msg->Append( GetNodeId() );
msg->Append( 2 );

View file

@ -48,8 +48,8 @@ enum SwitchToggleMultilevelCmd
//-----------------------------------------------------------------------------
// <SwitchToggleMultilevel::RequestState>
// Request current state from the device
// <SwitchToggleMultilevel::RequestState>
// Request current state from the device
//-----------------------------------------------------------------------------
bool SwitchToggleMultilevel::RequestState
(
@ -78,15 +78,21 @@ bool SwitchToggleMultilevel::RequestValue
Driver::MsgQueue const _queue
)
{
Msg* msg = new Msg( "SwitchToggleMultilevelCmd_StartLevelChange", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->SetInstance( this, _instance );
msg->Append( GetNodeId() );
msg->Append( 2 );
msg->Append( GetCommandClassId() );
msg->Append( SwitchToggleMultilevelCmd_Get );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
if ( IsGetSupported() )
{
Msg* msg = new Msg( "SwitchToggleMultilevelCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->SetInstance( this, _instance );
msg->Append( GetNodeId() );
msg->Append( 2 );
msg->Append( GetCommandClassId() );
msg->Append( SwitchToggleMultilevelCmd_Get );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
} else {
Log::Write( LogLevel_Info, GetNodeId(), "SwitchToggleMultilevelCmd_Get Not Supported on this node");
}
return false;
}
//-----------------------------------------------------------------------------
@ -125,7 +131,7 @@ bool SwitchToggleMultilevel::SetValue
)
{
Log::Write( LogLevel_Info, GetNodeId(), "SwitchToggleMultilevel::Set - Toggling the state" );
Msg* msg = new Msg( "SwitchToggleMultilevel Set", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true );
Msg* msg = new Msg( "SwitchToggleMultilevel Set", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true );
msg->SetInstance( this, _value.GetID().GetInstance() );
msg->Append( GetNodeId() );
msg->Append( 2 );
@ -152,7 +158,7 @@ void SwitchToggleMultilevel::StartLevelChange
param |= ( _bRollover ? 0x80 : 0x00 );
Log::Write( LogLevel_Info, GetNodeId(), "SwitchMultilevel::StartLevelChange - Starting a level change, Direction=%d, IgnoreStartLevel=%s and rollover=%s", (_direction==SwitchToggleMultilevelDirection_Up) ? "Up" : "Down", _bIgnoreStartLevel ? "True" : "False", _bRollover ? "True" : "False" );
Msg* msg = new Msg( "SwitchMultilevel StartLevelChange", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true );
Msg* msg = new Msg( "SwitchMultilevel StartLevelChange", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true );
msg->Append( GetNodeId() );
msg->Append( 3 );
msg->Append( GetCommandClassId() );
@ -170,7 +176,7 @@ void SwitchToggleMultilevel::StopLevelChange
)
{
Log::Write( LogLevel_Info, GetNodeId(), "SwitchToggleMultilevel::StopLevelChange - Stopping the level change" );
Msg* msg = new Msg( "SwitchToggleMultilevel StopLevelChange", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true );
Msg* msg = new Msg( "SwitchToggleMultilevel StopLevelChange", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true );
msg->Append( GetNodeId() );
msg->Append( 2 );
msg->Append( GetCommandClassId() );

View file

@ -47,7 +47,7 @@ enum ThermostatFanModeCmd
ThermostatFanModeCmd_SupportedReport = 0x05
};
static string const c_modeName[] =
static string const c_modeName[] =
{
"Auto Low",
"On Low",
@ -63,15 +63,14 @@ static string const c_modeName[] =
// Read the supported modes
//-----------------------------------------------------------------------------
void ThermostatFanMode::ReadXML
(
(
TiXmlElement const* _ccElement
)
{
CommandClass::ReadXML( _ccElement );
if( Node* node = GetNodeUnsafe() )
if( GetNodeUnsafe() )
{
node = node;
vector<ValueList::Item> supportedModes;
TiXmlElement const* supportedModesElement = _ccElement->FirstChildElement( "SupportedModes" );
@ -89,7 +88,7 @@ void ThermostatFanMode::ReadXML
ValueList::Item item;
item.m_value = index;
item.m_label = c_modeName[index];
supportedModes.push_back( item );
supportedModes.push_back( item );
}
}
@ -101,7 +100,7 @@ void ThermostatFanMode::ReadXML
{
m_supportedModes = supportedModes;
ClearStaticRequest( StaticRequest_Values );
CreateVars( 1 );
CreateVars( 1 );
}
}
}
@ -111,15 +110,14 @@ void ThermostatFanMode::ReadXML
// Save the supported modes
//-----------------------------------------------------------------------------
void ThermostatFanMode::WriteXML
(
(
TiXmlElement* _ccElement
)
{
CommandClass::WriteXML( _ccElement );
if( Node* node = GetNodeUnsafe() )
if( GetNodeUnsafe() )
{
node = node;
TiXmlElement* supportedModesElement = new TiXmlElement( "SupportedModes" );
_ccElement->LinkEndChild( supportedModesElement );
@ -180,7 +178,7 @@ bool ThermostatFanMode::RequestValue
if( _getTypeEnum == ThermostatFanModeCmd_SupportedGet )
{
// Request the supported modes
Msg* msg = new Msg( "Request Supported Thermostat Fan Modes", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
Msg* msg = new Msg( "ThermostatFanModeCmd_SupportedGet", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->SetInstance( this, _instance );
msg->Append( GetNodeId() );
msg->Append( 2 );
@ -193,16 +191,21 @@ bool ThermostatFanMode::RequestValue
if( _getTypeEnum == ThermostatFanModeCmd_Get || _getTypeEnum == 0 )
{
// Request the current fan mode
Msg* msg = new Msg( "Request Current Thermostat Fan Mode", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->SetInstance( this, _instance );
msg->Append( GetNodeId() );
msg->Append( 2 );
msg->Append( GetCommandClassId() );
msg->Append( ThermostatFanModeCmd_Get );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
if ( IsGetSupported() )
{
// Request the current fan mode
Msg* msg = new Msg( "ThermostatFanModeCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->SetInstance( this, _instance );
msg->Append( GetNodeId() );
msg->Append( 2 );
msg->Append( GetCommandClassId() );
msg->Append( ThermostatFanModeCmd_Get );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
} else {
Log::Write( LogLevel_Info, GetNodeId(), "ThermostatFanModeCmd_Get Not Supported on this node");
}
}
return false;
}
@ -221,14 +224,14 @@ bool ThermostatFanMode::HandleMsg
if( ThermostatFanModeCmd_Report == (ThermostatFanModeCmd)_data[0] )
{
uint8 mode = (int32)_data[1];
if( mode < m_supportedModes.size() )
{
// We have received the thermostat mode from the Z-Wave device
if( ValueList* valueList = static_cast<ValueList*>( GetValue( _instance, 0 ) ) )
{
valueList->OnValueRefreshed( (int32)_data[1] );
Log::Write( LogLevel_Info, GetNodeId(), "Received thermostat fan mode: %s", valueList->GetItem().m_label.c_str() );
Log::Write( LogLevel_Info, GetNodeId(), "Received thermostat fan mode: %s", valueList->GetItem().m_label.c_str() );
valueList->Release();
}
else
@ -238,15 +241,15 @@ bool ThermostatFanMode::HandleMsg
}
else
{
Log::Write( LogLevel_Info, GetNodeId(), "Received unknown thermostat fan mode: %d", mode );
Log::Write( LogLevel_Info, GetNodeId(), "Received unknown thermostat fan mode: %d", mode );
}
return true;
}
if( ThermostatFanModeCmd_SupportedReport == (ThermostatFanModeCmd)_data[0] )
{
// We have received the supported thermostat fan modes from the Z-Wave device
Log::Write( LogLevel_Info, GetNodeId(), "Received supported thermostat fan modes" );
Log::Write( LogLevel_Info, GetNodeId(), "Received supported thermostat fan modes" );
m_supportedModes.clear();
for( uint32 i=1; i<_length-1; ++i )
@ -257,7 +260,7 @@ bool ThermostatFanMode::HandleMsg
{
ValueList::Item item;
item.m_value = (int32)((i-1)<<3) + bit;
if ((size_t)item.m_value >= sizeof(c_modeName)/sizeof(*c_modeName))
{
Log::Write( LogLevel_Info, GetNodeId(), "Received unknown fan mode: 0x%x", item.m_value);
@ -295,7 +298,7 @@ bool ThermostatFanMode::SetValue
ValueList const* value = static_cast<ValueList const*>(&_value);
uint8 state = (uint8)value->GetItem().m_value;
Msg* msg = new Msg( "Set Thermostat Fan Mode", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true );
Msg* msg = new Msg( "ThermostatFanModeCmd_Set", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true );
msg->SetInstance( this, _value.GetID().GetInstance() );
msg->Append( GetNodeId() );
msg->Append( 3 );

View file

@ -43,7 +43,7 @@ enum ThermostatFanStateCmd
ThermostatFanStateCmd_Report = 0x03
};
static char const* c_stateName[] =
static char const* c_stateName[] =
{
"Idle",
"Running",
@ -94,16 +94,22 @@ bool ThermostatFanState::RequestValue
Driver::MsgQueue const _queue
)
{
// Request the current state
Msg* msg = new Msg( "Request Current Thermostat Fan State", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->SetInstance( this, _instance );
msg->Append( GetNodeId() );
msg->Append( 2 );
msg->Append( GetCommandClassId() );
msg->Append( ThermostatFanStateCmd_Get );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
if ( IsGetSupported() )
{
// Request the current state
Msg* msg = new Msg( "ThermostatFanStateCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->SetInstance( this, _instance );
msg->Append( GetNodeId() );
msg->Append( 2 );
msg->Append( GetCommandClassId() );
msg->Append( ThermostatFanStateCmd_Get );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
} else {
Log::Write( LogLevel_Info, GetNodeId(), "ThermostatFanStateCmd_Get Not Supported on this node");
}
return false;
}
//-----------------------------------------------------------------------------
@ -124,11 +130,11 @@ bool ThermostatFanState::HandleMsg
{
valueString->OnValueRefreshed( c_stateName[_data[1]&0x0f] );
valueString->Release();
Log::Write( LogLevel_Info, GetNodeId(), "Received thermostat fan state: %s", valueString->GetValue().c_str() );
Log::Write( LogLevel_Info, GetNodeId(), "Received thermostat fan state: %s", valueString->GetValue().c_str() );
}
return true;
}
return false;
}

View file

@ -46,7 +46,7 @@ enum ThermostatModeCmd
ThermostatModeCmd_SupportedReport = 0x05
};
static char const* c_modeName[] =
static char const* c_modeName[] =
{
"Off",
"Heat",
@ -69,15 +69,14 @@ static char const* c_modeName[] =
// Read the supported modes
//-----------------------------------------------------------------------------
void ThermostatMode::ReadXML
(
(
TiXmlElement const* _ccElement
)
{
CommandClass::ReadXML( _ccElement );
if( Node* node = GetNodeUnsafe() )
if( GetNodeUnsafe() )
{
node = node;
vector<ValueList::Item> supportedModes;
TiXmlElement const* supportedModesElement = _ccElement->FirstChildElement( "SupportedModes" );
@ -95,7 +94,7 @@ void ThermostatMode::ReadXML
ValueList::Item item;
item.m_value = index;
item.m_label = c_modeName[index];
supportedModes.push_back( item );
supportedModes.push_back( item );
}
}
@ -107,7 +106,7 @@ void ThermostatMode::ReadXML
{
m_supportedModes = supportedModes;
ClearStaticRequest( StaticRequest_Values );
CreateVars( 1 );
CreateVars( 1 );
}
}
}
@ -128,9 +127,8 @@ void ThermostatMode::WriteXML
CommandClass::WriteXML( _ccElement );
if( Node* node = GetNodeUnsafe() )
if( GetNodeUnsafe() )
{
node = node;
TiXmlElement* supportedModesElement = new TiXmlElement( "SupportedModes" );
_ccElement->LinkEndChild( supportedModesElement );
@ -191,7 +189,7 @@ bool ThermostatMode::RequestValue
if( _getTypeEnum == ThermostatModeCmd_SupportedGet )
{
// Request the supported modes
Msg* msg = new Msg( "Request Supported Thermostat Modes", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
Msg* msg = new Msg( "ThermostatModeCmd_SupportedGet", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->SetInstance( this, _instance );
msg->Append( GetNodeId() );
msg->Append( 2 );
@ -204,16 +202,22 @@ bool ThermostatMode::RequestValue
if( _getTypeEnum == 0 ) // get current mode
{
// Request the current mode
Msg* msg = new Msg( "Request Current Thermostat Mode", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->SetInstance( this, _instance );
msg->Append( GetNodeId() );
msg->Append( 2 );
msg->Append( GetCommandClassId() );
msg->Append( ThermostatModeCmd_Get );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
if ( IsGetSupported() )
{
// Request the current mode
Msg* msg = new Msg( "ThermostatModeCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->SetInstance( this, _instance );
msg->Append( GetNodeId() );
msg->Append( 2 );
msg->Append( GetCommandClassId() );
msg->Append( ThermostatModeCmd_Get );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
} else {
Log::Write( LogLevel_Info, GetNodeId(), "ThermostatModeCmd_Get Not Supported on this node");
}
}
return false;
}
@ -232,8 +236,18 @@ bool ThermostatMode::HandleMsg
if( ThermostatModeCmd_Report == (ThermostatModeCmd)_data[0] )
{
uint8 mode = _data[1]&0x1f;
if( mode < m_supportedModes.size() )
bool validMode = false;
for (vector<ValueList::Item>::iterator it = m_supportedModes.begin(); it != m_supportedModes.end(); ++it )
{
ValueList::Item const& item = *it;
if (item.m_value == mode) {
validMode = true;
break;
}
}
if( validMode )
{
// We have received the thermostat mode from the Z-Wave device
if( ValueList* valueList = static_cast<ValueList*>( GetValue( _instance, 0 ) ) )
@ -253,13 +267,13 @@ bool ThermostatMode::HandleMsg
}
return true;
}
if( ThermostatModeCmd_SupportedReport == (ThermostatModeCmd)_data[0] )
{
// We have received the supported thermostat modes from the Z-Wave device
// these values are used to populate m_supportedModes which, in turn, is used to "seed" the values
// for each m_modes instance
Log::Write( LogLevel_Info, GetNodeId(), "Received supported thermostat modes" );
Log::Write( LogLevel_Info, GetNodeId(), "Received supported thermostat modes" );
m_supportedModes.clear();
for( uint32 i=1; i<_length-1; ++i )
@ -270,7 +284,7 @@ bool ThermostatMode::HandleMsg
{
ValueList::Item item;
item.m_value = (int32)((i-1)<<3) + bit;
if ((size_t)item.m_value >= sizeof(c_modeName)/sizeof(*c_modeName))
{
Log::Write( LogLevel_Info, GetNodeId(), "Received unknown thermostat mode: 0x%x", item.m_value);
@ -290,7 +304,7 @@ bool ThermostatMode::HandleMsg
CreateVars( _instance );
return true;
}
return false;
}
@ -308,7 +322,7 @@ bool ThermostatMode::SetValue
ValueList const* value = static_cast<ValueList const*>(&_value);
uint8 state = (uint8)value->GetItem().m_value;
Msg* msg = new Msg( "Set Thermostat Mode", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true );
Msg* msg = new Msg( "ThermostatModeCmd_Set", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true );
msg->Append( GetNodeId() );
msg->Append( 3 );
msg->Append( GetCommandClassId() );
@ -332,10 +346,10 @@ void ThermostatMode::CreateVars
)
{
// There are three ways to get here...each needs to be handled differently:
// QueryStage_ProtocolInfo:
// QueryStage_ProtocolInfo:
// Don't know what's supported yet, so do nothing
// QueryStage_NodeInfo:
// Need to create the instance so the values can be read from the xml file
// QueryStage_NodeInfo:
// Need to create the instance so the values can be read from the xml file
// QueryStage_Static:
// Need to create the instance (processing SupportedReport) if it doesn't exist
// If it does, populate with the appropriate values

View file

@ -43,7 +43,7 @@ enum ThermostatOperatingStateCmd
ThermostatOperatingStateCmd_Report = 0x03
};
static char const* c_stateName[] =
static char const* c_stateName[] =
{
"Idle",
"Heating",
@ -53,13 +53,13 @@ static char const* c_stateName[] =
"Pending Cool",
"Vent / Economizer",
"State 07", // Undefined states. May be used in the future.
"State 08",
"State 09",
"State 10",
"State 11",
"State 12",
"State 13",
"State 14",
"State 08",
"State 09",
"State 10",
"State 11",
"State 12",
"State 13",
"State 14",
"State 15"
};
@ -93,15 +93,21 @@ bool ThermostatOperatingState::RequestValue
Driver::MsgQueue const _queue
)
{
Msg* msg = new Msg( "Request Current Thermostat Operating State", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->SetInstance( this, _instance );
msg->Append( GetNodeId() );
msg->Append( 2 );
msg->Append( GetCommandClassId() );
msg->Append( ThermostatOperatingStateCmd_Get );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
if ( IsGetSupported() )
{
Msg* msg = new Msg( "ThermostatOperatingStateCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->SetInstance( this, _instance );
msg->Append( GetNodeId() );
msg->Append( 2 );
msg->Append( GetCommandClassId() );
msg->Append( ThermostatOperatingStateCmd_Get );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
} else {
Log::Write( LogLevel_Info, GetNodeId(), "ThermostatOperatingStateCmd_Get Not Supported on this node");
}
return false;
}
//-----------------------------------------------------------------------------
@ -122,7 +128,7 @@ bool ThermostatOperatingState::HandleMsg
{
valueString->OnValueRefreshed( c_stateName[_data[1]&0x0f] );
valueString->Release();
Log::Write( LogLevel_Info, GetNodeId(), "Received thermostat operating state: %s", valueString->GetValue().c_str() );
Log::Write( LogLevel_Info, GetNodeId(), "Received thermostat operating state: %s", valueString->GetValue().c_str() );
}
return true;
}

View file

@ -65,7 +65,7 @@ enum
ThermostatSetpoint_Count
};
static char const* c_setpointName[] =
static char const* c_setpointName[] =
{
"Unused 0",
"Heating 1",
@ -94,7 +94,7 @@ ThermostatSetpoint::ThermostatSetpoint
):
CommandClass( _homeId, _nodeId ), m_setPointBase( 1 )
{
SetStaticRequest( StaticRequest_Values );
SetStaticRequest( StaticRequest_Values );
}
//-----------------------------------------------------------------------------
@ -102,7 +102,7 @@ ThermostatSetpoint::ThermostatSetpoint
// Read the saved change-counter value
//-----------------------------------------------------------------------------
void ThermostatSetpoint::ReadXML
(
(
TiXmlElement const* _ccElement
)
{
@ -120,7 +120,7 @@ void ThermostatSetpoint::ReadXML
// Write the change-counter value
//-----------------------------------------------------------------------------
void ThermostatSetpoint::WriteXML
(
(
TiXmlElement* _ccElement
)
{
@ -160,8 +160,8 @@ bool ThermostatSetpoint::RequestState
}
//-----------------------------------------------------------------------------
// <ThermostatSetpoint::RequestValue>
// Request current state from the device
// <ThermostatSetpoint::RequestValue>
// Request current state from the device
//-----------------------------------------------------------------------------
bool ThermostatSetpoint::RequestValue
(
@ -174,7 +174,7 @@ bool ThermostatSetpoint::RequestValue
if( _setPointIndex == 0xff ) // check for supportedget
{
// Request the supported setpoints
Msg* msg = new Msg( "Request Supported Thermostat Setpoints", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
Msg* msg = new Msg( "ThermostatSetpointCmd_SupportedGet", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->SetInstance( this, _instance );
msg->Append( GetNodeId() );
msg->Append( 2 );
@ -184,13 +184,17 @@ bool ThermostatSetpoint::RequestValue
GetDriver()->SendMsg( msg, _queue );
return true;
}
if ( !IsGetSupported() )
{
Log::Write( LogLevel_Info, GetNodeId(), "ThermostatSetpointCmd_Get Not Supported on this node");
return false;
}
Value* value = GetValue( 1, _setPointIndex );
if( value != NULL )
{
value->Release();
// Request the setpoint value
Msg* msg = new Msg( "Request Current Thermostat Setpoint", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
Msg* msg = new Msg( "ThermostatSetpointCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->SetInstance( this, _instance );
msg->Append( GetNodeId() );
msg->Append( 3 );
@ -232,17 +236,17 @@ bool ThermostatSetpoint::HandleMsg
}
value->Release();
Log::Write( LogLevel_Info, GetNodeId(), "Received thermostat setpoint report: Setpoint %s = %s%s", value->GetLabel().c_str(), value->GetValue().c_str(), value->GetUnits().c_str() );
Log::Write( LogLevel_Info, GetNodeId(), "Received thermostat setpoint report: Setpoint %s = %s%s", value->GetLabel().c_str(), value->GetValue().c_str(), value->GetUnits().c_str() );
}
return true;
}
if( ThermostatSetpointCmd_SupportedReport == (ThermostatSetpointCmd)_data[0] )
{
if( Node* node = GetNodeUnsafe() )
{
// We have received the supported thermostat setpoints from the Z-Wave device
Log::Write( LogLevel_Info, GetNodeId(), "Received supported thermostat setpoints" );
Log::Write( LogLevel_Info, GetNodeId(), "Received supported thermostat setpoints" );
// Parse the data for the supported setpoints
for( uint32 i=1; i<_length-1; ++i )

View file

@ -58,9 +58,9 @@ const uint8 UserCodeLength = 10;
// Constructor
//-----------------------------------------------------------------------------
UserCode::UserCode
(
(
uint32 const _homeId,
uint8 const _nodeId
uint8 const _nodeId
):
CommandClass( _homeId, _nodeId ),
m_queryAll( false ),
@ -76,7 +76,7 @@ UserCode::UserCode
// Class specific configuration
//-----------------------------------------------------------------------------
void UserCode::ReadXML
(
(
TiXmlElement const* _ccElement
)
{
@ -94,7 +94,7 @@ void UserCode::ReadXML
// Class specific configuration
//-----------------------------------------------------------------------------
void UserCode::WriteXML
(
(
TiXmlElement* _ccElement
)
{
@ -152,7 +152,11 @@ bool UserCode::RequestValue
// This command class doesn't work with multiple instances
return false;
}
if ( !IsGetSupported() )
{
Log::Write( LogLevel_Info, GetNodeId(), "UserNumberCmd_Get Not Supported on this node");
return false;
}
if( _userCodeIdx == 0xff )
{
// Get number of supported user codes.
@ -189,7 +193,7 @@ bool UserCode::HandleMsg
)
{
if( UserNumberCmd_Report == (UserCodeCmd)_data[0] )
{
{
m_userCodeCount = _data[1];
if( m_userCodeCount > 254 )
{
@ -235,7 +239,7 @@ bool UserCode::HandleMsg
return true;
}
else if( UserCodeCmd_Report == (UserCodeCmd)_data[0] )
{
{
int i = _data[1];
if( ValueRaw* value = static_cast<ValueRaw*>( GetValue( _instance, i ) ) )
{

View file

@ -72,7 +72,7 @@ Version::Version
// Read configuration.
//-----------------------------------------------------------------------------
void Version::ReadXML
(
(
TiXmlElement const* _ccElement
)
{
@ -90,7 +90,7 @@ void Version::ReadXML
// Save changed configuration
//-----------------------------------------------------------------------------
void Version::WriteXML
(
(
TiXmlElement* _ccElement
)
{
@ -138,15 +138,20 @@ bool Version::RequestValue
// This command class doesn't work with multiple instances
return false;
}
Msg* msg = new Msg( "VersionCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->Append( GetNodeId() );
msg->Append( 2 );
msg->Append( GetCommandClassId() );
msg->Append( VersionCmd_Get );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
if ( IsGetSupported() )
{
Msg* msg = new Msg( "VersionCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->Append( GetNodeId() );
msg->Append( 2 );
msg->Append( GetCommandClassId() );
msg->Append( VersionCmd_Get );
msg->Append( GetDriver()->GetTransmitOptions() );
GetDriver()->SendMsg( msg, _queue );
return true;
} else {
Log::Write( LogLevel_Info, GetNodeId(), "VersionCmd_Get Not Supported on this node");
}
return false;
}
//-----------------------------------------------------------------------------
@ -193,7 +198,7 @@ bool Version::HandleMsg
return true;
}
if (VersionCmd_CommandClassReport == (VersionCmd)_data[0])
{
if( CommandClass* pCommandClass = node->GetCommandClass( _data[1] ) )
@ -212,7 +217,7 @@ bool Version::HandleMsg
//-----------------------------------------------------------------------------
// <Version::RequestCommandClassVersion>
// Request the version of a command class used by the device
// Request the version of a command class used by the device
//-----------------------------------------------------------------------------
bool Version::RequestCommandClassVersion
(

View file

@ -36,6 +36,7 @@
#include "Notification.h"
#include "Mutex.h"
#include "ValueInt.h"
#include "Options.h"
using namespace OpenZWave;
@ -62,10 +63,12 @@ WakeUp::WakeUp
):
CommandClass( _homeId, _nodeId ),
m_mutex( new Mutex() ),
m_awake( true ),
m_pollRequired( false ),
m_notification( false )
{
m_awake = true;
Options::Get()->GetOptionAsBool("AssumeAwake", &m_awake);
SetStaticRequest( StaticRequest_Values );
}

View file

@ -1,68 +1,68 @@
//-----------------------------------------------------------------------------
//
// Controller.cpp
//
// Cross-platform, hardware-abstracted controller data interface
//
// Copyright (c) 2010 Jason Frazier <frazierjason@gmail.com>
//
// SOFTWARE NOTICE AND LICENSE
//
// This file is part of OpenZWave.
//
// OpenZWave is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// OpenZWave is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
#include "Defs.h"
#include "Driver.h"
#include "Controller.h"
using namespace OpenZWave;
//-----------------------------------------------------------------------------
// <Controller::PlayInitSequence>
// Queues up the controller's initialization commands.
//-----------------------------------------------------------------------------
void Controller::PlayInitSequence
(
Driver* _driver
)
{
_driver->SendMsg( new Msg( "FUNC_ID_ZW_GET_VERSION", 0xff, REQUEST, FUNC_ID_ZW_GET_VERSION, false ), Driver::MsgQueue_Command );
_driver->SendMsg( new Msg( "FUNC_ID_ZW_MEMORY_GET_ID", 0xff, REQUEST, FUNC_ID_ZW_MEMORY_GET_ID, false ), Driver::MsgQueue_Command );
_driver->SendMsg( new Msg( "FUNC_ID_ZW_GET_CONTROLLER_CAPABILITIES", 0xff, REQUEST, FUNC_ID_ZW_GET_CONTROLLER_CAPABILITIES, false ), Driver::MsgQueue_Command );
_driver->SendMsg( new Msg( "FUNC_ID_SERIAL_API_GET_CAPABILITIES", 0xff, REQUEST, FUNC_ID_SERIAL_API_GET_CAPABILITIES, false ), Driver::MsgQueue_Command );
_driver->SendMsg( new Msg( "FUNC_ID_ZW_GET_SUC_NODE_ID", 0xff, REQUEST, FUNC_ID_ZW_GET_SUC_NODE_ID, false ), Driver::MsgQueue_Command );
// FUNC_ID_ZW_GET_VIRTUAL_NODES & FUNC_ID_SERIAL_API_GET_INIT_DATA has moved into the handler for FUNC_ID_SERIAL_API_GET_CAPABILITIES
}
//-----------------------------------------------------------------------------
// <Controller::Read>
// Read from a controller
//-----------------------------------------------------------------------------
uint32 Controller::Read
(
uint8* _buffer,
uint32 _length
)
{
// Fetch the data from the ring buffer (which is an all or nothing read)
if( Get( _buffer, _length ) )
{
return _length;
}
return 0;
}
//-----------------------------------------------------------------------------
//
// Controller.cpp
//
// Cross-platform, hardware-abstracted controller data interface
//
// Copyright (c) 2010 Jason Frazier <frazierjason@gmail.com>
//
// SOFTWARE NOTICE AND LICENSE
//
// This file is part of OpenZWave.
//
// OpenZWave is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// OpenZWave is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
#include "Defs.h"
#include "Driver.h"
#include "Controller.h"
using namespace OpenZWave;
//-----------------------------------------------------------------------------
// <Controller::PlayInitSequence>
// Queues up the controller's initialization commands.
//-----------------------------------------------------------------------------
void Controller::PlayInitSequence
(
Driver* _driver
)
{
_driver->SendMsg( new Msg( "FUNC_ID_ZW_GET_VERSION", 0xff, REQUEST, FUNC_ID_ZW_GET_VERSION, false ), Driver::MsgQueue_Command );
_driver->SendMsg( new Msg( "FUNC_ID_ZW_MEMORY_GET_ID", 0xff, REQUEST, FUNC_ID_ZW_MEMORY_GET_ID, false ), Driver::MsgQueue_Command );
_driver->SendMsg( new Msg( "FUNC_ID_ZW_GET_CONTROLLER_CAPABILITIES", 0xff, REQUEST, FUNC_ID_ZW_GET_CONTROLLER_CAPABILITIES, false ), Driver::MsgQueue_Command );
_driver->SendMsg( new Msg( "FUNC_ID_SERIAL_API_GET_CAPABILITIES", 0xff, REQUEST, FUNC_ID_SERIAL_API_GET_CAPABILITIES, false ), Driver::MsgQueue_Command );
_driver->SendMsg( new Msg( "FUNC_ID_ZW_GET_SUC_NODE_ID", 0xff, REQUEST, FUNC_ID_ZW_GET_SUC_NODE_ID, false ), Driver::MsgQueue_Command );
// FUNC_ID_ZW_GET_VIRTUAL_NODES & FUNC_ID_SERIAL_API_GET_INIT_DATA has moved into the handler for FUNC_ID_SERIAL_API_GET_CAPABILITIES
}
//-----------------------------------------------------------------------------
// <Controller::Read>
// Read from a controller
//-----------------------------------------------------------------------------
uint32 Controller::Read
(
uint8* _buffer,
uint32 _length
)
{
// Fetch the data from the ring buffer (which is an all or nothing read)
if( Get( _buffer, _length ) )
{
return _length;
}
return 0;
}

View file

@ -1,107 +1,107 @@
//-----------------------------------------------------------------------------
//
// Controller.h
//
// Cross-platform, hardware-abstracted controller data interface
//
// Copyright (c) 2010 Jason Frazier <frazierjason@gmail.com>
//
// SOFTWARE NOTICE AND LICENSE
//
// This file is part of OpenZWave.
//
// OpenZWave is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// OpenZWave is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
#ifndef _Controller_H
#define _Controller_H
#include <string>
#include <list>
#include "Defs.h"
#include "Driver.h"
#include "Stream.h"
namespace OpenZWave
{
class Driver;
class Controller: public Stream
{
// Controller is derived from Stream rather than containing one, so that
// we can use its Wait abilities without having to duplicate them here.
// The stream is used for input. Buffering of output is handled by the OS.
public:
/**
* Consructor.
* Creates the controller object.
*/
Controller():Stream( 2048 ){}
/**
* Destructor.
* Destroys the controller object.
*/
virtual ~Controller(){}
/**
* Queues a set of Z-Wave messages in the correct order needed to initialize the Controller implementation.
* @param Pointer to the driver object that will handle the messages.
* @see Driver::Init
*/
void PlayInitSequence( Driver* _driver );
/**
* Open a controller.
* Attempts to open a controller and initialize it with the specified paramters.
* @param _controllerName The name of the port to open. For example, ttyS1 on Linux, or \\.\COM2 in Windows.
* @see Close, Read, Write
*/
virtual bool Open( string const& _controllerName ) = 0;
/**
* Close a controller.
* Closes the controller.
* @return True if the controller was closed successfully, or false if the controller was already closed, or an error occurred.
* @see Open
*/
virtual bool Close() = 0;
/**
* Write to a controller.
* Attempts to write data to an open controller.
* @param _buffer Pointer to a block of memory containing the data to be written.
* @param _length Length in bytes of the data.
* @return The number of bytes written.
* @see Read, Open, Close
*/
virtual uint32 Write( uint8* _buffer, uint32 _length ) = 0;
/**
* Read from a controller.
* Attempts to read data from an open controller.
* @param _buffer Pointer to a block of memory large enough to hold the requested data.
* @param _length Length in bytes of the data to be read.
* @return The number of bytes read.
* @see Write, Open, Close
*/
uint32 Read( uint8* _buffer, uint32 _length );
};
} // namespace OpenZWave
#endif //_Controller_H
//-----------------------------------------------------------------------------
//
// Controller.h
//
// Cross-platform, hardware-abstracted controller data interface
//
// Copyright (c) 2010 Jason Frazier <frazierjason@gmail.com>
//
// SOFTWARE NOTICE AND LICENSE
//
// This file is part of OpenZWave.
//
// OpenZWave is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// OpenZWave is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
#ifndef _Controller_H
#define _Controller_H
#include <string>
#include <list>
#include "Defs.h"
#include "Driver.h"
#include "Stream.h"
namespace OpenZWave
{
class Driver;
class Controller: public Stream
{
// Controller is derived from Stream rather than containing one, so that
// we can use its Wait abilities without having to duplicate them here.
// The stream is used for input. Buffering of output is handled by the OS.
public:
/**
* Consructor.
* Creates the controller object.
*/
Controller():Stream( 2048 ){}
/**
* Destructor.
* Destroys the controller object.
*/
virtual ~Controller(){}
/**
* Queues a set of Z-Wave messages in the correct order needed to initialize the Controller implementation.
* @param Pointer to the driver object that will handle the messages.
* @see Driver::Init
*/
void PlayInitSequence( Driver* _driver );
/**
* Open a controller.
* Attempts to open a controller and initialize it with the specified paramters.
* @param _controllerName The name of the port to open. For example, ttyS1 on Linux, or \\.\COM2 in Windows.
* @see Close, Read, Write
*/
virtual bool Open( string const& _controllerName ) = 0;
/**
* Close a controller.
* Closes the controller.
* @return True if the controller was closed successfully, or false if the controller was already closed, or an error occurred.
* @see Open
*/
virtual bool Close() = 0;
/**
* Write to a controller.
* Attempts to write data to an open controller.
* @param _buffer Pointer to a block of memory containing the data to be written.
* @param _length Length in bytes of the data.
* @return The number of bytes written.
* @see Read, Open, Close
*/
virtual uint32 Write( uint8* _buffer, uint32 _length ) = 0;
/**
* Read from a controller.
* Attempts to read data from an open controller.
* @param _buffer Pointer to a block of memory large enough to hold the requested data.
* @param _length Length in bytes of the data to be read.
* @return The number of bytes read.
* @see Write, Open, Close
*/
uint32 Read( uint8* _buffer, uint32 _length );
};
} // namespace OpenZWave
#endif //_Controller_H

View file

@ -1,100 +1,100 @@
//-----------------------------------------------------------------------------
//
// FileOps.cpp
//
// Cross-platform File Operations
//
// Copyright (c) 2012 Greg Satz <satz@iranger.com>
// All rights reserved.
//
// SOFTWARE NOTICE AND LICENSE
//
// This file is part of OpenZWave.
//
// OpenZWave is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// OpenZWave is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
#include <string>
#include "FileOps.h"
#include "FileOpsImpl.h" // Platform-specific implementation of a File Operations
using namespace OpenZWave;
FileOps* FileOps::s_instance = NULL;
FileOpsImpl* FileOps::m_pImpl = NULL;
//-----------------------------------------------------------------------------
// <FileOps::Create>
// Static creation of the singleton
//-----------------------------------------------------------------------------
FileOps* FileOps::Create
(
)
{
if( s_instance == NULL )
{
s_instance = new FileOps();
}
return s_instance;
}
//-----------------------------------------------------------------------------
// <FileOps::Destroy>
// Static method to destroy the fileops singleton.
//-----------------------------------------------------------------------------
void FileOps::Destroy
(
)
{
delete s_instance;
s_instance = NULL;
}
//-----------------------------------------------------------------------------
// <FileOps::FolderExists>
// Static method to check for existance of a folder
//-----------------------------------------------------------------------------
bool FileOps::FolderExists
(
string _folderName
)
{
if( s_instance != NULL )
{
return s_instance->m_pImpl->FolderExists( _folderName );
}
return false;
}
//-----------------------------------------------------------------------------
// <FileOps::FileOps>
// Constructor
//-----------------------------------------------------------------------------
FileOps::FileOps
(
)
{
m_pImpl = new FileOpsImpl();
}
//-----------------------------------------------------------------------------
// <FileOps::~FileOps>
// Destructor
//-----------------------------------------------------------------------------
FileOps::~FileOps
(
)
{
delete m_pImpl;
}
//-----------------------------------------------------------------------------
//
// FileOps.cpp
//
// Cross-platform File Operations
//
// Copyright (c) 2012 Greg Satz <satz@iranger.com>
// All rights reserved.
//
// SOFTWARE NOTICE AND LICENSE
//
// This file is part of OpenZWave.
//
// OpenZWave is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// OpenZWave is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
#include <string>
#include "FileOps.h"
#include "FileOpsImpl.h" // Platform-specific implementation of a File Operations
using namespace OpenZWave;
FileOps* FileOps::s_instance = NULL;
FileOpsImpl* FileOps::m_pImpl = NULL;
//-----------------------------------------------------------------------------
// <FileOps::Create>
// Static creation of the singleton
//-----------------------------------------------------------------------------
FileOps* FileOps::Create
(
)
{
if( s_instance == NULL )
{
s_instance = new FileOps();
}
return s_instance;
}
//-----------------------------------------------------------------------------
// <FileOps::Destroy>
// Static method to destroy the fileops singleton.
//-----------------------------------------------------------------------------
void FileOps::Destroy
(
)
{
delete s_instance;
s_instance = NULL;
}
//-----------------------------------------------------------------------------
// <FileOps::FolderExists>
// Static method to check for existance of a folder
//-----------------------------------------------------------------------------
bool FileOps::FolderExists
(
const string &_folderName
)
{
if( s_instance != NULL )
{
return s_instance->m_pImpl->FolderExists( _folderName );
}
return false;
}
//-----------------------------------------------------------------------------
// <FileOps::FileOps>
// Constructor
//-----------------------------------------------------------------------------
FileOps::FileOps
(
)
{
m_pImpl = new FileOpsImpl();
}
//-----------------------------------------------------------------------------
// <FileOps::~FileOps>
// Destructor
//-----------------------------------------------------------------------------
FileOps::~FileOps
(
)
{
delete m_pImpl;
}

View file

@ -1,75 +1,75 @@
//-----------------------------------------------------------------------------
//
// FileOps.h
//
// Cross-platform File Operations
//
// Copyright (c) 2012 Greg Satz <satz@iranger.com>
// All rights reserved.
//
// SOFTWARE NOTICE AND LICENSE
//
// This file is part of OpenZWave.
//
// OpenZWave is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// OpenZWave is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
#ifndef _FileOps_H
#define _FileOps_H
#include <stdarg.h>
#include <string>
#include "Defs.h"
namespace OpenZWave
{
class FileOpsImpl;
/** \brief Implements platform-independent File Operations.
*/
class FileOps
{
public:
/**
* Create a FileOps cross-platform singleton.
* \return a pointer to the file operations object.
* \see Destroy.
*/
static FileOps* Create();
/**
* Destroys the FileOps singleton.
* \see Create.
*/
static void Destroy();
/**
* FolderExists. Check for the existance of a folder.
* \param string. Folder name.
* \return Bool value indicating existance.
*/
static bool FolderExists( string _folderName );
private:
FileOps();
~FileOps();
static FileOpsImpl* m_pImpl; // Pointer to an object that encapsulates the platform-specific implementation of the FileOps.
static FileOps* s_instance;
};
} // namespace OpenZWave
#endif //_FileOps_H
//-----------------------------------------------------------------------------
//
// FileOps.h
//
// Cross-platform File Operations
//
// Copyright (c) 2012 Greg Satz <satz@iranger.com>
// All rights reserved.
//
// SOFTWARE NOTICE AND LICENSE
//
// This file is part of OpenZWave.
//
// OpenZWave is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// OpenZWave is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
#ifndef _FileOps_H
#define _FileOps_H
#include <stdarg.h>
#include <string>
#include "Defs.h"
namespace OpenZWave
{
class FileOpsImpl;
/** \brief Implements platform-independent File Operations.
*/
class FileOps
{
public:
/**
* Create a FileOps cross-platform singleton.
* \return a pointer to the file operations object.
* \see Destroy.
*/
static FileOps* Create();
/**
* Destroys the FileOps singleton.
* \see Create.
*/
static void Destroy();
/**
* FolderExists. Check for the existance of a folder.
* \param string. Folder name.
* \return Bool value indicating existance.
*/
static bool FolderExists( const string &_folderName );
private:
FileOps();
~FileOps();
static FileOpsImpl* m_pImpl; // Pointer to an object that encapsulates the platform-specific implementation of the FileOps.
static FileOps* s_instance;
};
} // namespace OpenZWave
#endif //_FileOps_H

View file

@ -322,7 +322,7 @@ bool HidController::Init
memset(serialHex, 0, serialLength + 1);
for (size_t i = 0; i < serialLength; ++i)
{
snprintf(&serialHex[i], serialLength - i + 1, "%hx", hidInfoString[i] & 0x0f);
snprintf(&serialHex[i], serialLength - i + 1, "%hx", (unsigned short)(hidInfoString[i] & 0x0f));
}
Log::Write( LogLevel_Info, " Serial #: %ls --> %s", hidInfoString, serialHex );
delete [] serialHex;

View file

@ -268,7 +268,7 @@ void Log::QueueClear
//-----------------------------------------------------------------------------
void Log::SetLogFileName
(
string _filename
const string &_filename
)
{
if( s_instance && s_dologging && s_instance->m_pImpl )
@ -294,7 +294,8 @@ Log::Log
):
m_logMutex( new Mutex() )
{
m_pImpl = new LogImpl( _filename, _bAppend, _bConsoleOutput, _saveLevel, _queueLevel, _dumpTrigger );
if (NULL == m_pImpl)
m_pImpl = new LogImpl( _filename, _bAppend, _bConsoleOutput, _saveLevel, _queueLevel, _dumpTrigger );
}
//-----------------------------------------------------------------------------

View file

@ -61,7 +61,7 @@ namespace OpenZWave
virtual void QueueDump() = 0;
virtual void QueueClear() = 0;
virtual void SetLoggingState( LogLevel _saveLevel, LogLevel _queueLevel, LogLevel _dumpTrigger ) = 0;
virtual void SetLogFileName( string _filename ) = 0;
virtual void SetLogFileName( const string &_filename ) = 0;
};
/** \brief Implements a platform-independent log...written to the console and, optionally, a file.
@ -139,7 +139,7 @@ namespace OpenZWave
* in the controlling application, to create timestamped log file names.
* \param _filename Name of the new (or existing) file to use for log output.
*/
static void SetLogFileName( string _filename );
static void SetLogFileName( const string &_filename );
/**
* Write an entry to the log.

View file

@ -1,91 +1,91 @@
//-----------------------------------------------------------------------------
//
// Ref.h
//
// Reference counting for objects.
//
// Copyright (c) 2010 Mal Lansell <mal@lansell.org>
// All rights reserved.
//
// SOFTWARE NOTICE AND LICENSE
//
// This file is part of OpenZWave.
//
// OpenZWave is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// OpenZWave is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
#ifndef _Ref_H
#define _Ref_H
#pragma once
#include "Defs.h"
namespace OpenZWave
{
/**
* Provides reference counting for objects.
* Any class wishing to include reference counting should be derived from Ref.
* Derived classes must declare their destructor as protected virtual.
* On construction, the reference count is set to one. Calls to AddRef increment
* the count. Calls to Release decrement the count. When the count reaches
* zero, the object is deleted.
*/
class Ref
{
public:
/**
* Initializes the RefCount to one. The object
* can only be deleted through a call to Release.
* \see AddRef, Release
*/
Ref(){ m_refs = 1; }
/**
* Increases the reference count of the object.
* Every call to AddRef requires a matching call
* to Release before the object will be deleted.
* \see Release
*/
void AddRef(){ ++m_refs; }
/**
* Removes a reference to an object.
* If this was the last reference to the message, the
* object is deleted.
* \see AddRef
*/
int32 Release()
{
if( 0 >= ( --m_refs ) )
{
delete this;
return 0;
}
return m_refs;
}
protected:
virtual ~Ref(){}
private:
// Reference counting
int32 m_refs;
}; // class Ref
} // namespace OpenZWave
#endif // _Ref_H
//-----------------------------------------------------------------------------
//
// Ref.h
//
// Reference counting for objects.
//
// Copyright (c) 2010 Mal Lansell <mal@lansell.org>
// All rights reserved.
//
// SOFTWARE NOTICE AND LICENSE
//
// This file is part of OpenZWave.
//
// OpenZWave is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// OpenZWave is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
#ifndef _Ref_H
#define _Ref_H
#pragma once
#include "Defs.h"
namespace OpenZWave
{
/**
* Provides reference counting for objects.
* Any class wishing to include reference counting should be derived from Ref.
* Derived classes must declare their destructor as protected virtual.
* On construction, the reference count is set to one. Calls to AddRef increment
* the count. Calls to Release decrement the count. When the count reaches
* zero, the object is deleted.
*/
class Ref
{
public:
/**
* Initializes the RefCount to one. The object
* can only be deleted through a call to Release.
* \see AddRef, Release
*/
Ref(){ m_refs = 1; }
/**
* Increases the reference count of the object.
* Every call to AddRef requires a matching call
* to Release before the object will be deleted.
* \see Release
*/
void AddRef(){ ++m_refs; }
/**
* Removes a reference to an object.
* If this was the last reference to the message, the
* object is deleted.
* \see AddRef
*/
int32 Release()
{
if( 0 >= ( --m_refs ) )
{
delete this;
return 0;
}
return m_refs;
}
protected:
virtual ~Ref(){}
private:
// Reference counting
int32 m_refs;
}; // class Ref
} // namespace OpenZWave
#endif // _Ref_H

View file

@ -1,227 +1,227 @@
//-----------------------------------------------------------------------------
//
// Stream.h
//
// Cross-platform circular buffer with signalling
//
// Copyright (c) 2010 Mal Lansell <mal@lansell.org>
// All rights reserved.
//
// SOFTWARE NOTICE AND LICENSE
//
// This file is part of OpenZWave.
//
// OpenZWave is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// OpenZWave is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
#include "Stream.h"
#include "Mutex.h"
#include "Log.h"
#include <string.h>
#include <cstdio>
using namespace OpenZWave;
//-----------------------------------------------------------------------------
// <Stream::Stream>
// Constructor
//-----------------------------------------------------------------------------
Stream::Stream
(
uint32 _bufferSize
):
m_bufferSize( _bufferSize ),
m_signalSize(1),
m_dataSize(0),
m_head(0),
m_tail(0),
m_mutex( new Mutex() )
{
m_buffer = new uint8[m_bufferSize];
}
//-----------------------------------------------------------------------------
// <Stream::~Stream>
// Destructor
//-----------------------------------------------------------------------------
Stream::~Stream
(
)
{
m_mutex->Release();
delete [] m_buffer;
}
//-----------------------------------------------------------------------------
// <Stream::SetSignalThreshold>
// Set the amount of data that must be in the buffer for to to be signalled
//-----------------------------------------------------------------------------
void Stream::SetSignalThreshold
(
uint32 _size
)
{
m_signalSize = _size;
if( IsSignalled() )
{
// We have more data than we are waiting for, so notify the watchers
Notify();
}
}
//-----------------------------------------------------------------------------
// <Stream::Get>
// Remove data from the buffer
//-----------------------------------------------------------------------------
bool Stream::Get
(
uint8* _buffer,
uint32 _size
)
{
if( m_dataSize < _size )
{
// There is not enough data in the buffer to fulfill the request
Log::Write( LogLevel_Error, "ERROR: Not enough data in stream buffer");
return false;
}
m_mutex->Lock();
if( (m_tail + _size) > m_bufferSize )
{
// We will have to wrap around
uint32 block1 = m_bufferSize - m_tail;
uint32 block2 = _size - block1;
memcpy( _buffer, &m_buffer[m_tail], block1 );
memcpy( &_buffer[block1], m_buffer, block2 );
m_tail = block2;
}
else
{
// Requested data is in a contiguous block
memcpy( _buffer, &m_buffer[m_tail], _size );
m_tail += _size;
}
LogData( _buffer, _size, " Read (buffer->application): ");
m_dataSize -= _size;
m_mutex->Unlock();
return true;
}
//-----------------------------------------------------------------------------
// <Stream::Put>
// Add data to the buffer
//-----------------------------------------------------------------------------
bool Stream::Put
(
uint8* _buffer,
uint32 _size
)
{
if( (m_bufferSize-m_dataSize) < _size )
{
// There is not enough space left in the buffer for the data
Log::Write( LogLevel_Error, "ERROR: Not enough space in stream buffer");
return false;
}
m_mutex->Lock();
if( (m_head + _size) > m_bufferSize )
{
// We will have to wrap around
uint32 block1 = m_bufferSize - m_head;
uint32 block2 = _size - block1;
memcpy( &m_buffer[m_head], _buffer, block1 );
memcpy( m_buffer, &_buffer[block1], block2 );
m_head = block2;
LogData( m_buffer + m_head - block1, block1, " Read (controller->buffer): ");
LogData( m_buffer, block2, " Read (controller->buffer): ");
}
else
{
// There is enough space before we reach the end of the buffer
memcpy( &m_buffer[m_head], _buffer, _size );
m_head += _size;
LogData(m_buffer+m_head-_size, _size, " Read (controller->buffer): ");
}
m_dataSize += _size;
if( IsSignalled() )
{
// We now have more data than we are waiting for, so notify the watchers
Notify();
}
m_mutex->Unlock();
return true;
}
//-----------------------------------------------------------------------------
// <Stream::Purge>
// Empty the data buffer
//-----------------------------------------------------------------------------
void Stream::Purge
(
)
{
m_tail = 0;
m_head = 0;
m_dataSize = 0;
}
//-----------------------------------------------------------------------------
// <Stream::IsSignalled>
// Test whether there is enough data to be signalled
//-----------------------------------------------------------------------------
bool Stream::IsSignalled
(
)
{
return( m_dataSize >= m_signalSize );
}
//-----------------------------------------------------------------------------
// <Stream::LogData>
// Format the stream buffer data for log output
//-----------------------------------------------------------------------------
void Stream::LogData
(
uint8* _buffer,
uint32 _length,
string _function
)
{
if( !_length ) return;
string str = "";
for( uint32 i=0; i<_length; ++i )
{
if( i )
{
str += ", ";
}
char byteStr[8];
snprintf( byteStr, sizeof(byteStr), "0x%.2x", _buffer[i] );
str += byteStr;
}
Log::Write( LogLevel_StreamDetail, "%s%s", _function.c_str(), str.c_str() );
}
//-----------------------------------------------------------------------------
//
// Stream.h
//
// Cross-platform circular buffer with signalling
//
// Copyright (c) 2010 Mal Lansell <mal@lansell.org>
// All rights reserved.
//
// SOFTWARE NOTICE AND LICENSE
//
// This file is part of OpenZWave.
//
// OpenZWave is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// OpenZWave is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
#include "Stream.h"
#include "Mutex.h"
#include "Log.h"
#include <string.h>
#include <cstdio>
using namespace OpenZWave;
//-----------------------------------------------------------------------------
// <Stream::Stream>
// Constructor
//-----------------------------------------------------------------------------
Stream::Stream
(
uint32 _bufferSize
):
m_bufferSize( _bufferSize ),
m_signalSize(1),
m_dataSize(0),
m_head(0),
m_tail(0),
m_mutex( new Mutex() )
{
m_buffer = new uint8[m_bufferSize];
}
//-----------------------------------------------------------------------------
// <Stream::~Stream>
// Destructor
//-----------------------------------------------------------------------------
Stream::~Stream
(
)
{
m_mutex->Release();
delete [] m_buffer;
}
//-----------------------------------------------------------------------------
// <Stream::SetSignalThreshold>
// Set the amount of data that must be in the buffer for to to be signalled
//-----------------------------------------------------------------------------
void Stream::SetSignalThreshold
(
uint32 _size
)
{
m_signalSize = _size;
if( IsSignalled() )
{
// We have more data than we are waiting for, so notify the watchers
Notify();
}
}
//-----------------------------------------------------------------------------
// <Stream::Get>
// Remove data from the buffer
//-----------------------------------------------------------------------------
bool Stream::Get
(
uint8* _buffer,
uint32 _size
)
{
if( m_dataSize < _size )
{
// There is not enough data in the buffer to fulfill the request
Log::Write( LogLevel_Error, "ERROR: Not enough data in stream buffer");
return false;
}
m_mutex->Lock();
if( (m_tail + _size) > m_bufferSize )
{
// We will have to wrap around
uint32 block1 = m_bufferSize - m_tail;
uint32 block2 = _size - block1;
memcpy( _buffer, &m_buffer[m_tail], block1 );
memcpy( &_buffer[block1], m_buffer, block2 );
m_tail = block2;
}
else
{
// Requested data is in a contiguous block
memcpy( _buffer, &m_buffer[m_tail], _size );
m_tail += _size;
}
LogData( _buffer, _size, " Read (buffer->application): ");
m_dataSize -= _size;
m_mutex->Unlock();
return true;
}
//-----------------------------------------------------------------------------
// <Stream::Put>
// Add data to the buffer
//-----------------------------------------------------------------------------
bool Stream::Put
(
uint8* _buffer,
uint32 _size
)
{
if( (m_bufferSize-m_dataSize) < _size )
{
// There is not enough space left in the buffer for the data
Log::Write( LogLevel_Error, "ERROR: Not enough space in stream buffer");
return false;
}
m_mutex->Lock();
if( (m_head + _size) > m_bufferSize )
{
// We will have to wrap around
uint32 block1 = m_bufferSize - m_head;
uint32 block2 = _size - block1;
memcpy( &m_buffer[m_head], _buffer, block1 );
memcpy( m_buffer, &_buffer[block1], block2 );
m_head = block2;
LogData( m_buffer + m_head - block1, block1, " Read (controller->buffer): ");
LogData( m_buffer, block2, " Read (controller->buffer): ");
}
else
{
// There is enough space before we reach the end of the buffer
memcpy( &m_buffer[m_head], _buffer, _size );
m_head += _size;
LogData(m_buffer+m_head-_size, _size, " Read (controller->buffer): ");
}
m_dataSize += _size;
if( IsSignalled() )
{
// We now have more data than we are waiting for, so notify the watchers
Notify();
}
m_mutex->Unlock();
return true;
}
//-----------------------------------------------------------------------------
// <Stream::Purge>
// Empty the data buffer
//-----------------------------------------------------------------------------
void Stream::Purge
(
)
{
m_tail = 0;
m_head = 0;
m_dataSize = 0;
}
//-----------------------------------------------------------------------------
// <Stream::IsSignalled>
// Test whether there is enough data to be signalled
//-----------------------------------------------------------------------------
bool Stream::IsSignalled
(
)
{
return( m_dataSize >= m_signalSize );
}
//-----------------------------------------------------------------------------
// <Stream::LogData>
// Format the stream buffer data for log output
//-----------------------------------------------------------------------------
void Stream::LogData
(
uint8* _buffer,
uint32 _length,
const string &_function
)
{
if( !_length ) return;
string str = "";
for( uint32 i=0; i<_length; ++i )
{
if( i )
{
str += ", ";
}
char byteStr[8];
snprintf( byteStr, sizeof(byteStr), "0x%.2x", _buffer[i] );
str += byteStr;
}
Log::Write( LogLevel_StreamDetail, "%s%s", _function.c_str(), str.c_str() );
}

View file

@ -1,135 +1,135 @@
//-----------------------------------------------------------------------------
//
// Stream.h
//
// Cross-platform circular buffer with signalling
//
// Copyright (c) 2010 Mal Lansell <mal@lansell.org>
// All rights reserved.
//
// SOFTWARE NOTICE AND LICENSE
//
// This file is part of OpenZWave.
//
// OpenZWave is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// OpenZWave is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
#ifndef _Stream_H
#define _Stream_H
#include "Defs.h"
#include "Wait.h"
#include <string>
namespace OpenZWave
{
class Mutex;
/** \brief Platform-independent definition of a circular buffer.
*/
class Stream: public Wait
{
friend class Wait;
public:
/**
* Constructor.
* Creates a cross-platform ring buffer object
*/
Stream( uint32 _bufferSize );
/**
* Set the number of bytes the buffer must contain before it becomes signalled.
* Once the threshold is set, the application can use Wait::Single or Wait::Multiple
* to wait until the buffer has been filled with the desired amount of data.
* \param _size the amoutn of data in bytes that the buffer must contain for it to become signalled.
* \see Wait::Single, Wait::Multiple
*/
void SetSignalThreshold( uint32 _size );
/**
* Copies the requested amount of data from the stream, removing it from the stream as it does so.
* If there is insufficient data available, the method returns false, and no data is transferred.
* \param _buffer pointer to a block of memory that will be filled with the stream data.
* \param _size the amount of data in bytes to copy from the stream.
* \return true if all the requested data has been copied. False if there was not enough data in
* the stream.
* \see GetDataSize, Put
*/
bool Get( uint8* _buffer, uint32 _size );
/**
* Copies the requested amount of data from the buffer into the stream.
* If there is insufficient room available in the stream's circular buffer, and no data is transferred.
* \param _buffer pointer to a block of memory that will be copied into the stream.
* \param _size the amount of data in bytes to copy to the stream.
* \return true if all the requested data has been copied. False if there was not enough space in
* the stream's circular buffer.
* \see Get, GetDataSize
*/
bool Put( uint8* _buffer, uint32 _size );
/**
* Returns the amount of data in bytes that is stored in the stream.
* \return the number of bytes of data in the stream.
* \see Get, GetDataSize
*/
uint32 GetDataSize()const{ return m_dataSize; }
/**
* Empties the stream bytes held in the buffer.
* This is called when the library gets out of sync with the controller and sends a "NAK"
* to the controller.
*/
void Purge();
protected:
/**
* Formats stream buffer data for output to the log.
* \param _buffer pointer to the stream buffer "head" location
* \param _size number of valid bytes currently in the buffer
* \param _function string containing text to display before the data
*/
void LogData( uint8* _buffer, uint32 _size, string _function );
/**
* Used by the Wait class to test whether the buffer contains sufficient data.
*/
virtual bool IsSignalled();
/**
* Destructor.
* Destroys the ring buffer object.
*/
~Stream();
private:
Stream( Stream const& ); // prevent copy
Stream& operator = ( Stream const& ); // prevent assignment
uint8* m_buffer;
uint32 m_bufferSize;
uint32 m_signalSize;
uint32 m_dataSize;
uint32 m_head;
uint32 m_tail;
Mutex* m_mutex;
};
} // namespace OpenZWave
#endif //_Event_H
//-----------------------------------------------------------------------------
//
// Stream.h
//
// Cross-platform circular buffer with signalling
//
// Copyright (c) 2010 Mal Lansell <mal@lansell.org>
// All rights reserved.
//
// SOFTWARE NOTICE AND LICENSE
//
// This file is part of OpenZWave.
//
// OpenZWave is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// OpenZWave is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
#ifndef _Stream_H
#define _Stream_H
#include "Defs.h"
#include "Wait.h"
#include <string>
namespace OpenZWave
{
class Mutex;
/** \brief Platform-independent definition of a circular buffer.
*/
class Stream: public Wait
{
friend class Wait;
public:
/**
* Constructor.
* Creates a cross-platform ring buffer object
*/
Stream( uint32 _bufferSize );
/**
* Set the number of bytes the buffer must contain before it becomes signalled.
* Once the threshold is set, the application can use Wait::Single or Wait::Multiple
* to wait until the buffer has been filled with the desired amount of data.
* \param _size the amoutn of data in bytes that the buffer must contain for it to become signalled.
* \see Wait::Single, Wait::Multiple
*/
void SetSignalThreshold( uint32 _size );
/**
* Copies the requested amount of data from the stream, removing it from the stream as it does so.
* If there is insufficient data available, the method returns false, and no data is transferred.
* \param _buffer pointer to a block of memory that will be filled with the stream data.
* \param _size the amount of data in bytes to copy from the stream.
* \return true if all the requested data has been copied. False if there was not enough data in
* the stream.
* \see GetDataSize, Put
*/
bool Get( uint8* _buffer, uint32 _size );
/**
* Copies the requested amount of data from the buffer into the stream.
* If there is insufficient room available in the stream's circular buffer, and no data is transferred.
* \param _buffer pointer to a block of memory that will be copied into the stream.
* \param _size the amount of data in bytes to copy to the stream.
* \return true if all the requested data has been copied. False if there was not enough space in
* the stream's circular buffer.
* \see Get, GetDataSize
*/
bool Put( uint8* _buffer, uint32 _size );
/**
* Returns the amount of data in bytes that is stored in the stream.
* \return the number of bytes of data in the stream.
* \see Get, GetDataSize
*/
uint32 GetDataSize()const{ return m_dataSize; }
/**
* Empties the stream bytes held in the buffer.
* This is called when the library gets out of sync with the controller and sends a "NAK"
* to the controller.
*/
void Purge();
protected:
/**
* Formats stream buffer data for output to the log.
* \param _buffer pointer to the stream buffer "head" location
* \param _size number of valid bytes currently in the buffer
* \param _function string containing text to display before the data
*/
void LogData( uint8* _buffer, uint32 _size, const string &_function );
/**
* Used by the Wait class to test whether the buffer contains sufficient data.
*/
virtual bool IsSignalled();
/**
* Destructor.
* Destroys the ring buffer object.
*/
~Stream();
private:
Stream( Stream const& ); // prevent copy
Stream& operator = ( Stream const& ); // prevent assignment
uint8* m_buffer;
uint32 m_bufferSize;
uint32 m_signalSize;
uint32 m_dataSize;
uint32 m_head;
uint32 m_tail;
Mutex* m_mutex;
};
} // namespace OpenZWave
#endif //_Event_H

View file

@ -1,103 +1,103 @@
//-----------------------------------------------------------------------------
//
// TimeStamp.h
//
// Cross-platform TimeStamp
//
// Copyright (c) 2010 Mal Lansell <mal@lansell.org>
// All rights reserved.
//
// SOFTWARE NOTICE AND LICENSE
//
// This file is part of OpenZWave.
//
// OpenZWave is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// OpenZWave is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
#include <string>
#include "Defs.h"
#include "TimeStamp.h"
#include "TimeStampImpl.h" // Platform-specific implementation of a TimeStamp
using namespace OpenZWave;
//-----------------------------------------------------------------------------
// <TimeStamp::TimeStamp>
// Constructor
//-----------------------------------------------------------------------------
TimeStamp::TimeStamp
(
):
m_pImpl( new TimeStampImpl() )
{
}
//-----------------------------------------------------------------------------
// <TimeStamp::~TimeStamp>
// Destructor
//-----------------------------------------------------------------------------
TimeStamp::~TimeStamp
(
)
{
delete m_pImpl;
}
//-----------------------------------------------------------------------------
// <TimeStamp::SetTime>
// Sets the timestamp to now, plus an offset in milliseconds
//-----------------------------------------------------------------------------
void TimeStamp::SetTime
(
int32 _milliseconds // = 0
)
{
m_pImpl->SetTime( _milliseconds );
}
//-----------------------------------------------------------------------------
// <TimeStamp::TimeRemaining>
// Gets the difference between now and the timestamp time in milliseconds
//-----------------------------------------------------------------------------
int32 TimeStamp::TimeRemaining
(
)
{
return m_pImpl->TimeRemaining();
}
//-----------------------------------------------------------------------------
// <TimeStamp::GetAsString>
// Return object as a string
//-----------------------------------------------------------------------------
string TimeStamp::GetAsString
(
)
{
return m_pImpl->GetAsString();
}
//-----------------------------------------------------------------------------
// <TimeStamp::operator->
// Overload the subtract operator to get the difference between two
// timestamps in milliseconds
//-----------------------------------------------------------------------------
int32 TimeStamp::operator-
(
TimeStamp const& _other
)
{
return (int32)(m_pImpl - _other.m_pImpl);
}
//-----------------------------------------------------------------------------
//
// TimeStamp.h
//
// Cross-platform TimeStamp
//
// Copyright (c) 2010 Mal Lansell <mal@lansell.org>
// All rights reserved.
//
// SOFTWARE NOTICE AND LICENSE
//
// This file is part of OpenZWave.
//
// OpenZWave is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// OpenZWave is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
#include <string>
#include "Defs.h"
#include "TimeStamp.h"
#include "TimeStampImpl.h" // Platform-specific implementation of a TimeStamp
using namespace OpenZWave;
//-----------------------------------------------------------------------------
// <TimeStamp::TimeStamp>
// Constructor
//-----------------------------------------------------------------------------
TimeStamp::TimeStamp
(
):
m_pImpl( new TimeStampImpl() )
{
}
//-----------------------------------------------------------------------------
// <TimeStamp::~TimeStamp>
// Destructor
//-----------------------------------------------------------------------------
TimeStamp::~TimeStamp
(
)
{
delete m_pImpl;
}
//-----------------------------------------------------------------------------
// <TimeStamp::SetTime>
// Sets the timestamp to now, plus an offset in milliseconds
//-----------------------------------------------------------------------------
void TimeStamp::SetTime
(
int32 _milliseconds // = 0
)
{
m_pImpl->SetTime( _milliseconds );
}
//-----------------------------------------------------------------------------
// <TimeStamp::TimeRemaining>
// Gets the difference between now and the timestamp time in milliseconds
//-----------------------------------------------------------------------------
int32 TimeStamp::TimeRemaining
(
)
{
return m_pImpl->TimeRemaining();
}
//-----------------------------------------------------------------------------
// <TimeStamp::GetAsString>
// Return object as a string
//-----------------------------------------------------------------------------
string TimeStamp::GetAsString
(
)
{
return m_pImpl->GetAsString();
}
//-----------------------------------------------------------------------------
// <TimeStamp::operator->
// Overload the subtract operator to get the difference between two
// timestamps in milliseconds
//-----------------------------------------------------------------------------
int32 TimeStamp::operator-
(
TimeStamp const& _other
)
{
return (int32)(m_pImpl - _other.m_pImpl);
}

View file

@ -1,91 +1,91 @@
//-----------------------------------------------------------------------------
//
// TimeStamp.h
//
// Cross-platform TimeStamp
//
// Copyright (c) 2010 Mal Lansell <mal@lansell.org>
// All rights reserved.
//
// SOFTWARE NOTICE AND LICENSE
//
// This file is part of OpenZWave.
//
// OpenZWave is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// OpenZWave is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
#ifndef _TimeStamp_H
#define _TimeStamp_H
#include "Defs.h"
namespace OpenZWave
{
class TimeStampImpl;
/** \brief Implements a platform-independent TimeStamp.
*/
class TimeStamp
{
public:
/**
* Constructor.
* Creates a TimeStamp object.
*/
TimeStamp();
/**
* Destructor.
* Destroys the TimeStamp object.
*/
~TimeStamp();
/**
* SetTime. Sets the timestamp to now, plus the offset in milliseconds.
* \param _milliseconds optional positive or negative offset from
* now in milliseconds. Defaults to zero.
*/
void SetTime( int32 _milliseconds = 0 );
/**
* TimeRemaining. Gets the difference between now and the timestamp
* time in milliseconds.
* \return milliseconds remaining until we reach the timestamp. The
* return value is negative if the timestamp is in the past.
*/
int32 TimeRemaining();
/**
* Return as a string for output.
* \return string
*/
string GetAsString();
/**
* Overload the subtract operator to get the difference between
* two timestamps in milliseconds.
*/
int32 operator- ( TimeStamp const& _other );
private:
TimeStamp( TimeStamp const& ); // prevent copy
TimeStamp& operator = ( TimeStamp const& ); // prevent assignment
TimeStampImpl* m_pImpl; // Pointer to an object that encapsulates the platform-specific implementation of the TimeStamp.
};
} // namespace OpenZWave
#endif //_TimeStamp_H
//-----------------------------------------------------------------------------
//
// TimeStamp.h
//
// Cross-platform TimeStamp
//
// Copyright (c) 2010 Mal Lansell <mal@lansell.org>
// All rights reserved.
//
// SOFTWARE NOTICE AND LICENSE
//
// This file is part of OpenZWave.
//
// OpenZWave is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// OpenZWave is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
#ifndef _TimeStamp_H
#define _TimeStamp_H
#include "Defs.h"
namespace OpenZWave
{
class TimeStampImpl;
/** \brief Implements a platform-independent TimeStamp.
*/
class OPENZWAVE_EXPORT TimeStamp
{
public:
/**
* Constructor.
* Creates a TimeStamp object.
*/
TimeStamp();
/**
* Destructor.
* Destroys the TimeStamp object.
*/
~TimeStamp();
/**
* SetTime. Sets the timestamp to now, plus the offset in milliseconds.
* \param _milliseconds optional positive or negative offset from
* now in milliseconds. Defaults to zero.
*/
void SetTime( int32 _milliseconds = 0 );
/**
* TimeRemaining. Gets the difference between now and the timestamp
* time in milliseconds.
* \return milliseconds remaining until we reach the timestamp. The
* return value is negative if the timestamp is in the past.
*/
int32 TimeRemaining();
/**
* Return as a string for output.
* \return string
*/
string GetAsString();
/**
* Overload the subtract operator to get the difference between
* two timestamps in milliseconds.
*/
int32 operator- ( TimeStamp const& _other );
private:
TimeStamp( TimeStamp const& ); // prevent copy
TimeStamp& operator = ( TimeStamp const& ); // prevent assignment
TimeStampImpl* m_pImpl; // Pointer to an object that encapsulates the platform-specific implementation of the TimeStamp.
};
} // namespace OpenZWave
#endif //_TimeStamp_H

Some files were not shown because too many files have changed in this diff Show more