Arianna autonomous DAQ firmware

Dependencies:   mbed SDFileSystemFilinfo AriSnProtocol NetServicesMin AriSnComm MODSERIAL PowerControlClkPatch DS1820OW

Revision:
2:e67f7c158087
Parent:
1:e392595b4b76
Child:
3:24c5f0f50bf1
--- a/SnCommWin.cpp	Fri Jul 20 19:04:02 2012 +0000
+++ b/SnCommWin.cpp	Tue Jul 24 02:07:23 2012 +0000
@@ -1,83 +1,80 @@
-#include "SnCommWin.h"
-
-#include "SnConfigFrame.h"
-#include "SnSDUtils.h"
-
-/*
-bool SnCommWin::fgCommEst   = false;
-bool SnCommWin::fgWinOpen   = false;
-*/
-
-SnCommWin::ECommWinResult SnCommWin::SendData(SnConfigFrame& conf,
-                                              SnEventFrame& evt,
-                                              char* const evtBuf,
-                                              char* const confBuf,
-                                              const uint32_t timeout) {
-    ECommWinResult res = kUndefFail;
-    if (conf.IsSendingAllFiles()) {
-        res = SnSDUtils::SendAllFiles(this, conf.IsDeletingFiles());
-    } else {
-        if (conf.GetCommSendData()==0) {
-            res = kOkNoMsg;
-        } else {
-            const uint32_t nev = (conf.GetCommSendData()>0) ?
-                                  conf.GetCommSendData() 
-                                  : 0u; // send all events in file
-            res = SendData(SnSDUtils::GetCurFile(), SnSDUtils::GetCurFileName(),
-                           conf, evt, evtBuf, confBuf, nev);
-        }
-    }
-    return res;
-}
-
-SnCommWin::ECommWinResult SnCommWin::SendData(FILE* inf, const char* infn,
-                                              const SnConfigFrame& curConf,
-                                              SnEventFrame& evt,
-                                              char* const evtBuf,
-                                              char* const confBuf,
-                                              const uint32_t nevts,
-                                              const uint32_t firstEvt) {
-    // nevts==0 ==> send all events
-    // evtBuf should be 0 only if nevts==0
-    //
-    // this version should be used to send the current file (avoid fopen/fclose)
-    
-    ECommWinResult res = kUndefFail;
-    if (inf!=0) {
-        if (nevts==0) {
-            res = SendData(inf);
-            if (curConf.IsDeletingFiles() && res>=kOkMsgSent) {
-                SnSDUtilsWhisperer::DeleteFile(inf, infn);
-            }
-        } else {
-            if (evtBuf!=0) {
-                res = SendConfAndEvents(inf, curConf, evt, evtBuf, confBuf, nevts, firstEvt);
-            }
-        }
-    }
-    return res;
-}
-
-
-SnCommWin::ECommWinResult SnCommWin::SendData(const char* infn,
-                                              const SnConfigFrame& curConf,
-                                              SnEventFrame& evt,
-                                              char* const evtBuf,
-                                              char* const confBuf,
-                                              const uint32_t nevts,
-                                              const uint32_t firstEvt) {
-    // nevts==0 ==> send all events
-    // evtBuf should be 0 only if nevts==0
-    //
-    // this version can send existing files that were previous closed
-    
-    ECommWinResult res = kUndefFail;
-    FILE* inf = fopen(infn, "rb");
-    if (inf!=0) {
-        SendData(inf, infn, curConf, evt, evtBuf, confBuf, nevts, firstEvt);
-        if (inf!=0) {
-            fclose(inf);
-        }
-    }
-    return res;
-}
+#include "SnCommWin.h"
+
+#include "SnConfigFrame.h"
+#include "SnSDUtils.h"
+
+/*
+bool SnCommWin::fgCommEst   = false;
+bool SnCommWin::fgWinOpen   = false;
+*/
+
+SnCommWin::ECommWinResult SnCommWin::SendData(SnConfigFrame& conf,
+                                              SnEventFrame& evt,
+                                              char* const genBuf,
+                                              const uint32_t timeout) {
+    ECommWinResult res = kUndefFail;
+    if (conf.IsSendingAllFiles()) {
+        res = SnSDUtils::SendAllFiles(this, conf.IsDeletingFiles());
+    } else {
+        if (conf.GetCommSendData()==0) {
+            res = kOkNoMsg;
+        } else {
+            const uint32_t nev = (conf.GetCommSendData()>0) ?
+                                  conf.GetCommSendData() 
+                                  : 0u; // send all events in file
+            res = SendData(SnSDUtils::GetCurFile(), SnSDUtils::GetCurFileName(),
+                           conf, evt, genBuf, nev);
+        }
+    }
+    return res;
+}
+
+SnCommWin::ECommWinResult SnCommWin::SendData(FILE* inf, const char* infn,
+                                              const SnConfigFrame& curConf,
+                                              SnEventFrame& evt,
+                                              char* const genBuf,
+                                              const uint32_t nevts,
+                                              const uint32_t firstEvt) {
+    // nevts==0 ==> send all events
+    // evtBuf should be 0 only if nevts==0
+    //
+    // this version should be used to send the current file (avoid fopen/fclose)
+    
+    ECommWinResult res = kUndefFail;
+    if (inf!=0) {
+        if (nevts==0) {
+            res = SendData(inf);
+            if (curConf.IsDeletingFiles() && res>=kOkMsgSent) {
+                SnSDUtilsWhisperer::DeleteFile(inf, infn);
+            }
+        } else {
+            if (genBuf!=0) {
+                res = SendConfAndEvents(inf, curConf, evt, genBuf, nevts, firstEvt);
+            }
+        }
+    }
+    return res;
+}
+
+
+SnCommWin::ECommWinResult SnCommWin::SendData(const char* infn,
+                                              const SnConfigFrame& curConf,
+                                              SnEventFrame& evt,
+                                              char* const genBuf,
+                                              const uint32_t nevts,
+                                              const uint32_t firstEvt) {
+    // nevts==0 ==> send all events
+    // evtBuf should be 0 only if nevts==0
+    //
+    // this version can send existing files that were previous closed
+    
+    ECommWinResult res = kUndefFail;
+    FILE* inf = fopen(infn, "rb");
+    if (inf!=0) {
+        SendData(inf, infn, curConf, evt, genBuf, nevts, firstEvt);
+        if (inf!=0) {
+            fclose(inf);
+        }
+    }
+    return res;
+}