terminal.cpp

Ir a la documentación de este archivo.
00001 
00007 
00009 /* Licencia GPL                                                             */
00010 /* Programa de prueba de la clase Rhino                                     */
00011 
00012 #include <stdio.h>
00013 #include <stdlib.h>
00014 //#include <curses.h>
00015 #include "rhino.h"
00016 
00017 /*****************************/
00018 /*  Declaraciones            */
00019 /*****************************/
00020 
00021 Rhino *RhinoBot = NULL;
00022 unsigned int uiCommandEnumeration;
00023 unsigned int uiCode;
00024 unsigned int uiLogLevel;
00025 char sMessage[MSG_LENGTH];
00026 char sAux[4];
00027 
00028 /*****************************/
00029 /*  Funcion Principal        */
00030 /*****************************/
00031 int main(void){
00032 /*
00033 Prueba general de todos los niveles de logueo de mensajes y todos los mensajes de estado y error de la clase RHINO
00034 */
00035     for(int j=0; j<4; j++){
00036 
00037         RhinoBot = new(Rhino);
00038 
00039         for(int i=0; i<256; i++){
00040             RhinoBot->set_LogLevel(j);
00041             RhinoBot->ProcessCommandToRhino("SS");
00042             sprintf(sAux,"%d", i);
00043             RhinoBot->ProcessMessageFromRhino(sAux);
00044 
00045             if(RhinoBot->CBkMsg()){
00046                 RhinoBot->get_CBkMsg(sMessage);
00047                 printf("CBkMsg:\n%s\n", sMessage);
00048             }
00049         }
00050 
00051         for(int i=0; i<256; i++){
00052             RhinoBot->set_LogLevel(j);
00053             RhinoBot->ProcessCommandToRhino("SA");
00054             sprintf(sAux,"%d", i);
00055             RhinoBot->ProcessMessageFromRhino(sAux); 
00056 
00057             if(RhinoBot->CBkMsg()){
00058                 RhinoBot->get_CBkMsg(sMessage);
00059                 printf("CBkMsg:\n%s\n", sMessage);
00060             }
00061         }
00062     
00063         for(int i=0; i<129; i++){
00064             RhinoBot->set_LogLevel(j);
00065             RhinoBot->ProcessCommandToRhino("SE");
00066             sprintf(sAux,"%d", i);
00067             RhinoBot->ProcessMessageFromRhino(sAux);
00068 
00069             if(RhinoBot->CBkMsg()){
00070                 RhinoBot->get_CBkMsg(sMessage);
00071                 printf("CBkMsg:\n%s\n", sMessage);
00072             }
00073         }
00074 
00075         delete(RhinoBot);
00076 
00077     }
00078 
00079 /*
00080 Prueba de las funciones "ProcessCommandToRhino" y "ProcessMessageFromRhino" para el paso de mensajes de la clase al programa principal
00081 */
00082 /*
00083     RhinoBot = new(Rhino);
00084     
00085     for(int i=0; i<8; i++){
00086 
00087         fprintf(stdout,"%s","Ingrese Log Level: ");
00088         fscanf(stdin,"%s",sAux);
00089         RhinoBot->set_LogLevel(atoi(sAux));
00090         
00091         fprintf(stdout,"%s","Ingrese comando: ");
00092         fscanf(stdin,"%s",sAux);
00093         RhinoBot->ProcessCommandToRhino(sAux, &uiCommandEnumeration);
00094         
00095         fprintf(stdout,"%s","Ingrese argumento: ");
00096         fscanf(stdin,"%s",sAux);
00097         RhinoBot->ProcessMessageFromRhino(uiCommandEnumeration, sAux, &uiCode, sMessage);
00098 
00099         RhinoBot->get_LogLevel(&uiLogLevel);
00100         printf("Terminal->Main:\n\tCode:\t%d\n\tLogLevel:\t%d\n\tMessage:\t%s\n", uiCode, uiLogLevel, sMessage );
00101 
00102     }
00103 
00104     delete(RhinoBot);
00105 */
00106 
00107 /*
00108 Prueba de la funcion CBkMsg para el paso de mensajes de la clase al programa principal
00109 */
00110 /*
00111     RhinoBot = new(Rhino);
00112 
00113     for(int i=0; i<8; i++){
00114 
00115         fprintf(stdout,"%s","Ingrese Log Level: ");
00116         fscanf(stdin,"%s",sAux);
00117         RhinoBot->set_LogLevel(atoi(sAux));
00118         
00119         fprintf(stdout,"%s","Ingrese comando: ");
00120         fscanf(stdin,"%s",sAux);
00121         RhinoBot->ProcessCommandToRhino(sAux);
00122         
00123         fprintf(stdout,"%s","Ingrese argumento: ");
00124         fscanf(stdin,"%s",sAux);
00125         RhinoBot->ProcessMessageFromRhino(sAux);
00126 
00127         if(RhinoBot->CBkMsg()){
00128             RhinoBot->get_CBkMsg(sMessage);
00129             printf("CBkMsg:\n%s\n", sMessage);
00130         }
00131     }
00132     
00133     delete(RhinoBot);
00134 */
00135     fprintf(stdout,"%s","\nAUFWIEDERSEHEN\n");
00136     return 0;
00137 }
00138 

Generado el Wed Jun 18 19:42:44 2008 para Documentacion de la clase Rhino por  doxygen 1.5.4