-// Return a scene's Value ID
+// Return a scene's Value ID
//-----------------------------------------------------------------------------
int Manager::SceneGetValues
(
diff --git a/cpp/src/Manager.h b/cpp/src/Manager.h
index 6203178e..04552ef7 100644
--- a/cpp/src/Manager.h
+++ b/cpp/src/Manager.h
@@ -71,8 +71,8 @@ namespace OpenZWave
* the low-level details of the Z-Wave protocol.
*
* 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.
*
@@ -88,24 +88,24 @@ namespace OpenZWave
* notifications of Z-Wave network changes and updates to device values, and is
* an essential element of OpenZWave.
*
- * 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.
*
- * [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.
- *
+ *
* 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 m_pendingDrivers; /**< Drivers that are in the process of reading saved data and querying their Z-Wave network for basic information. */
map 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 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,
* 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.
*
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
diff --git a/cpp/src/Msg.h b/cpp/src/Msg.h
index 644019f4..5e288f31 100644
--- a/cpp/src/Msg.h
+++ b/cpp/src/Msg.h
@@ -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
diff --git a/cpp/src/Notification.h b/cpp/src/Notification.h
index f0365d67..4553e6b8 100644
--- a/cpp/src/Notification.h
+++ b/cpp/src/Notification.h
@@ -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;
diff --git a/cpp/src/Options.cpp b/cpp/src/Options.cpp
index 382ac8f6..3f0f012e 100644
--- a/cpp/src/Options.cpp
+++ b/cpp/src/Options.cpp
@@ -25,8 +25,8 @@
//
//-----------------------------------------------------------------------------
-#include
-#include
+#include
+#include
#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
{
diff --git a/cpp/src/Options.h b/cpp/src/Options.h
index 3ebf488c..39d4fef5 100644
--- a/cpp/src/Options.h
+++ b/cpp/src/Options.h
@@ -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 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.
diff --git a/cpp/src/Scene.h b/cpp/src/Scene.h
index 3b4ceb54..3af3e674 100644
--- a/cpp/src/Scene.h
+++ b/cpp/src/Scene.h
@@ -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 );
diff --git a/cpp/src/command_classes/Alarm.cpp b/cpp/src/command_classes/Alarm.cpp
index 92f56cc4..5d68c972 100644
--- a/cpp/src/command_classes/Alarm.cpp
+++ b/cpp/src/command_classes/Alarm.cpp
@@ -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;
}
diff --git a/cpp/src/command_classes/Association.cpp b/cpp/src/command_classes/Association.cpp
index 6ecefd71..dc01336d 100644
--- a/cpp/src/command_classes/Association.cpp
+++ b/cpp/src/command_classes/Association.cpp
@@ -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;
}
-
//-----------------------------------------------------------------------------
//
// 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() );
diff --git a/cpp/src/command_classes/AssociationCommandConfiguration.cpp b/cpp/src/command_classes/AssociationCommandConfiguration.cpp
index 9c61e9ea..0d6de2b8 100644
--- a/cpp/src/command_classes/AssociationCommandConfiguration.cpp
+++ b/cpp/src/command_classes/AssociationCommandConfiguration.cpp
@@ -59,8 +59,8 @@ enum
//-----------------------------------------------------------------------------
-//
-// Request current state from the device
+//
+// Request current state from the device
//-----------------------------------------------------------------------------
bool AssociationCommandConfiguration::RequestState
(
@@ -78,8 +78,8 @@ bool AssociationCommandConfiguration::RequestState
}
//-----------------------------------------------------------------------------
-//
-// Request current value from the device
+//
+// Request current value from the device
//-----------------------------------------------------------------------------
bool AssociationCommandConfiguration::RequestValue
(
@@ -106,8 +106,8 @@ bool AssociationCommandConfiguration::RequestValue
}
//-----------------------------------------------------------------------------
-//
-// Request the command data
+//
+// 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");
+ }
}
-
//-----------------------------------------------------------------------------
//
// 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
//-----------------------------------------------------------------------------
//
-// Set a command for the association
+// Set a command for the association
//-----------------------------------------------------------------------------
void AssociationCommandConfiguration::SetCommand
(
diff --git a/cpp/src/command_classes/Basic.cpp b/cpp/src/command_classes/Basic.cpp
index 40043780..748464ae 100644
--- a/cpp/src/command_classes/Basic.cpp
+++ b/cpp/src/command_classes/Basic.cpp
@@ -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(&_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 );
diff --git a/cpp/src/command_classes/Battery.cpp b/cpp/src/command_classes/Battery.cpp
index 7017a257..2690ebba 100644
--- a/cpp/src/command_classes/Battery.cpp
+++ b/cpp/src/command_classes/Battery.cpp
@@ -44,8 +44,8 @@ enum BatteryCmd
};
//-----------------------------------------------------------------------------
-//
-// Request current state from the device
+//
+// Request current state from the device
//-----------------------------------------------------------------------------
bool Battery::RequestState
(
@@ -63,8 +63,8 @@ bool Battery::RequestState
}
//-----------------------------------------------------------------------------
-//
-// Request current value from the device
+//
+// 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;
}
//-----------------------------------------------------------------------------
diff --git a/cpp/src/command_classes/Clock.cpp b/cpp/src/command_classes/Clock.cpp
index 26e73e83..4e7b1a48 100644
--- a/cpp/src/command_classes/Clock.cpp
+++ b/cpp/src/command_classes/Clock.cpp
@@ -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 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 );
diff --git a/cpp/src/command_classes/CommandClass.cpp b/cpp/src/command_classes/CommandClass.cpp
index facbf7f3..8b5358de 100644
--- a/cpp/src/command_classes/CommandClass.cpp
+++ b/cpp/src/command_classes/CommandClass.cpp
@@ -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;
diff --git a/cpp/src/command_classes/CommandClass.h b/cpp/src/command_classes/CommandClass.h
index 33674589..9d4aa35c 100644
--- a/cpp/src/command_classes/CommandClass.h
+++ b/cpp/src/command_classes/CommandClass.h
@@ -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::iterator it = m_endPointMap.begin(); it != m_endPointMap.end(); it++ )
+ for( map::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 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
diff --git a/cpp/src/command_classes/Configuration.cpp b/cpp/src/command_classes/Configuration.cpp
index 4b47af1f..8a67819f 100644
--- a/cpp/src/command_classes/Configuration.cpp
+++ b/cpp/src/command_classes/Configuration.cpp
@@ -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;
}
-
//-----------------------------------------------------------------------------
//
-// 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 ) );
}
diff --git a/cpp/src/command_classes/EnergyProduction.cpp b/cpp/src/command_classes/EnergyProduction.cpp
index 5b2430b7..db35fef9 100644
--- a/cpp/src/command_classes/EnergyProduction.cpp
+++ b/cpp/src/command_classes/EnergyProduction.cpp
@@ -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[] =
};
//-----------------------------------------------------------------------------
-//
-// Request current state from the device
+//
+// Request current state from the device
//-----------------------------------------------------------------------------
bool EnergyProduction::RequestState
(
@@ -84,8 +84,8 @@ bool EnergyProduction::RequestState
}
//-----------------------------------------------------------------------------
-//
-// Request current production from the device
+//
+// 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;
}
-
//-----------------------------------------------------------------------------
//
// Handle a message from the Z-Wave network
diff --git a/cpp/src/command_classes/Indicator.cpp b/cpp/src/command_classes/Indicator.cpp
index 02a92657..21f708aa 100644
--- a/cpp/src/command_classes/Indicator.cpp
+++ b/cpp/src/command_classes/Indicator.cpp
@@ -45,8 +45,8 @@ enum IndicatorCmd
};
//-----------------------------------------------------------------------------
-//
-// Request current state from the device
+//
+// Request current state from the device
//-----------------------------------------------------------------------------
bool Indicator::RequestState
(
@@ -64,8 +64,8 @@ bool Indicator::RequestState
}
//-----------------------------------------------------------------------------
-//
-// Request current value from the device
+//
+// 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;
}
+
//-----------------------------------------------------------------------------
//
// Handle a message from the Z-Wave network
@@ -114,7 +121,7 @@ bool Indicator::HandleMsg
//-----------------------------------------------------------------------------
//
-// 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(&_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 );
diff --git a/cpp/src/command_classes/Language.cpp b/cpp/src/command_classes/Language.cpp
index 95eda79e..1eaf350f 100644
--- a/cpp/src/command_classes/Language.cpp
+++ b/cpp/src/command_classes/Language.cpp
@@ -51,8 +51,8 @@ enum
};
//-----------------------------------------------------------------------------
-//
-// Request current state from the device
+//
+// Request current state from the device
//-----------------------------------------------------------------------------
bool Language::RequestState
(
@@ -70,8 +70,8 @@ bool Language::RequestState
}
//-----------------------------------------------------------------------------
-//
-// Request current value from the device
+//
+// 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;
}
//-----------------------------------------------------------------------------
diff --git a/cpp/src/command_classes/Lock.cpp b/cpp/src/command_classes/Lock.cpp
index 218a7431..28738122 100644
--- a/cpp/src/command_classes/Lock.cpp
+++ b/cpp/src/command_classes/Lock.cpp
@@ -45,8 +45,8 @@ enum LockCmd
};
//-----------------------------------------------------------------------------
-//
-// Request current state from the device
+//
+// Request current state from the device
//-----------------------------------------------------------------------------
bool Lock::RequestState
(
@@ -64,8 +64,8 @@ bool Lock::RequestState
}
//-----------------------------------------------------------------------------
-//
-// Request current value from the device
+//
+// 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;
}
+
//-----------------------------------------------------------------------------
//
// Handle a message from the Z-Wave network
diff --git a/cpp/src/command_classes/ManufacturerSpecific.cpp b/cpp/src/command_classes/ManufacturerSpecific.cpp
index a9cc4a32..3f992a74 100644
--- a/cpp/src/command_classes/ManufacturerSpecific.cpp
+++ b/cpp/src/command_classes/ManufacturerSpecific.cpp
@@ -54,8 +54,8 @@ map ManufacturerSpecific::s_productMap;
bool ManufacturerSpecific::s_bXmlLoaded = false;
//-----------------------------------------------------------------------------
-//
-// Request current state from the device
+//
+// Request current state from the device
//-----------------------------------------------------------------------------
bool ManufacturerSpecific::RequestState
(
@@ -73,8 +73,8 @@ bool ManufacturerSpecific::RequestState
}
//-----------------------------------------------------------------------------
-//
-// Request current value from the device
+//
+// 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::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;
}
diff --git a/cpp/src/command_classes/Meter.cpp b/cpp/src/command_classes/Meter.cpp
index 48edc474..97535880 100644
--- a/cpp/src/command_classes/Meter.cpp
+++ b/cpp/src/command_classes/Meter.cpp
@@ -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[] =
};
//-----------------------------------------------------------------------------
-//
+//
// 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 );
}
//-----------------------------------------------------------------------------
-//
-// Request current state from the device
+//
+// Request current state from the device
//-----------------------------------------------------------------------------
bool Meter::RequestState
(
@@ -175,8 +174,8 @@ bool Meter::RequestState
}
//-----------------------------------------------------------------------------
-//
-// Request current value from the device
+//
+// 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() );
diff --git a/cpp/src/command_classes/Meter.h b/cpp/src/command_classes/Meter.h
index badfe0c4..10f061c9 100644
--- a/cpp/src/command_classes/Meter.h
+++ b/cpp/src/command_classes/Meter.h
@@ -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
diff --git a/cpp/src/command_classes/MeterPulse.cpp b/cpp/src/command_classes/MeterPulse.cpp
index e3fe613d..5e8d2a60 100644
--- a/cpp/src/command_classes/MeterPulse.cpp
+++ b/cpp/src/command_classes/MeterPulse.cpp
@@ -44,8 +44,8 @@ enum MeterPulseCmd
};
//-----------------------------------------------------------------------------
-//
-// Request current state from the device
+//
+// Request current state from the device
//-----------------------------------------------------------------------------
bool MeterPulse::RequestState
(
@@ -63,8 +63,8 @@ bool MeterPulse::RequestState
}
//-----------------------------------------------------------------------------
-//
-// Request current value from the device
+//
+// 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;
}
//-----------------------------------------------------------------------------
diff --git a/cpp/src/command_classes/MultiInstance.cpp b/cpp/src/command_classes/MultiInstance.cpp
index 2c5b4ac6..7a35d81d 100644
--- a/cpp/src/command_classes/MultiInstance.cpp
+++ b/cpp/src/command_classes/MultiInstance.cpp
@@ -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
)
diff --git a/cpp/src/command_classes/NodeNaming.cpp b/cpp/src/command_classes/NodeNaming.cpp
index ff28b1df..e0be4bf0 100644
--- a/cpp/src/command_classes/NodeNaming.cpp
+++ b/cpp/src/command_classes/NodeNaming.cpp
@@ -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[] =
};
//-----------------------------------------------------------------------------
-//
-// Request current state from the device
+//
+// Request current state from the device
//-----------------------------------------------------------------------------
bool NodeNaming::RequestState
(
@@ -228,8 +228,8 @@ bool NodeNaming::RequestState
}
//-----------------------------------------------------------------------------
-//
-// Request current value from the device
+//
+// 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; iAppend( _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; iAppend( _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:
diff --git a/cpp/src/command_classes/Powerlevel.cpp b/cpp/src/command_classes/Powerlevel.cpp
index bc0cdd4a..3c82471d 100644
--- a/cpp/src/command_classes/Powerlevel.cpp
+++ b/cpp/src/command_classes/Powerlevel.cpp
@@ -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( 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 );
diff --git a/cpp/src/command_classes/Protection.cpp b/cpp/src/command_classes/Protection.cpp
index d377622f..c74c3b97 100644
--- a/cpp/src/command_classes/Protection.cpp
+++ b/cpp/src/command_classes/Protection.cpp
@@ -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 );
diff --git a/cpp/src/command_classes/SensorAlarm.cpp b/cpp/src/command_classes/SensorAlarm.cpp
index df2280eb..95748afa 100644
--- a/cpp/src/command_classes/SensorAlarm.cpp
+++ b/cpp/src/command_classes/SensorAlarm.cpp
@@ -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];
diff --git a/cpp/src/command_classes/SensorBinary.cpp b/cpp/src/command_classes/SensorBinary.cpp
index 7184e09c..bf868ed3 100644
--- a/cpp/src/command_classes/SensorBinary.cpp
+++ b/cpp/src/command_classes/SensorBinary.cpp
@@ -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;
}
//-----------------------------------------------------------------------------
diff --git a/cpp/src/command_classes/SensorMultilevel.cpp b/cpp/src/command_classes/SensorMultilevel.cpp
index 31a03bc7..bb5dbeef 100644
--- a/cpp/src/command_classes/SensorMultilevel.cpp
+++ b/cpp/src/command_classes/SensorMultilevel.cpp
@@ -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
}
//-----------------------------------------------------------------------------
-//
-// Request current value from the device
+//
+// 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( GetValue( _instance, sensorType ) );
}
- else
+ else
{
value->SetUnits(units);
}
diff --git a/cpp/src/command_classes/SwitchAll.cpp b/cpp/src/command_classes/SwitchAll.cpp
index fc9b6093..62b3e10c 100644
--- a/cpp/src/command_classes/SwitchAll.cpp
+++ b/cpp/src/command_classes/SwitchAll.cpp
@@ -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
//-----------------------------------------------------------------------------
//
-// 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
//-----------------------------------------------------------------------------
//
-// 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
//-----------------------------------------------------------------------------
//
-// 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 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 );
diff --git a/cpp/src/command_classes/SwitchBinary.cpp b/cpp/src/command_classes/SwitchBinary.cpp
index 82665557..77fc61fe 100644
--- a/cpp/src/command_classes/SwitchBinary.cpp
+++ b/cpp/src/command_classes/SwitchBinary.cpp
@@ -46,8 +46,8 @@ enum SwitchBinaryCmd
};
//-----------------------------------------------------------------------------
-//
-// Request current state from the device
+//
+// Request current state from the device
//-----------------------------------------------------------------------------
bool SwitchBinary::RequestState
(
@@ -65,8 +65,8 @@ bool SwitchBinary::RequestState
}
//-----------------------------------------------------------------------------
-//
-// Request current value from the device
+//
+// 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(&_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 );
diff --git a/cpp/src/command_classes/SwitchMultilevel.cpp b/cpp/src/command_classes/SwitchMultilevel.cpp
index dc65e790..467b4241 100644
--- a/cpp/src/command_classes/SwitchMultilevel.cpp
+++ b/cpp/src/command_classes/SwitchMultilevel.cpp
@@ -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( 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( 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 );
diff --git a/cpp/src/command_classes/SwitchToggleBinary.cpp b/cpp/src/command_classes/SwitchToggleBinary.cpp
index 12d22f04..5a8ecc73 100644
--- a/cpp/src/command_classes/SwitchToggleBinary.cpp
+++ b/cpp/src/command_classes/SwitchToggleBinary.cpp
@@ -45,8 +45,8 @@ enum SwitchToggleBinaryCmd
};
//-----------------------------------------------------------------------------
-//
-// Request current state from the device
+//
+// Request current state from the device
//-----------------------------------------------------------------------------
bool SwitchToggleBinary::RequestState
(
@@ -64,8 +64,8 @@ bool SwitchToggleBinary::RequestState
}
//-----------------------------------------------------------------------------
-//
-// Request current value from the device
+//
+// 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 );
diff --git a/cpp/src/command_classes/SwitchToggleMultilevel.cpp b/cpp/src/command_classes/SwitchToggleMultilevel.cpp
index 0714c55d..13102b4f 100644
--- a/cpp/src/command_classes/SwitchToggleMultilevel.cpp
+++ b/cpp/src/command_classes/SwitchToggleMultilevel.cpp
@@ -48,8 +48,8 @@ enum SwitchToggleMultilevelCmd
//-----------------------------------------------------------------------------
-//
-// Request current state from the device
+//
+// 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() );
diff --git a/cpp/src/command_classes/ThermostatFanMode.cpp b/cpp/src/command_classes/ThermostatFanMode.cpp
index 374fefa0..db207817 100644
--- a/cpp/src/command_classes/ThermostatFanMode.cpp
+++ b/cpp/src/command_classes/ThermostatFanMode.cpp
@@ -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 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( 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(&_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 );
diff --git a/cpp/src/command_classes/ThermostatFanState.cpp b/cpp/src/command_classes/ThermostatFanState.cpp
index 1941cb5c..7a0be72e 100644
--- a/cpp/src/command_classes/ThermostatFanState.cpp
+++ b/cpp/src/command_classes/ThermostatFanState.cpp
@@ -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;
}
diff --git a/cpp/src/command_classes/ThermostatMode.cpp b/cpp/src/command_classes/ThermostatMode.cpp
index 67e6b161..a620086a 100644
--- a/cpp/src/command_classes/ThermostatMode.cpp
+++ b/cpp/src/command_classes/ThermostatMode.cpp
@@ -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 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::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( 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(&_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
diff --git a/cpp/src/command_classes/ThermostatOperatingState.cpp b/cpp/src/command_classes/ThermostatOperatingState.cpp
index fde7250b..d31bf8ea 100644
--- a/cpp/src/command_classes/ThermostatOperatingState.cpp
+++ b/cpp/src/command_classes/ThermostatOperatingState.cpp
@@ -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;
}
diff --git a/cpp/src/command_classes/ThermostatSetpoint.cpp b/cpp/src/command_classes/ThermostatSetpoint.cpp
index ac2595eb..8e17e81c 100644
--- a/cpp/src/command_classes/ThermostatSetpoint.cpp
+++ b/cpp/src/command_classes/ThermostatSetpoint.cpp
@@ -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
}
//-----------------------------------------------------------------------------
-//
-// Request current state from the device
+//
+// 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 )
diff --git a/cpp/src/command_classes/UserCode.cpp b/cpp/src/command_classes/UserCode.cpp
index e1ad0bfd..17bc30f9 100644
--- a/cpp/src/command_classes/UserCode.cpp
+++ b/cpp/src/command_classes/UserCode.cpp
@@ -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( GetValue( _instance, i ) ) )
{
diff --git a/cpp/src/command_classes/Version.cpp b/cpp/src/command_classes/Version.cpp
index 1b2cd5a6..39d5491e 100644
--- a/cpp/src/command_classes/Version.cpp
+++ b/cpp/src/command_classes/Version.cpp
@@ -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
//-----------------------------------------------------------------------------
//
-// 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
(
diff --git a/cpp/src/command_classes/WakeUp.cpp b/cpp/src/command_classes/WakeUp.cpp
index 310527fd..13260a81 100644
--- a/cpp/src/command_classes/WakeUp.cpp
+++ b/cpp/src/command_classes/WakeUp.cpp
@@ -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 );
}
diff --git a/cpp/src/platform/Controller.cpp b/cpp/src/platform/Controller.cpp
index 1541c036..11be51d6 100644
--- a/cpp/src/platform/Controller.cpp
+++ b/cpp/src/platform/Controller.cpp
@@ -1,68 +1,68 @@
-//-----------------------------------------------------------------------------
-//
-// Controller.cpp
-//
-// Cross-platform, hardware-abstracted controller data interface
-//
-// Copyright (c) 2010 Jason Frazier
-//
-// 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 .
-//
-//-----------------------------------------------------------------------------
-#include "Defs.h"
-#include "Driver.h"
-#include "Controller.h"
-
-using namespace OpenZWave;
-
-//-----------------------------------------------------------------------------
-//
-// 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
-}
-
-//-----------------------------------------------------------------------------
-//
-// 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
+//
+// 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 .
+//
+//-----------------------------------------------------------------------------
+#include "Defs.h"
+#include "Driver.h"
+#include "Controller.h"
+
+using namespace OpenZWave;
+
+//-----------------------------------------------------------------------------
+//
+// 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
+}
+
+//-----------------------------------------------------------------------------
+//
+// 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;
+}
+
diff --git a/cpp/src/platform/Controller.h b/cpp/src/platform/Controller.h
index 97ac0f40..11e4e03b 100644
--- a/cpp/src/platform/Controller.h
+++ b/cpp/src/platform/Controller.h
@@ -1,107 +1,107 @@
-//-----------------------------------------------------------------------------
-//
-// Controller.h
-//
-// Cross-platform, hardware-abstracted controller data interface
-//
-// Copyright (c) 2010 Jason Frazier
-//
-// 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 .
-//
-//-----------------------------------------------------------------------------
-
-#ifndef _Controller_H
-#define _Controller_H
-
-#include
-#include
-#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
+//
+// 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 .
+//
+//-----------------------------------------------------------------------------
+
+#ifndef _Controller_H
+#define _Controller_H
+
+#include
+#include
+#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
+
diff --git a/cpp/src/platform/FileOps.cpp b/cpp/src/platform/FileOps.cpp
index 2db0c9cb..7525e020 100644
--- a/cpp/src/platform/FileOps.cpp
+++ b/cpp/src/platform/FileOps.cpp
@@ -1,100 +1,100 @@
-//-----------------------------------------------------------------------------
-//
-// FileOps.cpp
-//
-// Cross-platform File Operations
-//
-// Copyright (c) 2012 Greg Satz
-// 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 .
-//
-//-----------------------------------------------------------------------------
-#include
-#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;
-
-//-----------------------------------------------------------------------------
-//
-// Static creation of the singleton
-//-----------------------------------------------------------------------------
-FileOps* FileOps::Create
-(
-)
-{
- if( s_instance == NULL )
- {
- s_instance = new FileOps();
- }
- return s_instance;
-}
-
-//-----------------------------------------------------------------------------
-//
-// Static method to destroy the fileops singleton.
-//-----------------------------------------------------------------------------
-void FileOps::Destroy
-(
-)
-{
- delete s_instance;
- s_instance = NULL;
-}
-
-//-----------------------------------------------------------------------------
-//
-// 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;
-}
-
-//-----------------------------------------------------------------------------
-//
-// Constructor
-//-----------------------------------------------------------------------------
-FileOps::FileOps
-(
-)
-{
- m_pImpl = new FileOpsImpl();
-}
-
-//-----------------------------------------------------------------------------
-//
-// Destructor
-//-----------------------------------------------------------------------------
-FileOps::~FileOps
-(
-)
-{
- delete m_pImpl;
-}
+//-----------------------------------------------------------------------------
+//
+// FileOps.cpp
+//
+// Cross-platform File Operations
+//
+// Copyright (c) 2012 Greg Satz
+// 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 .
+//
+//-----------------------------------------------------------------------------
+#include
+#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;
+
+//-----------------------------------------------------------------------------
+//
+// Static creation of the singleton
+//-----------------------------------------------------------------------------
+FileOps* FileOps::Create
+(
+)
+{
+ if( s_instance == NULL )
+ {
+ s_instance = new FileOps();
+ }
+ return s_instance;
+}
+
+//-----------------------------------------------------------------------------
+//
+// Static method to destroy the fileops singleton.
+//-----------------------------------------------------------------------------
+void FileOps::Destroy
+(
+)
+{
+ delete s_instance;
+ s_instance = NULL;
+}
+
+//-----------------------------------------------------------------------------
+//
+// 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;
+}
+
+//-----------------------------------------------------------------------------
+//
+// Constructor
+//-----------------------------------------------------------------------------
+FileOps::FileOps
+(
+)
+{
+ m_pImpl = new FileOpsImpl();
+}
+
+//-----------------------------------------------------------------------------
+//
+// Destructor
+//-----------------------------------------------------------------------------
+FileOps::~FileOps
+(
+)
+{
+ delete m_pImpl;
+}
diff --git a/cpp/src/platform/FileOps.h b/cpp/src/platform/FileOps.h
index 539cc890..79bf06d5 100644
--- a/cpp/src/platform/FileOps.h
+++ b/cpp/src/platform/FileOps.h
@@ -1,75 +1,75 @@
-//-----------------------------------------------------------------------------
-//
-// FileOps.h
-//
-// Cross-platform File Operations
-//
-// Copyright (c) 2012 Greg Satz
-// 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 .
-//
-//-----------------------------------------------------------------------------
-#ifndef _FileOps_H
-#define _FileOps_H
-
-#include
-#include
-#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
+// 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 .
+//
+//-----------------------------------------------------------------------------
+#ifndef _FileOps_H
+#define _FileOps_H
+
+#include
+#include
+#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
+
diff --git a/cpp/src/platform/HidController.cpp b/cpp/src/platform/HidController.cpp
index c70f3b51..1576a9d0 100644
--- a/cpp/src/platform/HidController.cpp
+++ b/cpp/src/platform/HidController.cpp
@@ -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;
diff --git a/cpp/src/platform/Log.cpp b/cpp/src/platform/Log.cpp
index c1c56907..a152df9b 100644
--- a/cpp/src/platform/Log.cpp
+++ b/cpp/src/platform/Log.cpp
@@ -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 );
}
//-----------------------------------------------------------------------------
diff --git a/cpp/src/platform/Log.h b/cpp/src/platform/Log.h
index a085edd8..638cc353 100644
--- a/cpp/src/platform/Log.h
+++ b/cpp/src/platform/Log.h
@@ -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.
diff --git a/cpp/src/platform/Ref.h b/cpp/src/platform/Ref.h
index b9469c1d..57c32743 100644
--- a/cpp/src/platform/Ref.h
+++ b/cpp/src/platform/Ref.h
@@ -1,91 +1,91 @@
-//-----------------------------------------------------------------------------
-//
-// Ref.h
-//
-// Reference counting for objects.
-//
-// Copyright (c) 2010 Mal Lansell
-// 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 .
-//
-//-----------------------------------------------------------------------------
-#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
+// 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 .
+//
+//-----------------------------------------------------------------------------
+#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
+
diff --git a/cpp/src/platform/Stream.cpp b/cpp/src/platform/Stream.cpp
index c08c42fd..7dfb8be1 100644
--- a/cpp/src/platform/Stream.cpp
+++ b/cpp/src/platform/Stream.cpp
@@ -1,227 +1,227 @@
-//-----------------------------------------------------------------------------
-//
-// Stream.h
-//
-// Cross-platform circular buffer with signalling
-//
-// Copyright (c) 2010 Mal Lansell
-// 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 .
-//
-//-----------------------------------------------------------------------------
-#include "Stream.h"
-#include "Mutex.h"
-#include "Log.h"
-
-#include
-
-#include
-
-using namespace OpenZWave;
-
-//-----------------------------------------------------------------------------
-//
-// 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];
-}
-
-//-----------------------------------------------------------------------------
-//
-// Destructor
-//-----------------------------------------------------------------------------
-Stream::~Stream
-(
-)
-{
- m_mutex->Release();
- delete [] m_buffer;
-}
-
-//-----------------------------------------------------------------------------
-//
-// 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();
- }
-}
-
-//-----------------------------------------------------------------------------
-//
-// 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;
-}
-
-//-----------------------------------------------------------------------------
-//
-// 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;
-}
-
-//-----------------------------------------------------------------------------
-//
-// Empty the data buffer
-//-----------------------------------------------------------------------------
-void Stream::Purge
-(
-)
-{
- m_tail = 0;
- m_head = 0;
- m_dataSize = 0;
-}
-
-//-----------------------------------------------------------------------------
-//
-// Test whether there is enough data to be signalled
-//-----------------------------------------------------------------------------
-bool Stream::IsSignalled
-(
-)
-{
- return( m_dataSize >= m_signalSize );
-}
-
-//-----------------------------------------------------------------------------
-//
-// 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
+// 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 .
+//
+//-----------------------------------------------------------------------------
+#include "Stream.h"
+#include "Mutex.h"
+#include "Log.h"
+
+#include
+
+#include
+
+using namespace OpenZWave;
+
+//-----------------------------------------------------------------------------
+//
+// 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];
+}
+
+//-----------------------------------------------------------------------------
+//
+// Destructor
+//-----------------------------------------------------------------------------
+Stream::~Stream
+(
+)
+{
+ m_mutex->Release();
+ delete [] m_buffer;
+}
+
+//-----------------------------------------------------------------------------
+//
+// 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();
+ }
+}
+
+//-----------------------------------------------------------------------------
+//
+// 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;
+}
+
+//-----------------------------------------------------------------------------
+//
+// 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;
+}
+
+//-----------------------------------------------------------------------------
+//
+// Empty the data buffer
+//-----------------------------------------------------------------------------
+void Stream::Purge
+(
+)
+{
+ m_tail = 0;
+ m_head = 0;
+ m_dataSize = 0;
+}
+
+//-----------------------------------------------------------------------------
+//
+// Test whether there is enough data to be signalled
+//-----------------------------------------------------------------------------
+bool Stream::IsSignalled
+(
+)
+{
+ return( m_dataSize >= m_signalSize );
+}
+
+//-----------------------------------------------------------------------------
+//
+// 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() );
+}
diff --git a/cpp/src/platform/Stream.h b/cpp/src/platform/Stream.h
index 79581006..ddc534a4 100644
--- a/cpp/src/platform/Stream.h
+++ b/cpp/src/platform/Stream.h
@@ -1,135 +1,135 @@
-//-----------------------------------------------------------------------------
-//
-// Stream.h
-//
-// Cross-platform circular buffer with signalling
-//
-// Copyright (c) 2010 Mal Lansell
-// 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 .
-//
-//-----------------------------------------------------------------------------
-#ifndef _Stream_H
-#define _Stream_H
-
-#include "Defs.h"
-#include "Wait.h"
-
-#include
-
-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
+// 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 .
+//
+//-----------------------------------------------------------------------------
+#ifndef _Stream_H
+#define _Stream_H
+
+#include "Defs.h"
+#include "Wait.h"
+
+#include
+
+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
+
diff --git a/cpp/src/platform/TimeStamp.cpp b/cpp/src/platform/TimeStamp.cpp
index 4dd92629..3177f7e6 100644
--- a/cpp/src/platform/TimeStamp.cpp
+++ b/cpp/src/platform/TimeStamp.cpp
@@ -1,103 +1,103 @@
-//-----------------------------------------------------------------------------
-//
-// TimeStamp.h
-//
-// Cross-platform TimeStamp
-//
-// Copyright (c) 2010 Mal Lansell
-// 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 .
-//
-//-----------------------------------------------------------------------------
-#include
-#include "Defs.h"
-#include "TimeStamp.h"
-
-#include "TimeStampImpl.h" // Platform-specific implementation of a TimeStamp
-
-
-using namespace OpenZWave;
-
-//-----------------------------------------------------------------------------
-//
-// Constructor
-//-----------------------------------------------------------------------------
-TimeStamp::TimeStamp
-(
-):
- m_pImpl( new TimeStampImpl() )
-{
-}
-
-//-----------------------------------------------------------------------------
-//
-// Destructor
-//-----------------------------------------------------------------------------
-TimeStamp::~TimeStamp
-(
-)
-{
- delete m_pImpl;
-}
-
-//-----------------------------------------------------------------------------
-//
-// Sets the timestamp to now, plus an offset in milliseconds
-//-----------------------------------------------------------------------------
-void TimeStamp::SetTime
-(
- int32 _milliseconds // = 0
-)
-{
- m_pImpl->SetTime( _milliseconds );
-}
-
-//-----------------------------------------------------------------------------
-//
-// Gets the difference between now and the timestamp time in milliseconds
-//-----------------------------------------------------------------------------
-int32 TimeStamp::TimeRemaining
-(
-)
-{
- return m_pImpl->TimeRemaining();
-}
-
-//-----------------------------------------------------------------------------
-//
-// Return object as a string
-//-----------------------------------------------------------------------------
-string TimeStamp::GetAsString
-(
-)
-{
- return m_pImpl->GetAsString();
-}
-//-----------------------------------------------------------------------------
-//
-// 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
+// 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 .
+//
+//-----------------------------------------------------------------------------
+#include
+#include "Defs.h"
+#include "TimeStamp.h"
+
+#include "TimeStampImpl.h" // Platform-specific implementation of a TimeStamp
+
+
+using namespace OpenZWave;
+
+//-----------------------------------------------------------------------------
+//
+// Constructor
+//-----------------------------------------------------------------------------
+TimeStamp::TimeStamp
+(
+):
+ m_pImpl( new TimeStampImpl() )
+{
+}
+
+//-----------------------------------------------------------------------------
+//
+// Destructor
+//-----------------------------------------------------------------------------
+TimeStamp::~TimeStamp
+(
+)
+{
+ delete m_pImpl;
+}
+
+//-----------------------------------------------------------------------------
+//
+// Sets the timestamp to now, plus an offset in milliseconds
+//-----------------------------------------------------------------------------
+void TimeStamp::SetTime
+(
+ int32 _milliseconds // = 0
+)
+{
+ m_pImpl->SetTime( _milliseconds );
+}
+
+//-----------------------------------------------------------------------------
+//
+// Gets the difference between now and the timestamp time in milliseconds
+//-----------------------------------------------------------------------------
+int32 TimeStamp::TimeRemaining
+(
+)
+{
+ return m_pImpl->TimeRemaining();
+}
+
+//-----------------------------------------------------------------------------
+//
+// Return object as a string
+//-----------------------------------------------------------------------------
+string TimeStamp::GetAsString
+(
+)
+{
+ return m_pImpl->GetAsString();
+}
+//-----------------------------------------------------------------------------
+//
+// 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);
+}
diff --git a/cpp/src/platform/TimeStamp.h b/cpp/src/platform/TimeStamp.h
index 467506ce..b3c6f9e1 100644
--- a/cpp/src/platform/TimeStamp.h
+++ b/cpp/src/platform/TimeStamp.h
@@ -1,91 +1,91 @@
-//-----------------------------------------------------------------------------
-//
-// TimeStamp.h
-//
-// Cross-platform TimeStamp
-//
-// Copyright (c) 2010 Mal Lansell
-// 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 .
-//
-//-----------------------------------------------------------------------------
-#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
+// 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 .
+//
+//-----------------------------------------------------------------------------
+#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
+
diff --git a/cpp/src/platform/Wait.cpp b/cpp/src/platform/Wait.cpp
index d86ba609..20655e1a 100644
--- a/cpp/src/platform/Wait.cpp
+++ b/cpp/src/platform/Wait.cpp
@@ -1,176 +1,177 @@
-//-----------------------------------------------------------------------------
-//
-// Wait.cpp
-//
-// Base class for objects we want to be able to wait for.
-//
-// Copyright (c) 2010 Mal Lansell
-// 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 .
-//
-//-----------------------------------------------------------------------------
-#include "Defs.h"
-#include "Wait.h"
-#include "WaitImpl.h" // Platform-specific implementation of a Wait object
-#include "Event.h"
-#include "Log.h"
-
-using namespace OpenZWave;
-
-void WaitMultipleCallback( void* _context );
-
-//-----------------------------------------------------------------------------
-//
-// Constructor
-//-----------------------------------------------------------------------------
-Wait::Wait
-(
-)
-{
- m_pImpl = new WaitImpl( this );
-}
-
-//-----------------------------------------------------------------------------
-//
-// Destructor
-//-----------------------------------------------------------------------------
-Wait::~Wait
-(
-)
-{
- delete m_pImpl;
-}
-
-//-----------------------------------------------------------------------------
-//
-// Add a watcher to our object.
-//-----------------------------------------------------------------------------
-void Wait::AddWatcher
-(
- pfnWaitNotification_t _callback,
- void* _context
-)
-{
- if( !_callback )
- {
- assert(0);
- return;
- }
-
- // Add a ref so our object cannot disappear while being watched
- AddRef();
-
- // Add the watcher (platform specific code required here for thread safety)
- m_pImpl->AddWatcher( _callback, _context );
-}
-
-//-----------------------------------------------------------------------------
-//
-// Remove a watcher from our object.
-//-----------------------------------------------------------------------------
-void Wait::RemoveWatcher
-(
- pfnWaitNotification_t _callback,
- void* _context
-)
-{
- if( m_pImpl->RemoveWatcher( _callback, _context ) )
- {
- Release();
- }
-}
-
-//-----------------------------------------------------------------------------
-//