# shmessage.h

Go to the documentation of this file.

    00001 /*
    00002  * SmartHome server: Base of the system
    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 SHMESSAGE_H
    00019 #define SHMESSAGE_H
    00020
    00021 #include <QString>
    00022 #include <QVariant>
    00023 #include <QSharedPointer>
    00024
    00025 #include "shpin.h"
    00026
    00027 // -----------------------------------------------------------------------------
    00028
    00029 class ShMessage;
    00030
    00035 typedef QSharedPointer<ShMessage> ShMessagePtr;
    00036
    00037 // -----------------------------------------------------------------------------
    00038
    00043 class ShMessage
    00044 {
    00045 public:
    00046     enum MessageType
    00047     {
    00048         mtUnknown = 0, mtValue, mtGet, mtAck, mtReload, mtError
    00049     };
    00050
    00051     ShMessage();
    00052
    00053     bool        setMsgType(QString typeStr);
    00054     QString     msgTypeStr();
    00055
    00056     void        setMsgType(MessageType msgType)  { mMsgType = msgType;       };
    00057     MessageType msgType()                        { return mMsgType;          };
    00058
    00059     void        setPin(ShPin pin)                { mPin = pin;               };
    00060     ShPin       pin()                            { return mPin;              };
    00061
    00062     void        setSignal(QString signal)        { mSignal = signal;         };
    00063     QString     signal()                         { return mSignal;           };
    00064
    00065     void        setValue(QVariant value)         { mValue = value;           };
    00066     QVariant    value()                          { return mValue;            };
    00067
    00068     void        setSenderId(int senderId)        { mSenderId = senderId;     };
    00069     int         senderId()                       { return mSenderId;         };
    00070     void        setReceiverId(int receiverId)    { mReceiverId = receiverId; };
    00071     int         receiverId()                     { return mReceiverId;       };
    00072
    00073     void        setRequireAck(bool requireAck)   { mRequireAck = requireAck; };
    00074     bool        requireAck()                     { return mRequireAck;       };
    00075
    00076 private:
    00077     MessageType mMsgType;
    00078     QString mSignal;
    00079     QVariant mValue;
    00080     int mSenderId, mReceiverId;
    00081     ShPin mPin;
    00082     bool mRequireAck;
    00083 };
    00084 // -----------------------------------------------------------------------------
    00085
    00086 #endif // SHMESSAGE_H

All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends