Arianna autonomous DAQ firmware
Dependencies: mbed SDFileSystemFilinfo AriSnProtocol NetServicesMin AriSnComm MODSERIAL PowerControlClkPatch DS1820OW
SnCommWin.h@6:6f002d202f59, 2012-08-03 (annotated)
- Committer:
- uci1
- Date:
- Fri Aug 03 23:50:57 2012 +0000
- Revision:
- 6:6f002d202f59
- Parent:
- 3:24c5f0f50bf1
- Child:
- 8:95a325df1f6b
Remove line that powered amps outside of SetPower. Still lots of debugging output. Communication systems totally unimplemented.
Who changed what in which revision?
User | Revision | Line number | New 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 | 3:24c5f0f50bf1 | 20 | kUnexpectedRec, // unexpected / unhandled message received |
uci1 | 1:e392595b4b76 | 21 | kAllFails, // to be used for "if (ret > kAllFails) ==> success" |
uci1 | 1:e392595b4b76 | 22 | // only successes should go below |
uci1 | 1:e392595b4b76 | 23 | kConnected, // connection established, no messaging attempted |
uci1 | 1:e392595b4b76 | 24 | kOkMsgSent, // message sent without waiting for "received" handshake |
uci1 | 1:e392595b4b76 | 25 | kOkNoMsg, // timed out with no message, but that is ok |
uci1 | 1:e392595b4b76 | 26 | kOkWithMsg // successfully received message |
uci1 | 1:e392595b4b76 | 27 | }; |
uci1 | 2:e67f7c158087 | 28 | |
uci1 | 1:e392595b4b76 | 29 | private: |
uci1 | 1:e392595b4b76 | 30 | //bool fWinOpen; // whether this comm should listen |
uci1 | 1:e392595b4b76 | 31 | |
uci1 | 1:e392595b4b76 | 32 | |
uci1 | 3:24c5f0f50bf1 | 33 | protected: |
uci1 | 6:6f002d202f59 | 34 | virtual SnCommWin::ECommWinResult SendFileContents(FILE* inf, |
uci1 | 6:6f002d202f59 | 35 | const SnConfigFrame& curConf, |
uci1 | 6:6f002d202f59 | 36 | SnEventFrame& evt, |
uci1 | 6:6f002d202f59 | 37 | char* const genBuf, |
uci1 | 6:6f002d202f59 | 38 | uint32_t nevts, |
uci1 | 6:6f002d202f59 | 39 | const uint32_t timeout_clock, |
uci1 | 6:6f002d202f59 | 40 | const uint32_t firstEvt=0)=0; |
uci1 | 1:e392595b4b76 | 41 | public: |
uci1 | 1:e392595b4b76 | 42 | virtual ~SnCommWin() {} |
uci1 | 1:e392595b4b76 | 43 | |
uci1 | 1:e392595b4b76 | 44 | virtual ECommWinResult OpenWindow(const uint32_t timeout, |
uci1 | 1:e392595b4b76 | 45 | const bool sendStatus, |
uci1 | 1:e392595b4b76 | 46 | const SnConfigFrame& conf, |
uci1 | 1:e392595b4b76 | 47 | const SnEventFrame& evt, |
uci1 | 2:e67f7c158087 | 48 | char* const genBuf)=0; |
uci1 | 1:e392595b4b76 | 49 | |
uci1 | 1:e392595b4b76 | 50 | virtual bool Connect(const uint32_t timeout)=0; |
uci1 | 1:e392595b4b76 | 51 | |
uci1 | 3:24c5f0f50bf1 | 52 | virtual ECommWinResult WaitHandshake(const uint32_t timeout, |
uci1 | 3:24c5f0f50bf1 | 53 | char* const buf, |
uci1 | 6:6f002d202f59 | 54 | const uint32_t bsize, |
uci1 | 6:6f002d202f59 | 55 | uint8_t& hndShkCode)=0; |
uci1 | 3:24c5f0f50bf1 | 56 | |
uci1 | 1:e392595b4b76 | 57 | virtual ECommWinResult GetConfig(SnConfigFrame& conf, |
uci1 | 1:e392595b4b76 | 58 | const uint32_t timeOut, |
uci1 | 3:24c5f0f50bf1 | 59 | char* const confBuf, |
uci1 | 3:24c5f0f50bf1 | 60 | const uint32_t bsize)=0; |
uci1 | 1:e392595b4b76 | 61 | |
uci1 | 1:e392595b4b76 | 62 | virtual ECommWinResult SendStatus(const SnConfigFrame& conf, |
uci1 | 1:e392595b4b76 | 63 | const SnEventFrame& evt, |
uci1 | 6:6f002d202f59 | 64 | char* const genBuf, |
uci1 | 6:6f002d202f59 | 65 | const uint32_t timeout_clock)=0; |
uci1 | 1:e392595b4b76 | 66 | |
uci1 | 6:6f002d202f59 | 67 | virtual SnCommWin::ECommWinResult SendFilename(const char* fn, |
uci1 | 6:6f002d202f59 | 68 | char* const genBuf, |
uci1 | 6:6f002d202f59 | 69 | const uint32_t timeout_clock)=0; |
uci1 | 6:6f002d202f59 | 70 | |
uci1 | 6:6f002d202f59 | 71 | ECommWinResult SendData(FILE* inf, const char* infn, |
uci1 | 6:6f002d202f59 | 72 | const SnConfigFrame& curConf, |
uci1 | 6:6f002d202f59 | 73 | SnEventFrame& evt, |
uci1 | 6:6f002d202f59 | 74 | char* const genBuf, |
uci1 | 6:6f002d202f59 | 75 | const uint32_t bsize, |
uci1 | 6:6f002d202f59 | 76 | const uint32_t nevts, |
uci1 | 6:6f002d202f59 | 77 | const uint32_t timeout_clock, |
uci1 | 6:6f002d202f59 | 78 | const uint32_t firstEvt=0); |
uci1 | 6:6f002d202f59 | 79 | |
uci1 | 1:e392595b4b76 | 80 | ECommWinResult SendData(SnConfigFrame& conf, |
uci1 | 1:e392595b4b76 | 81 | SnEventFrame& evt, |
uci1 | 2:e67f7c158087 | 82 | char* const genBuf, |
uci1 | 3:24c5f0f50bf1 | 83 | const uint32_t bsize, |
uci1 | 1:e392595b4b76 | 84 | const uint32_t timeout); |
uci1 | 1:e392595b4b76 | 85 | |
uci1 | 1:e392595b4b76 | 86 | }; |
uci1 | 1:e392595b4b76 | 87 | |
uci1 | 1:e392595b4b76 | 88 | #endif // SN_SnCommWin |