[dss-commits] r8794 - dss/trunk/unix

dss-commits at forum.digitalstrom.org dss-commits at forum.digitalstrom.org
Wed Sep 23 18:13:26 CEST 2009


Author: pstaehlin
Date: 2009-09-23 18:13:26 +0200 (Wed, 23 Sep 2009)
New Revision: 8794

Modified:
   dss/trunk/unix/ds485proxy.cpp
Log:
Log contents of sent/received packets


Modified: dss/trunk/unix/ds485proxy.cpp
===================================================================
--- dss/trunk/unix/ds485proxy.cpp	2009-09-23 15:34:07 UTC (rev 8793)
+++ dss/trunk/unix/ds485proxy.cpp	2009-09-23 16:13:26 UTC (rev 8794)
@@ -475,6 +475,20 @@
        	m_DS485Controller.enqueueFrame(_frame);
       }
     }
+    std::ostringstream sstream;
+    sstream << "Frame content: ";
+    PayloadDissector pd(_frame.getPayload());
+    while(!pd.isEmpty()) {
+      uint8_t data = pd.get<uint8_t>();
+      sstream << "(0x" << std::hex << (unsigned int)data << ", " << std::dec << (int)data << "d)";
+    }
+    sstream << std::dec;
+    sstream << " to " << int(_frame.getHeader().getDestination());
+    if(broadcast) {
+      sstream << " as broadcast";
+    }
+    log(sstream.str());
+
     boost::shared_ptr<DS485CommandFrame> pFrame(new DS485CommandFrame);
     *pFrame = _frame;
     // relay the frame to update our state
@@ -1165,6 +1179,12 @@
     case FunctionDSLinkInterrupt:
       return "Function DSLink Interrupt";
       
+    case FunctionZoneAddDevice:
+      return "Function Zone Add Device";
+    case FunctionZoneRemoveDevice:
+      return "Function Zone Remove Device";
+    case FunctionDeviceAddToGroup:
+      return "Function Device Add To Group";
     case EventNewDS485Device:
       return "Event New DS485 Device";
     case EventLostDS485Device:
@@ -1210,7 +1230,18 @@
             if(functionIDStr.empty()) {
               functionIDStr = "Unknown function id: " + intToString(functionID, true);
             }
-            log("Got request: " + functionIDStr);
+            std::ostringstream sstream;
+            sstream << "Got request: " << functionIDStr << " from " << int(frame->getHeader().getSource()) << " ";
+
+            PayloadDissector pdDump(frame->getPayload());
+            while(!pdDump.isEmpty()) {
+              uint8_t data = pdDump.get<uint8_t>();
+              sstream << "(0x" << std::hex << (unsigned int)data << ", " << std::dec << (int)data << "d)";
+            }
+            sstream << std::dec;
+            log(sstream.str());
+
+
             PayloadDissector pd(frame->getPayload());
 
             if(frame->getFrameSource() == fsWire) {
@@ -1298,6 +1329,7 @@
               sstream << "(0x" << std::hex << (unsigned int)data << ", " << std::dec << (int)data << "d)";
             }
             sstream << std::dec;
+            sstream << " from " << int(frame->getHeader().getSource());
             log(sstream.str());
 
             log(string("Response for: ") + FunctionIDToString(functionID));



More information about the dss-commits mailing list