Arianna autonomous DAQ firmware

Dependencies:   mbed SDFileSystemFilinfo AriSnProtocol NetServicesMin AriSnComm MODSERIAL PowerControlClkPatch DS1820OW

Committer:
uci1
Date:
Sat Jun 30 02:03:51 2012 +0000
Revision:
0:664899e0b988
Child:
1:e392595b4b76
first version. SD card writing and data readout works. communications not tested.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
uci1 0:664899e0b988 1 #ifndef SN_SnCommWin
uci1 0:664899e0b988 2 #define SN_SnCommWin
uci1 0:664899e0b988 3
uci1 0:664899e0b988 4 #include "mbed.h"
uci1 0:664899e0b988 5 #include <stdint.h>
uci1 0:664899e0b988 6
uci1 0:664899e0b988 7 class SnConfigFrame;
uci1 0:664899e0b988 8 class SnEventFrame;
uci1 0:664899e0b988 9
uci1 0:664899e0b988 10 // ABC for communication types
uci1 0:664899e0b988 11
uci1 0:664899e0b988 12 class SnCommWin {
uci1 0:664899e0b988 13 public:
uci1 0:664899e0b988 14 enum ECommWinResult {
uci1 0:664899e0b988 15 kUndefFail, // undefined fail type
uci1 0:664899e0b988 16 kCanNotConnect, // unable to connect to port
uci1 0:664899e0b988 17 kFailTimeout, // timed out but message required
uci1 0:664899e0b988 18 kFailPartSent, // only part of the message sent
uci1 0:664899e0b988 19 kAllFails, // to be used for "if (ret > kAllFails) ==> success"
uci1 0:664899e0b988 20 // only successes should go below
uci1 0:664899e0b988 21 kConnected, // connection established, no messaging attempted
uci1 0:664899e0b988 22 kOkMsgSent, // message sent without waiting for "received" handshake
uci1 0:664899e0b988 23 kOkNoMsg, // timed out with no message, but that is ok
uci1 0:664899e0b988 24 kOkWithMsg // successfully received message
uci1 0:664899e0b988 25 };
uci1 0:664899e0b988 26
uci1 0:664899e0b988 27 private:
uci1 0:664899e0b988 28 //bool fWinOpen; // whether this comm should listen
uci1 0:664899e0b988 29
uci1 0:664899e0b988 30 ECommWinResult SendData(const char* infn,
uci1 0:664899e0b988 31 const SnConfigFrame& curConf,
uci1 0:664899e0b988 32 SnEventFrame& evt,
uci1 0:664899e0b988 33 char* const evtBuf,
uci1 0:664899e0b988 34 char* const confBuf,
uci1 0:664899e0b988 35 const uint32_t nevts=0,
uci1 0:664899e0b988 36 const uint32_t firstEvt=0);
uci1 0:664899e0b988 37
uci1 0:664899e0b988 38 protected:
uci1 0:664899e0b988 39 virtual ECommWinResult SendConfAndEvents(FILE* inf,
uci1 0:664899e0b988 40 const SnConfigFrame& curConf,
uci1 0:664899e0b988 41 SnEventFrame& evt,
uci1 0:664899e0b988 42 char* const evtBuf,
uci1 0:664899e0b988 43 char* const confBuf,
uci1 0:664899e0b988 44 const uint32_t nevts,
uci1 0:664899e0b988 45 const uint32_t firstEvt=0)=0;
uci1 0:664899e0b988 46 public:
uci1 0:664899e0b988 47 virtual ~SnCommWin() {}
uci1 0:664899e0b988 48
uci1 0:664899e0b988 49 /*
uci1 0:664899e0b988 50 void SetCommWinOpen(const bool o) { fWinOpen = o; }
uci1 0:664899e0b988 51 bool IsCommWinOpen() const { return fWinOpen; }
uci1 0:664899e0b988 52 */
uci1 0:664899e0b988 53
uci1 0:664899e0b988 54 virtual ECommWinResult OpenWindow(Timer& timer,
uci1 0:664899e0b988 55 const uint32_t timeout,
uci1 0:664899e0b988 56 const bool sendStatus,
uci1 0:664899e0b988 57 const SnConfigFrame& conf,
uci1 0:664899e0b988 58 const SnEventFrame& evt,
uci1 0:664899e0b988 59 char* const evtBuf,
uci1 0:664899e0b988 60 char* const statBuf)=0;
uci1 0:664899e0b988 61
uci1 0:664899e0b988 62 virtual bool Connect(Timer& timer, const uint32_t timeout)=0;
uci1 0:664899e0b988 63
uci1 0:664899e0b988 64 virtual ECommWinResult GetConfig(SnConfigFrame& conf,
uci1 0:664899e0b988 65 Timer& timer,
uci1 0:664899e0b988 66 const uint32_t timeOut,
uci1 0:664899e0b988 67 char* const confBuf)=0;
uci1 0:664899e0b988 68
uci1 0:664899e0b988 69 virtual ECommWinResult SendStatus(const SnConfigFrame& conf,
uci1 0:664899e0b988 70 const SnEventFrame& evt,
uci1 0:664899e0b988 71 char* const evtBuf,
uci1 0:664899e0b988 72 char* const statBuf)=0;
uci1 0:664899e0b988 73
uci1 0:664899e0b988 74 ECommWinResult SendData(SnConfigFrame& conf,
uci1 0:664899e0b988 75 SnEventFrame& evt,
uci1 0:664899e0b988 76 char* const evtBuf,
uci1 0:664899e0b988 77 char* const confBuf);
uci1 0:664899e0b988 78
uci1 0:664899e0b988 79 virtual ECommWinResult SendData(FILE* inf)=0;
uci1 0:664899e0b988 80
uci1 0:664899e0b988 81 };
uci1 0:664899e0b988 82
uci1 0:664899e0b988 83 #endif // SN_SnCommWin