WakeUp.h
Go to the documentation of this file.
//-----------------------------------------------------------------------------
//
// WakeUp.h
//
// Implementation of the Z-Wave COMMAND_CLASS_WAKE_UP
//
// Copyright (c) 2010 Mal Lansell <openzwave@lansell.org>
//
// 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 _WakeUp_H
#define _WakeUp_H
#include <list>
#include "command_classes/CommandClass.h"
#include "Driver.h"
namespace OpenZWave
{
class Msg;
class ValueInt;
class Mutex;
class WakeUp: public CommandClass
{
public:
static CommandClass* Create( uint32 const _homeId, uint8 const _nodeId ){ return new WakeUp( _homeId, _nodeId ); }
virtual ~WakeUp();
static uint8 const StaticGetCommandClassId(){ return 0x84; }
static string const StaticGetCommandClassName(){ return "COMMAND_CLASS_WAKE_UP"; }
void Init(); // Starts the process of requesting node state from a sleeping device.
void QueueMsg( Driver::MsgQueueItem const& _item );
void SendPending();
bool IsAwake()const{ return m_awake; }
void SetAwake( bool _state );
void SetPollRequired(){ m_pollRequired = true; }
// From CommandClass
virtual bool RequestState( uint32 const _requestFlags, uint8 const _instance, Driver::MsgQueue const _queue );
virtual bool RequestValue( uint32 const _requestFlags, uint8 const _index, uint8 const _instance, Driver::MsgQueue const _queue );
virtual uint8 const GetCommandClassId()const{ return StaticGetCommandClassId(); }
virtual string const GetCommandClassName()const{ return StaticGetCommandClassName(); }
virtual bool HandleMsg( uint8 const* _data, uint32 const _length, uint32 const _instance = 1 );
virtual bool SetValue( Value const& _value );
virtual void SetVersion( uint8 const _version );
virtual uint8 GetMaxVersion(){ return 2; }
protected:
virtual void CreateVars( uint8 const _instance );
private:
WakeUp( uint32 const _homeId, uint8 const _nodeId );
Mutex* m_mutex; // Serialize access to the pending queue
list<Driver::MsgQueueItem> m_pendingQueue; // Messages waiting to be sent when the device wakes up
bool m_awake;
bool m_pollRequired;
};
} // namespace OpenZWave
#endif
OpenZWave::WakeUp::SetVersion
virtual void SetVersion(uint8 const _version)
Definition: WakeUp.cpp:326
OpenZWave
Definition: Bitfield.h:34
OpenZWave::Driver::MsgQueue
MsgQueue
Definition: Driver.h:565
OpenZWave::WakeUp::IsAwake
bool IsAwake() const
Definition: WakeUp.h:55
OpenZWave::WakeUp::RequestValue
virtual bool RequestValue(uint32 const _requestFlags, uint8 const _index, uint8 const _instance, Driver::MsgQueue const _queue)
Definition: WakeUp.cpp:151
OpenZWave::WakeUp::SetValue
virtual bool SetValue(Value const &_value)
Definition: WakeUp.cpp:285
OpenZWave::WakeUp::GetMaxVersion
virtual uint8 GetMaxVersion()
Definition: WakeUp.h:68
OpenZWave::WakeUp::StaticGetCommandClassId
static uint8 const StaticGetCommandClassId()
Definition: WakeUp.h:49
OpenZWave::WakeUp::SendPending
void SendPending()
Definition: WakeUp.cpp:423
CommandClass.h
OpenZWave::WakeUp
Implements COMMAND_CLASS_WAKE_UP (0x84), a Z-Wave device command class.
Definition: WakeUp.h:43
OpenZWave::WakeUp::HandleMsg
virtual bool HandleMsg(uint8 const *_data, uint32 const _length, uint32 const _instance=1)
Definition: WakeUp.cpp:197
OpenZWave::WakeUp::CreateVars
virtual void CreateVars(uint8 const _instance)
Definition: WakeUp.cpp:478
OpenZWave::WakeUp::Init
void Init()
Definition: WakeUp.cpp:103
OpenZWave::WakeUp::GetCommandClassName
virtual string const GetCommandClassName() const
Definition: WakeUp.h:63
OpenZWave::CommandClass
Base class for all Z-Wave command classes.
Definition: CommandClass.h:46
Driver.h
OpenZWave::WakeUp::QueueMsg
void QueueMsg(Driver::MsgQueueItem const &_item)
Definition: WakeUp.cpp:377
OpenZWave::WakeUp::StaticGetCommandClassName
static string const StaticGetCommandClassName()
Definition: WakeUp.h:50
OpenZWave::WakeUp::SetPollRequired
void SetPollRequired()
Definition: WakeUp.h:57
uint32
unsigned int uint32
Definition: Defs.h:80
OpenZWave::WakeUp::SetAwake
void SetAwake(bool _state)
Definition: WakeUp.cpp:339
OpenZWave::Mutex
Implements a platform-independent mutex–for serializing access to a shared resource.
Definition: Mutex.h:39
OpenZWave::WakeUp::Create
static CommandClass * Create(uint32 const _homeId, uint8 const _nodeId)
Definition: WakeUp.h:46
OpenZWave::Value
Base class for values associated with a node.
Definition: Value.h:47
OpenZWave::WakeUp::RequestState
virtual bool RequestState(uint32 const _requestFlags, uint8 const _instance, Driver::MsgQueue const _queue)
Definition: WakeUp.cpp:120
OpenZWave::WakeUp::GetCommandClassId
virtual uint8 const GetCommandClassId() const
Definition: WakeUp.h:62
OpenZWave::WakeUp::~WakeUp
virtual ~WakeUp()
Definition: WakeUp.cpp:79
uint8
unsigned char uint8
Definition: Defs.h:74