Versão do protegemed que calcula o tempo em ms da fuga, calcula o numero de onverflow (valores muito baixo) e underflow (valores muito altos). Além disso, calcula um valor médio a partir dos valores capturados e não apenas pela fft.

Dependencies:   EthernetInterface mbed-rtos mbed

Committer:
rebonatto
Date:
Wed Jul 09 21:16:23 2014 +0000
Revision:
0:c64e1194230b
Vers?o do Protegemed com calculo de tempo de fuga, overflow, underflow e novo valor m?dio (manual).

Who changed what in which revision?

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