video streaming using websocket. but,streaming is very slower than 0.1fps.

Dependencies:   BaseUsbHost EthernetInterface WebSocketClient mbed-rtos mbed

Fork of BaseUsbHost_example by Norimasa Okamoto

viewer

Revision:
0:2a9734a95d55
Child:
1:80205a2de336
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/UsbMouseHost/UsbMouseHost.cpp	Tue Dec 04 13:39:57 2012 +0000
@@ -0,0 +1,42 @@
+// UsbMouseHost.cpp
+#include "mbed.h"
+#include "rtos.h"
+#include "BaseUsbHost.h"
+//#define DEBUG
+#include "BaseUsbHostDebug.h"
+#define TEST
+#include "BaseUsbHostTest.h"
+#include "UsbMouseHost.h"
+
+UsbMouseHost::UsbMouseHost(ControlEp* ctlEp)
+{
+    if (ctlEp == NULL) { // root hub
+        DBG_OHCI(LPC_USB->HcRhPortStatus1);
+        int lowSpeed = 0;
+        if (LPC_USB->HcRhPortStatus1 & 0x200) {
+            lowSpeed = 1;
+        }
+        m_ctlEp = new ControlEp(lowSpeed);
+        TEST_ASSERT_TRUE(m_ctlEp);
+    } else {
+        m_ctlEp = ctlEp;
+    }
+
+    int rc = m_ctlEp->SetConfiguration(1);
+    TEST_ASSERT_EQUAL(rc, USB_OK);
+
+    int addr = m_ctlEp->GetAddr();
+    int lowSpeed = m_ctlEp->GetLowSpeed();
+    m_intEp = new InterruptEp(addr, 0x81, 8, lowSpeed);
+    TEST_ASSERT_TRUE(m_intEp);
+}
+
+int UsbMouseHost::read(uint32_t* status, int millisec)
+{
+    int rc = m_intEp->read(reinterpret_cast<uint8_t*>(status), 4, millisec);
+    if (rc < 0) { // error?
+        *status = 0x00000000;
+        return rc;
+    }
+    return USB_OK;
+}