Versão estável sem DMA e FFT. 128 amostras.

Dependencies:   EthernetInterface NTPClient mbed-rtos mbed

Committer:
rebonatto
Date:
Tue Jan 05 11:47:35 2016 +0000
Revision:
0:fac116e94d44
Vers?o est?vel sem DMA e FFT. 128 amostras.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rebonatto 0:fac116e94d44 1 #include "TelnetServer.h"
rebonatto 0:fac116e94d44 2
rebonatto 0:fac116e94d44 3 char *header_msg_remove = "File removed successfully\r\n\r\n";
rebonatto 0:fac116e94d44 4 char *wrong_args_msg_remove = "Wrong number of arguments.\r\n\r\nUsage: remove <filename>\r\n";
rebonatto 0:fac116e94d44 5 char *file_not_found_msg_remove = "File not found.\r\n\r\n";
rebonatto 0:fac116e94d44 6
rebonatto 0:fac116e94d44 7 extern LocalFileSystem local;
rebonatto 0:fac116e94d44 8
rebonatto 0:fac116e94d44 9 int TelnetServer::RemoveCommand(TCPSocketConnection *conn,char** argv,int argc)
rebonatto 0:fac116e94d44 10 {
rebonatto 0:fac116e94d44 11
rebonatto 0:fac116e94d44 12 if(argc != 2)
rebonatto 0:fac116e94d44 13 {
rebonatto 0:fac116e94d44 14 conn->send(wrong_args_msg_remove,strlen(wrong_args_msg_remove));
rebonatto 0:fac116e94d44 15 return 0;
rebonatto 0:fac116e94d44 16 }
rebonatto 0:fac116e94d44 17
rebonatto 0:fac116e94d44 18 char fullpath[256];
rebonatto 0:fac116e94d44 19 strcpy(fullpath,"/local/");
rebonatto 0:fac116e94d44 20 strcat(fullpath,argv[1]);
rebonatto 0:fac116e94d44 21 printf("File = %s\n",fullpath);
rebonatto 0:fac116e94d44 22 FILE* f = fopen(fullpath,"r");
rebonatto 0:fac116e94d44 23 if(f == NULL)
rebonatto 0:fac116e94d44 24 {
rebonatto 0:fac116e94d44 25 conn->send(file_not_found_msg_remove,strlen(file_not_found_msg_remove));
rebonatto 0:fac116e94d44 26 return 0;
rebonatto 0:fac116e94d44 27 }
rebonatto 0:fac116e94d44 28
rebonatto 0:fac116e94d44 29 fclose(f);
rebonatto 0:fac116e94d44 30
rebonatto 0:fac116e94d44 31 local.remove(argv[1]);
rebonatto 0:fac116e94d44 32
rebonatto 0:fac116e94d44 33 conn->send(header_msg_remove,strlen(header_msg_remove));
rebonatto 0:fac116e94d44 34
rebonatto 0:fac116e94d44 35 return 0;
rebonatto 0:fac116e94d44 36 }