Wenkai Gong / libmDot-mbed5-UNSWDot
Revision:
72:b1e07ec1c30d
Parent:
70:0c5b5b02d17b
--- a/Fota/Fragmentation/FragmentationSession.h	Fri Nov 08 09:34:58 2019 -0600
+++ b/Fota/Fragmentation/FragmentationSession.h	Mon Feb 17 14:43:04 2020 -0600
@@ -35,6 +35,18 @@
         ~FragmentationSession();
         void processCmd(uint8_t* payload, uint8_t size);
         void reset();
+        bool isComplete() const;
+        bool cleanUp();
+
+        enum FragCmd {
+            PACKAGE_VERSION_FRAG,
+            FRAG_STATUS,
+            FRAG_SESSION_SETUP,
+            FRAG_SESSION_DELETE,
+            DATA_FRAGMENT = 0x08,
+            CHECKSUM = 0x80,
+            FRAG_SESSION_COMPLETE = 0x90
+        };
 
     private:
 
@@ -68,29 +80,23 @@
             FRAG_COMPLETE
         };
 
-        enum FragCmd {
-            PACKAGE_VERSION_FRAG,
-            FRAG_STATUS,
-            FRAG_SESSION_SETUP,
-            FRAG_SESSION_DELETE,
-            DATA_FRAGMENT = 0x08,
-            CHECKSUM = 0x80
-        };
-
         void reset(uint16_t num);
-        void upgradeFile(uint8_t fragIndex);
-        bool process_frame(uint8_t fragIndex,uint16_t index, uint8_t buffer[], size_t size);
+        void upgradeFile(uint8_t sessionIndex);
+        bool processFrame(uint8_t fragIndex, uint16_t index, uint8_t buffer[], size_t size);
+        uint32_t getDescriptor() { return _descriptor; }
 
         mDot* _dot;
         WriteFile* _fh;
-        fragGroup fg[MULTICAST_SESSIONS];
+        fragGroup _sessions[MULTICAST_SESSIONS];
 
         uint8_t ans;
         bool* _filled;
         uint32_t* _delay;
-        uint8_t fragIndex;
+        uint8_t _session_index;
+        uint32_t _descriptor;
         std::vector<uint8_t>* _ret;
-        std::string _org_class;
+        bool _complete;
+        bool _validated;
 };
 #endif
 #endif // _FRAGMENTATION_SESSION_H