BPLightContraption
 All Classes Namespaces Files Functions Variables Macros Pages
Public Member Functions | Private Attributes | List of all members
PUInterface Class Reference

A general interface to a power unit. More...

#include <powerunit.h>

Inheritance diagram for PUInterface:
Inheritance graph
[legend]
Collaboration diagram for PUInterface:
Collaboration graph
[legend]

Public Member Functions

 PUInterface (char id, const QString &desc, QSharedPointer< MCInterface > mc)
 Constructor. More...
 
 ~PUInterface ()
 
quint8 GetLevel (void)
 Returns the current dimmer level. More...
 
QString GetDescription (void)
 Returns the description of the power unit. More...
 
char GetID (void)
 Returns the ID of the power unit. More...
 
quint8 GetState (void)
 Returns the state of the power unit (see commands.h) More...
 
void SyncState (char state, quint8 level)
 Syncs the state of the class with the given state and dimmer level. More...
 
bool Toggle (void)
 Toggles the power unit between on and off. More...
 
quint8 SetLevel (quint8 level)
 Dims the powerunit to the given level. More...
 
void TurnOff (void)
 Turns off the power unit. More...
 
void TurnOn (void)
 Turns on the power unit. More...
 
void Reset (void)
 Resets the power unit state. More...
 
bool MCIsOpen (void)
 Returns true if the microcontroller controlling this power unit is open. More...
 

Private Attributes

char _id
 The ID given to this power unit. More...
 
QString _desc
 A text description of the power unit. More...
 
quint8 _state
 The current state of the power unit (PUSTATE_XXX) More...
 
quint8 _level
 The current dimmer level. More...
 
QSharedPointer< MCInterface_mc
 The microcontroller interface controlling this power unit. More...
 

Detailed Description

A general interface to a power unit.

In general, if any operation goes wrong, this class will throw a MCInterfaceException

Definition at line 23 of file powerunit.h.

Constructor & Destructor Documentation

PUInterface::PUInterface ( char  id,
const QString &  desc,
QSharedPointer< MCInterface mc 
)

Constructor.

Creates an interface to a power unit given an id, description, and an pointer to the micrcontroller it's connected to

Definition at line 25 of file powerunit.cpp.

Here is the call graph for this function:

PUInterface::~PUInterface ( )

Definition at line 31 of file powerunit.cpp.

Member Function Documentation

QString PUInterface::GetDescription ( void  )

Returns the description of the power unit.

Definition at line 40 of file powerunit.cpp.

Here is the caller graph for this function:

char PUInterface::GetID ( void  )

Returns the ID of the power unit.

Definition at line 45 of file powerunit.cpp.

quint8 PUInterface::GetLevel ( void  )

Returns the current dimmer level.

Definition at line 35 of file powerunit.cpp.

Here is the caller graph for this function:

quint8 PUInterface::GetState ( void  )

Returns the state of the power unit (see commands.h)

Definition at line 124 of file powerunit.cpp.

Here is the caller graph for this function:

bool PUInterface::MCIsOpen ( void  )

Returns true if the microcontroller controlling this power unit is open.

Definition at line 119 of file powerunit.cpp.

Here is the caller graph for this function:

void PUInterface::Reset ( void  )

Resets the power unit state.

This does not actually communicate with the microcontroller

Definition at line 113 of file powerunit.cpp.

Here is the caller graph for this function:

quint8 PUInterface::SetLevel ( quint8  level)

Dims the powerunit to the given level.

Returns
The level to which it was actually set
Exceptions
MCInterfaceExceptionThere is a problem communicating this command to the microcontroller

Definition at line 61 of file powerunit.cpp.

Here is the caller graph for this function:

void PUInterface::SyncState ( char  state,
quint8  level 
)

Syncs the state of the class with the given state and dimmer level.

Definition at line 129 of file powerunit.cpp.

Here is the caller graph for this function:

bool PUInterface::Toggle ( void  )

Toggles the power unit between on and off.

This has no effect if the state is not PUSTATE_ON or PUSTATE_OFF

Exceptions
MCInterfaceExceptionThere is a problem communicating this command to the microcontroller

Definition at line 51 of file powerunit.cpp.

Here is the call graph for this function:

void PUInterface::TurnOff ( void  )

Turns off the power unit.

Exceptions
MCInterfaceExceptionThere is a problem communicating this command to the microcontroller

Definition at line 87 of file powerunit.cpp.

Here is the caller graph for this function:

void PUInterface::TurnOn ( void  )

Turns on the power unit.

Exceptions
MCInterfaceExceptionThere is a problem communicating this command to the microcontroller

Definition at line 100 of file powerunit.cpp.

Here is the caller graph for this function:

Member Data Documentation

QString PUInterface::_desc
private

A text description of the power unit.

Definition at line 98 of file powerunit.h.

char PUInterface::_id
private

The ID given to this power unit.

Definition at line 97 of file powerunit.h.

quint8 PUInterface::_level
private

The current dimmer level.

Definition at line 100 of file powerunit.h.

QSharedPointer<MCInterface> PUInterface::_mc
private

The microcontroller interface controlling this power unit.

Definition at line 102 of file powerunit.h.

quint8 PUInterface::_state
private

The current state of the power unit (PUSTATE_XXX)

Definition at line 99 of file powerunit.h.


The documentation for this class was generated from the following files: