OpenZWave Library  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HidControllerWinRT.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 //
3 // HidControllerImpl.h
4 //
5 // WinRT implementation of a HidController
6 //
7 // Copyright (c) 2015 Microsoft Corporation
8 // All rights reserved.
9 //
10 // SOFTWARE NOTICE AND LICENSE
11 //
12 // This file is part of OpenZWave.
13 //
14 // OpenZWave is free software: you can redistribute it and/or modify
15 // it under the terms of the GNU Lesser General Public License as published
16 // by the Free Software Foundation, either version 3 of the License,
17 // or (at your option) any later version.
18 //
19 // OpenZWave is distributed in the hope that it will be useful,
20 // but WITHOUT ANY WARRANTY; without even the implied warranty of
21 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 // GNU Lesser General Public License for more details.
23 //
24 // You should have received a copy of the GNU Lesser General Public License
25 // along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
26 //
27 //-----------------------------------------------------------------------------
28 
29 #ifndef _HidControllerImpl_H
30 #define _HidControllerImpl_H
31 
32 #include <windows.h>
33 
34 #include "Defs.h"
35 #include "platform/Controller.h"
36 #include <ppltasks.h>
37 
38 namespace OpenZWave
39 {
40  class HidController : public Controller
41  {
42  public:
43 
48  HidController();
49 
54  virtual ~HidController();
55 
62  bool SetVendorId(uint32 const _vendorId);
63 
70  bool SetProductId(uint32 const _productId);
71 
78  bool SetSerialNumber(string const& _serialNumber);
79 
87  bool Open(string const& _hidControllerName);
88 
95  bool Close();
96 
105  uint32 Write(uint8* _buffer, uint32 _length);
106 
107  private:
108 
109  uint32 SendFeatureReport( uint8* _buffer, uint32 _length, unsigned short reportId );
110  Concurrency::task<bool> Init();
111 
112  Windows::Devices::HumanInterfaceDevice::HidDevice ^ m_device;
113  Windows::Foundation::EventRegistrationToken m_inputReportEventToken;
114 
115  uint32 m_vendorId;
116  uint32 m_productId;
117  string m_serialNumber;
118  string m_hidControllerName;
119  bool m_bOpen;
120  };
121 
122 } // namespace OpenZWave
123 
124 #endif //_HidControllerImpl_H
125 
virtual ~HidController()
Definition: HidController.cpp:69
bool Close()
Definition: HidController.cpp:164
HidController()
Definition: HidController.cpp:52
bool Open(string const &_hidControllerName)
Definition: HidController.cpp:133
unsigned int uint32
Definition: Defs.h:80
bool SetSerialNumber(string const &_serialNumber)
Definition: HidController.cpp:115
bool SetVendorId(uint32 const _vendorId)
Definition: HidController.cpp:79
uint32 Write(uint8 *_buffer, uint32 _length)
Definition: HidController.cpp:457
bool SetProductId(uint32 const _productId)
Definition: HidController.cpp:97
unsigned char uint8
Definition: Defs.h:74