Meach will / libmDot-mbed5

Dependents:   ncu_project

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MulticastGroup.h Source File

MulticastGroup.h

00001 /**********************************************************************
00002 * COPYRIGHT 2018 MULTI-TECH SYSTEMS, INC.
00003 *
00004 * ALL RIGHTS RESERVED BY AND FOR THE EXCLUSIVE BENEFIT OF
00005 * MULTI-TECH SYSTEMS, INC.
00006 *
00007 * MULTI-TECH SYSTEMS, INC. - CONFIDENTIAL AND PROPRIETARY
00008 * INFORMATION AND/OR TRADE SECRET.
00009 *
00010 * NOTICE: ALL CODE, PROGRAM, INFORMATION, SCRIPT, INSTRUCTION,
00011 * DATA, AND COMMENT HEREIN IS AND SHALL REMAIN THE CONFIDENTIAL
00012 * INFORMATION AND PROPERTY OF MULTI-TECH SYSTEMS, INC.
00013 * USE AND DISCLOSURE THEREOF, EXCEPT AS STRICTLY AUTHORIZED IN A
00014 * WRITTEN AGREEMENT SIGNED BY MULTI-TECH SYSTEMS, INC. IS PROHIBITED.
00015 *
00016 ***********************************************************************/
00017 
00018 #ifndef MULTICASTGROUP_H
00019 #define MULTICASTGROUP_H
00020 #include "mDot.h"
00021 #include "mbed.h"
00022 #define GPS_EPOCH 315986400
00023 #define MULTICAST_SESSIONS 3
00024 
00025 class MulticastGroup {
00026     public:
00027         MulticastGroup(mDot* dot, std::vector<uint8_t>* ret, bool* filled);
00028         ~MulticastGroup();
00029         void reset();
00030         //void newTime();
00031         void processCmd(uint8_t* payload, uint8_t size);
00032         int32_t timeToStart();
00033         void fixEventQueue();
00034 
00035     private:
00036         enum McGroup {
00037             PACKAGE_VERSION_MC,
00038             STATUS,
00039             SETUP,
00040             DELETE,
00041             CLASS_C_SESSION,
00042             DATA_BLOCK_AUTH
00043         };
00044 
00045         typedef struct {
00046             bool valid;
00047             uint8_t dr;
00048             uint8_t fragGroup;
00049             uint16_t timeout;
00050             uint32_t tme;
00051             uint32_t freq;
00052             uint32_t addr;
00053             uint32_t max_frame_count;
00054             int32_t timetostart;
00055             int32_t class_c_end;
00056             int32_t class_c_start;
00057             time_t time_setup;
00058         } mcgroup;
00059 
00060         bool* _filled;
00061         uint8_t _groupId;
00062         uint8_t _ans;
00063         uint8_t _delay;
00064         uint8_t _token;
00065         uint8_t _dr;
00066         uint32_t _freq;
00067         uint32_t _frame_count;
00068         time_t _now;
00069 
00070         mDot* _dot;
00071         Thread _event_thread;
00072         EventQueue _switch_class_queue;
00073         mcgroup _mcGroup[MULTICAST_SESSIONS];
00074         std::vector<uint8_t>* _ret;
00075         std::string _org_class;
00076 
00077         void setupClassC(uint8_t id);
00078         static void switchClass(uint32_t freq, uint8_t dr, std::string newClass);
00079 };
00080 #endif