upm  1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
ozwinterface.hpp
1 /*
2  * Author: Jon Trulson <jtrulson@ics.com>
3  * Copyright (c) 2016 Intel Corporation.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining
6  * a copy of this software and associated documentation files (the
7  * "Software"), to deal in the Software without restriction, including
8  * without limitation the rights to use, copy, modify, merge, publish,
9  * distribute, sublicense, and/or sell copies of the Software, and to
10  * permit persons to whom the Software is furnished to do so, subject to
11  * the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be
14  * included in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  */
24 #pragma once
25 
26 #include <string>
27 
28 #include "ozw.hpp"
29 
30 namespace upm {
31 
49  class ozwInterface {
50  public:
51 
58  ozwInterface(int nodeID);
59 
63  virtual ~ozwInterface();
64 
71  virtual void setDebug(bool enable);
72 
87  virtual void optionsCreate(std::string configPath="/etc/openzwave",
88  std::string userConfigDir="",
89  std::string cmdLine="")
90  {
91  m_instance->optionsCreate(configPath, userConfigDir, cmdLine);
92  }
93 
101  virtual void optionAddInt(std::string name, int val)
102  {
103  m_instance->optionAddInt(name, val);
104  }
105 
113  virtual void optionAddBool(std::string name, bool val)
114  {
115  m_instance->optionAddBool(name, val);
116  }
117 
126  virtual void optionAddString(std::string name, std::string val,
127  bool append)
128  {
129  m_instance->optionAddString(name, val, append);
130  }
131 
139  virtual void optionsLock()
140  {
141  m_instance->optionsLock();
142  }
143 
155  virtual void init(std::string devicePath, bool isHID=false);
156 
169  virtual void dumpNodes(bool all=false)
170  {
171  m_instance->dumpNodes(all);
172  }
173 
182  virtual std::string getValueUnits(int index)
183  {
184  return m_instance->getValueUnits(m_nodeID, index);
185  }
186 
195  virtual std::string getValueLabel(int index)
196  {
197  return m_instance->getValueLabel(m_nodeID, index);
198  }
199 
200  protected:
201  // also enable debugging in ozw
202  bool m_debugging;
203 
204  // our target Device Node ID
205  uint32_t m_nodeID;
206 
207  // a copy of the OZW singleton instance pointer. This is used by
208  // drivers to access underlying OZW facilities.
209  OZW* m_instance;
210 
211  // are we initialized?
212  bool m_initialized;
213 
214  private:
215  };
216 }
void optionAddBool(std::string name, bool val)
Definition: ozw.cxx:136
virtual void optionAddBool(std::string name, bool val)
Definition: ozwinterface.hpp:113
void optionsCreate(std::string configPath="/etc/openzwave", std::string userConfigDir="", std::string cmdLine="")
Definition: ozw.cxx:123
virtual void optionAddString(std::string name, std::string val, bool append)
Definition: ozwinterface.hpp:126
virtual void setDebug(bool enable)
Definition: ozwinterface.cxx:69
virtual void optionsLock()
Definition: ozwinterface.hpp:139
virtual ~ozwInterface()
Definition: ozwinterface.cxx:54
ozwInterface(int nodeID)
Definition: ozwinterface.cxx:38
virtual void init(std::string devicePath, bool isHID=false)
Definition: ozwinterface.cxx:58
virtual void optionsCreate(std::string configPath="/etc/openzwave", std::string userConfigDir="", std::string cmdLine="")
Definition: ozwinterface.hpp:87
virtual void dumpNodes(bool all=false)
Definition: ozwinterface.hpp:169
C++ API wrapper for the bh1749 driver.
Definition: a110x.hpp:29
virtual std::string getValueUnits(int index)
Definition: ozwinterface.hpp:182
void optionsLock()
Definition: ozw.cxx:148
void optionAddString(std::string name, std::string val, bool append)
Definition: ozw.cxx:142
UPM Interface API for OpenZWave (OZW)
Definition: ozwinterface.hpp:49
virtual void optionAddInt(std::string name, int val)
Definition: ozwinterface.hpp:101
Definition: ozw.hpp:95
virtual std::string getValueLabel(int index)
Definition: ozwinterface.hpp:195
std::string getValueLabel(int nodeId, int index)
Definition: ozw.cxx:486
std::string getValueUnits(int nodeId, int index)
Definition: ozw.cxx:459
void optionAddInt(std::string name, int val)
Definition: ozw.cxx:130
void dumpNodes(bool all=false)
Definition: ozw.cxx:349