ValueSchedule.h
Go to the documentation of this file.
//-----------------------------------------------------------------------------
//
// ValueSchedule.h
//
// A one day schedule for the Climate Control Schedule command class
//
// 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 _ValueSchedule_H
#define _ValueSchedule_H
#include <string>
#include "Defs.h"
#include "value_classes/Value.h"
class TiXmlElement;
namespace OpenZWave
{
class Msg;
class Node;
class ValueSchedule: public Value
{
public:
ValueSchedule( uint32 const _homeId, uint8 const _nodeId, ValueID::ValueGenre const _genre, uint8 const _commandClassId, uint8 const _instance, uint8 const _index, string const& _label, string const& _units, bool const _readOnly, bool const _writeOnly, uint8 const _pollIntensity );
ValueSchedule();
virtual ~ValueSchedule(){}
bool SetSwitchPoint( uint8 const _hours, uint8 const _minutes, int8 const _setback );
bool RemoveSwitchPoint( uint8 const _idx );
void ClearSwitchPoints(){ m_numSwitchPoints = 0; }
bool GetSwitchPoint( uint8 const _idx, uint8* o_hours, uint8* o_minutes, int8* o_setback )const;
bool FindSwitchPoint( uint8 const _hours, uint8 const _minutes, uint8* o_idx )const;
uint8 GetNumSwitchPoints()const{ return m_numSwitchPoints; }
bool Set();
void OnValueRefreshed();
virtual string const GetAsString() const;
// From Value
virtual void ReadXML( uint32 const _homeId, uint8 const _nodeId, uint8 const _commandClassId, TiXmlElement const* _valueElement );
virtual void WriteXML( TiXmlElement* _valueElement );
private:
struct SwitchPoint
{
uint8 m_hours;
uint8 m_minutes;
int8 m_setback;
};
SwitchPoint m_switchPoints[9];
uint8 m_numSwitchPoints;
};
} // namespace OpenZWave
#endif
OpenZWave
Definition: Bitfield.h:34
OpenZWave::ValueSchedule::WriteXML
virtual void WriteXML(TiXmlElement *_valueElement)
Definition: ValueSchedule.cpp:130
OpenZWave::ValueSchedule::SetSwitchPoint
bool SetSwitchPoint(uint8 const _hours, uint8 const _minutes, int8 const _setback)
Definition: ValueSchedule.cpp:201
Defs.h
OpenZWave::ValueSchedule::FindSwitchPoint
bool FindSwitchPoint(uint8 const _hours, uint8 const _minutes, uint8 *o_idx) const
Definition: ValueSchedule.cpp:325
OpenZWave::ValueSchedule::Set
bool Set()
Definition: ValueSchedule.cpp:165
int8
signed char int8
Definition: Defs.h:73
uint32
unsigned int uint32
Definition: Defs.h:80
OpenZWave::ValueSchedule::ValueSchedule
ValueSchedule()
Definition: ValueSchedule.cpp:66
OpenZWave::ValueSchedule::GetNumSwitchPoints
uint8 GetNumSwitchPoints() const
Definition: ValueSchedule.h:56
OpenZWave::ValueSchedule::GetAsString
virtual string const GetAsString() const
Definition: ValueSchedule.cpp:362
OpenZWave::ValueSchedule::~ValueSchedule
virtual ~ValueSchedule()
Definition: ValueSchedule.h:49
OpenZWave::ValueSchedule::ClearSwitchPoints
void ClearSwitchPoints()
Definition: ValueSchedule.h:53
OpenZWave::ValueSchedule::GetSwitchPoint
bool GetSwitchPoint(uint8 const _idx, uint8 *o_hours, uint8 *o_minutes, int8 *o_setback) const
Definition: ValueSchedule.cpp:289
Value.h
OpenZWave::Value
Base class for values associated with a node.
Definition: Value.h:47
OpenZWave::ValueSchedule::RemoveSwitchPoint
bool RemoveSwitchPoint(uint8 const _idx)
Definition: ValueSchedule.cpp:262
OpenZWave::ValueSchedule::OnValueRefreshed
void OnValueRefreshed()
Definition: ValueSchedule.cpp:178
OpenZWave::ValueID::ValueGenre
ValueGenre
Definition: ValueID.h:71
OpenZWave::ValueSchedule::ReadXML
virtual void ReadXML(uint32 const _homeId, uint8 const _nodeId, uint8 const _commandClassId, TiXmlElement const *_valueElement)
Definition: ValueSchedule.cpp:79
OpenZWave::ValueSchedule
Schedule sent to/received from a node.
Definition: ValueSchedule.h:44
uint8
unsigned char uint8
Definition: Defs.h:74