Wenkai Gong / libmDot-mbed5-UNSWDot
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MulticastGroup.h Source File

MulticastGroup.h

00001 #ifndef MULTICASTGROUP_H
00002 #define MULTICASTGROUP_H
00003 #include "mDot.h"
00004 #include "mbed.h"
00005 #define GPS_EPOCH 315986400
00006 #define MULTICAST_SESSIONS 3
00007 
00008 class MulticastGroup {
00009     public:
00010         MulticastGroup(mDot* dot, std::vector<uint8_t>* ret, bool* filled);
00011         ~MulticastGroup();
00012         void reset();
00013         //void newTime();
00014         void processCmd(uint8_t* payload, uint8_t size);
00015         int32_t timeToStart();
00016         void fixEventQueue();
00017 
00018     private:
00019         enum McGroup {
00020             PACKAGE_VERSION_MC,
00021             STATUS,
00022             SETUP,
00023             DELETE,
00024             CLASS_C_SESSION,
00025             DATA_BLOCK_AUTH
00026         };
00027 
00028         typedef struct {
00029             bool valid;
00030             uint8_t dr;
00031             uint8_t fragGroup;
00032             uint16_t timeout;
00033             uint32_t tme;
00034             uint32_t freq;
00035             uint32_t addr;
00036             uint32_t max_frame_count;
00037             int32_t timetostart;
00038             int32_t class_c_end;
00039             int32_t class_c_start;
00040             time_t time_setup;
00041         } mcgroup;
00042         
00043         bool* _filled;
00044         uint8_t _groupId;
00045         uint8_t _ans;
00046         uint8_t _delay;
00047         uint8_t _token;
00048         uint8_t _dr;
00049         uint32_t _freq;
00050         uint32_t _frame_count;
00051         time_t _now;
00052         
00053         mDot* _dot; 
00054         Thread _event_thread;
00055         EventQueue _switch_class_queue;
00056         mcgroup _mcGroup[MULTICAST_SESSIONS];
00057         std::vector<uint8_t>* _ret;
00058         std::string _org_class;
00059 
00060         void setupClassC(uint8_t id);
00061         static void switchClass(uint32_t freq, uint8_t dr, std::string newClass);
00062 };
00063 #endif