HidController.h
Go to the documentation of this file.
//-----------------------------------------------------------------------------
//
// HidController.h
//
// Cross-platform HID port handler
//
// Copyright (c) 2010 Jason Frazier <frazierjason@gmail.com>
//
// 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 <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
#ifndef _HidController_H
#define _HidController_H
#include <string>
#include "Defs.h"
#include "platform/Controller.h"
struct hid_device_;
typedef struct hid_device_ hid_device;
namespace OpenZWave
{
class Driver;
class Msg;
class Thread;
class Event;
class HidController: public Controller
{
public:
HidController();
virtual ~HidController();
bool SetVendorId( uint32 const _vendorId );
bool SetProductId( uint32 const _productId );
bool SetSerialNumber( string const& _serialNumber );
bool Open( string const& _hidControllerName );
bool Close();
uint32 Write( uint8* _buffer, uint32 _length );
private:
bool Init( uint32 const _attempts );
void Read();
// helpers for internal use only
int GetFeatureReport( uint32 _length, uint8 _reportId, uint8* _buffer );
int SendFeatureReport( uint32 _length, const uint8* _data );
static void ThreadEntryPoint( Event* _exitEvent, void* _context );
void ThreadProc( Event* _exitEvent );
hid_device* m_hHidController;
Thread* m_thread;
uint32 m_vendorId;
uint32 m_productId;
string m_serialNumber;
string m_hidControllerName;
bool m_bOpen;
};
} // namespace OpenZWave
#endif //_HidController_H
OpenZWave::HidController::~HidController
virtual ~HidController()
Definition: HidControllerWinRT.cpp:65
OpenZWave
Definition: Bitfield.h:34
OpenZWave::HidController::Close
bool Close()
Definition: HidControllerWinRT.cpp:170
OpenZWave::HidController::HidController
HidController()
Definition: HidControllerWinRT.cpp:52
OpenZWave::Controller
Definition: Controller.h:41
OpenZWave::Event
Platform-independent definition of event objects.
Definition: Event.h:39
hid_device
struct hid_device_ hid_device
Definition: HidController.h:38
OpenZWave::Thread
Implements a platform-independent thread management class.
Definition: Thread.h:42
Defs.h
OpenZWave::HidController::Open
bool Open(string const &_hidControllerName)
Definition: HidControllerWinRT.cpp:125
uint32
unsigned int uint32
Definition: Defs.h:80
OpenZWave::HidController::SetSerialNumber
bool SetSerialNumber(string const &_serialNumber)
Definition: HidControllerWinRT.cpp:110
Controller.h
OpenZWave::HidController::SetVendorId
bool SetVendorId(uint32 const _vendorId)
Definition: HidControllerWinRT.cpp:78
OpenZWave::HidController
Definition: HidController.h:47
OpenZWave::HidController::Write
uint32 Write(uint8 *_buffer, uint32 _length)
Definition: HidControllerWinRT.cpp:239
OpenZWave::HidController::SetProductId
bool SetProductId(uint32 const _productId)
Definition: HidControllerWinRT.cpp:95
uint8
unsigned char uint8
Definition: Defs.h:74