00001
00002
00003
00004
00005
00006
00007 #include <stdio.h>
00008 #include <string.h>
00009 #include <stdlib.h>
00010
00011 #include "errdef.h"
00012 #include "cmddef.h"
00013 #include "statusdef.h"
00014
00015 #ifndef RHINO_H
00016 #define RHINO_H
00017
00018 #define MAX_LOG_LEVEL 3 // Maximo nivel de logueo
00019
00020 #define MAX_RB_ERROR_CODES 128 // Max Rhino Controller Error Codes
00021 #define MAX_RC_ERROR_CODES 32 // Max Rhino Class Error Codes
00022
00023 #define MSG_LENGTH 256 // Max Messages Length
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 class Rhino{
00044 private:
00045 unsigned int uiLogLevel;
00046 unsigned int uiErrorCode;
00047 unsigned int uiStatusCode;
00048
00049
00050 struct {
00051 unsigned int uiLastCommandtoRhino;
00052 char LastCommandtoRhino[MSG_LENGTH];
00053 char LastMessageFromRhino[MSG_LENGTH];
00054 }LastCmdAndMsg;
00055
00056 FILE *pFile;
00057
00058 char RhinoBotErrorMsg[MAX_RB_ERROR_CODES][MSG_LENGTH];
00059 char RhinoClassErrorMsg[MAX_RC_ERROR_CODES][MSG_LENGTH];
00060
00061 char RhinoBotStatusMsg[MAX_RB_STATUS_CODES][MSG_LENGTH];
00062 char RhinoClassStatusMsg[MAX_RC_STATUS_CODES][MSG_LENGTH];
00063
00064 char RhinoMessages[MSG_LENGTH];
00065 char cErrorMessage[MSG_LENGTH];
00066 char cStatusMessage[MSG_LENGTH];
00067
00068
00069 enum {
00070 LMODisplay,
00071 LMOFile,
00072 LMOCBk
00073 }logType;
00074
00075
00076 struct {
00077 bool bNewMsg;
00078 char sCBkMessage[MSG_LENGTH];
00079 }CallBack;
00080
00081
00082 int ProcessErrorMsg(unsigned int);
00083 int ProcessStatusMsg(unsigned int);
00084
00085 public:
00086 Rhino();
00087 ~Rhino();
00088
00089 int InitMessageVectors(char [MAX_RB_ERROR_CODES][MSG_LENGTH], char [MAX_RC_ERROR_CODES][MSG_LENGTH], char [MAX_RB_STATUS_CODES][MSG_LENGTH], char [MAX_RC_STATUS_CODES][MSG_LENGTH]);
00090
00091 int set_LogLevel(unsigned int);
00092 int get_LogLevel(unsigned int *);
00093
00094 int get_ErrorMsg(char *);
00095 int get_ErrorMsg(unsigned int, char *);
00096 int get_ErrorCode(unsigned int *);
00097
00098 int get_StatusMsg(char *);
00099 int get_StatusMsg(unsigned int, char *);
00100 int get_StatusCode(unsigned int *);
00101
00102 int ProcessCommandToRhino(char *);
00103 int ProcessMessageFromRhino(char *);
00104 int ProcessCommandToRhino(char *, unsigned int *);
00105 int ProcessMessageFromRhino(unsigned int, char *, unsigned int *, char *);
00106
00107 int CBkMsg(void);
00108 int get_CBkMsg(char *);
00109
00110 int LogMessage(int, char *);
00111
00112 int DisplayAllErrorMessages(void);
00113 };
00114
00115 #endif //RHINO_H