Main Page Class Hierarchy Compound List File List Compound Members File Members

# /home/gilberto/prog/tesi2.31/lib/Packages/TelepatiPkg.h

Go to the documentation of this file.

    00001 #ifndef TELEPATIPKG_H_DEF
    00002 #define TELEPATIPKG_H_DEF
    00003
    00004 #include <OPENR/ODataFormats.h>
    00005 #include <OPENR/OSyslog.h>
    00006
    00009 using namespace std;
    00010
    00014 enum pkg_type {
    00015   DUMMY=0,
    00016   INFO=1,
    00017   HI=2,
    00018   HIREPLY=3,
    00019   BYE=4,
    00020   ACK=5,
    00021   DUMMYLED=6,
    00022   COUNTER=7,
    00023   LEADER=8,
    00024   LEADERREPLY=9,
    00025   COMMAND=10,
    00026   TIMEINFO=11,
    00027   OTHHEADREADY=12,
    00028   OTHLEGSREADY=13,
    00029   BREAKTHELINE=14
    00030 };
    00031
    00032
    00048 class TelepatiPkg {
    00049  public:
    00051   TelepatiPkg();
    00056   TelepatiPkg(byte* ptr);
    00057
    00059   virtual ~TelepatiPkg() {
    00060     delete [] message;
    00061   };
    00062
    00065    virtual inline void setAibo(int a) { aibo=a; return;};
    00068   virtual inline int getAibo() {return aibo;};
    00071   virtual inline pkg_type getType() { return type;};
    00076   virtual inline size_t getSize() { return size; };
    00079   virtual inline bool needConfirm() { return needAck; };
    00082   virtual inline unsigned short getSerial() { return serialNum; };
    00083
    00090   virtual byte* getMsg() = 0;
    00091
    00096   virtual TelepatiPkg* clone() = 0;
    00097
    00102   byte* createStdHeader(size_t pkgDataSize);
    00103
    00110   static TelepatiPkg* createPkg(byte* ptr);
    00111
    00115   static size_t getSizeOfPkg(byte* ptr);
    00116
    00117   static const int ADDR_INVALID=254;
    00118   static const int ADDR_BROADCAST=255;
    00119   static const size_t STD_HEADER_SIZE = 7;
    00121  protected:
    00123   int aibo;
    00125   pkg_type type;
    00127   unsigned short size;
    00129   bool needAck;
    00131   unsigned short serialNum;
    00133   byte* message;
    00134 };
    00135 #endif
    00136