# x10packet.h

Go to the documentation of this file.

    00001 /*
    00002  * SmartHome server: Plug-in x10
    00003  *
    00004  * Copyright (C) 2010 Daniel Pisi <dan.pisi@gmail.com>
    00005  *
    00006  * This program is free software; you can redistribute it and/or modify it
    00007  * under the terms of version 2 of the GNU General Public License
    00008  * as published by the Free Software Foundation.
    00009  *
    00010  */
    00011
    00018 #ifndef X10PACKET_H
    00019 #define X10PACKET_H
    00020
    00021 #include <QtCore/QCoreApplication>
    00022 #include <QByteArray>
    00023 #include <QSharedPointer>
    00024
    00025 // -----------------------------------------------------------------------------
    00026
    00027 class X10Packet;
    00028
    00029 typedef QSharedPointer<X10Packet> X10PacketPtr;
    00030
    00031 // -----------------------------------------------------------------------------
    00032
    00037 class X10Packet
    00038 {
    00039 public:
    00040     enum X10Function
    00041     {
    00042         fcAllUnitsOff = 0, fcAllLightsOn = 1, fcAllLightsOff = 6,
    00043         fcOn = 2, fcOff = 3,
    00044         fcDim = 4, fcBright = 5,
    00045         fcHailRequest = 8, fcHailAck = 9,
    00046         fcPresetDim1 = 10, fcPresetDim2 = 11,
    00047         fcExCode = 7, fcExData = 12,
    00048         fcStatOn = 13, fcStatOff = 14, fcStatRequest = 15
    00049     };
    00050
    00051     X10Packet();
    00052
    00053     bool setHousecode(quint8 housecode);
    00054     bool setDevicecode(quint8 devicecode);
    00055     bool setFunction(X10Function function);
    00056     bool setDimAmount(quint8 dim);
    00057
    00058     quint8 housecode() { return mHousecode; };
    00059     quint8 dimAmount() { return mDimAmount; };
    00060
    00061     QByteArray frameData();
    00062     quint8 checksum();
    00063
    00064 private:
    00065     quint8 mDimAmount;
    00066     bool   mFa, mEs;
    00067     quint8 mHousecode;
    00068     quint8 mData;
    00069     quint8 mChecksum;
    00070     bool   mModified;
    00071 };
    00072 // -----------------------------------------------------------------------------
    00073
    00074 #endif // X10PACKET_H

All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends