Arianna autonomous DAQ firmware

Dependencies:   mbed SDFileSystemFilinfo AriSnProtocol NetServicesMin AriSnComm MODSERIAL PowerControlClkPatch DS1820OW

Revision:
25:57b2627fe756
Parent:
22:f957c4f840ad
Child:
27:efc4d654b139
--- a/SnSDUtils.h	Tue Oct 23 20:58:29 2012 +0000
+++ b/SnSDUtils.h	Tue Oct 30 05:23:57 2012 +0000
@@ -25,7 +25,7 @@
  private:
     
     static
-    FILE* OpenSDFile(const char* name, const char* mode);
+    FILE* OpenSDFile(const char* name, const char* mode, const bool redoDir);
     
     static
     uint16_t GetSeqNum(const uint64_t macadr,
@@ -35,10 +35,10 @@
     const char* GetOutFileName(const uint64_t macadr,
                                const uint32_t run,
                                const uint16_t seq);
-    
+ public:
     static
     void  DeleteFile(FILE*& f, const char* fname);
-        
+ private:   
     static char     fgCurFileName[kFNBufSize];
     static FILE*    fgCurFile;
     static uint16_t fgCurSeq;
@@ -59,7 +59,8 @@
                             const uint32_t run);
     
     static
-    FILE* OpenExistingFile(const char* name, const bool setcurrent);
+    FILE* OpenExistingFile(const char* name, const bool setcurrent,
+                           const bool redoDir);
     
     static
     SnCommWin::ECommWinResult SendAllFiles(SnCommWin* comm,
@@ -69,7 +70,11 @@
                                            const SnConfigFrame& curConf,
                                                  SnEventFrame& evt,
                                                  SnPowerFrame& pow,
-                                           const uint32_t handshakeTimeout);
+                                           const uint32_t handshakeTimeout,
+                                           const char* dirname=kSDsubDir);
+    
+    static
+    DIR*        OpenOrMakeDir(const char* dirname);
     
     static
     const char* GetCurFileName() { return fgCurFileName; }
@@ -79,9 +84,25 @@
     
     static
     uint16_t    GetCurSeqNum() { return fgCurSeq; }
+    /*
+    static
+    uint16_t    GetSeqNumFromFileName(const char* fn);
+    */
+    static
+    bool        GetRunSeqFromFilename(const char* fn,
+                                      uint32_t& run,
+                                      uint16_t& seq);
 
     static
-    uint16_t    GetSeqNumFromFileName(const char* fn);
+    const char* GetSubDirFor(const uint32_t run, const uint16_t seq,
+                             uint32_t& slen, const bool useSeq);
+
+    static
+    bool        GetFullFilename(const char* name, std::string& ffn);
+
+
+    static
+    void        PrintFilesInDirs(const char* dirname);
     
     static
     void        GetDirProps(const char* dirname,
@@ -174,7 +195,7 @@
     void  DeleteFile(FILE*& f, const char* fname) {
         return SnSDUtils::DeleteFile(f, fname);
     }
-    
+
     friend class SnCommWin; // the one who's allowed to use me
 };