Index: trunk/abscontrol/source/Control_Module
===================================================================
diff --git a/trunk/abscontrol/source/Control_Module b/trunk/abscontrol/source/Control_Module
deleted file mode 10644
--- a/trunk/abscontrol/source/Control_Module (revision 19)
+++ /dev/null (revision 20)
Index: trunk/abscontrol/source/Control_Module_Test
===================================================================
diff --git a/trunk/abscontrol/source/Control_Module_Test b/trunk/abscontrol/source/Control_Module_Test
deleted file mode 10644
--- a/trunk/abscontrol/source/Control_Module_Test (revision 19)
+++ /dev/null (revision 20)
Index: trunk/abscontrol/source/absc/ABS_Client_v2/.cproject
===================================================================
diff --git a/trunk/abscontrol/source/absc/ABS_Client_v2/.cproject b/trunk/abscontrol/source/absc/ABS_Client_v2/.cproject
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/abscontrol/source/absc/ABS_Client_v2/.cproject (revision 20)
@@ -0,0 +1,593 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: trunk/abscontrol/source/absc/ABS_Client_v2/.project
===================================================================
diff --git a/trunk/abscontrol/source/absc/ABS_Client_v2/.project b/trunk/abscontrol/source/absc/ABS_Client_v2/.project
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/abscontrol/source/absc/ABS_Client_v2/.project (revision 20)
@@ -0,0 +1,81 @@
+
+
+ ABS_Client_v2
+
+
+
+
+
+ org.eclipse.cdt.managedbuilder.core.genmakebuilder
+ clean,full,incremental,
+
+
+ ?name?
+
+
+
+ org.eclipse.cdt.make.core.append_environment
+ true
+
+
+ org.eclipse.cdt.make.core.autoBuildTarget
+ all
+
+
+ org.eclipse.cdt.make.core.buildArguments
+
+
+
+ org.eclipse.cdt.make.core.buildCommand
+ make
+
+
+ org.eclipse.cdt.make.core.buildLocation
+ ${workspace_loc:/ABS_Client_v2/Debug}
+
+
+ org.eclipse.cdt.make.core.cleanBuildTarget
+ clean
+
+
+ org.eclipse.cdt.make.core.contents
+ org.eclipse.cdt.make.core.activeConfigSettings
+
+
+ org.eclipse.cdt.make.core.enableAutoBuild
+ false
+
+
+ org.eclipse.cdt.make.core.enableCleanBuild
+ true
+
+
+ org.eclipse.cdt.make.core.enableFullBuild
+ true
+
+
+ org.eclipse.cdt.make.core.fullBuildTarget
+ all
+
+
+ org.eclipse.cdt.make.core.stopOnError
+ true
+
+
+ org.eclipse.cdt.make.core.useDefaultBuildCmd
+ true
+
+
+
+
+ org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
+
+
+
+
+
+ org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
+ org.eclipse.cdt.managedbuilder.core.managedBuildNature
+ org.eclipse.cdt.core.cnature
+
+
Index: trunk/abscontrol/source/absc/ABS_Client_v2/ABS_Client.c
===================================================================
diff --git a/trunk/abscontrol/source/absc/ABS_Client_v2/ABS_Client.c b/trunk/abscontrol/source/absc/ABS_Client_v2/ABS_Client.c
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/abscontrol/source/absc/ABS_Client_v2/ABS_Client.c (revision 20)
@@ -0,0 +1,283 @@
+/*
+ * ABS_Client.c
+ *
+ * Fecha de creacion : Set, 2012
+ * Ultima modificacion : Oct 2012
+ * Autor : Christiane Dietrich.
+ */
+//#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "./Librerias/Mensajes.h"
+
+#define PUERTO_SERVIDOR 7000
+//#define DIR_SERVIDOR "192.168.1.30"
+
+/* Servidor */
+#define TAM_BUFFER 10000
+/* Servidor */
+
+
+int ABS_Client(char *header, char *addrClient, char *addrServer ,char *opcion, char *valor_help){
+
+ int conexion_clienteFD;
+ struct sockaddr_in inf_servidor;
+
+ int broadcast= 1;
+ int resultado;
+ int numbytes_enviados;
+
+ long lSize=0;
+ size_t size_of_filecontent=0;
+
+ char *head= NULL;
+ char *tx= NULL;
+ char *rx= NULL;
+ char *comando= NULL;
+ char *data= NULL;
+ char *helper= ":";
+ char *tx_buff= NULL;
+ unsigned int indicator = 1;
+
+ head = (char*) malloc (sizeof(char)*(strlen(header)+1));
+ if (head == NULL) {
+ printf("Memory error");
+ return -1;
+ }
+ strcpy (head, header);
+
+ tx = (char*) malloc (sizeof(char)*(strlen(addrClient)+1));
+ if (tx == NULL) {
+ printf("Memory error");
+ return -1;
+ }
+ strcpy (tx, addrClient);
+
+ rx = (char*) malloc (sizeof(char)*(strlen(addrServer)+1));
+ if (rx == NULL) {
+ printf("Memory error");
+ return -1;
+ }
+ strcpy (rx, addrServer);
+
+ /* determine comand */
+ if(strcmp(opcion,"-f") == 0){
+ comando= "SNDF";
+ FILE * file_to_send= NULL;
+ file_to_send = fopen(valor_help, "r");
+ if (!file_to_send){
+ printf("The file provided for the Control Modules couldn't be opened!!!\n");
+ return -1;
+ }
+ else{
+ // obtain file size:
+ fseek (file_to_send, 0 , SEEK_END);
+ lSize = ftell (file_to_send);
+ rewind (file_to_send);
+
+ // allocate memory to contain the whole file:
+ data = (char*) malloc (sizeof(char)*(lSize+1));
+ if (data == NULL) {
+ printf("Memory error");
+ return -1;
+ }
+
+ // copy the file into the data:
+ size_of_filecontent = fread (data,1,lSize,file_to_send);
+
+ if (size_of_filecontent != lSize) {
+ printf ("Reading error");
+ return -1;
+ }
+
+ /* the whole file is now loaded in the memory data. */
+ // terminate
+ fclose (file_to_send);
+ }
+ }else if (strcmp(opcion,"-c") == 0){ // Se reconoce el comando que se esta enviando
+ comando= "CHGB";
+ data = (char*) malloc (sizeof(char)*(strlen(valor_help)+1));
+ //data = (char *) malloc(strlen(valor)+1);
+ if (data == NULL) {
+ printf("Memory error");
+ return -1;
+ }
+ strcpy (data, valor_help);
+ }else if(strcmp(opcion,"-a") == 0){
+ comando= "ANST";
+ data = (char*) malloc (sizeof(char)*(strlen(valor_help)+1));
+ //data = (char *) malloc(strlen(valor)+1);
+ if (data == NULL) {
+ printf("Memory error");
+ return -1;
+ }
+ strcpy (data, valor_help);
+ }else {
+ ERROR("OPCION INCORRECTA: {-c|-a|-f}");
+ return -1;
+ }
+
+ //complete tx frame
+ tx_buff= (char *) malloc(strlen(head)+1+strlen(tx)+1+strlen(rx)+1+strlen(comando)+1+strlen(data)+1);
+ // Se arma el buffer a ser enviado.
+ strcpy(tx_buff,head);
+ strcat(tx_buff,helper);
+ strcat(tx_buff,tx);
+ strcat(tx_buff,helper);
+ strcat(tx_buff,rx);
+ strcat(tx_buff,helper);
+ strcat(tx_buff,comando);
+ strcat(tx_buff,helper);
+ strcat(tx_buff,data);
+ strcat(tx_buff,helper);
+
+
+ /* Se establece el socket UDP */
+ conexion_clienteFD= socket(AF_INET,SOCK_DGRAM,0);
+ if (conexion_clienteFD == -1){
+ ERROR("No se pudo establecer el socket: socket()");
+ return -1;
+ }
+
+ /* Se establece el Broadcast con la funcion setsockpt() */
+ resultado= setsockopt(conexion_clienteFD, SOL_SOCKET, SO_BROADCAST, &broadcast, sizeof(broadcast));
+ if (resultado == -1){
+ ERROR("No se pudo establecer la opcion de Broadcast: setsockopt()");
+ return -1;
+ }
+
+ /* Se configura la estructura que contiene la informacion sobre el servidor: inf_servidor */
+ inf_servidor.sin_family= AF_INET;
+ inf_servidor.sin_port= htons(PUERTO_SERVIDOR);
+ inf_servidor.sin_addr.s_addr= inet_addr(addrServer);
+ memset(inf_servidor.sin_zero, '\0', sizeof(inf_servidor.sin_zero));
+
+ /* Se procede a enviar el buffer */
+ numbytes_enviados= sendto(conexion_clienteFD,tx_buff,strlen(tx_buff),0,(struct sockaddr *)&inf_servidor,sizeof(inf_servidor));
+
+ printf ("Frame was sent to Central Control Module with %s IP number\n",addrServer);
+
+ if(numbytes_enviados == -1){
+ ERROR("Error de envio de datos: sendto()");
+ return -1;
+ }
+
+
+ free (head);
+ free (tx);
+ free (rx);
+ free (data);
+ free(tx_buff);
+ close(conexion_clienteFD);
+///*
+// servidor
+ int conexion_servidorFd;
+ struct sockaddr_in inf_servidor2;
+ struct sockaddr_storage inf_cliente;
+ int resultado2;
+ int numbytes_recibidos;
+
+ char *headR;
+ char *txR;
+ char *rxR;
+ char *comandoR;
+ char *valorR;
+ FILE *file_to_wr;
+ char *rx_buff = (char *) malloc(TAM_BUFFER);
+
+// size_t addr_len;
+ socklen_t addr_len;
+
+ memset(&inf_servidor2, 0, sizeof(inf_servidor2));
+ inf_servidor2.sin_family= AF_INET;
+ inf_servidor2.sin_port= htons(PUERTO_SERVIDOR);
+ inf_servidor2.sin_addr.s_addr= INADDR_ANY;
+
+ // Se establece el socket
+ conexion_servidorFd = socket(AF_INET,SOCK_DGRAM,0);
+ if (conexion_servidorFd == -1){
+ ERROR_FATAL("No se establecio correctamente el socket: socket() point1");
+ }
+
+ // Se asocia el socket a un puerto y una IP
+ resultado2 = bind(conexion_servidorFd,(struct sockaddr *)&inf_servidor2,sizeof(inf_servidor2));
+ if (resultado2== -1){
+ ERROR_FATAL("No se establecio correctamente el socket: bind() point2");
+ }
+
+ while(indicator == 1){
+ LOG_SERVIDOR("Waiting for the client...\n");
+
+ // Se espera hasta que un cliente se conecte
+ addr_len = sizeof(inf_cliente);
+ numbytes_recibidos = recvfrom(conexion_servidorFd, rx_buff, TAM_BUFFER-1, 0, (struct sockaddr *)&inf_cliente, &addr_len);
+
+ if (numbytes_recibidos == -1){
+ ERROR_FATAL("Error en la recepcion de datos: recvfrom()");
+ }
+
+ // Se procede a procesar los datos recibidos
+ rx_buff[numbytes_recibidos]= '\0';
+
+ // create a response-file
+ headR = strtok(rx_buff, ":");
+ txR = strtok(NULL, ":");
+ rxR = strtok(NULL, ":");
+ comandoR = strtok(NULL, ":");
+ valorR = strtok(NULL, ":");
+
+
+ if ((headR == NULL) || (txR == NULL) || (rxR == NULL) || (comandoR == NULL) || (valorR == NULL)){
+ ERROR("procesarPeticionClient: formato de mensaje incorrecto");
+ }else{
+
+ if(strcmp(comandoR,"SNDF") == 0){
+ file_to_wr = fopen("report.abs", "w+");
+ if (!file_to_wr){
+ printf("The file, in which the received data should be written, couldn't be opened!!!\n");
+ }else{
+ fprintf(file_to_wr, "%s", valorR);
+ }
+ fclose(file_to_wr);
+ printf("File content was successfully written in\"report.abs\"\n");
+ }else if(strcmp(comandoR,"CHGB") == 0){
+ file_to_wr = fopen("report.ver", "w+");
+ if (!file_to_wr){
+ printf("The file, in which the received data should be written, couldn't be opened!!!\n");
+ }else{
+ fprintf(file_to_wr, "%s", valorR);
+ }
+ fclose(file_to_wr);
+ printf("File content was successfully written in \"report.ver\"\n");
+ }else if(strcmp(comandoR,"ANST") == 0){
+ file_to_wr = fopen("report.net", "w+");
+ if (!file_to_wr){
+ printf("The file, in which the received data should be written, couldn't be opened!!!\n");
+ }else{
+ fprintf(file_to_wr, "%s", valorR);
+ }
+ fclose(file_to_wr);
+ printf("File content was successfully written in \"report.net\"\n");
+ }else{
+ ERROR("procesa_peticion_client: respuesta no reconocido");
+ }
+ }
+ indicator = 0;
+// servidor
+ }
+ free (rx_buff);
+//*/
+ return 0;
+}
+
Index: trunk/abscontrol/source/absc/ABS_Client_v2/ABS_Client_Test.c
===================================================================
diff --git a/trunk/abscontrol/source/absc/ABS_Client_v2/ABS_Client_Test.c b/trunk/abscontrol/source/absc/ABS_Client_v2/ABS_Client_Test.c
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/abscontrol/source/absc/ABS_Client_v2/ABS_Client_Test.c (revision 20)
@@ -0,0 +1,27 @@
+/*
+ * ABS_Client_Test.c
+ *
+ * Created on: Set, 2012
+ * Author: Christiane Dietrich.
+ */
+#include
+#include
+
+#include
+#include
+
+#include "./Librerias/Mensajes.h"
+#include "./Librerias/Funciones_ControlER.h"
+
+int main(int argc, char *argv[]){
+
+ char *header = argv[1];
+ char *tx = argv[2];
+ char *rx = argv[3];
+ char *cmd = argv[4];
+ char *val = argv[5];
+
+ ABS_Client(header, tx, rx, cmd, val);
+
+ return 0;
+}
Index: trunk/abscontrol/source/absc/ABS_Client_v2/Librerias/Funciones_ControlER.h
===================================================================
diff --git a/trunk/abscontrol/source/absc/ABS_Client_v2/Librerias/Funciones_ControlER.h b/trunk/abscontrol/source/absc/ABS_Client_v2/Librerias/Funciones_ControlER.h
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/abscontrol/source/absc/ABS_Client_v2/Librerias/Funciones_ControlER.h (revision 20)
@@ -0,0 +1,13 @@
+/*
+ * Funciones_ControlERs.h
+ *
+ * Created on: Jan 14, 2010
+ * Author: redes
+ */
+
+#ifndef FUNCIONES_CONTROLERS_H_
+#define FUNCIONES_CONTROLERS_H_
+
+int ABS_Client(char *header, char *addrClient, char *addrServer ,char *opcion, char *valor_help);
+
+#endif /* FUNCIONES_CONTROLERS_H_ */
Index: trunk/abscontrol/source/absc/ABS_Client_v2/Librerias/Mensajes.h
===================================================================
diff --git a/trunk/abscontrol/source/absc/ABS_Client_v2/Librerias/Mensajes.h b/trunk/abscontrol/source/absc/ABS_Client_v2/Librerias/Mensajes.h
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/abscontrol/source/absc/ABS_Client_v2/Librerias/Mensajes.h (revision 20)
@@ -0,0 +1,17 @@
+/*
+ * Mensajes.h
+ *
+ * Created on: Nov 12, 2009
+ * Author: redes
+ */
+
+#ifndef MENSAJES_H_
+#define MENSAJES_H_
+
+void LOG_SERVIDOR(char *mensaje);
+void LOG_CLIENTE(char *mensaje);
+void ERROR_FATAL(char *mensaje);
+void ERROR(char *mensaje);
+
+
+#endif /* MENSAJES_H_ */
Index: trunk/abscontrol/source/absc/ABS_Client_v2/Mensajes.c
===================================================================
diff --git a/trunk/abscontrol/source/absc/ABS_Client_v2/Mensajes.c b/trunk/abscontrol/source/absc/ABS_Client_v2/Mensajes.c
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/abscontrol/source/absc/ABS_Client_v2/Mensajes.c (revision 20)
@@ -0,0 +1,39 @@
+/*
+ * Mensajes.c
+ *
+ * Created on: Nov 12, 2009
+ * Author: Jose Francisco Quenta
+ */
+
+#include
+#include
+
+/*
+ * Imprime mensajes del servidor
+ */
+void LOG_SERVIDOR(char *mensaje){
+ printf("SERVER MODE: %s\n",mensaje);
+}
+
+/*
+ * Imprime mensajes del cliente
+ */
+void LOG_CLIENTE(char *mensaje){
+ printf("CLIENTE: %s\n",mensaje);
+}
+
+/*
+ * Error no fatal, permite la continuación del programa
+ */
+void ERROR(char *mensaje){
+ fprintf(stderr, "ERROR. %s\n", mensaje);
+}
+
+/*
+ * Error fatal, aborta la ejecución del programa con código de salida de error
+ */
+void ERROR_FATAL(char *mensaje){
+ fprintf(stderr, "ERROR FATAL. %s\n", mensaje);
+ exit(EXIT_FAILURE);
+}
+
Index: trunk/abscontrol/source/absc/ABS_Client_v2/experimento1.ab1
===================================================================
diff --git a/trunk/abscontrol/source/absc/ABS_Client_v2/experimento1.ab1 b/trunk/abscontrol/source/absc/ABS_Client_v2/experimento1.ab1
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/abscontrol/source/absc/ABS_Client_v2/experimento1.ab1 (revision 20)
@@ -0,0 +1,15 @@
+experimento.abs
+------
+000000
+001001
+010010
+011011
+100100
+101101
+110110
+111111
+000000
+001001
+010010
+011011
+------
Index: trunk/abscontrol/source/absc/ABS_Client_v2/experimento1.abs
===================================================================
diff --git a/trunk/abscontrol/source/absc/ABS_Client_v2/experimento1.abs b/trunk/abscontrol/source/absc/ABS_Client_v2/experimento1.abs
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/abscontrol/source/absc/ABS_Client_v2/experimento1.abs (revision 20)
@@ -0,0 +1,231 @@
+ title ='MST-ISR 2009 (NS-Up)'
+
+ #Experiments = 12
+
+1 =
+ [[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5],$
+ [1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0],$
+ [0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5],$
+ [0.5,0.5,0.5,0.5,0.5,0.5,0.5,0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,3.0,3.0],$
+ [0.5,0.5,0.5,0.5,3.0,3.0,3.0,3.0]]
+
+ [[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5],$
+ [1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0],$
+ [0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5],$
+ [0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5],$
+ [1.0,1.0,1.0,1.0,3.0,3.0,3.0,3.0],$
+ [0.5,0.5,0.5,1.0,3.0,3.0,3.0,3.0],$
+ [1.0,1.0,1.0,1.0,3.0,3.0,3.0,3.0],$
+ [0.5,0.5,0.5,0.5,3.0,3.0,3.0,3.0]]
+
+12 =
+ [[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5],$
+ [1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0],$
+ [0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5],$
+ [0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5],$
+ [1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0],$
+ [0.5,0.5,0.5,1.0,0.0,0.0,0.0,0.0],$
+ [1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0],$
+ [0.5,0.5,0.5,0.5,0.0,0.0,0.0,0.0]]
+
+ [[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5],$
+ [1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0],$
+ [0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5],$
+ [0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5],$
+ [1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0],$
+ [0.5,0.5,0.5,1.0,0.0,0.0,0.0,0.0],$
+ [1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0],$
+ [0.5,0.5,0.5,0.5,0.0,0.0,0.0,0.0]]
Index: trunk/abscontrol/source/absc/Control_Module/.cproject
===================================================================
diff --git a/trunk/abscontrol/source/absc/Control_Module/.cproject b/trunk/abscontrol/source/absc/Control_Module/.cproject
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/abscontrol/source/absc/Control_Module/.cproject (revision 20)
@@ -0,0 +1,219 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: trunk/abscontrol/source/absc/Control_Module/.project
===================================================================
diff --git a/trunk/abscontrol/source/absc/Control_Module/.project b/trunk/abscontrol/source/absc/Control_Module/.project
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/abscontrol/source/absc/Control_Module/.project (revision 20)
@@ -0,0 +1,81 @@
+
+
+ Control_Module
+
+
+
+
+
+ org.eclipse.cdt.managedbuilder.core.genmakebuilder
+ clean,full,incremental,
+
+
+ ?name?
+
+
+
+ org.eclipse.cdt.make.core.append_environment
+ true
+
+
+ org.eclipse.cdt.make.core.autoBuildTarget
+ all
+
+
+ org.eclipse.cdt.make.core.buildArguments
+
+
+
+ org.eclipse.cdt.make.core.buildCommand
+ make
+
+
+ org.eclipse.cdt.make.core.buildLocation
+ ${workspace_loc:/Control_Module/Release}
+
+
+ org.eclipse.cdt.make.core.cleanBuildTarget
+ clean
+
+
+ org.eclipse.cdt.make.core.contents
+ org.eclipse.cdt.make.core.activeConfigSettings
+
+
+ org.eclipse.cdt.make.core.enableAutoBuild
+ false
+
+
+ org.eclipse.cdt.make.core.enableCleanBuild
+ true
+
+
+ org.eclipse.cdt.make.core.enableFullBuild
+ true
+
+
+ org.eclipse.cdt.make.core.fullBuildTarget
+ all
+
+
+ org.eclipse.cdt.make.core.stopOnError
+ true
+
+
+ org.eclipse.cdt.make.core.useDefaultBuildCmd
+ true
+
+
+
+
+ org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
+
+
+
+
+
+ org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
+ org.eclipse.cdt.managedbuilder.core.managedBuildNature
+ org.eclipse.cdt.core.cnature
+
+
Index: trunk/abscontrol/source/absc/Control_Module/AT91gpio_Funciones.c
===================================================================
diff --git a/trunk/abscontrol/source/absc/Control_Module/AT91gpio_Funciones.c b/trunk/abscontrol/source/absc/Control_Module/AT91gpio_Funciones.c
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/abscontrol/source/absc/Control_Module/AT91gpio_Funciones.c (revision 20)
@@ -0,0 +1,102 @@
+/*
+ * This programmer uses AT91' GPIO lines
+ *
+ * 2006 by Carlos Camargo
+ * 2007.May.10 Andres Calderon
+ * 2009.Aug.26 Jose Francisco Quenta
+ */
+
+#include
+#include
+#include
+#include
+
+
+#include
+#include
+#include
+#include
+
+#include "./Librerias/AT91gpio_Funciones.h"
+
+void pio_out(AT91S_PIO * pio, int mask, unsigned long val, int opcion)
+{
+ if (opcion == 1)
+ pio->PIO_SODR = mask & val;
+ else
+ pio->PIO_CODR = mask & val;
+}
+
+
+int pio_in(AT91S_PIO * pio, int mask)
+{
+ return (pio->PIO_PDSR & mask);
+}
+
+
+AT91S_PIO *pio_map(unsigned int piobase)
+{
+ int fd;
+ void *base;
+
+ AT91S_PIO *pio;
+
+ off_t addr = piobase;
+
+ if ((fd = open("/dev/mem", O_RDWR | O_SYNC)) == -1) {
+ fprintf(stderr, "Cannot open /dev/mem.\n");
+ exit(EXIT_FAILURE);
+ }
+
+ fprintf(stderr, "/dev/mem opened.\n");
+
+ base = mmap(0, MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, addr & ~MAP_MASK);
+
+ if (base == (void *) -1) {
+ fprintf(stderr, "Cannot open /dev/mem.\n");
+ exit(EXIT_FAILURE);
+ }
+
+ fprintf(stderr, "Memory mapped at address %p.\n", base);
+
+ pio = base + (addr & MAP_MASK);
+
+ return pio;
+}
+
+
+void pio_enable(AT91S_PIO * pio, int mask)
+{
+ pio->PIO_PER = mask; /* Enable PIO */
+}
+
+void pio_output_enable(AT91S_PIO * pio, int mask)
+{
+ pio->PIO_OER = mask; /* Set TDI, TMS and TCK as outputs */
+}
+
+void pio_input_enable(AT91S_PIO * pio, int mask)
+{
+ pio->PIO_ODR = mask; /* Set TDO as input */
+ pio->PIO_IFER = mask; /* Enable Input Filter */
+}
+
+void pio_disable_irq(AT91S_PIO * pio, int mask)
+{
+ pio->PIO_IDR = mask; /* Disable pin interrupts */
+}
+
+void pio_disable_multiple_driver(AT91S_PIO * pio, int mask)
+{
+ pio->PIO_MDDR = mask; /* Disable Multiple Diver */
+}
+
+void pio_disable_pull_ups(AT91S_PIO * pio, int mask)
+{
+ pio->PIO_PUDR = mask; /* Disable Pull-Ups */
+}
+
+void pio_synchronous_data_output(AT91S_PIO * pio, int mask)
+{
+ pio->PIO_OWDR = mask; /* Synchronous Data Output Write in PIO_ */
+}
Index: trunk/abscontrol/source/absc/Control_Module/Librerias/AT91gpio_Funciones.h
===================================================================
diff --git a/trunk/abscontrol/source/absc/Control_Module/Librerias/AT91gpio_Funciones.h b/trunk/abscontrol/source/absc/Control_Module/Librerias/AT91gpio_Funciones.h
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/abscontrol/source/absc/Control_Module/Librerias/AT91gpio_Funciones.h (revision 20)
@@ -0,0 +1,131 @@
+/*
+ * This programmer uses AT91' GPIO lines
+ *
+ * 2006 by Carlos Camargo
+ * 2007.May.10 Andres Calderon
+ * 2009.Aug.26 Jose Francisco Quenta
+ */
+
+#ifndef ECB_AT91_H
+#define ECB_AT91_H
+
+
+#define MAP_SIZE 4096Ul
+#define MAP_MASK (MAP_SIZE - 1)
+
+#define PIOA_BASE 0xFFFFF400
+#define PIOB_BASE 0xFFFFF600
+#define PIOC_BASE 0xFFFFF800
+#define PIOD_BASE 0xFFFFFA00
+
+#define PB0 (1 << 0)
+#define PB1 (1 << 1)
+#define PB2 (1 << 2)
+#define PB3 (1 << 3)
+#define PB8 (1 << 8)
+#define PB9 (1 << 9)
+#define PB10 (1 << 10)
+#define PB11 (1 << 11)
+#define PB16 (1 << 16)
+#define PB17 (1 << 17)
+#define PB18 (1 << 18)
+#define PB19 (1 << 19)
+#define PB20 (1 << 20)
+#define PB21 (1 << 21)
+#define PB22 (1 << 22)
+#define PB23 (1 << 23)
+#define PB24 (1 << 24)
+#define PB25 (1 << 25)
+#define PB30 (1 << 30)
+#define PB31 (1 << 31)
+
+#define PC0 (1 << 0)
+#define PC1 (1 << 1)
+#define PC4 (1 << 4)
+#define PC5 (1 << 5)
+#define PC6 (1 << 6)
+#define PC7 (1 << 7)
+#define PC8 (1 << 8)
+#define PC9 (1 << 9)
+#define PC10 (1 << 10)
+#define PC11 (1 << 11)
+#define PC16 (1 << 16)
+#define PC17 (1 << 17)
+#define PC18 (1 << 18)
+#define PC19 (1 << 19)
+#define PC20 (1 << 20)
+#define PC21 (1 << 21)
+#define PC22 (1 << 22)
+#define PC23 (1 << 23)
+#define PC24 (1 << 24)
+#define PC25 (1 << 25)
+#define PC26 (1 << 26)
+#define PC27 (1 << 27)
+#define PC28 (1 << 28)
+#define PC29 (1 << 29)
+#define PC30 (1 << 30)
+#define PC31 (1 << 31)
+
+
+typedef volatile unsigned int AT91_REG;
+/* Hardware register definition */
+
+typedef struct _AT91S_PIO {
+ AT91_REG PIO_PER; /* PIO Enable Register */
+ AT91_REG PIO_PDR; /* PIO Disable Register */
+ AT91_REG PIO_PSR; /* PIO Status Register */
+ AT91_REG Reserved0[1];
+ AT91_REG PIO_OER; /* Output Enable Register */
+ AT91_REG PIO_ODR; /* Output Disable Registerr */
+ AT91_REG PIO_OSR; /* Output Status Register */
+ AT91_REG Reserved1[1];
+ AT91_REG PIO_IFER; /* Input Filter Enable Register */
+ AT91_REG PIO_IFDR; /* Input Filter Disable Register */
+ AT91_REG PIO_IFSR; /* Input Filter Status Register */
+ AT91_REG Reserved2[1];
+ AT91_REG PIO_SODR; /* Set Output Data Register */
+ AT91_REG PIO_CODR; /* Clear Output Data Register */
+ AT91_REG PIO_ODSR; /* Output Data Status Register */
+ AT91_REG PIO_PDSR; /* Pin Data Status Register */
+ AT91_REG PIO_IER; /* Interrupt Enable Register */
+ AT91_REG PIO_IDR; /* Interrupt Disable Register */
+ AT91_REG PIO_IMR; /* Interrupt Mask Register */
+ AT91_REG PIO_ISR; /* Interrupt Status Register */
+ AT91_REG PIO_MDER; /* Multi-driver Enable Register */
+ AT91_REG PIO_MDDR; /* Multi-driver Disable Register */
+ AT91_REG PIO_MDSR; /* Multi-driver Status Register */
+ AT91_REG Reserved3[1];
+ AT91_REG PIO_PUDR; /* Pull-up Disable Register */
+ AT91_REG PIO_PUER; /* Pull-up Enable Register */
+ AT91_REG PIO_PUSR; /* Pad Pull-up Status Register */
+ AT91_REG Reserved4[1];
+ AT91_REG PIO_ASR; /* Select A Register */
+ AT91_REG PIO_BSR; /* Select B Register */
+ AT91_REG PIO_ABSR; /* AB Select Status Register */
+ AT91_REG Reserved5[9];
+ AT91_REG PIO_OWER; /* Output Write Enable Register */
+ AT91_REG PIO_OWDR; /* Output Write Disable Register */
+ AT91_REG PIO_OWSR; /* Output Write Status Register */
+} AT91S_PIO, *AT91PS_PIO;
+
+void pio_out(AT91S_PIO * pio, int mask, unsigned long val, int opcion);
+
+int pio_in(AT91S_PIO * pio, int mask);
+
+AT91S_PIO *pio_map(unsigned int piobase);
+
+void pio_enable(AT91S_PIO * pio, int mask);
+
+void pio_output_enable(AT91S_PIO * pio, int mask);
+
+void pio_input_enable(AT91S_PIO * pio, int mask);
+
+void pio_disable_irq(AT91S_PIO * pio, int mask);
+
+void pio_disable_multiple_driver(AT91S_PIO * pio, int mask);
+
+void pio_disable_pull_ups(AT91S_PIO * pio, int mask);
+
+void pio_synchronous_data_output(AT91S_PIO * pio, int mask);
+
+#endif
Index: trunk/abscontrol/source/absc/Control_Module/Librerias/Funciones_ControlER.h
===================================================================
diff --git a/trunk/abscontrol/source/absc/Control_Module/Librerias/Funciones_ControlER.h b/trunk/abscontrol/source/absc/Control_Module/Librerias/Funciones_ControlER.h
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/abscontrol/source/absc/Control_Module/Librerias/Funciones_ControlER.h (revision 20)
@@ -0,0 +1,19 @@
+/*
+ * Funciones_ControlERs.h
+ *
+ * Created on: Jan 14, 2010
+ * Author: redes
+ */
+
+#ifndef FUNCIONES_CONTROLERS_H_
+#define FUNCIONES_CONTROLERS_H_
+
+int estado_ERemota(char dir_red[],int dir_inicio,int dir_fin);
+
+int envia_experimento(char valor[], int base);
+
+int trae_monitoreo(char valor[], int base);
+
+int ClienteUDP(char *opcion, char *valor);
+
+#endif /* FUNCIONES_CONTROLERS_H_ */
Index: trunk/abscontrol/source/absc/Control_Module/Librerias/Mensajes.h
===================================================================
diff --git a/trunk/abscontrol/source/absc/Control_Module/Librerias/Mensajes.h b/trunk/abscontrol/source/absc/Control_Module/Librerias/Mensajes.h
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/abscontrol/source/absc/Control_Module/Librerias/Mensajes.h (revision 20)
@@ -0,0 +1,17 @@
+/*
+ * Mensajes.h
+ *
+ * Created on: Nov 12, 2009
+ * Author: redes
+ */
+
+#ifndef MENSAJES_H_
+#define MENSAJES_H_
+
+void LOG_SERVIDOR(char *mensaje);
+void LOG_CLIENTE(char *mensaje);
+void ERROR_FATAL(char *mensaje);
+void ERROR(char *mensaje);
+
+
+#endif /* MENSAJES_H_ */
Index: trunk/abscontrol/source/absc/Control_Module/Mensajes.c
===================================================================
diff --git a/trunk/abscontrol/source/absc/Control_Module/Mensajes.c b/trunk/abscontrol/source/absc/Control_Module/Mensajes.c
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/abscontrol/source/absc/Control_Module/Mensajes.c (revision 20)
@@ -0,0 +1,39 @@
+/*
+ * Mensajes.c
+ *
+ * Created on: Nov 12, 2009
+ * Author: Jose Francisco Quenta
+ */
+
+#include
+#include
+
+/*
+ * Imprime mensajes del servidor
+ */
+void LOG_SERVIDOR(char *mensaje){
+ printf("SERVIDOR: %s\n",mensaje);
+}
+
+/*
+ * Imprime mensajes del cliente
+ */
+void LOG_CLIENTE(char *mensaje){
+ printf("CLIENTE: %s\n",mensaje);
+}
+
+/*
+ * Error no fatal, permite la continuación del programa
+ */
+void ERROR(char *mensaje){
+ fprintf(stderr, "ERROR. %s\n", mensaje);
+}
+
+/*
+ * Error fatal, aborta la ejecución del programa con código de salida de error
+ */
+void ERROR_FATAL(char *mensaje){
+ fprintf(stderr, "ERROR FATAL. %s\n", mensaje);
+ exit(EXIT_FAILURE);
+}
+
Index: trunk/abscontrol/source/absc/Control_Module/ServidorUDP.c
===================================================================
diff --git a/trunk/abscontrol/source/absc/Control_Module/ServidorUDP.c b/trunk/abscontrol/source/absc/Control_Module/ServidorUDP.c
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/abscontrol/source/absc/Control_Module/ServidorUDP.c (revision 20)
@@ -0,0 +1,322 @@
+/*
+ * Servidor.c
+ *
+ * Created on: Nov 3, 2009
+ * Author: Jose Francisco Quenta
+ *
+ * Se implementa:
+ * -Carga en memoria los apuntes contenidos en un archivo de experimentos: apunte0 -> GPIO
+ * -Cambio de apunte.
+ * -Lectura del estado actual del apunte y grabado del mismo en un archivo
+ */
+
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+
+#include "./Librerias/AT91gpio_Funciones.h"
+#include "./Librerias/Mensajes.h"
+
+#define PUERTO_SERVIDOR 5500
+#define TAM_BUFFER 100
+
+#define maskc_out PC30+PC28+PC26+PC24+PC22+PC20 //MSB-UP-LSB MSB-DOWN-LSB //APUNTE
+
+#define maskb_in PB16+PB18+PB20+PB30+PB24+PB22 //MSB-UP-LSB MSB-DOWN-LSB //VERIFICACION
+
+#define bit_up_2 0x00010000 //Mascara de cada bit a revisar: bit_up_2 es MSB
+#define bit_up_1 0x00040000
+#define bit_up_0 0x00100000
+#define bit_dow_2 0x40000000
+#define bit_dow_1 0x01000000
+#define bit_dow_0 0x00400000
+
+#define MyID 11
+
+char *buff_experimento= NULL;
+
+AT91S_PIO *pioc;
+AT91S_PIO *piob;
+
+/*
+ * Zona de declaracion de cabeceras.
+ */
+void inicializa_gpio();
+int procesa_peticion(char *buff_peticion);
+int cambia_apuntamiento(char *puntero_char);
+int carga_experimento(char *nombre_archivo);
+int chequeo_sistema(char *numero_muestras);
+
+/*
+ *
+ */
+int main(){
+
+ int conexion_servidorFd;
+ struct sockaddr_in inf_servidor;
+ struct sockaddr_storage inf_cliente;
+ int resultado;
+ int numbytes_recibidos;
+ int rpta;
+
+ char *buff_peticion = (char *) malloc(TAM_BUFFER);
+
+ size_t addr_len;
+
+ memset(&inf_servidor, 0, sizeof(inf_servidor));
+ inf_servidor.sin_family= AF_INET;
+ inf_servidor.sin_port= htons(PUERTO_SERVIDOR);
+ inf_servidor.sin_addr.s_addr= INADDR_ANY;
+
+ /* Se establece el socket */
+ conexion_servidorFd = socket(AF_INET,SOCK_DGRAM,0);
+ if (conexion_servidorFd == -1){
+ ERROR_FATAL("No se establecio correctamente el socket: socket()");
+ }
+
+ /* Se asocia el socket a un puerto y una IP */
+ resultado = bind(conexion_servidorFd,(struct sockaddr *)&inf_servidor,sizeof(inf_servidor));
+ if (resultado== -1){
+ ERROR_FATAL("No se establecio correctamente el socket: bind()");
+ }
+
+ /* Inicializamos el puerto GPIO del sistema embebido GSBC-9260S */
+ inicializa_gpio();
+
+ while(1){
+ LOG_SERVIDOR("Esperando solicitud de cliente...\n");
+
+ /* Se espera hasta que un cliente se conecte */
+ addr_len = sizeof(inf_cliente);
+ numbytes_recibidos = recvfrom(conexion_servidorFd, buff_peticion, TAM_BUFFER-1, 0, (struct sockaddr *)&inf_cliente, &addr_len);
+ if (numbytes_recibidos == -1){
+ ERROR_FATAL("Error en la recepcion de datos: recvfrom()");
+ }
+
+ /* Se procede a procesar los datos recibidos */
+ buff_peticion[numbytes_recibidos]= '\0';
+
+ /* procesamiento de la peticion */
+ rpta = procesa_peticion(buff_peticion);
+
+ //Respuesta del modulo de control
+ //
+
+
+ }
+}
+
+/*
+ * Esta funcion incializa el puerto GPIO
+ */
+void inicializa_gpio(){
+
+ // Configuracion de los pines de APUNTE
+ pioc = pio_map(PIOC_BASE);
+ pio_enable(pioc, maskc_out);
+ pio_disable_irq(pioc, maskc_out);
+ pio_disable_multiple_driver(pioc, maskc_out);
+ pio_disable_pull_ups(pioc, maskc_out);
+ pio_synchronous_data_output(pioc, maskc_out);
+ pio_output_enable(pioc, maskc_out);
+
+ // Configuracion de los pines de VERIFICACION
+ piob = pio_map(PIOB_BASE);
+ pio_enable(piob, maskb_in);
+ pio_disable_irq(piob, maskb_in);
+ pio_disable_multiple_driver(piob, maskb_in);
+ pio_disable_pull_ups(piob, maskb_in);
+ pio_input_enable(piob, maskb_in);
+
+}
+
+/*
+ * Esta funcion procesa el mensaje de peticion y genera respuesta
+ */
+int procesa_peticion(char *buff_peticion){
+ int rpta;
+// char *header = strtok(buff_peticion, ":");
+// char *ipSource = strtok(buff_peticion, ":");
+// char *ipDestino = strtok(buff_peticion, ":");
+ char *comando = strtok(buff_peticion, ":");
+ char *valor = strtok(NULL, ":");
+
+ if ((comando == NULL) || (valor == NULL)){
+ ERROR("procesarPeticion: formato de mensaje incorrecto");
+ }
+ else{
+ if(strcmp(comando,"CARGA") == 0)
+ rpta = carga_experimento(valor);
+ else if(strcmp(comando,"CAMBIA") == 0)
+ rpta = cambia_apuntamiento(valor);
+ else if(strcmp(comando,"CHEQUEO") == 0)
+ rpta = chequeo_sistema(valor);
+ else
+ ERROR("procesa_peticion: comando no reconocido");
+ }
+
+ return rpta;
+}
+
+
+/*
+ * Esta funcion carga un archivo en un buffer que esta ubicado en memoria, luego
+ * este buffer es usado en la funcion "cambia_apuntamiento" para obtener el dato
+ * que sera usado en el cambio de apuntamiento.
+ */
+int carga_experimento(char *nombre_archivo){
+
+ FILE *Archivo_Fd;
+
+ char *cadena = (char *) malloc(25);
+
+ int longitud_cadena;
+ int num_bytes= 0;
+ int num_filas= 0;
+
+ char ruta_archivo[50]; // Se crea la ruta para abrir el archivo
+ strcpy(ruta_archivo,"/mnt/sd/archivos/");
+ strcat(ruta_archivo,nombre_archivo);
+
+ Archivo_Fd = fopen(ruta_archivo,"r"); // Se procede a abrir el archivo, segun la ruta especificada
+ if(!Archivo_Fd){
+ ERROR("carga_archivo: No se pudo abrir el archivo!!! --> fopen()\n");
+ return -1;
+ }else{
+
+ while(!feof(Archivo_Fd)){ // Se procede a calcular la longitud del archivo para separar memoria
+ fgets(cadena,20,Archivo_Fd);
+ longitud_cadena= strlen(cadena);
+ cadena[longitud_cadena-1] = '\0';
+ num_bytes = num_bytes + longitud_cadena;
+ num_filas++;
+ }
+
+ rewind(Archivo_Fd); // Se reinicia el puntero del archivo
+
+ char *buffer_temporal = (char *) malloc(num_bytes+1); // Se separa espacio de memoria segun
+ // la longitud del archivo
+ fread(buffer_temporal, sizeof(char), num_bytes, Archivo_Fd);
+
+ char *puntero= strstr(buffer_temporal,".abs"); // Se procede a eliminar la cabecera del archivo
+ puntero= puntero + 12;
+
+ buff_experimento = (char *) malloc(7*(num_filas-3)); // num_bytes_fila*(num_filas-3);
+ strncpy(buff_experimento,puntero,7*(num_filas-3)); // Se carga en memoria la informacion del archivo
+
+ fclose(Archivo_Fd);
+
+ cambia_apuntamiento("0"); // Se apunta a la direccion 0
+
+ return 1;
+ }
+}
+
+/*
+ * Esta funcion recibe un numero en formato char, el dato se transforma a su equivalente en
+ * un numero entero, que sera usado para sacar un dato del buffer "buff_experimento", esta
+ * dato es el valor que se enviara al sistema de conmutacion RF para el cambio de apunte a
+ * traves del puerto GPIO.
+ */
+int cambia_apuntamiento(char *puntero_char){
+
+ /*MSB-UP-LSB MSB-DOWN-LSB*/
+ int desplazamiento[6]={30,28,26,24,22,20}; // Defino los dezplazamientos que se aplicara
+ // al dato que ingresa para formar el número
+ // entero que se le pasara al puerto GPIO
+ // Estos números son los pines del puerto GPIO
+ // que se estan usando para el control
+
+ int puntero= atoi(puntero_char); // Se convierte a entero la direccion del puntero
+
+ int base= 7*puntero; // base= cantidad_bytes del dato x puntero
+ // cantidad de bytes es el numero de bytes que
+ printf("%i\n",puntero); // contiene cada dato, para este caso es 7
+ // porque es 6 bits de datos + 1 bit del cambio
+ // de linea.
+ char valor_char;
+ unsigned long valor;
+ unsigned long acumulado_ceros=0;
+ unsigned long acumulado_unos=0;
+
+ int offset; // Defino offset para el desplazamiento a traves
+ for(offset=0;offset<6;offset++){ // de cada dato que se obtiene del "buff_experimento"
+
+ valor_char= buff_experimento[base+offset]; // Obtengo el dato
+
+ if (valor_char == '0'){ // Obtengo el número acumulado segun sea un cero o un uno
+ valor= 0;
+ acumulado_ceros= acumulado_ceros + (1 << desplazamiento[offset]);
+ }else{
+ valor= 1;
+ acumulado_unos= acumulado_unos + (1 << desplazamiento[offset]);
+ }
+
+ }
+
+ pio_out(pioc, maskc_out, acumulado_unos, 1);
+ pio_out(pioc, maskc_out, acumulado_ceros, 0);
+
+ return 1;
+
+}
+
+/*
+ * Esta funcion lee "n" veces el estado del APUNTE actual y lo guarda en el
+ * archivo Verificacion.
+ */
+
+int chequeo_sistema(char *numero_muestras){
+
+ char valor[7];
+ int i,cnt;
+ unsigned int entradac= 0;
+ FILE *fd;
+ fd=fopen("/mnt/sd/archivos/Verificacion","w");
+ fprintf(fd,"%s\n","Verificacion");
+ fprintf(fd,"%s\n","------------");
+ cnt=0;
+ do
+ {
+ //Inicializando arreglo
+ for(i=0;i<6;i++)
+ valor[i]='0';
+
+ valor[6]='\0';
+
+ //Lectura de puerto
+ entradac= pio_in(piob,maskb_in);
+
+ //Dandole formato al dato
+ if (!(entradac & bit_up_2))
+ valor[0] = '1';
+ if (!(entradac & bit_up_1))
+ valor[1] = '1';
+ if (!(entradac & bit_up_0))
+ valor[2] = '1';
+ if (!(entradac & bit_dow_2))
+ valor[3] = '1';
+ if (!(entradac & bit_dow_1))
+ valor[4] = '1';
+ if (!(entradac & bit_dow_0))
+ valor[5] = '1';
+
+ //Escribiendo en archivo
+ fprintf(fd,"%s\n",valor);
+ cnt=cnt+1;
+ usleep(1*1000*1000);
+
+ }while(cnt < atoi(numero_muestras));
+
+ fclose(fd);
+
+ return 1;
+}
Index: trunk/abscontrol/source/absc/Control_Module_Test/.cproject
===================================================================
diff --git a/trunk/abscontrol/source/absc/Control_Module_Test/.cproject b/trunk/abscontrol/source/absc/Control_Module_Test/.cproject
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/abscontrol/source/absc/Control_Module_Test/.cproject (revision 20)
@@ -0,0 +1,219 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: trunk/abscontrol/source/absc/Control_Module_Test/.project
===================================================================
diff --git a/trunk/abscontrol/source/absc/Control_Module_Test/.project b/trunk/abscontrol/source/absc/Control_Module_Test/.project
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/abscontrol/source/absc/Control_Module_Test/.project (revision 20)
@@ -0,0 +1,81 @@
+
+
+ Control_Module_Test
+
+
+
+
+
+ org.eclipse.cdt.managedbuilder.core.genmakebuilder
+ clean,full,incremental,
+
+
+ ?name?
+
+
+
+ org.eclipse.cdt.make.core.append_environment
+ true
+
+
+ org.eclipse.cdt.make.core.autoBuildTarget
+ all
+
+
+ org.eclipse.cdt.make.core.buildArguments
+
+
+
+ org.eclipse.cdt.make.core.buildCommand
+ make
+
+
+ org.eclipse.cdt.make.core.buildLocation
+ ${workspace_loc:/Control_Module_Test/Release}
+
+
+ org.eclipse.cdt.make.core.cleanBuildTarget
+ clean
+
+
+ org.eclipse.cdt.make.core.contents
+ org.eclipse.cdt.make.core.activeConfigSettings
+
+
+ org.eclipse.cdt.make.core.enableAutoBuild
+ false
+
+
+ org.eclipse.cdt.make.core.enableCleanBuild
+ true
+
+
+ org.eclipse.cdt.make.core.enableFullBuild
+ true
+
+
+ org.eclipse.cdt.make.core.fullBuildTarget
+ all
+
+
+ org.eclipse.cdt.make.core.stopOnError
+ true
+
+
+ org.eclipse.cdt.make.core.useDefaultBuildCmd
+ true
+
+
+
+
+ org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
+
+
+
+
+
+ org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
+ org.eclipse.cdt.managedbuilder.core.managedBuildNature
+ org.eclipse.cdt.core.cnature
+
+
Index: trunk/abscontrol/source/absc/Control_Module_Test/ClienteUDP.c
===================================================================
diff --git a/trunk/abscontrol/source/absc/Control_Module_Test/ClienteUDP.c b/trunk/abscontrol/source/absc/Control_Module_Test/ClienteUDP.c
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/abscontrol/source/absc/Control_Module_Test/ClienteUDP.c (revision 20)
@@ -0,0 +1,83 @@
+/*
+ * ClienteUDP.c
+ *
+ * Fecha de creacion : Nov 2, 2009
+ * Ultima modificacion : Nov 19, 2009
+ * Autor : Jose Francisco Quenta C.
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "./Librerias/Mensajes.h"
+
+#define PUERTO_SERVIDOR 5500
+//#define DIR_SERVIDOR "10.10.12.255"
+#define DIR_SERVIDOR "192.168.1.255"
+
+int ClienteUDP(char *opcion, char *valor){
+
+ int conexion_clienteFD;
+ struct sockaddr_in inf_servidor;
+
+ int broadcast= 1;
+ int resultado;
+ int numbytes_enviados;
+
+ char *buff_peticion;
+ char *comando= NULL;
+
+ if (strcmp(opcion,"-l") == 0){ // Se reconoce el comando que se esta enviando
+ comando= "CARGA:";
+ }else if(strcmp(opcion,"-c") == 0){
+ comando= "CAMBIA:";
+ }else if(strcmp(opcion,"-ch") == 0){
+ comando= "CHEQUEO:";
+ }else {
+ ERROR("OPCION INCORRECTA: {-l|-c|-ch}");
+ return -1;
+ }
+
+ buff_peticion= (char *) malloc(strlen(comando)+1+strlen(valor)+1); // Se arma el buffer a ser enviado.
+ strcpy(buff_peticion,comando);
+ strcat(buff_peticion,valor);
+
+ /* Se establece el socket UDP */
+ conexion_clienteFD= socket(AF_INET,SOCK_DGRAM,0);
+ if (conexion_clienteFD == -1){
+ ERROR("No se pudo establecer el socket: socket()");
+ return -1;
+ }
+
+ /* Se establece el Broadcast con la funcion setsockpt() */
+ resultado= setsockopt(conexion_clienteFD, SOL_SOCKET, SO_BROADCAST, &broadcast, sizeof(broadcast));
+ if (resultado == -1){
+ ERROR("No se pudo establecer la opcion de Broadcast: setsockopt()");
+ return -1;
+ }
+
+ /* Se configura la estructura que contiene la informacion sobre el servidor: inf_servidor */
+ inf_servidor.sin_family= AF_INET;
+ inf_servidor.sin_port= htons(PUERTO_SERVIDOR);
+ inf_servidor.sin_addr.s_addr= inet_addr(DIR_SERVIDOR);
+ memset(inf_servidor.sin_zero, '\0', sizeof(inf_servidor.sin_zero));
+
+ /* Se procede a enviar el buffer */
+ numbytes_enviados= sendto(conexion_clienteFD,buff_peticion,strlen(buff_peticion),0,(struct sockaddr *)&inf_servidor,sizeof(inf_servidor));
+ if(numbytes_enviados == -1){
+ ERROR("Error de envio de datos: sendto()");
+ return -1;
+ }
+
+ close(conexion_clienteFD);
+
+ return 0;
+}
Index: trunk/abscontrol/source/absc/Control_Module_Test/Librerias/Funciones_ControlER.h
===================================================================
diff --git a/trunk/abscontrol/source/absc/Control_Module_Test/Librerias/Funciones_ControlER.h b/trunk/abscontrol/source/absc/Control_Module_Test/Librerias/Funciones_ControlER.h
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/abscontrol/source/absc/Control_Module_Test/Librerias/Funciones_ControlER.h (revision 20)
@@ -0,0 +1,19 @@
+/*
+ * Funciones_ControlERs.h
+ *
+ * Created on: Jan 14, 2010
+ * Author: redes
+ */
+
+#ifndef FUNCIONES_CONTROLERS_H_
+#define FUNCIONES_CONTROLERS_H_
+
+int estado_ERemota(char dir_red[],int dir_inicio,int dir_fin);
+
+int envia_experimento(char valor[], int base);
+
+int trae_monitoreo(char valor[], int base);
+
+int ClienteUDP(char *opcion, char *valor);
+
+#endif /* FUNCIONES_CONTROLERS_H_ */
Index: trunk/abscontrol/source/absc/Control_Module_Test/Librerias/Mensajes.h
===================================================================
diff --git a/trunk/abscontrol/source/absc/Control_Module_Test/Librerias/Mensajes.h b/trunk/abscontrol/source/absc/Control_Module_Test/Librerias/Mensajes.h
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/abscontrol/source/absc/Control_Module_Test/Librerias/Mensajes.h (revision 20)
@@ -0,0 +1,17 @@
+/*
+ * Mensajes.h
+ *
+ * Created on: Nov 12, 2009
+ * Author: redes
+ */
+
+#ifndef MENSAJES_H_
+#define MENSAJES_H_
+
+void LOG_SERVIDOR(char *mensaje);
+void LOG_CLIENTE(char *mensaje);
+void ERROR_FATAL(char *mensaje);
+void ERROR(char *mensaje);
+
+
+#endif /* MENSAJES_H_ */
Index: trunk/abscontrol/source/absc/Control_Module_Test/Mensajes.c
===================================================================
diff --git a/trunk/abscontrol/source/absc/Control_Module_Test/Mensajes.c b/trunk/abscontrol/source/absc/Control_Module_Test/Mensajes.c
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/abscontrol/source/absc/Control_Module_Test/Mensajes.c (revision 20)
@@ -0,0 +1,39 @@
+/*
+ * Mensajes.c
+ *
+ * Created on: Nov 12, 2009
+ * Author: Jose Francisco Quenta
+ */
+
+#include
+#include
+
+/*
+ * Imprime mensajes del servidor
+ */
+void LOG_SERVIDOR(char *mensaje){
+ printf("SERVIDOR: %s\n",mensaje);
+}
+
+/*
+ * Imprime mensajes del cliente
+ */
+void LOG_CLIENTE(char *mensaje){
+ printf("CLIENTE: %s\n",mensaje);
+}
+
+/*
+ * Error no fatal, permite la continuación del programa
+ */
+void ERROR(char *mensaje){
+ fprintf(stderr, "ERROR. %s\n", mensaje);
+}
+
+/*
+ * Error fatal, aborta la ejecución del programa con código de salida de error
+ */
+void ERROR_FATAL(char *mensaje){
+ fprintf(stderr, "ERROR FATAL. %s\n", mensaje);
+ exit(EXIT_FAILURE);
+}
+
Index: trunk/abscontrol/source/absc/Control_Module_Test/Prueba_ClienteUDP.c
===================================================================
diff --git a/trunk/abscontrol/source/absc/Control_Module_Test/Prueba_ClienteUDP.c b/trunk/abscontrol/source/absc/Control_Module_Test/Prueba_ClienteUDP.c
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/abscontrol/source/absc/Control_Module_Test/Prueba_ClienteUDP.c (revision 20)
@@ -0,0 +1,19 @@
+/*
+ * Prueba_UDP.c
+ *
+ * Created on: Nov 19, 2009
+ * Author: redes
+ */
+
+#include
+#include
+
+#include "./Librerias/Mensajes.h"
+#include "./Librerias/Funciones_ControlER.h"
+
+int main(int argc, char *argv[]){
+
+ ClienteUDP(argv[1],argv[2]);
+
+ return 0;
+}
Index: trunk/abscontrol/source/abspy/lib/client.py
===================================================================
diff --git a/trunk/abscontrol/source/abspy/lib/client.py b/trunk/abscontrol/source/abspy/lib/client.py
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/abscontrol/source/abspy/lib/client.py (revision 20)
@@ -0,0 +1,31 @@
+import library
+
+class ABSClient:
+
+ def __init__(self,ipSource, ipDestino, portDestino):
+
+ self.ipSource = ipSource
+ self.ipDestino = ipDestino
+ self.portDestino = portDestino
+
+ self.createObjects()
+
+ def createObjects(self):
+
+ self.commObj = library.UDPComm(self.ipSource, self.ipDestino, self.portDestino)
+
+ def sendFile(self, filename):
+
+ fp = open(filename)
+ data = fp.read()
+
+ commObj.sendTxRxCommand(cmd="SND", data=data, nbytes=10)
+
+ def changeBeam(self, newBeam):
+
+ commObj.sendTxRxCommand(cmd="CHG", data=newBeam, nbytes=10)
+
+ def getStatus(self):
+
+ commObj.sendTxRxCommand(cmd="ANST", data="ABS", nbytes=10)
+
\ No newline at end of file
Index: trunk/abscontrol/source/abspy/lib/library.py
===================================================================
diff --git a/trunk/abscontrol/source/abspy/lib/library.py b/trunk/abscontrol/source/abspy/lib/library.py
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/abscontrol/source/abspy/lib/library.py (revision 20)
@@ -0,0 +1,80 @@
+import socket
+
+class UDPComm:
+
+ __HEADER = "ABS"
+
+ def __init__(self, ipSource, ipDestino, portDestino=1520, asServer=False):
+
+ self.ipSource = ipSource
+ self.ipDestino = ipDestino
+ self.portDestino = portDestino
+
+ self.openSocket(asServer)
+
+ def openSocket(self, asServer):
+
+ self.socket_c = socket.socket()
+ self.socket_c.connect((self.ipDestino, self.portDestino))
+
+ if asServer:
+ self.configAsServer()
+ else:
+ self.configAsClient()
+
+ def configAsClient(self):
+
+ #Configurar broadcast
+ pass
+
+ def configAsServer(self):
+
+ pass
+
+ def waitRequest(self, nbytes):
+
+ trama_rx = self.socket_c.recv(nbytes)
+ ipSource, ipDestino, cmd, data = self.__getTrama(trama_rx)
+
+ return ipSource, ipDestino, cmd, data
+
+ def sendTxRxCommand(self, cmd, data, nbytes):
+
+ self.sendRequest(cmd, data)
+
+ time.sleep(1)
+
+ ipSource_rx, ipDestino_rx, cmd_rx, data_rx = self.getRpta(nbytes)
+
+ if not(self.ipSource == ipDestino_rx):
+ print "Error"
+
+ return data_rx
+
+ def sendRequest(self, cmd, data):
+
+ trama_tx = self.__HEADER + str(self.ipSource) + str(self.ipDestino) + str(cmd) + str(data)
+ self.socket_c.send(trama_tx)
+
+ def getRpta(self, nbytes):
+
+ trama_rx = self.socket_c.recv(nbytes)
+ ipSource, ipDestino, cmd, data = self.__getTrama(trama_rx)
+
+ return ipSource, ipDestino, cmd, data
+
+ def __getTrama(self, trama):
+
+ ipSource = trama[5:15]
+ ipDestino = trama[15:24]
+ cmd = trama[24:30]
+ data = trama[30:-1]
+
+ return ipSource, ipDestino, cmd, data
+
+class FTPComm:
+
+ def __init__(self):
+ pass
+
+
\ No newline at end of file
Index: trunk/abscontrol/source/abspy/lib/server.py
===================================================================
diff --git a/trunk/abscontrol/source/abspy/lib/server.py b/trunk/abscontrol/source/abspy/lib/server.py
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/abscontrol/source/abspy/lib/server.py (revision 20)
@@ -0,0 +1,50 @@
+import library
+
+class ABSServer:
+
+ def __init__(self,ipSource, ipDestino, portDestino, ipDestino2, portDestino2, ftpPortDestino):
+
+ self.ipSource = ipSource
+ self.ipDestino = ipDestino
+ self.portDestino = portDestino
+
+ self.ipDestino2 = ipDestino2
+ self.portDestino2 = portDestino2
+
+ self.ftpPortDestino = ftpPortDestino
+
+ self.createObjects()
+
+ def createObjects(self):
+ asServer = True
+ self.commServerObj = library.UDPComm(self.ipSource, self.ipDestino, self.portDestino, asServer)
+ self.commClientObj = library.UDPComm(self.ipSource, self.ipDestino2, self.portDestino2)
+ self.ftpCommObj = library.FTPComm(self.ipSource, self.ipDestino, self.ftpPortDestino)
+
+ def waitRequest(self):
+
+ ipSource, ipDestino, cmd, data = library.waitRequest()
+
+ if cmd == "SND":
+ self.sendFile()
+
+ if cmd == "CHG":
+ self.changeBeam()
+
+ if cmd == "ANST":
+ self.getStatus()
+
+
+ def sendFile(self):
+
+ self.ftpCommObj.sendFile(filename)
+ rpta = self.commClientObj.sendTxRxCommand(cmd='CARGA', data=filename, nbytes=1)
+
+
+ def changeBeam(self):
+
+ rpta = self.commClientObj.sendTxRxCommand(cmd='CAMBIA', data="0", nbytes=1)
+
+ def getStatus(self):
+
+ rpta = self.commClientObj.sendTxRxCommand(cmd='CHEQUEO', data="0", nbytes=1)
\ No newline at end of file
Index: trunk/abscontrol/source/abspy/scripts/sendFile.py
===================================================================
diff --git a/trunk/abscontrol/source/abspy/scripts/sendFile.py b/trunk/abscontrol/source/abspy/scripts/sendFile.py
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/abscontrol/source/abspy/scripts/sendFile.py (revision 20)