Arianna autonomous DAQ firmware

Dependencies:   mbed SDFileSystemFilinfo AriSnProtocol NetServicesMin AriSnComm MODSERIAL PowerControlClkPatch DS1820OW

Committer:
uci1
Date:
Fri Aug 10 18:35:43 2012 +0000
Revision:
10:3c93db1cfb12
Parent:
8:95a325df1f6b
Child:
12:d472f9811262
Ensure that lockRegisters (p20) is 0 before accessing the SD card, for example when closing the file. This fixes an issue seen when running in power count mode. Communications still under dev. Many debug outputs.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
uci1 3:24c5f0f50bf1 1 #ifndef SN_SnCommAfarTCP
uci1 3:24c5f0f50bf1 2 #define SN_SnCommAfarTCP
uci1 7:079617408fec 3
uci1 3:24c5f0f50bf1 4 #include "SnCommWin.h"
uci1 6:6f002d202f59 5 #include "string"
uci1 3:24c5f0f50bf1 6
uci1 3:24c5f0f50bf1 7 class SnEventFrame;
uci1 3:24c5f0f50bf1 8
uci1 3:24c5f0f50bf1 9 class EthernetInterface;
uci1 3:24c5f0f50bf1 10 class TCPSocketConnection;
uci1 3:24c5f0f50bf1 11
uci1 3:24c5f0f50bf1 12 class SnCommAfarTCP : public SnCommWin {
uci1 5:9cea89700c66 13 public:
uci1 6:6f002d202f59 14 typedef int (TCPSocketConnection::*TCPSendRecv)(char*, int);
uci1 5:9cea89700c66 15
uci1 3:24c5f0f50bf1 16 protected:
uci1 6:6f002d202f59 17 bool fUseB64;
uci1 6:6f002d202f59 18 std::string fRserv;
uci1 8:95a325df1f6b 19 uint16_t fRport;
uci1 8:95a325df1f6b 20 std::string fMyIp;
uci1 8:95a325df1f6b 21 std::string fMyMask;
uci1 8:95a325df1f6b 22 std::string fMyGate;
uci1 3:24c5f0f50bf1 23 EthernetInterface* fEth;
uci1 3:24c5f0f50bf1 24 TCPSocketConnection* fSock;
uci1 3:24c5f0f50bf1 25
uci1 6:6f002d202f59 26 int DoIO(char* const data,
uci1 6:6f002d202f59 27 const uint32_t length,
uci1 6:6f002d202f59 28 const uint32_t timeout_clock,
uci1 6:6f002d202f59 29 TCPSendRecv fcn);
uci1 8:95a325df1f6b 30 virtual int32_t ReceiveAll(char* const buf, const uint32_t mlen,
uci1 8:95a325df1f6b 31 const uint32_t timeout_clock);
uci1 8:95a325df1f6b 32 virtual int32_t SendAll(char* const data, const uint32_t length,
uci1 8:95a325df1f6b 33 const uint32_t timeout_clock);
uci1 8:95a325df1f6b 34 virtual SnConfigFrame::EDatPackBit GetCommType() const {
uci1 8:95a325df1f6b 35 return SnConfigFrame::kAfar;
uci1 8:95a325df1f6b 36 }
uci1 3:24c5f0f50bf1 37
uci1 3:24c5f0f50bf1 38 public:
uci1 8:95a325df1f6b 39 SnCommAfarTCP(const SnConfigFrame& conf);
uci1 3:24c5f0f50bf1 40 virtual ~SnCommAfarTCP();
uci1 3:24c5f0f50bf1 41
uci1 8:95a325df1f6b 42 void Set(const char* remote, const uint16_t rport,
uci1 8:95a325df1f6b 43 const char* myip, const char* mask,
uci1 8:95a325df1f6b 44 const char* gate, const bool useb64);
uci1 8:95a325df1f6b 45
uci1 8:95a325df1f6b 46 virtual void Set(const SnConfigFrame& conf) {
uci1 8:95a325df1f6b 47 Set(conf.GetRemoteServer(), conf.GetRemotePort(),
uci1 8:95a325df1f6b 48 conf.GetMbedIP(), conf.GetMbedMask(), conf.GetMbedGate(),
uci1 8:95a325df1f6b 49 false);
uci1 8:95a325df1f6b 50 printf("set conf done\r\n");
uci1 8:95a325df1f6b 51 }
uci1 8:95a325df1f6b 52
uci1 3:24c5f0f50bf1 53 virtual bool Connect(const uint32_t timeout);
uci1 3:24c5f0f50bf1 54
uci1 3:24c5f0f50bf1 55 virtual SnCommWin::ECommWinResult OpenWindow(const uint32_t timeout,
uci1 3:24c5f0f50bf1 56 const bool sendStatus,
uci1 3:24c5f0f50bf1 57 const SnConfigFrame& conf,
uci1 3:24c5f0f50bf1 58 const SnEventFrame& evt,
uci1 8:95a325df1f6b 59 const SnPowerFrame& pow,
uci1 10:3c93db1cfb12 60 const uint16_t seq,
uci1 10:3c93db1cfb12 61 const float thmrate,
uci1 10:3c93db1cfb12 62 const float evtrate,
uci1 3:24c5f0f50bf1 63 char* const genBuf);
uci1 3:24c5f0f50bf1 64
uci1 3:24c5f0f50bf1 65
uci1 3:24c5f0f50bf1 66 };
uci1 7:079617408fec 67
uci1 3:24c5f0f50bf1 68 #endif // SN_SnCommAfarTCP