@@ -56,7 +56,7 | |||||
56 |
|
56 | |||
57 | typedef struct control_module_parameters cmp; |
|
57 | typedef struct control_module_parameters cmp; | |
58 |
|
58 | |||
59 |
|
59 | cmp parameters; | ||
60 | /* |
|
60 | /* | |
61 | * Zona de declaracion de cabeceras. |
|
61 | * Zona de declaracion de cabeceras. | |
62 | */ |
|
62 | */ | |
@@ -79,7 +79,7 | |||||
79 |
|
79 | |||
80 | int servSocket; |
|
80 | int servSocket; | |
81 | int clntSocket; |
|
81 | int clntSocket; | |
82 | cmp parameters; |
|
82 | ||
83 |
|
83 | |||
84 | char *rx_buffer = (char *) malloc(TAM_BUFFER); |
|
84 | char *rx_buffer = (char *) malloc(TAM_BUFFER); | |
85 | char *tx_buffer = (char *) malloc(TAM_BUFFER); |
|
85 | char *tx_buffer = (char *) malloc(TAM_BUFFER); | |
@@ -230,10 +230,7 | |||||
230 | tx_data = "OK"; |
|
230 | tx_data = "OK"; | |
231 | } |
|
231 | } | |
232 | else if(strcmp(cmd,"CHGB") == 0){ |
|
232 | else if(strcmp(cmd,"CHGB") == 0){ | |
233 |
|
|
233 | cambia_apuntamiento(rx_data); | |
234 | printf("%s\n",rx_data); |
|
|||
235 | //cambia_apuntamiento(rx_data); |
|
|||
236 | cambia_apuntamiento("1"); |
|
|||
237 | tx_data = (char*)malloc(3); |
|
234 | tx_data = (char*)malloc(3); | |
238 | tx_data = "OK"; |
|
235 | tx_data = "OK"; | |
239 |
|
236 | |||
@@ -265,6 +262,8 | |||||
265 | strcat(tx_buffer,tx_data); |
|
262 | strcat(tx_buffer,tx_data); | |
266 | strcat(tx_buffer,":"); |
|
263 | strcat(tx_buffer,":"); | |
267 | strcat(tx_buffer,crc); |
|
264 | strcat(tx_buffer,crc); | |
|
265 | strcat(tx_buffer,":"); | |||
|
266 | strcat(tx_buffer,"quit"); | |||
268 |
|
267 | |||
269 | } |
|
268 | } | |
270 |
|
269 | |||
@@ -325,7 +324,7 | |||||
325 | // la longitud del archivo |
|
324 | // la longitud del archivo | |
326 | fread(buffer_temporal, sizeof(char), num_bytes, Archivo_Fd); |
|
325 | fread(buffer_temporal, sizeof(char), num_bytes, Archivo_Fd); | |
327 |
|
326 | |||
328 |
char *puntero= strstr(buffer_temporal,".ab |
|
327 | char *puntero= strstr(buffer_temporal,".ab1"); // Se procede a eliminar la cabecera del archivo | |
329 | puntero= puntero + 12; |
|
328 | puntero= puntero + 12; | |
330 |
|
329 | |||
331 | buff_experimento = (char *) malloc(7*(num_filas-3)); // num_bytes_fila*(num_filas-3); |
|
330 | buff_experimento = (char *) malloc(7*(num_filas-3)); // num_bytes_fila*(num_filas-3); | |
@@ -356,7 +355,7 | |||||
356 |
|
355 | |||
357 | int base= 7*puntero; // base= cantidad_bytes del dato x puntero |
|
356 | int base= 7*puntero; // base= cantidad_bytes del dato x puntero | |
358 | // cantidad de bytes es el numero de bytes que |
|
357 | // cantidad de bytes es el numero de bytes que | |
359 |
printf("%s\n |
|
358 | printf("%s\n",puntero_char); // contiene cada dato, para este caso es 7 | |
360 | // porque es 6 bits de datos + 1 bit del cambio |
|
359 | // porque es 6 bits de datos + 1 bit del cambio | |
361 | // de linea. |
|
360 | // de linea. | |
362 | char valor_char; |
|
361 | char valor_char; | |
@@ -366,8 +365,7 | |||||
366 |
|
365 | |||
367 | int offset; // Defino offset para el desplazamiento a traves |
|
366 | int offset; // Defino offset para el desplazamiento a traves | |
368 | for(offset=0;offset<6;offset++){ // de cada dato que se obtiene del "buff_experimento" |
|
367 | for(offset=0;offset<6;offset++){ // de cada dato que se obtiene del "buff_experimento" | |
369 | printf("tp1\n"); |
|
368 | ||
370 | printf("%i\n",base+offset); |
|
|||
371 | valor_char= buff_experimento[base+offset]; // Obtengo el dato |
|
369 | valor_char= buff_experimento[base+offset]; // Obtengo el dato | |
372 |
|
370 | |||
373 | if (valor_char == '0'){ // Obtengo el número acumulado segun sea un cero o un uno |
|
371 | if (valor_char == '0'){ // Obtengo el número acumulado segun sea un cero o un uno | |
@@ -378,11 +376,8 | |||||
378 | acumulado_unos= acumulado_unos + (1 << desplazamiento[offset]); |
|
376 | acumulado_unos= acumulado_unos + (1 << desplazamiento[offset]); | |
379 | } |
|
377 | } | |
380 | } |
|
378 | } | |
381 | printf("tp2\n"); |
|
|||
382 | pio_out(pioc, maskc_out, acumulado_unos, 1); |
|
379 | pio_out(pioc, maskc_out, acumulado_unos, 1); | |
383 | printf("tp3\n"); |
|
|||
384 | pio_out(pioc, maskc_out, acumulado_ceros, 0); |
|
380 | pio_out(pioc, maskc_out, acumulado_ceros, 0); | |
385 | printf("tp4\n"); |
|
|||
386 |
|
381 | |||
387 | return 1; |
|
382 | return 1; | |
388 |
|
383 | |||
@@ -401,6 +396,7 | |||||
401 | FILE *fd; |
|
396 | FILE *fd; | |
402 | fd=fopen(filename,"w"); |
|
397 | fd=fopen(filename,"w"); | |
403 | fprintf(fd,"%s\n","Verificacion"); |
|
398 | fprintf(fd,"%s\n","Verificacion"); | |
|
399 | fprintf(fd,"%s",parameters.ID); | |||
404 | fprintf(fd,"%s\n","------------"); |
|
400 | fprintf(fd,"%s\n","------------"); | |
405 | cnt=0; |
|
401 | cnt=0; | |
406 | do |
|
402 | do | |
@@ -437,15 +433,18 | |||||
437 |
|
433 | |||
438 | fclose(fd); |
|
434 | fclose(fd); | |
439 |
|
435 | |||
440 | return 7*atoi(numero_muestras) + 26 + 1; //incluye eof |
|
436 | return 7*atoi(numero_muestras) + 26 + 4 + 1; //incluye eof | |
441 | } |
|
437 | } | |
442 |
|
438 | |||
443 | char* File2buffer(char *filename, int n){ |
|
439 | char* File2buffer(char *filename, int n){ | |
444 | FILE *fd; |
|
440 | FILE *fd; | |
445 | char* tx_data = (char *)malloc(n); |
|
441 | char* tx_data = (char *)malloc(n); | |
446 | fd = fopen(filename,"r"); |
|
442 | fd = fopen(filename,"r"); | |
447 | fread(tx_data, 1, n, fd); |
|
443 | fread(tx_data, 1, n-1, fd); | |
448 | fclose(fd); |
|
444 | fclose(fd); | |
|
445 | tx_data = tx_data + n - 1; | |||
|
446 | *tx_data = '\0'; | |||
|
447 | tx_data = tx_data - n + 1; | |||
449 | return tx_data; |
|
448 | return tx_data; | |
450 | } |
|
449 | } | |
451 |
|
450 |
General Comments 0
You need to be logged in to leave comments.
Login now