ozw: Rework and add some device specific drivers and examples.
This commit reworks ozw somewhat and adds some device specific drivers with examples. All of these drivers are kept in the UPM ozw library. The OZW class has been reworked to make it a proper singleton, since the OpenZWave::Manager() it depends on is already a singleton. This avoids issues such as opening and initializing OpenZWave multiple times. A new, relatively thin base class, ozwInterface is also now present. This class wraps some basic functionality, and handles initialization of the OZW base class. It is intended to be inherited by device driver classes. It operates on a node id for a device. Each OZW device is referenced by a node id, which does not change unless the device is removed (and possibly re-added) to a Z-Wave network. Finally, a series of device specific drivers have been implemented. These provide basic functionality to monitor and in some cases control the operation of a Z-Wave device. They are the following: ozwdump - This is a fake 'device' driver that initializes an OZW network and dumps information on all of the nodes (devices) present. Along with each node, available information on each valueid associated with that node is also printed. This fake device and it's examples replace the original ozw example. aeotecss6 - Aeotec Smart Switch 6. This device allows control of the switch, as well as reporting of information the switch makes available, such as current consumption, volts, watts, and accumulated energy use (kWh). aeotecsdg2 - Aeotec Smart Dimmer Gen 2. This device is similar to the Smart Switch 6, but also provides dimming functionality. It also provides information on energy use. aeotecdw2e - Aeotec Door/Window Sensor 2nd Edition. This device is a magnetic switch with an embedded tamper switch used to detect the opening/closing of windows and doors. This is a battery powered device. aeotecdsb09104 - Aeotec Home Energy Monitor. This device is intended to be installed at the MAINS or Breaker box. It reports current and cumulative energy consumption. tzemt400 - Trane TZEMT400 Thermostat. This device is a thermostat with Z-Wave functionality. The variant tested was the TZEMT400BB32MAA. The driver reports various information on the status of the thermostat, as well as the current measured temperature. Signed-off-by: Jon Trulson <jtrulson@ics.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Author: Jon Trulson <jtrulson@ics.com>
|
||||
* Copyright (c) 2015 Intel Corporation.
|
||||
* Copyright (c) 2015-2016l Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
@@ -24,14 +24,28 @@
|
||||
#pragma once
|
||||
|
||||
#include <map>
|
||||
#include <list>
|
||||
|
||||
#include "Manager.h"
|
||||
|
||||
namespace upm {
|
||||
|
||||
/**
|
||||
* @library ozw
|
||||
*
|
||||
* @brief Node management for ozw
|
||||
*
|
||||
* This class is used by ozw to manage valueids for a node (device).
|
||||
* No user-servicable parts inside. It is not exposed to the end
|
||||
* user.
|
||||
*/
|
||||
|
||||
class zwNode {
|
||||
public:
|
||||
// valueid map
|
||||
typedef std::map<int, OpenZWave::ValueID> valueMap_t;
|
||||
// valueid list, used for sorting
|
||||
typedef std::list<OpenZWave::ValueID> valueList_t;
|
||||
|
||||
/**
|
||||
* zwNode contructor.
|
||||
@@ -90,15 +104,38 @@ namespace upm {
|
||||
*/
|
||||
void dumpNode(bool all=false);
|
||||
|
||||
/**
|
||||
* Clear the VID map, sort the list containing registered VID's,
|
||||
* and re-create the VID map. The goal is to ensure that the Map
|
||||
* is always sorted in acsending order by VID.
|
||||
*/
|
||||
void updateVIDMap();
|
||||
|
||||
/**
|
||||
* When enabled, updateVIDMap() will be called every time a new
|
||||
* VID is inserted or removed. This is disabled by default for
|
||||
* performance reasons during init() time. Once the driver is
|
||||
* initialized, then this option is, by default enabled so that
|
||||
* the VID map is always kept in a sorted order.
|
||||
*
|
||||
* @param enable true to enable, false to disable.
|
||||
*/
|
||||
void setAutoUpdate(bool enable)
|
||||
{
|
||||
m_autoUpdate = enable;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
bool m_autoUpdate;
|
||||
uint32_t m_homeId;
|
||||
uint8_t m_nodeId;
|
||||
|
||||
valueMap_t m_values;
|
||||
valueList_t m_list;
|
||||
|
||||
// we increment this index for every ValueID we add
|
||||
// we increment this index for every ValueID we add into the map
|
||||
unsigned int m_vindex;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user