Arianna autonomous DAQ firmware

Dependencies:   mbed SDFileSystemFilinfo AriSnProtocol NetServicesMin AriSnComm MODSERIAL PowerControlClkPatch DS1820OW

Revision:
8:95a325df1f6b
Parent:
7:079617408fec
Child:
10:3c93db1cfb12
--- a/SnCommAfarTCP.h	Sat Aug 04 01:48:55 2012 +0000
+++ b/SnCommAfarTCP.h	Wed Aug 08 23:27:37 2012 +0000
@@ -4,7 +4,6 @@
 #include "SnCommWin.h"
 #include "string"
 
-class SnConfigFrame;
 class SnEventFrame;
 
 class EthernetInterface;
@@ -17,7 +16,10 @@
  protected:
     bool                 fUseB64;
     std::string          fRserv;
-    int32_t              fRport;
+    uint16_t             fRport;
+    std::string          fMyIp;
+    std::string          fMyMask;
+    std::string          fMyGate;
     EthernetInterface*   fEth;
     TCPSocketConnection* fSock;
     
@@ -25,51 +27,38 @@
              const uint32_t length,
              const uint32_t timeout_clock,
              TCPSendRecv fcn);
-    int ReceiveAll(char* const buf, const uint32_t mlen,
-                   const uint32_t timeout_clock);
-    int SendAll(char* const data, const uint32_t length,
-                const uint32_t timeout_clock);
-
-    virtual SnCommWin::ECommWinResult SendFilename(const char* fn,
-                                                   char* const genBuf,
-                                                   const uint32_t timeout_clock);
-    virtual SnCommWin::ECommWinResult SendFileContents(FILE* inf,
-                                                    const SnConfigFrame& curConf,
-                                                    SnEventFrame& evt,
-                                                    char* const genBuf,
-                                                    uint32_t nevts,
-                                                    const uint32_t timeout_clock,
-                                                    const uint32_t firstEvt=0);
+    virtual int32_t ReceiveAll(char* const buf, const uint32_t mlen,
+                               const uint32_t timeout_clock);
+    virtual int32_t SendAll(char* const data, const uint32_t length,
+                            const uint32_t timeout_clock);
+    virtual SnConfigFrame::EDatPackBit GetCommType() const {
+        return SnConfigFrame::kAfar;
+    }
 
  public:
-    SnCommAfarTCP(const bool useb64,
-                  const char* remote="128.195.204.151",
-                  const int32_t rport=6655); 
+    SnCommAfarTCP(const SnConfigFrame& conf);
     virtual ~SnCommAfarTCP();
     
+    void    Set(const char* remote, const uint16_t rport,
+                const char* myip, const char* mask,
+                const char* gate, const bool useb64);
+    
+    virtual void Set(const SnConfigFrame& conf) {
+        Set(conf.GetRemoteServer(), conf.GetRemotePort(),
+            conf.GetMbedIP(), conf.GetMbedMask(), conf.GetMbedGate(),
+            false);
+        printf("set conf done\r\n");
+    }
+
     virtual bool Connect(const uint32_t timeout);
     
     virtual SnCommWin::ECommWinResult  OpenWindow(const uint32_t timeout,
                                                   const bool sendStatus,
                                                   const SnConfigFrame& conf,
                                                   const SnEventFrame& evt,
+                                                  const SnPowerFrame& pow,
                                                   char* const genBuf);
     
-    virtual SnCommWin::ECommWinResult  WaitHandshake(const uint32_t timeout,
-                                                     char* const buf,
-                                                     const uint32_t bsize,
-                                                     uint8_t& hndShkCode);
-    
-    virtual SnCommWin::ECommWinResult  GetConfig(SnConfigFrame& conf,
-                                                 const uint32_t timeOut,
-                                                 char* const confBuf,
-                                                 const uint32_t bsize);
-
-    virtual SnCommWin::ECommWinResult  SendStatus(const SnConfigFrame& conf,
-                                                  const SnEventFrame& evt,
-                                                  char* const genBuf,
-                                                  const uint32_t timeout_clock);
-
 
 };