FTPGET

Dependencies:   SDFileSystem dspmodified mbed

Fork of fft_merge_main_codev1 by Testbed

Revision:
14:1e0b8a2d3942
Parent:
13:78f55c942044
Child:
15:e8defe4bdd37
--- a/main.cpp	Mon Jan 26 05:31:21 2015 +0000
+++ b/main.cpp	Mon Jan 26 07:44:22 2015 +0000
@@ -33,6 +33,7 @@
 char pathDC[100]   ="";
 char pathDCdetect[100]   ="";
 char pathfft[100]="";
+//char putpathname[100]="";
 char filenameAC[100]   ="";
 char filenameDC[100]   ="";
 char filenamefft[100]   ="";
@@ -136,6 +137,7 @@
             sprintf(hour_dir,"%s/%s%02d%02d%02d%02d",date_dir,sitename,year,month,date,hour);
             sprintf(filepath,"%s/%s%02d%02d%02d%02d%02d%02d",hour_dir,sitename,year,month,date,hour,minute,second);
             sprintf(filename,"%s%02d%02d%02d%02d%02d%02d",sitename,year,month,date,hour,minute,second);
+            //sprintf(putpathname,
             gsmerr=0;
             mkdir(main_dir,0777);
             mkdir(month_dir,0777);
@@ -478,8 +480,18 @@
     sprintf(ftpfilepath,"%s",pathfft);
     char command1[40];
     char result1[20];
+    char command2 [100];
+    char result2 [20];
+   
+   
     sprintf(command1,"%s\"%s\"", "AT+FTPPUTNAME=", ftpfilename);
     sprintf(result1,"%s", "OK");
+    pc.printf("\n\r %s \n\r",ftpfilepath);
+    sprintf(ftpfilepath1,"%s",ftpfilepath);
+    memset(ftpfilepath1,'\0',3);
+    pc.printf("\n\r %s \n\r",ftpfilepath1);
+   
+   
     //sd card
     int char_cnt=0;
     char file_data[1294];
@@ -500,9 +512,10 @@
     for(int putname_attempt=0; putname_attempt<2; putname_attempt++) {
         pc.printf("\r\nftp_put attempt\n\r");
         if(sendATcommand(command1,result1, 10,0)) {
-            //  pc.printf("\n %p",ftpfilename);
-            sendATcommand("AT+FTPPUTPATH=\"/Trial/\"", "OK", 5,0);
-            if(sendATcommand("AT+FTPPUT=1", "OK", 5,0)) {
+             sprintf(command2,"%s\%s\"", "AT+FTPPUTPATH=\"", ftpfilepath);
+             sprintf(result2,"%s", "OK");
+             sendATcommand(command2,result2, 10,0);
+             if(sendATcommand("AT+FTPPUT=1", "OK", 5,0)) {
                 wait(8);
                 // pc.printf("in loop");
                 // pc.printf("\n\r %s",ftpfilepath);