A general interface to a power unit. More...
#include <powerunit.h>


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... | |
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.
| 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.

| PUInterface::~PUInterface | ( | ) |
Definition at line 31 of file powerunit.cpp.
| QString PUInterface::GetDescription | ( | void | ) |
Returns the description of the power unit.
Definition at line 40 of file powerunit.cpp.

| 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.

| quint8 PUInterface::GetState | ( | void | ) |
Returns the state of the power unit (see commands.h)
Definition at line 124 of file powerunit.cpp.

| bool PUInterface::MCIsOpen | ( | void | ) |
Returns true if the microcontroller controlling this power unit is open.
Definition at line 119 of file powerunit.cpp.

| 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.

| quint8 PUInterface::SetLevel | ( | quint8 | level) |
Dims the powerunit to the given level.
| MCInterfaceException | There is a problem communicating this command to the microcontroller |
Definition at line 61 of file powerunit.cpp.

| 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.

| 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
| MCInterfaceException | There is a problem communicating this command to the microcontroller |
Definition at line 51 of file powerunit.cpp.

| void PUInterface::TurnOff | ( | void | ) |
Turns off the power unit.
| MCInterfaceException | There is a problem communicating this command to the microcontroller |
Definition at line 87 of file powerunit.cpp.

| void PUInterface::TurnOn | ( | void | ) |
Turns on the power unit.
| MCInterfaceException | There is a problem communicating this command to the microcontroller |
Definition at line 100 of file powerunit.cpp.

|
private |
A text description of the power unit.
Definition at line 98 of file powerunit.h.
|
private |
The ID given to this power unit.
Definition at line 97 of file powerunit.h.
|
private |
The current dimmer level.
Definition at line 100 of file powerunit.h.
|
private |
The microcontroller interface controlling this power unit.
Definition at line 102 of file powerunit.h.
|
private |
The current state of the power unit (PUSTATE_XXX)
Definition at line 99 of file powerunit.h.
1.8.4