Stable version of the xDot library for mbed 5. This version of the library is suitable for deployment scenarios.

Dependents:   Dot-Examples XDOT-Devicewise Dot-Examples-delujoc Dot-Examples_receive ... more

Fork of libxDot-dev-mbed5-deprecated by MultiTech

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 315964800U
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         void setClockOffset(int32_t offset);
00035 
00036     private:
00037         enum MulticastCommands {
00038             PACKAGE_VERSION,
00039             STATUS,
00040             SETUP,
00041             DELETE,
00042             CLASS_C_SESSION,
00043             CLASS_B_SESSION_REQ
00044         };
00045 
00046         typedef struct {
00047             bool valid;
00048             uint8_t dr;
00049             uint8_t fragGroup;
00050             uint16_t timeout;
00051             uint32_t tme;
00052             uint32_t freq;
00053             uint32_t addr;
00054             uint32_t max_frame_count;
00055             int32_t timetostart;
00056             int32_t class_c_end;
00057             int32_t class_c_start;
00058             time_t time_setup;
00059             int8_t periodicity;
00060         } mcgroup;
00061 
00062         bool* _filled;
00063         uint8_t _groupId;
00064         uint8_t _ans;
00065         uint8_t _delay;
00066         uint8_t _token;
00067         uint8_t _dr;
00068         uint32_t _freq;
00069         uint32_t _frame_count;
00070         time_t _now;
00071         int32_t _clk_sync;
00072 
00073         mDot* _dot;
00074         Thread _event_thread;
00075         EventQueue _switch_class_queue;
00076         mcgroup _mcGroup[MULTICAST_SESSIONS];
00077         std::vector<uint8_t>* _ret;
00078         char _org_class;
00079 
00080         void setupClassB(uint8_t id);
00081         void setupClassC(uint8_t id);
00082         static void switchClass(uint32_t freq, uint8_t dr, char newClass);
00083 };
00084 #endif