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/example1_UsbFlashDrive.cpp	Tue Dec 04 13:39:57 2012 +0000
@@ -0,0 +1,90 @@
+#if 0
+#include "mbed.h"
+#include "rtos.h"
+#include "BaseUsbHost.h"
+#define DEBUG
+#include "BaseUsbHostDebug.h"
+#define TEST
+#include "BaseUsbHostTest.h"
+#include "UsbFlashDrive.h"
+
+DigitalOut led1(LED1), led2(LED2), led3(LED3), led4(LED4);
+Serial pc(USBTX, USBRX);
+
+BaseUsbHost *UsbHost;
+UsbHub* hub;
+ControlEp* ctlEp = NULL;
+UsbFlashDrive* drive;
+int main() {
+    pc.baud(921600);
+    printf("%s\n", __FILE__);
+
+    UsbHost = new BaseUsbHost;
+    TEST_ASSERT_TRUE(UsbHost);
+
+    UsbHub* hub = new UsbHub();
+    TEST_ASSERT_TRUE(hub);
+
+    for(int i = 0; i < MAX_HUB_PORT; i++) {
+        if (hub->PortEp[i]) {
+            if (hub->PortEp[i]->DeviceClass == 0x01) {  
+                ctlEp = hub->PortEp[i];
+                break;
+            }
+        }
+    }
+
+    drive = new UsbFlashDrive("usb", ctlEp);
+    TEST_ASSERT(drive);
+
+
+    const int file_size = 1024*256;
+    printf("USB FLASH DRIVE read/write file size: %d bytes\n", file_size);
+    
+    char path[32];
+    int size;
+    Timer t;
+    for(int n = 0; n <= 9; n++) {
+        sprintf(path, "/usb/test%d.txt", n);
+        FILE* fp = fopen(path, "wb");
+        size = 0;
+        t.reset();
+        t.start();
+        if (fp) {
+            for(int i = 0; i < file_size; i++) {
+                int c = i & 0xff;
+                fputc(c, fp);
+                size++;
+            }
+            t.stop();
+            fclose(fp);
+        }
+        printf("write file %d bytes %d ms %s\n", size, t.read_ms(), path);
+        led1 = !led1;
+    }
+    
+    for(int n = 0; n <=9; n++) {
+        sprintf(path, "/usb/test%d.txt", n);
+        FILE* fp = fopen(path, "rb");
+        size = 0;
+        t.reset();
+        t.start();
+        if (fp) {
+            while(1) {
+                int c = fgetc(fp);
+                if (c == EOF) {
+                    break;
+                }
+                size++;
+            } 
+            t.stop();
+            fclose(fp);
+        }
+        printf("read file %d bytes %d ms %s\n", size, t.read_ms(), path);
+        led2 = !led2;
+    }
+
+    exit(1);
+}
+
+#endif