Webcam Server.
Dependencies: uvchost FatFileSystem mbed HTTPServer NetServicesMin
WebcamServer.cpp
00001 #include "mbed.h" 00002 #include "uvc.h" 00003 #include "EthernetNetIf.h" 00004 //#include "WIZ820ioNetIf.h" 00005 #include "HTTPServer.h" 00006 #include "WebcamServerConfig.h" 00007 #include "WebcamHandler.h" 00008 #include "WebcamInput.h" 00009 Serial pc(USBTX, USBRX); 00010 00011 HTTPServer svr; 00012 00013 EthernetNetIf eth; 00014 //WIZ820ioNetIf eth; 00015 00016 00017 uvc* Webcam[CAM_COUNT]; 00018 00019 int main() { 00020 pc.baud(921600); 00021 printf("%s\n", __FILE__); 00022 00023 for(int i = 0; i < CAM_COUNT; i++) { 00024 uvc* cam = new uvc(i); 00025 cam->SetImageSize(160, 120); 00026 WebcamInput* input = new WebcamInput(i); 00027 cam->attach(input); 00028 if (cam->setup() < 0) exit(1); 00029 Webcam[i] = cam; 00030 } 00031 00032 int ethErr = eth.setup(); 00033 if (ethErr < 0) exit(1); 00034 IpAddr ip = eth.getIp(); 00035 printf("http://%d.%d.%d.%d/\n", ip[0], ip[1], ip[2], ip[3]); 00036 svr.addHandler<WebcamHandler>("/"); 00037 svr.bind(80); 00038 00039 while(1) { 00040 Net::poll(); 00041 for(int i = 0; i < CAM_COUNT; i++) { 00042 Webcam[i]->poll(); 00043 } 00044 } 00045 }
Generated on Sat Jul 23 2022 11:10:59 by 1.7.2