fg

Dependencies:   CameraC328 SDFileSystem WIZnetInterface WizFi310Interface_Legacynew2 mbed-src

Fork of Camera_FTP_WIZwiki-W7500 by Ricky Kwon

Files at this revision

API Documentation at this revision

Comitter:
Dxmanas
Date:
Thu Feb 08 06:28:43 2018 +0000
Parent:
5:5cc3d57c04f8
Commit message:
qwer

Changed in this revision

WIZnetInterface.lib Show annotated file Show diff for this revision Revisions of this file
WizFi310Interface_Legacynew.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 5cc3d57c04f8 -r 9f00e2657d78 WIZnetInterface.lib
--- a/WIZnetInterface.lib	Wed Apr 12 02:06:13 2017 +0000
+++ b/WIZnetInterface.lib	Thu Feb 08 06:28:43 2018 +0000
@@ -1,1 +1,1 @@
-http://developer.mbed.org/teams/WIZnet/code/WIZnetInterface/#c91884bd2713
+https://os.mbed.com/users/akshaytom/code/WIZnetInterface/#584efa51ee60
diff -r 5cc3d57c04f8 -r 9f00e2657d78 WizFi310Interface_Legacynew.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/WizFi310Interface_Legacynew.lib	Thu Feb 08 06:28:43 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/Dxmanas/code/WizFi310Interface_Legacynew2/#467115cfab87
diff -r 5cc3d57c04f8 -r 9f00e2657d78 main.cpp
--- a/main.cpp	Wed Apr 12 02:06:13 2017 +0000
+++ b/main.cpp	Thu Feb 08 06:28:43 2018 +0000
@@ -1,6 +1,7 @@
 #include "mbed.h"
 #include "SDFileSystem.h"
-#include "EthernetInterface.h"
+//#include "EthernetInterface.h"
+#include "WizFi310Interface.h"
 #include "CameraC328.h"
 
 /* CAMERA */
@@ -24,8 +25,8 @@
 char ftpServer_data_ip_addr[4]={0,};
 char ftpServer_data_ip_addr_str[20]={0,};
 static char buf[256];
-static char ID[]={"abc"};                   //Set FTPServer Login ID
-static char PASSWORD[]={"123"};             //Set FTPServer Login Password
+static char ID[]={"FTP"};                   //Set FTPServer Login ID
+static char PASSWORD[]={"user"};             //Set FTPServer Login Password
 enum CommandFirst {
     f_nocmd,
     f_put,
@@ -55,12 +56,12 @@
 char fname[32];
 char fname_server[16];
 char fnamecnt=0;
-/* UART */
+///* UART */
 Serial pc(USBTX, USBRX);
 char gMsgBuf[10];
 char User_Keyboard_MSG_Cnt;
-/* CAMERA */
-CameraC328 camera(PA_13, PA_14, CameraC328::Baud115200);
+///* CAMERA */
+//CameraC328 camera(PA_13, PA_14, CameraC328::Baud115200);
 /* Function*/ 
 char* User_Keyboard_MSG(void);
 int pportc(char * arg);
@@ -68,6 +69,16 @@
 void sync(void);
 void test_jpeg_snapshot_picture(void);
 
+#define SECURE WizFi310::SEC_WPA2_MIXED
+#define SSID "cdi1"
+#define PASS "cdilab17"
+ 
+FTPClient FTP(PB_3, PB_2, PB_1, PB_0, "sd"); // WIZwiki-W7500 
+#if defined(TARGET_WIZwiki_W7500)
+WizFi310Interface wizfi310(D1, D0, D7, D6, D8, NC, 115200);
+Serial pc(USBTX, USBRX);
+#endif
+
 int main() {
 
     char Msg_c;
@@ -79,16 +90,19 @@
     
     pc.printf("Hello Home Security World!\r\n"); 
       
-    uint8_t mac_addr[6] = {0x00, 0x08, 0xdc, 0x12, 0x34, 0x45};
-    const char ip_addr[] = "192.168.0.123"; 
-    const char mask_addr[] = "255.255.255.0"; 
-    const char gateway_addr[] = "192.168.0.1"; 
-    const char ftpServer_control_ip_addr[] = "192.168.0.2";
-    
-    
-    EthernetInterface eth;
-    eth.init(mac_addr, ip_addr, mask_addr, gateway_addr); //Use Static
-    eth.connect();
+    //uint8_t mac_addr[6] = {0x00, 0x08, 0xdc, 0x12, 0x34, 0x45};
+//    const char ip_addr[] = "192.168.0.123"; 
+//    const char mask_addr[] = "255.255.255.0"; 
+//    const char gateway_addr[] = "192.168.0.1"; 
+//    const char ftpServer_control_ip_addr[] = "192.168.0.100";
+//    
+//    
+//    EthernetInterface eth;
+//    eth.init(mac_addr, ip_addr, mask_addr, gateway_addr); //Use Static
+//    eth.connect();
+
+     wizfi310.init();
+    if ( wizfi310.connect(SECURE, SSID, PASS, WizFi310::WM_STATION))      return -1;
     
     TCPSocketConnection FTP_CONTROL_SOCK;
     TCPSocketConnection FTP_DATA_SOCK;
@@ -97,15 +111,15 @@
     //while 1
     while(true)
     {
-        pc.printf("\r\n----------------------------------------\r\n");
-        pc.printf("Press menu key\r\n");
-        pc.printf("----------------------------------------\r\n");
-        pc.printf("1> Snapshot Picture and Send FTPServer\r\n");
-        pc.printf("----------------------------------------\r\n");
-        Msg_c = pc.getc();
-        if(Msg_c==0x31){
+        //pc.printf("\r\n----------------------------------------\r\n");
+//        pc.printf("Press menu key\r\n");
+//        pc.printf("----------------------------------------\r\n");
+//        pc.printf("1> Snapshot Picture and Send FTPServer\r\n");
+//        pc.printf("----------------------------------------\r\n");
+//        Msg_c = pc.getc();
+//        if(Msg_c==1){
             
-            test_jpeg_snapshot_picture();
+           // test_jpeg_snapshot_picture();
             ftpclientrun = true;
             while(ftpclientrun){
                 //while 2
@@ -218,7 +232,7 @@
                     }//end of gDataPutGetStart if
                 }//end of while 3                
             }
-        }
+     //   }
     }//end of while 1
 }
 char* User_Keyboard_MSG(void)
@@ -273,7 +287,7 @@
 void sync(void) {
     CameraC328::ErrorNumber err = CameraC328::NoError;
 
-    err = camera.sync();
+//    err = camera.sync();
     if (CameraC328::NoError == err) {
         printf("[ OK ] : CameraC328::sync\r\n");
     } else {
@@ -281,22 +295,22 @@
     }
 }
 void test_jpeg_snapshot_picture(void) {
-    CameraC328::ErrorNumber err = CameraC328::NoError;
+//    CameraC328::ErrorNumber err = CameraC328::NoError;
 
-#if (USE_JPEG_HIGH_RESOLUTION==1)
-    err = camera.init(CameraC328::Jpeg, CameraC328::RawResolution80x60, CameraC328::JpegResolution80x64);
-#elif (USE_JPEG_HIGH_RESOLUTION==2)
-    err = camera.init(CameraC328::Jpeg, CameraC328::RawResolution80x60, CameraC328::JpegResolution160x128);
-#elif (USE_JPEG_HIGH_RESOLUTION==3)
-    err = camera.init(CameraC328::Jpeg, CameraC328::RawResolution80x60, CameraC328::JpegResolution320x240);
-#elif (USE_JPEG_HIGH_RESOLUTION==4)
-    err = camera.init(CameraC328::Jpeg, CameraC328::RawResolution80x60, CameraC328::JpegResolution640x480);
-#endif
-    if (CameraC328::NoError == err) {
-        printf("[ OK ] : CameraC328::init\r\n");
-    } else {
-        printf("[FAIL] : CameraC328::init (Error=%02X)\r\n", (int)err);
-    }
+//#if (USE_JPEG_HIGH_RESOLUTION==1)
+//    err = camera.init(CameraC328::Jpeg, CameraC328::RawResolution80x60, CameraC328::JpegResolution80x64);
+//#elif (USE_JPEG_HIGH_RESOLUTION==2)
+//    err = camera.init(CameraC328::Jpeg, CameraC328::RawResolution80x60, CameraC328::JpegResolution160x128);
+//#elif (USE_JPEG_HIGH_RESOLUTION==3)
+//    err = camera.init(CameraC328::Jpeg, CameraC328::RawResolution80x60, CameraC328::JpegResolution320x240);
+//#elif (USE_JPEG_HIGH_RESOLUTION==4)
+//    err = camera.init(CameraC328::Jpeg, CameraC328::RawResolution80x60, CameraC328::JpegResolution640x480);
+//#endif
+//    if (CameraC328::NoError == err) {
+//        printf("[ OK ] : CameraC328::init\r\n");
+//    } else {
+//        printf("[FAIL] : CameraC328::init (Error=%02X)\r\n", (int)err);
+//    }
 
 
     snprintf(fname, sizeof(fname), "/sd/jpss%04d.jpg", fnamecnt);
@@ -306,12 +320,12 @@
     }
     fp_jpeg = fopen(fname, "w");
 
-    err = camera.getJpegSnapshotPicture(jpeg_callback);
-    if (CameraC328::NoError == err) {
-        printf("[ OK ] : CameraC328::getJpegSnapshotPicture\r\n");
-    } else {
-        printf("[FAIL] : CameraC328::getJpegSnapshotPicture (Error=%02X)\r\n", (int)err);
-    }
+//    err = camera.getJpegSnapshotPicture(jpeg_callback);
+//    if (CameraC328::NoError == err) {
+//        printf("[ OK ] : CameraC328::getJpegSnapshotPicture\r\n");
+//    } else {
+//        printf("[FAIL] : CameraC328::getJpegSnapshotPicture (Error=%02X)\r\n", (int)err);
+//    }
 
     fclose(fp_jpeg);