Arianna autonomous DAQ firmware

Dependencies:   mbed SDFileSystemFilinfo AriSnProtocol NetServicesMin AriSnComm MODSERIAL PowerControlClkPatch DS1820OW

Committer:
uci1
Date:
Tue Jul 24 02:07:23 2012 +0000
Revision:
2:e67f7c158087
Parent:
1:e392595b4b76
Child:
3:24c5f0f50bf1
added header to i/o. still lots of debugging prints.

Who changed what in which revision?

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