video streaming using websocket. but,streaming is very slower than 0.1fps.
Dependencies: BaseUsbHost EthernetInterface WebSocketClient mbed-rtos mbed
Fork of BaseUsbHost_example by
Diff: example1_UsbFlashDrive.cpp
- Revision:
- 2:c10029b87439
- Parent:
- 1:80205a2de336
- Child:
- 3:6ae9a03a6145
--- a/example1_UsbFlashDrive.cpp Wed Dec 05 13:25:18 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,104 +0,0 @@ -#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 (UsbFlashDrive::check(hub->PortEp[i])) { - ctlEp = hub->PortEp[i]; - break; - } - } - if (ctlEp == NULL) { - error("USB Flash Drive not found\n"); - } - TEST_ASSERT(ctlEp); - - drive = new UsbFlashDrive("usb", ctlEp); - TEST_ASSERT(drive); - - const int size_table[] = { - 1024*1, - 1024*2, - 1024*4, - 1024*8, - 1024*16, - 1024*32, - 1024*64, - 1024*128, - 1204*256, - 1204*512, - }; - - printf("USB FLASH DRIVE read/write test\n"); - - char path[32]; - int size; - Timer t; - for(int n = 0; n <= 9; n++) { - int file_size = size_table[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