Public Types | Signals | Public Member Functions | Private Slots | Private Member Functions | Private Attributes

# X10Interface Class Reference

Interfaces the CM12U controller via serial port. More...

`#include <x10interface.h>`

Inheritance diagram for X10Interface:
[legend]
Collaboration diagram for X10Interface:
[legend]

List of all members.

## Public Types
enum | X10State { stReady = 0, stCmdSent, stChecksumOk }
## Signals
void | transmissionDone ()
void | transmissionFailed (QString reason)
## Public Member Functions
| X10Interface (QString device, QObject *parent=0)
| Constructor of ShX10, initialization and opening the CM12U controller port.
bool | onOffDevices (QString devices, bool on)
| Enqueue X-10 packet turning the addressed device(s) on/off.
bool | dimLights (QString devices, int dim)
| Enqueue X-10 packet brightening/dimming the addressed device(s) on/off.
bool | onOffAllLights (char house, bool on)
| Enqueue X-10 packet turning on/off all lights within given house.
void | sendTime ()
| Updates the CM12U controller time.
X10State | state ()
## Private Slots
void | onReadyRead ()
| Slot reading incoming data.
void | onTimeout ()
| Slot invoked on sent packet response timeout.
## Private Member Functions
void | sendNextPacket ()
| Send the enqueued packet, if all of packets has been sent emits a signal transmissionDone.
bool | enqueueAddressing (QString devices)
| Enqueue X-10 addressing packet(s).
## Private Attributes
QextSerialPort * | mX10Port
X10State | mState
QQueue< X10PacketPtr > | mPacketQueue
QTimer * | mTimer

## Detailed Description

Interfaces the CM12U controller via serial port.

Definition at line 36 of file x10interface.h.

## Member Enumeration Documentation

enum X10Interface::X10State

Enumerator:

  stReady |
  stCmdSent |
  stChecksumOk |

Definition at line 41 of file x10interface.h.

## Constructor & Destructor Documentation

X10Interface::X10Interface | ( | QString | device,
|  | QObject * | parent = `0` |
| ) |  |  |

Constructor of ShX10, initialization and opening the CM12U controller port.

Parameters:

  | device | Path to the CM12U controller port
  | parent | Pointer to the parent object

Definition at line 27 of file x10interface.cpp.

References mState, mTimer, mX10Port, onReadyRead(), and onTimeout().

Here is the call graph for this function:

## Member Function Documentation

bool X10Interface::dimLights | ( | QString | devices,
|  | int | dim |
| ) |  |  |

Enqueue X-10 packet brightening/dimming the addressed device(s) on/off.

Parameters:

  | devices | Addressed device(s), only housecode part is relevant
  | dim | Number of dimming steps (1 to 24)

Returns:
  true if the packet(s) has been enqueued successfully

Definition at line 154 of file x10interface.cpp.

References enqueueAddressing(), X10Packet::fcBright, X10Packet::fcDim, mPacketQueue, mState, sendNextPacket(), and stReady.

Referenced by ShX10::processNextMessage().

Here is the call graph for this function:

Here is the caller graph for this function:

bool X10Interface::enqueueAddressing | ( | QString | devices | ) | `[private]`

Enqueue X-10 addressing packet(s).

Parameters:

  | devices | Addressed device(s)

Returns:
  true if the packet(s) has been enqueued successfully

Definition at line 103 of file x10interface.cpp.

References mPacketQueue.

Referenced by dimLights(), and onOffDevices().

Here is the caller graph for this function:

bool X10Interface::onOffAllLights | ( | char | house,
|  | bool | on |
| ) |  |  |

Enqueue X-10 packet turning on/off all lights within given house.

Parameters:

  | house | Housecode
  | on | true for turning lights on, false for turning them off

Returns:
  true if the packet(s) has been enqueued successfully

Definition at line 183 of file x10interface.cpp.

References X10Packet::fcAllLightsOff, X10Packet::fcAllLightsOn, mPacketQueue, mState, sendNextPacket(), and stReady.

Referenced by ShX10::processNextMessage().

Here is the call graph for this function:

Here is the caller graph for this function:

bool X10Interface::onOffDevices | ( | QString | devices,
|  | bool | on |
| ) |  |  |

Enqueue X-10 packet turning the addressed device(s) on/off.

Parameters:

  | devices | Addressed device(s), only housecode part is relevant
  | on | true for turning devices on, false for turning them off

Returns:
  true if the packet(s) has been enqueued successfully

Definition at line 129 of file x10interface.cpp.

References enqueueAddressing(), X10Packet::fcOff, X10Packet::fcOn, mPacketQueue, mState, sendNextPacket(), and stReady.

Referenced by ShX10::processNextMessage().

Here is the call graph for this function:

Here is the caller graph for this function:

void X10Interface::onReadyRead | ( |  | ) | `[private, slot]`

Slot reading incoming data.

Definition at line 203 of file x10interface.cpp.

References mPacketQueue, mState, mX10Port, sendNextPacket(), sendTime(), stChecksumOk, stCmdSent, and stReady.

Referenced by X10Interface().

Here is the call graph for this function:

Here is the caller graph for this function:

void X10Interface::onTimeout | ( |  | ) | `[private, slot]`

Slot invoked on sent packet response timeout.

Definition at line 243 of file x10interface.cpp.

References mPacketQueue, mState, mTimer, and transmissionFailed().

Referenced by X10Interface().

Here is the call graph for this function:

Here is the caller graph for this function:

void X10Interface::sendNextPacket | ( |  | ) | `[private]`

Send the enqueued packet, if all of packets has been sent emits a signal transmissionDone.

Definition at line 57 of file x10interface.cpp.

References mPacketQueue, mState, mTimer, mX10Port, and transmissionDone().

Referenced by dimLights(), onOffAllLights(), onOffDevices(), and onReadyRead().

Here is the call graph for this function:

Here is the caller graph for this function:

void X10Interface::sendTime | ( |  | ) |

Updates the CM12U controller time.

Definition at line 79 of file x10interface.cpp.

References mX10Port.

Referenced by ShX10::init(), and onReadyRead().

Here is the caller graph for this function:

X10State X10Interface::state | ( |  | ) | `[inline]`

Definition at line 53 of file x10interface.h.

References mState.

Referenced by ShX10::processNextMessage().

Here is the caller graph for this function:

void X10Interface::transmissionDone | ( |  | ) | `[signal]`

Referenced by sendNextPacket().

Here is the caller graph for this function:

void X10Interface::transmissionFailed | ( | QString | reason | ) | `[signal]`

Referenced by onTimeout().

Here is the caller graph for this function:

## Member Data Documentation

QQueue<X10PacketPtr> X10Interface::mPacketQueue`[private]`

Definition at line 69 of file x10interface.h.

Referenced by dimLights(), enqueueAddressing(), onOffAllLights(), onOffDevices(), onReadyRead(), onTimeout(), and sendNextPacket().

X10State X10Interface::mState`[private]`

Definition at line 68 of file x10interface.h.

Referenced by dimLights(), onOffAllLights(), onOffDevices(), onReadyRead(), onTimeout(), sendNextPacket(), state(), and X10Interface().

QTimer* X10Interface::mTimer`[private]`

Definition at line 70 of file x10interface.h.

Referenced by onTimeout(), sendNextPacket(), and X10Interface().

QextSerialPort* X10Interface::mX10Port`[private]`

Definition at line 67 of file x10interface.h.

Referenced by onReadyRead(), sendNextPacket(), sendTime(), and X10Interface().

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

- shx10/x10interface.h
- shx10/x10interface.cpp

All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends