upm
1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
|
Public Types | |
typedef std::map< uint8_t, zwNode * > | zwNodeMap_t |
Public Member Functions | |
void | optionsCreate (std::string configPath="/etc/openzwave", std::string userConfigDir="", std::string cmdLine="") |
void | optionAddInt (std::string name, int val) |
void | optionAddBool (std::string name, bool val) |
void | optionAddString (std::string name, std::string val, bool append) |
void | optionsLock () |
bool | init (std::string devicePath, bool isHID=false) |
void | dumpNodes (bool all=false) |
std::string | getValueUnits (int nodeId, int index) |
void | setValueUnits (int nodeId, int index, std::string text) |
std::string | getValueLabel (int nodeId, int index) |
void | setValueLabel (int nodeId, int index, std::string text) |
std::string | getValueHelp (int nodeId, int index) |
void | setValueHelp (int nodeId, int index, std::string text) |
void | setValueAsString (int nodeId, int index, std::string val) |
void | setValueAsBool (int nodeId, int index, bool val) |
void | setValueAsByte (int nodeId, int index, uint8_t val) |
void | setValueAsFloat (int nodeId, int index, float val) |
void | setValueAsInt32 (int nodeId, int index, int32_t val) |
void | setValueAsInt16 (int nodeId, int index, int16_t val) |
void | setValueAsBytes (int nodeId, int index, uint8_t *val, uint8_t len) |
int | getValueMin (int nodeId, int index) |
int | getValueMax (int nodeId, int index) |
bool | isValueReadOnly (int nodeId, int index) |
bool | isValueWriteOnly (int nodeId, int index) |
bool | isValueSet (int nodeId, int index) |
bool | isValuePolled (int nodeId, int index) |
std::string | getValueAsString (int nodeId, int index) |
bool | getValueAsBool (int nodeId, int index) |
uint8_t | getValueAsByte (int nodeId, int index) |
float | getValueAsFloat (int nodeId, int index) |
int | getValueAsInt32 (int nodeId, int index) |
int | getValueAsInt16 (int nodeId, int index) |
void | refreshValue (int nodeId, int index) |
void | setDebug (bool enable) |
bool | isNodeListeningDevice (int nodeId) |
bool | isNodeFrequentListeningDevice (int nodeId) |
bool | isNodeAwake (int nodeId) |
bool | isNodeInfoReceived (int nodeId) |
bool | isInitialized () |
Static Public Member Functions | |
static OZW * | instance () |
Protected Member Functions | |
OZW () | |
~OZW () | |
bool | getValueID (int nodeId, int index, OpenZWave::ValueID *vid) |
uint32_t | getHomeID () |
void | lockNodes () |
void | unlockNodes () |
|
static |
Get our singleton instance, initializing it if neccessary. All requests to this class should be done through this instance accessor.
void optionsCreate | ( | std::string | configPath = "/etc/openzwave" , |
std::string | userConfigDir = "" , |
||
std::string | cmdLine = "" |
||
) |
Start configuration with basic options. This must be called prior to init(), after the OZW() constructor is called.
configPath | Set the location of the OpenZWave config directory, default is /etc/openzwave |
userConfigDir | Set the path to the user configuration directory. This is the location of the zwcfg*.xml and option.xml files for the user (probably created by the OpenZWave Control Panel example application). The default is the current directory (""). |
cmdLine | Specify command line formatted options to OpenZWave. The default is "". |
void optionAddInt | ( | std::string | name, |
int | val | ||
) |
Add an integer Option. See the OpenZWave documentation for valid values.
name | The name of the configuration option |
val | The value to set it to |
void optionAddBool | ( | std::string | name, |
bool | val | ||
) |
Add a boolean Option. See the OpenZWave documentation for valid values.
name | The name of the configuration option |
val | The value to set it to |
void optionAddString | ( | std::string | name, |
std::string | val, | ||
bool | append | ||
) |
Add a string Option. See the OpenZWave documentation for valid values.
name | The name of the configuration option |
val | The value to set it to true to append to the option, false to override |
void optionsLock | ( | ) |
bool init | ( | std::string | devicePath, |
bool | isHID = false |
||
) |
Initialize the ZWave network. This method will start a probe of all defined devices on the ZWave network and query essential information about them. This function will not return until either initialization has failed, or has succeeded far enough along for the following methods to work. Depending on the size an complexity of the ZWave network, this may take anywhere from seconds to several minutes to complete.
All Options (via option*()) must have been specified before this function is called. If the Options have not been locked via optionsLock() prior to calling init(), this method will lock them for you before proceeding.
devicePath | The device path for the ZWave controller, typically something like /dev/ttyACM0, or similiar |
isHID | true if this is a HID device, false otherwise (ie: a serial port like /dev/ttyACM0, /dev/ttyUSB0, etc). Default is false. |
void dumpNodes | ( | bool | all = false | ) |
Dump information about all configured nodes (devices) and their available values to stdout. This is useful to determine what nodes are available, and the index (used for querying and seting values for them). In addition, it includes information about each value (type, current value, etc).
all | set to true to dump information about all values available for each node. If false, only information about 'user' values (ignoring 'system' and 'configuration') are output. The default is false ('user' values only). |
string getValueUnits | ( | int | nodeId, |
int | index | ||
) |
Return a string (which may be empty) indicating the Units of measure for a given value. For example, querying a temperature value may return "F" to indicate Fahrenheit.
nodeId | The node ID to query |
index | The value index (see dumpNodes()) of the value to query. |
void setValueUnits | ( | int | nodeId, |
int | index, | ||
std::string | text | ||
) |
Set the text for the Units of measure for a value.
nodeId | The node ID to query |
index | The value index (see dumpNodes()) of the value to query. |
text | The text to set |
string getValueLabel | ( | int | nodeId, |
int | index | ||
) |
Return a string (which may be empty) containing the user-freindly Label for a value.
nodeId | The node ID to query |
index | The value index (see dumpNodes()) of the value to query. |
void setValueLabel | ( | int | nodeId, |
int | index, | ||
std::string | text | ||
) |
Set the text for a Value's label.
nodeId | The node ID to query |
index | The value index (see dumpNodes()) of the value to query. |
text | The text to set |
string getValueHelp | ( | int | nodeId, |
int | index | ||
) |
Return a string (which may be empty) indicating the Help text of a value, if available.
nodeId | The node ID to query |
index | The value index (see dumpNodes()) of the value to query. |
void setValueHelp | ( | int | nodeId, |
int | index, | ||
std::string | text | ||
) |
Set the text for a Value's help text.
nodeId | The node ID to query |
index | The value index (see dumpNodes()) of the value to query. |
text | The text to set |
void setValueAsString | ( | int | nodeId, |
int | index, | ||
std::string | val | ||
) |
Set the contents of a Value to a string. This should always succeed if the supplied content makes sense for a given value, regardless of the value's actual type.
nodeId | The node ID |
index | The value index (see dumpNodes()) of the value to query. |
val | the content to assign to the value referenced by nodeId, and index. |
void setValueAsBool | ( | int | nodeId, |
int | index, | ||
bool | val | ||
) |
Set the contents of a Value, to a bool. This will fail, and an error message printed if the value type is not a boolean value.
nodeId | The node ID |
index | The value index (see dumpNodes()) of the value to query. |
val | the boolean content to assign to the value referenced by nodeId, and index. |
void setValueAsByte | ( | int | nodeId, |
int | index, | ||
uint8_t | val | ||
) |
Set the contents of a Value, to a byte. This will fail, and an error message printed if the value type is not a byte value.
nodeId | The node ID |
index | The value index (see dumpNodes()) of the value to query. |
val | the byte content to assign to the value referenced by nodeId, and index. |
void setValueAsFloat | ( | int | nodeId, |
int | index, | ||
float | val | ||
) |
Set the contents of a Value, to a float. This will fail, and an error message printed if the value type is not a float value.
nodeId | The node ID |
index | The value index (see dumpNodes()) of the value to query. |
val | the float content to assign to the value referenced by nodeId, and index. |
void setValueAsInt32 | ( | int | nodeId, |
int | index, | ||
int32_t | val | ||
) |
Set the contents of a Value, to a 32 bit integer (int32). This will fail, and an error message printed if the value type is not an int32.
nodeId | The node ID |
index | The value index (see dumpNodes()) of the value to query. |
val | the int32 content to assign to the value referenced by nodeId, and index. |
void setValueAsInt16 | ( | int | nodeId, |
int | index, | ||
int16_t | val | ||
) |
Set the contents of a Value, to a 16 bit integer (int16). This will fail, and an error message printed if the value type is not an int16.
nodeId | The node ID |
index | The value index (see dumpNodes()) of the value to query. |
val | the int16 content to assign to the value referenced by nodeId, and index. |
void setValueAsBytes | ( | int | nodeId, |
int | index, | ||
uint8_t * | val, | ||
uint8_t | len | ||
) |
Set the contents of a Value, to an array of bytes. This will fail, and an error message printed if the value type is not settable as an array of bytes.
nodeId | The node ID |
index | The value index (see dumpNodes()) of the value to query. |
val | the byte array content to assign to the value referenced by nodeId, and index. |
len | The length of the byte array |
int getValueMin | ( | int | nodeId, |
int | index | ||
) |
Get the minimum allowed value for a node's Value.
nodeId | The node ID |
index | The value index (see dumpNodes()) of the value to query. |
int getValueMax | ( | int | nodeId, |
int | index | ||
) |
Get the maximum allowed value for a node's Value.
nodeId | The node ID |
index | The value index (see dumpNodes()) of the value to query. |
bool isValueReadOnly | ( | int | nodeId, |
int | index | ||
) |
Test whether a value is read-only.
nodeId | The node ID |
index | The value index (see dumpNodes()) of the value to query. |
bool isValueWriteOnly | ( | int | nodeId, |
int | index | ||
) |
Test whether a value is write only.
nodeId | The node ID |
index | The value index (see dumpNodes()) of the value to query. |
bool isValueSet | ( | int | nodeId, |
int | index | ||
) |
Test whether a value is really set on a node, and not a default value chosen by the OpenZWave library.
nodeId | The node ID |
index | The value index (see dumpNodes()) of the value to query. |
bool isValuePolled | ( | int | nodeId, |
int | index | ||
) |
Test whether a value is being manually polled by the OpenZWave library. Most modern devices are never polled, rather they are configured to report changing values to the controller on their own at device specific intervals or when appropriate events (depending the device) have occurred.
nodeId | The node ID |
index | The value index (see dumpNodes()) of the value to query. |
string getValueAsString | ( | int | nodeId, |
int | index | ||
) |
Return the content of a value as a string. This should always succeed, regardless of the actual value type.
nodeId | The node ID |
index | The value index (see dumpNodes()) of the value to query. |
bool getValueAsBool | ( | int | nodeId, |
int | index | ||
) |
Return the content of a value as a booleang. This will fail, and an error message printed if the value type is not boolean.
nodeId | The node ID |
index | The value index (see dumpNodes()) of the value to query. |
uint8_t getValueAsByte | ( | int | nodeId, |
int | index | ||
) |
Return the content of a value as a byte. This will fail, and an error message printed if the value type is not a byte.
nodeId | The node ID |
index | The value index (see dumpNodes()) of the value to query. |
float getValueAsFloat | ( | int | nodeId, |
int | index | ||
) |
Return the content of a value as a float. This will fail, and an error message printed if the value type is not a floating point value.
nodeId | The node ID |
index | The value index (see dumpNodes()) of the value to query. |
int getValueAsInt32 | ( | int | nodeId, |
int | index | ||
) |
Return the content of a value as an int32. This will fail, and an error message printed if the value type is not an int32.
nodeId | The node ID |
index | The value index (see dumpNodes()) of the value to query. |
int getValueAsInt16 | ( | int | nodeId, |
int | index | ||
) |
Return the content of a value as an int16. This will fail, and an error message printed if the value type is not an int16.
nodeId | The node ID |
index | The value index (see dumpNodes()) of the value to query. |
void refreshValue | ( | int | nodeId, |
int | index | ||
) |
Issue a refresh request for a value on a node. OpenZWave will query the value and update it's internal state when the device responds. Note, this happens asynchronously - it may take some time before the current value is reported to OpenZWave by the node. If the node is asleep, you may not get a current value for some time (or at all, depending on the device). This method will return immediately after the request has been queued.
nodeId | The node ID |
index | The value index (see dumpNodes()) of the value to query. |
void setDebug | ( | bool | enable | ) |
Enable or disable some debugging output. Note, this will not affect OpenZWave's own debugging, which is usually set in the option.xml file.
enable | true to enable debugging, false otherwise |
bool isNodeListeningDevice | ( | int | nodeId | ) |
Determine if a node is a listening device – in other words, the node never sleeps.
nodeId | The node ID |
bool isNodeFrequentListeningDevice | ( | int | nodeId | ) |
Determine if a node is a frequent listening device – in other words, if the node is asleep, can it be woken by a beam.
nodeId | The node ID |
bool isNodeAwake | ( | int | nodeId | ) |
Determine if a node is awake.
nodeId | The node ID |
bool isNodeInfoReceived | ( | int | nodeId | ) |
Determine whether a Node's information has been received. For sleeping nodes, this may take a while (until the node wakes).
nodeId | The node ID |
|
inline |
Determine if the Z-Wave network has been initialized yet.
|
protected |
Based on a nodeId and a value index, lookup the corresponding OpenZWave ValueID.
nodeId | The node ID |
index | The value index (see dumpNodes()) of the value to query. |
A | pointer to a ValueID that will be returned if successful |
|
inlineprotected |
Return the Home ID of the network.
|
inlineprotected |
Lock the m_zwNodeMap mutex to protect against changes made to the the the map by the OpenZWave notification handler. Always lock this mutex when acessing anything in the zwNodeMap map.
|
inlineprotected |
Unlock the m_zwNodeMap mutex after lockNodes() has been called.