Proyecto ABInBev para la tarjeta Guaria 1/2.

Committer:
fmanzano_dtk
Date:
Thu Jul 07 16:17:25 2022 +0000
Revision:
19:5580a9a54ad5
Parent:
1:9e821e640117
Sincronizacion;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
fmanzano_dtk 1:9e821e640117 1 /**
fmanzano_dtk 1:9e821e640117 2 * @file fingerprint_frame.cpp
fmanzano_dtk 1:9e821e640117 3 * @author Felícito Manzano (felicito.manzano@detektor.com.sv)
fmanzano_dtk 1:9e821e640117 4 * @brief
fmanzano_dtk 1:9e821e640117 5 * @version 0.1
fmanzano_dtk 1:9e821e640117 6 * @date 2020-09-28
fmanzano_dtk 1:9e821e640117 7 *
fmanzano_dtk 1:9e821e640117 8 * @copyright Copyright (c) 2020
fmanzano_dtk 1:9e821e640117 9 *
fmanzano_dtk 1:9e821e640117 10 */
fmanzano_dtk 1:9e821e640117 11
fmanzano_dtk 1:9e821e640117 12 #include "mbed.h"
fmanzano_dtk 1:9e821e640117 13 #include "fingerprint_frame.hpp"
fmanzano_dtk 1:9e821e640117 14
fmanzano_dtk 1:9e821e640117 15 /**
fmanzano_dtk 1:9e821e640117 16 * @brief
fmanzano_dtk 1:9e821e640117 17 *
fmanzano_dtk 1:9e821e640117 18 */
fmanzano_dtk 1:9e821e640117 19
fmanzano_dtk 1:9e821e640117 20 // CONSTANTES DE PROTOCOLO DE COMUNICACIÓN
fmanzano_dtk 1:9e821e640117 21 const char SERVER_SEPARATOR[] = ";";
fmanzano_dtk 1:9e821e640117 22 const char FINGER_CMD_BEGIN[] = "@";
fmanzano_dtk 1:9e821e640117 23 const char FINGER_CMD_EOF[] = "#";
fmanzano_dtk 1:9e821e640117 24
fmanzano_dtk 1:9e821e640117 25 // COMANDOS DE HUELLA
fmanzano_dtk 1:9e821e640117 26 const char FINGERPRINT_DIS_CMD[] = "FPF"; // DESHABILITAR HUELLA
fmanzano_dtk 1:9e821e640117 27 const char FINGERPRINT_ENA_CMD[] = "FPN"; // HABILITAR HUELLA
fmanzano_dtk 1:9e821e640117 28 const char ADD_CMD[] = "ADD"; // AGREGAR HUELLA
fmanzano_dtk 1:9e821e640117 29 const char FINGERPRINT_QRY_CMD[] = "ASK"; // INTERROGAR HUELLA
fmanzano_dtk 1:9e821e640117 30 const char Q_CHECK_ENROLLED_ID[] = "CEI"; // query Check Enrolled fingerprint ID
fmanzano_dtk 1:9e821e640117 31 const char DEL_CMD[] = "DEL"; // ELIMINAR HUELLA
fmanzano_dtk 1:9e821e640117 32 const char Q_FINGERPRINT_STATUS[] = "QFS"; // Query Fingerprint Status - 1 Enable, 0 Disable
fmanzano_dtk 1:9e821e640117 33 const char FP_OVERRIDE_ENABLE[] = "FON"; // Fingerprint Override oN
fmanzano_dtk 1:9e821e640117 34 const char FP_OVERRIDE_DISABLE[] = "FOF"; // Fingerprint Override oFF
fmanzano_dtk 1:9e821e640117 35 const char FP_OVERRIDE_COUNT[] = "FOC"; // Fingerprint unauthorized Override Count
fmanzano_dtk 1:9e821e640117 36 const char Q_FP_OVERRIDE_CNT[] = "QFO"; // Query Fingerprint Override
fmanzano_dtk 1:9e821e640117 37
fmanzano_dtk 1:9e821e640117 38 // COMANDOS DE PARLANTE
fmanzano_dtk 1:9e821e640117 39 const char VOL_CMD[] = "VOL"; // SET JQ8400 VOL
fmanzano_dtk 1:9e821e640117 40 const char Q_VOLUME_LEVEL[] = "QVL"; // Query Volume level
fmanzano_dtk 1:9e821e640117 41
fmanzano_dtk 1:9e821e640117 42 // COMANDOS PARA SENSOR DE LLUVIA
fmanzano_dtk 1:9e821e640117 43 const char RAIN_ENA_CMD[] = "RNN"; // RaiN oN
fmanzano_dtk 1:9e821e640117 44 const char RAIN_DIS_CMD[] = "RNF"; // RaiN oFf
fmanzano_dtk 1:9e821e640117 45 const char Q_RAIN_SENSOR_STATUS[] = "QRS"; // Query Rain Sensor Status - 1 Enable, 0 Disable
fmanzano_dtk 1:9e821e640117 46 const char CHANGE_RAIN_TIMER[] = "RST"; // change Rain Sensor Timer
fmanzano_dtk 1:9e821e640117 47 const char Q_RAIN_TIMER[] = "QRT"; // Query Rain Timer
fmanzano_dtk 1:9e821e640117 48 const char CHANGE_WSL_TXT[] = "WSL"; // Wet Speed Limit
fmanzano_dtk 1:9e821e640117 49 const char CHANGE_WSW_TXT[] = "WSW"; // Wet Speed Warning
fmanzano_dtk 1:9e821e640117 50 const char CHANGE_DSL_TXT[] = "DSL"; // Dry Speed Limit
fmanzano_dtk 1:9e821e640117 51 const char CHANGE_DSW_TXT[] = "DSW"; // Dry Speed Warning
fmanzano_dtk 1:9e821e640117 52 const char QUERY_SPEED_LIMIT[] = "QSL"; // Query Speed Limit
fmanzano_dtk 1:9e821e640117 53 const char RAIN_SILENT_ENABLE[] = "RSN"; //* Rain sensor Silent mode oN
fmanzano_dtk 1:9e821e640117 54 const char RAIN_SILENT_DISABLE[] = "RSF"; //* Rain sensor Silent mode ofF
fmanzano_dtk 1:9e821e640117 55 const char RAIN_SILENT_QUERY[] = "RSQ"; //* Rain sensor Silent mode Query
fmanzano_dtk 1:9e821e640117 56
fmanzano_dtk 1:9e821e640117 57 // COMANDOS PARA CINTURONES DE SEGURIDAD
fmanzano_dtk 1:9e821e640117 58 const char SEATBELT_ENA_CMD[] = "SBN"; // SeatBelt reading oN
fmanzano_dtk 1:9e821e640117 59 const char SEATBELT_DIS_CMD[] = "SBF"; // SeatBelt reading oFF
fmanzano_dtk 1:9e821e640117 60 const char SEATBELT_QUERY_CMD[] = "SBQ"; // SeatBelt reading Query
fmanzano_dtk 1:9e821e640117 61 const char FORCE_BUCLKE_ENA_CMD[] = "FBN"; // Force Buclke oN
fmanzano_dtk 1:9e821e640117 62 const char FORCE_BUCLKE_DIS_CMD[] = "FBF"; // Force Buclke oFF
fmanzano_dtk 1:9e821e640117 63 const char Q_FORCE_SEATBELT_STATUS[] = "FSS"; // query Force Seatbelt Status
fmanzano_dtk 1:9e821e640117 64 const char INPUT_NORMALLY_OPEN[] = "INO"; // Inputs Normally Open
fmanzano_dtk 1:9e821e640117 65 const char INPUT_NORMALLY_CLOSE[] = "INC"; // Inputs Normally Close
fmanzano_dtk 1:9e821e640117 66 const char Q_DIGITAL_INPUT_CONF[] = "QDI"; // Query Digital Input Configuration
fmanzano_dtk 1:9e821e640117 67 // Definición de cinturones Individual
fmanzano_dtk 1:9e821e640117 68 const char PILOT_BUCKLE_N_OPEN[4] = "PBO"; // Pilot Buckle normally Open
fmanzano_dtk 1:9e821e640117 69 const char PILOT_BUCKLE_N_CLOSE[4] = "PBC"; // Pilot Buckle normally Close
fmanzano_dtk 1:9e821e640117 70 const char Q_PILOT_BUCLE_TYPE[4] = "QPB"; // Query Pilot Buckle type
fmanzano_dtk 1:9e821e640117 71 const char COPILOT_BUCKLE_N_OPEN[4] = "CBO"; // Copilot Buckle normally Open
fmanzano_dtk 1:9e821e640117 72 const char COPILOT_BUCKLE_N_CLOSE[4] = "CBC"; // Copilot Buckle normally Close
fmanzano_dtk 1:9e821e640117 73 const char Q_COPILOT_BUCLE_TYPE[4] = "QCB"; // Query Copilot Buckle type
fmanzano_dtk 1:9e821e640117 74 const char CREW_BUCKLE_N_OPEN[4] = "TBO"; // Crew Buckle normally Open
fmanzano_dtk 1:9e821e640117 75 const char CREW_BUCKLE_N_CLOSE[4] = "TBC"; // Crew Buckle normally Close
fmanzano_dtk 1:9e821e640117 76 const char Q_CREW_BUCLE_TYPE[4] = "QTB"; // Query Crew Buckle type
fmanzano_dtk 1:9e821e640117 77
fmanzano_dtk 1:9e821e640117 78 // COMANDOS DE RALENTI
fmanzano_dtk 1:9e821e640117 79 const char IDLE_SHUTDOWN_ENA_CMD[] = "ISN"; // Idle Shutdown oN
fmanzano_dtk 1:9e821e640117 80 const char IDLE_SHUTDOWN_DIS_CMD[] = "ISF"; // Idle Shutdown oFF
fmanzano_dtk 1:9e821e640117 81 const char IDLE_SHUTDOWN_QUERY[] = "ISQ"; // Idle Shutdown Query
fmanzano_dtk 1:9e821e640117 82 const char Q_IDLE_SHUTDOWN_STATUS[] = "ISS"; // query Idle Shutdown Status
fmanzano_dtk 1:9e821e640117 83 const char CHANGE_IDLE_TIMER[] = "IST"; // Idle Shutdown Timer
fmanzano_dtk 1:9e821e640117 84 const char QUERY_IDLE_TIMER[] = "QIT"; // Query Idle shutdown Timer
fmanzano_dtk 1:9e821e640117 85 const char IDLE_REMINDER_ENABLE[] = "IRN"; // Idle Reminder oN
fmanzano_dtk 1:9e821e640117 86 const char IDLE_REMINDER_DISABLE[] = "IRF"; // Idle Remider oFF
fmanzano_dtk 1:9e821e640117 87 const char QUERY_IDLE_REMINDER[] = "QIR"; // Query Idle Reminder
fmanzano_dtk 1:9e821e640117 88 const char IDLE_REMINDER_TIMER[] = "IRT"; // Idle Reminer Timer
fmanzano_dtk 1:9e821e640117 89 const char QUERY_IDLE_REMINDER_T[] = "QRT"; // Query idle Reminder Timer
fmanzano_dtk 1:9e821e640117 90
fmanzano_dtk 1:9e821e640117 91 // COMANDOS DE TIP DE SEGURIDAD
fmanzano_dtk 1:9e821e640117 92 const char QUERY_SAFETY_TIP[] = "QST"; // Query Safety Tip Time
fmanzano_dtk 1:9e821e640117 93 const char CHANGE_SAFETY_TIME[] = "STT"; // Safety Tip Time
fmanzano_dtk 1:9e821e640117 94 const char SAFETY_TIP_ENABLE[] = "STN"; // Safety Tip oN
fmanzano_dtk 1:9e821e640117 95 const char SAFETY_TIP_DISABLE[] = "STF"; // Safety Tip oFf
fmanzano_dtk 1:9e821e640117 96
fmanzano_dtk 1:9e821e640117 97 // COMANDOS DE VERSION DE ICS5
fmanzano_dtk 1:9e821e640117 98 const char Q_HARDWARE_VERSION[] = "QHW"; // Query Hardware Version
fmanzano_dtk 1:9e821e640117 99 const char Q_FIRMWARE_VERSION[] = "QFW"; // Query Firmware Version
fmanzano_dtk 1:9e821e640117 100
fmanzano_dtk 1:9e821e640117 101 // COMANDOS DE NOTIFICACION DE GEOCERCA
fmanzano_dtk 1:9e821e640117 102 const char GEO_WARNING_ENABLE[] = "GWN"; //* Geozone Warning oN
fmanzano_dtk 1:9e821e640117 103 const char GEO_WARNING_DISABLE[] = "GWF"; //* Geozone Warning ofF
fmanzano_dtk 1:9e821e640117 104 const char Q_GEO_WARNING_CONF[] = "QGW"; //* Query Geozone Warning Status
fmanzano_dtk 1:9e821e640117 105 const char GEO_WARNING_GETIN[] = "GNI"; //* Geozone Notification Inside
fmanzano_dtk 1:9e821e640117 106 const char GEO_WARNING_GETOUT[] = "GNO"; //* Geozone Notification Outside
fmanzano_dtk 1:9e821e640117 107 const char GEO_WARNING_EVENT[] = "GNE"; //* Geozone Notification Event
fmanzano_dtk 1:9e821e640117 108
fmanzano_dtk 1:9e821e640117 109 // COMANDOS DE AUTORESET BLUETOOTH
fmanzano_dtk 1:9e821e640117 110 const char BLE_AUTORESET_ENABLE[4] = "BAN"; // Bluetooth Autoreset oN
fmanzano_dtk 1:9e821e640117 111 const char BLE_AUTORESET_DISABLE[4] = "BAF"; // Bluetooth Autoreset ofF
fmanzano_dtk 1:9e821e640117 112 const char BLE_AUTORESET_TIME[4] = "BAT"; // Bluetooth Autoreset change Time
fmanzano_dtk 1:9e821e640117 113 const char BLE_AUTORESET_QUERY[4] = "BAQ"; // Bluetooth Autoreset Query
fmanzano_dtk 1:9e821e640117 114
fmanzano_dtk 1:9e821e640117 115 // CONSTANTES DE CAMPOS DE TRAMA
fmanzano_dtk 1:9e821e640117 116 const int FINGER_CMD_START = 1;
fmanzano_dtk 1:9e821e640117 117 const int FINGER_CMD_END = 3;
fmanzano_dtk 1:9e821e640117 118 const int FINGER_ID_BEGIN = 5;
fmanzano_dtk 1:9e821e640117 119 const int FINGER_ID_END = 8;
fmanzano_dtk 1:9e821e640117 120 const int FINGER_PAYLOAD_EOL = 9;
fmanzano_dtk 1:9e821e640117 121 const int FINGER_PAYLOAD_START = 10;
fmanzano_dtk 1:9e821e640117 122 const int FINGER_PAYLOAD_END = 1006;
fmanzano_dtk 1:9e821e640117 123
fmanzano_dtk 1:9e821e640117 124 /**
fmanzano_dtk 1:9e821e640117 125 * @brief
fmanzano_dtk 1:9e821e640117 126 *
fmanzano_dtk 1:9e821e640117 127 * @param cadena
fmanzano_dtk 1:9e821e640117 128 * @return int
fmanzano_dtk 1:9e821e640117 129 */
fmanzano_dtk 1:9e821e640117 130 int strID_to_intID(char cadena[5]) {
fmanzano_dtk 1:9e821e640117 131 /*
fmanzano_dtk 1:9e821e640117 132 Esta función recibe una cadena de 5 posiciones
fmanzano_dtk 1:9e821e640117 133 multiplica cada posición de la cadena por su peso
fmanzano_dtk 1:9e821e640117 134 decimal y lo acumula en una variable de tipo long.
fmanzano_dtk 1:9e821e640117 135 La posición 5 no se opera por tratarse del caracter
fmanzano_dtk 1:9e821e640117 136 de fin de cadena \0.
fmanzano_dtk 1:9e821e640117 137 */
fmanzano_dtk 1:9e821e640117 138 int result = 0;
fmanzano_dtk 1:9e821e640117 139 int temp = 0;
fmanzano_dtk 1:9e821e640117 140
fmanzano_dtk 1:9e821e640117 141 temp = (int) cadena[0];
fmanzano_dtk 1:9e821e640117 142 temp = temp - 48.0;
fmanzano_dtk 1:9e821e640117 143 temp = temp * 1000;
fmanzano_dtk 1:9e821e640117 144 result = result + temp;
fmanzano_dtk 1:9e821e640117 145
fmanzano_dtk 1:9e821e640117 146 temp = (int) cadena[1];
fmanzano_dtk 1:9e821e640117 147 temp = temp - 48.0;
fmanzano_dtk 1:9e821e640117 148 temp = temp * 100;
fmanzano_dtk 1:9e821e640117 149 result = result + temp;
fmanzano_dtk 1:9e821e640117 150
fmanzano_dtk 1:9e821e640117 151 temp = (int) cadena[2];
fmanzano_dtk 1:9e821e640117 152 temp = temp - 48.0;
fmanzano_dtk 1:9e821e640117 153 temp = temp * 10;
fmanzano_dtk 1:9e821e640117 154 result = result + temp;
fmanzano_dtk 1:9e821e640117 155
fmanzano_dtk 1:9e821e640117 156 temp = (int) cadena[3];
fmanzano_dtk 1:9e821e640117 157 temp = temp - 48.0;
fmanzano_dtk 1:9e821e640117 158 result = result + temp;
fmanzano_dtk 1:9e821e640117 159
fmanzano_dtk 1:9e821e640117 160 return(result);
fmanzano_dtk 1:9e821e640117 161 }
fmanzano_dtk 1:9e821e640117 162
fmanzano_dtk 1:9e821e640117 163 /**
fmanzano_dtk 1:9e821e640117 164 * @brief
fmanzano_dtk 1:9e821e640117 165 *
fmanzano_dtk 1:9e821e640117 166 * @param payload
fmanzano_dtk 1:9e821e640117 167 * @return true
fmanzano_dtk 1:9e821e640117 168 * @return false
fmanzano_dtk 1:9e821e640117 169 */
fmanzano_dtk 1:9e821e640117 170 bool verify_finger_payload(char payload[1011]) {
fmanzano_dtk 1:9e821e640117 171 bool inicio_encontrado = false; // Tipo Bool
fmanzano_dtk 1:9e821e640117 172 bool fin_encontrado = false; // Tipo Bool
fmanzano_dtk 1:9e821e640117 173 char *ret;
fmanzano_dtk 1:9e821e640117 174
fmanzano_dtk 1:9e821e640117 175 // Verificar si se encuentra el inicio del comando @
fmanzano_dtk 1:9e821e640117 176 ret = strchr(payload, FINGER_CMD_BEGIN[0]);
fmanzano_dtk 1:9e821e640117 177 if (ret!=NULL) {
fmanzano_dtk 1:9e821e640117 178 inicio_encontrado = true;
fmanzano_dtk 1:9e821e640117 179 }
fmanzano_dtk 1:9e821e640117 180
fmanzano_dtk 1:9e821e640117 181 // Verificar si se encuentra el fin de comando #
fmanzano_dtk 1:9e821e640117 182 ret = strchr(payload, FINGER_CMD_EOF[0]);
fmanzano_dtk 1:9e821e640117 183 if (ret!=NULL) {
fmanzano_dtk 1:9e821e640117 184 fin_encontrado = 1;
fmanzano_dtk 1:9e821e640117 185 }
fmanzano_dtk 1:9e821e640117 186
fmanzano_dtk 1:9e821e640117 187 if (inicio_encontrado && fin_encontrado) { // Trama para procesar
fmanzano_dtk 1:9e821e640117 188 return(true);
fmanzano_dtk 1:9e821e640117 189 } else { // Trama para ignorar
fmanzano_dtk 1:9e821e640117 190 return(false);
fmanzano_dtk 1:9e821e640117 191 }
fmanzano_dtk 1:9e821e640117 192 }
fmanzano_dtk 1:9e821e640117 193
fmanzano_dtk 1:9e821e640117 194 /**
fmanzano_dtk 1:9e821e640117 195 * @brief
fmanzano_dtk 1:9e821e640117 196 *
fmanzano_dtk 1:9e821e640117 197 * @param payload
fmanzano_dtk 1:9e821e640117 198 * @param comando
fmanzano_dtk 1:9e821e640117 199 * @param id_huella
fmanzano_dtk 1:9e821e640117 200 * @param huella_hex
fmanzano_dtk 1:9e821e640117 201 * @return true
fmanzano_dtk 1:9e821e640117 202 * @return false
fmanzano_dtk 1:9e821e640117 203 */
fmanzano_dtk 1:9e821e640117 204 bool parse_finger_payload(char payload[1011], char comando[4], int *id_huella, char huella_hex[997]) {
fmanzano_dtk 1:9e821e640117 205 char id_txt[5]; // Almacenar temporalmente el ID a procesar.
fmanzano_dtk 1:9e821e640117 206 char * pch;
fmanzano_dtk 1:9e821e640117 207 int i = 0;
fmanzano_dtk 1:9e821e640117 208 int j = 0;
fmanzano_dtk 1:9e821e640117 209 memset(id_txt, '\0', sizeof(id_txt));
fmanzano_dtk 1:9e821e640117 210 memset(huella_hex, '\0', sizeof(huella_hex));
fmanzano_dtk 1:9e821e640117 211
fmanzano_dtk 1:9e821e640117 212 if (payload[0] == '@') {
fmanzano_dtk 1:9e821e640117 213
fmanzano_dtk 1:9e821e640117 214 pch = strtok (payload, "@;#");
fmanzano_dtk 1:9e821e640117 215
fmanzano_dtk 1:9e821e640117 216 while (pch != NULL) {
fmanzano_dtk 1:9e821e640117 217 j++;
fmanzano_dtk 1:9e821e640117 218 //debug -> printf("BLE - Puntero-%d = %s\r\n", j, pch);
fmanzano_dtk 1:9e821e640117 219 if (j == 1) {
fmanzano_dtk 1:9e821e640117 220 strcpy(comando, pch);
fmanzano_dtk 1:9e821e640117 221 //debug -> printf("BLE - Comando TXT = %s\r\n", comando);
fmanzano_dtk 1:9e821e640117 222 } else if (j ==2) {
fmanzano_dtk 1:9e821e640117 223 strcpy(id_txt, pch);
fmanzano_dtk 1:9e821e640117 224 //debug -> printf("BLE - ID TXT = %s\r\n", id_txt);
fmanzano_dtk 1:9e821e640117 225 *id_huella = atoi(id_txt);
fmanzano_dtk 1:9e821e640117 226 //debug -> printf("BLE - ID NUM=%d\r\n", *id_huella);
fmanzano_dtk 1:9e821e640117 227 } else if (j == 3) {
fmanzano_dtk 1:9e821e640117 228 strcpy(huella_hex, pch);
fmanzano_dtk 1:9e821e640117 229 //debug -> printf("BLE - Huella ASCII\r\n=%s\r\n\r\n", huella_hex);
fmanzano_dtk 1:9e821e640117 230 }
fmanzano_dtk 1:9e821e640117 231 pch = strtok (NULL, "@;#");
fmanzano_dtk 1:9e821e640117 232 }
fmanzano_dtk 1:9e821e640117 233
fmanzano_dtk 1:9e821e640117 234 //debug -> printf("BLE - Repeticiones de Lazo = %d\r\n", j);
fmanzano_dtk 1:9e821e640117 235 if (j == 4) {
fmanzano_dtk 1:9e821e640117 236 //debug -> printf("BLE - Trama con Huella TRUE\r\n");
fmanzano_dtk 1:9e821e640117 237 return true;
fmanzano_dtk 1:9e821e640117 238 } else {
fmanzano_dtk 1:9e821e640117 239 //debug -> printf("BLE - Trama con Huella FALSE\r\n");
fmanzano_dtk 1:9e821e640117 240 return false;
fmanzano_dtk 1:9e821e640117 241 }
fmanzano_dtk 1:9e821e640117 242 }
fmanzano_dtk 1:9e821e640117 243 return true;
fmanzano_dtk 1:9e821e640117 244 }
fmanzano_dtk 1:9e821e640117 245
fmanzano_dtk 1:9e821e640117 246
fmanzano_dtk 1:9e821e640117 247 /**
fmanzano_dtk 1:9e821e640117 248 * @brief
fmanzano_dtk 1:9e821e640117 249 *
fmanzano_dtk 1:9e821e640117 250 * @param huella_hex
fmanzano_dtk 1:9e821e640117 251 * @param huella_ascii
fmanzano_dtk 1:9e821e640117 252 * @return true
fmanzano_dtk 1:9e821e640117 253 * @return false
fmanzano_dtk 1:9e821e640117 254 */
fmanzano_dtk 1:9e821e640117 255 bool fingerprint_HEX2CHAR(char huella_hex[997], char huella_ascii[499]) {
fmanzano_dtk 1:9e821e640117 256 /*
fmanzano_dtk 1:9e821e640117 257 Esta función se encarga de analisar el payload de una
fmanzano_dtk 1:9e821e640117 258 huella que es enviada dentro de una cadena (char array)
fmanzano_dtk 1:9e821e640117 259 expresada de manera hexadecimal. en su equivalente de código
fmanzano_dtk 1:9e821e640117 260 ASCII que es guardado en otra cadena.
fmanzano_dtk 1:9e821e640117 261 */
fmanzano_dtk 1:9e821e640117 262
fmanzano_dtk 1:9e821e640117 263 int i = 0;
fmanzano_dtk 1:9e821e640117 264 int j = 0;
fmanzano_dtk 1:9e821e640117 265 int k = 0;
fmanzano_dtk 1:9e821e640117 266 int limite = strlen(huella_hex);
fmanzano_dtk 1:9e821e640117 267 char pre_buffer[] = "--\0";
fmanzano_dtk 1:9e821e640117 268
fmanzano_dtk 1:9e821e640117 269 for (i=0; i<limite; i++) {
fmanzano_dtk 1:9e821e640117 270 pre_buffer[j] = huella_hex[i];
fmanzano_dtk 1:9e821e640117 271 j++;
fmanzano_dtk 1:9e821e640117 272
fmanzano_dtk 1:9e821e640117 273 if ((i%2)&&(i>=1)) { // Si es impar.
fmanzano_dtk 1:9e821e640117 274 j=0;
fmanzano_dtk 1:9e821e640117 275 huella_ascii[k] = (int)strtol(pre_buffer, NULL, 16);
fmanzano_dtk 1:9e821e640117 276 k++;
fmanzano_dtk 1:9e821e640117 277 }
fmanzano_dtk 1:9e821e640117 278 }
fmanzano_dtk 1:9e821e640117 279 return(true);
fmanzano_dtk 1:9e821e640117 280 }
fmanzano_dtk 1:9e821e640117 281
fmanzano_dtk 1:9e821e640117 282 /**
fmanzano_dtk 1:9e821e640117 283 * @brief
fmanzano_dtk 1:9e821e640117 284 *
fmanzano_dtk 1:9e821e640117 285 * @param comando
fmanzano_dtk 1:9e821e640117 286 * @return int
fmanzano_dtk 1:9e821e640117 287 */
fmanzano_dtk 1:9e821e640117 288 int identify_server_cmd(char comando[4]) {
fmanzano_dtk 1:9e821e640117 289 /*
fmanzano_dtk 1:9e821e640117 290 Esta función se encarga de verificar que el comando a ejecutar es soportado
fmanzano_dtk 1:9e821e640117 291 por el código y que no se ha generado una mala interpretación de la trama
fmanzano_dtk 1:9e821e640117 292 al momento de extraer los caracteres correspondientes al comando.
fmanzano_dtk 1:9e821e640117 293 Esta función retorna 1 si el comando es ADD. Retorna 2 para el comando DEL.
fmanzano_dtk 1:9e821e640117 294 Retorna 0 si no es ninguno de los dos.
fmanzano_dtk 1:9e821e640117 295 */
fmanzano_dtk 1:9e821e640117 296 char* p;
fmanzano_dtk 1:9e821e640117 297 int comand_int = 0;
fmanzano_dtk 1:9e821e640117 298
fmanzano_dtk 1:9e821e640117 299
fmanzano_dtk 1:9e821e640117 300 /** **********************************
fmanzano_dtk 1:9e821e640117 301 * COMANDOS DE GEOCERCA
fmanzano_dtk 1:9e821e640117 302 * ********************************** */
fmanzano_dtk 1:9e821e640117 303 p = strstr(comando, GEO_WARNING_GETIN);
fmanzano_dtk 1:9e821e640117 304 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 305 comand_int = CMD_GEO_WARNING_GETIN;
fmanzano_dtk 1:9e821e640117 306 return(comand_int);
fmanzano_dtk 1:9e821e640117 307 }
fmanzano_dtk 1:9e821e640117 308
fmanzano_dtk 1:9e821e640117 309 p = strstr(comando, GEO_WARNING_GETOUT);
fmanzano_dtk 1:9e821e640117 310 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 311 comand_int = CMD_GEO_WARNING_GETOUT;
fmanzano_dtk 1:9e821e640117 312 return(comand_int);
fmanzano_dtk 1:9e821e640117 313 }
fmanzano_dtk 1:9e821e640117 314
fmanzano_dtk 1:9e821e640117 315 p = strstr(comando, GEO_WARNING_EVENT);
fmanzano_dtk 1:9e821e640117 316 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 317 comand_int = CMD_GEO_WARNING_EVENT;
fmanzano_dtk 1:9e821e640117 318 return(comand_int);
fmanzano_dtk 1:9e821e640117 319 }
fmanzano_dtk 1:9e821e640117 320
fmanzano_dtk 1:9e821e640117 321 p = strstr(comando, GEO_WARNING_ENABLE);
fmanzano_dtk 1:9e821e640117 322 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 323 comand_int = CMD_GEO_WARNING_ENABLE;
fmanzano_dtk 1:9e821e640117 324 return(comand_int);
fmanzano_dtk 1:9e821e640117 325 }
fmanzano_dtk 1:9e821e640117 326
fmanzano_dtk 1:9e821e640117 327 p = strstr(comando, GEO_WARNING_DISABLE);
fmanzano_dtk 1:9e821e640117 328 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 329 comand_int = CMD_GEO_WARNING_DISABLE;
fmanzano_dtk 1:9e821e640117 330 return(comand_int);
fmanzano_dtk 1:9e821e640117 331 }
fmanzano_dtk 1:9e821e640117 332
fmanzano_dtk 1:9e821e640117 333 p = strstr(comando, Q_GEO_WARNING_CONF);
fmanzano_dtk 1:9e821e640117 334 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 335 comand_int = CMD_GEO_WARNING_QUERY;
fmanzano_dtk 1:9e821e640117 336 return(comand_int);
fmanzano_dtk 1:9e821e640117 337 }
fmanzano_dtk 1:9e821e640117 338
fmanzano_dtk 1:9e821e640117 339
fmanzano_dtk 1:9e821e640117 340
fmanzano_dtk 1:9e821e640117 341 /** **********************************
fmanzano_dtk 1:9e821e640117 342 * COMANDOS DE LECTOR DE HUELLA
fmanzano_dtk 1:9e821e640117 343 * ********************************** */
fmanzano_dtk 1:9e821e640117 344 p = strstr(comando, ADD_CMD);
fmanzano_dtk 1:9e821e640117 345 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 346 comand_int = CMD_FINGER_ADD;
fmanzano_dtk 1:9e821e640117 347 return(comand_int);
fmanzano_dtk 1:9e821e640117 348 }
fmanzano_dtk 1:9e821e640117 349
fmanzano_dtk 1:9e821e640117 350 p = strstr(comando, DEL_CMD);
fmanzano_dtk 1:9e821e640117 351 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 352 comand_int = CMD_FINGER_DELETE;
fmanzano_dtk 1:9e821e640117 353 return(comand_int);
fmanzano_dtk 1:9e821e640117 354 }
fmanzano_dtk 1:9e821e640117 355
fmanzano_dtk 1:9e821e640117 356 p = strstr(comando, FINGERPRINT_DIS_CMD);
fmanzano_dtk 1:9e821e640117 357 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 358 comand_int = CMD_FINGER_DISABLE;
fmanzano_dtk 1:9e821e640117 359 return(comand_int);
fmanzano_dtk 1:9e821e640117 360 }
fmanzano_dtk 1:9e821e640117 361
fmanzano_dtk 1:9e821e640117 362 p = strstr(comando, FINGERPRINT_ENA_CMD);
fmanzano_dtk 1:9e821e640117 363 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 364 comand_int = CMD_FINGER_ENABLE;
fmanzano_dtk 1:9e821e640117 365 return(comand_int);
fmanzano_dtk 1:9e821e640117 366 }
fmanzano_dtk 1:9e821e640117 367
fmanzano_dtk 1:9e821e640117 368 p = strstr(comando, Q_FINGERPRINT_STATUS);
fmanzano_dtk 1:9e821e640117 369 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 370 comand_int = CMD_FINGERPRINT_QUERY;
fmanzano_dtk 1:9e821e640117 371 return(comand_int);
fmanzano_dtk 1:9e821e640117 372 }
fmanzano_dtk 1:9e821e640117 373
fmanzano_dtk 1:9e821e640117 374 p = strstr(comando, FINGERPRINT_QRY_CMD);
fmanzano_dtk 1:9e821e640117 375 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 376 comand_int = CMD_FINGER_ENROLL_CNT;
fmanzano_dtk 1:9e821e640117 377 return(comand_int);
fmanzano_dtk 1:9e821e640117 378 }
fmanzano_dtk 1:9e821e640117 379
fmanzano_dtk 1:9e821e640117 380 p = strstr(comando, Q_CHECK_ENROLLED_ID);
fmanzano_dtk 1:9e821e640117 381 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 382 comand_int = CMD_CHECK_ENROLLED_ID;
fmanzano_dtk 1:9e821e640117 383 return(comand_int);
fmanzano_dtk 1:9e821e640117 384 }
fmanzano_dtk 1:9e821e640117 385
fmanzano_dtk 1:9e821e640117 386 p = strstr(comando, FP_OVERRIDE_ENABLE);
fmanzano_dtk 1:9e821e640117 387 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 388 comand_int = CMD_FP_OVERRIDE_ENABLE;
fmanzano_dtk 1:9e821e640117 389 return(comand_int);
fmanzano_dtk 1:9e821e640117 390 }
fmanzano_dtk 1:9e821e640117 391
fmanzano_dtk 1:9e821e640117 392 p = strstr(comando, FP_OVERRIDE_DISABLE);
fmanzano_dtk 1:9e821e640117 393 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 394 comand_int = CMD_FP_OVERRIDE_DISABLE;
fmanzano_dtk 1:9e821e640117 395 return(comand_int);
fmanzano_dtk 1:9e821e640117 396 }
fmanzano_dtk 1:9e821e640117 397
fmanzano_dtk 1:9e821e640117 398 p = strstr(comando, FP_OVERRIDE_COUNT);
fmanzano_dtk 1:9e821e640117 399 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 400 comand_int = CMD_FP_OVERRIDE_COUNT;
fmanzano_dtk 1:9e821e640117 401 return(comand_int);
fmanzano_dtk 1:9e821e640117 402 }
fmanzano_dtk 1:9e821e640117 403
fmanzano_dtk 1:9e821e640117 404 p = strstr(comando, Q_FP_OVERRIDE_CNT);
fmanzano_dtk 1:9e821e640117 405 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 406 comand_int = CMD_FP_OVERRIDE_QUERY;
fmanzano_dtk 1:9e821e640117 407 return(comand_int);
fmanzano_dtk 1:9e821e640117 408 }
fmanzano_dtk 1:9e821e640117 409
fmanzano_dtk 1:9e821e640117 410
fmanzano_dtk 1:9e821e640117 411
fmanzano_dtk 1:9e821e640117 412 /** **********************************
fmanzano_dtk 1:9e821e640117 413 * COMANDOS DE PARLANTE
fmanzano_dtk 1:9e821e640117 414 * ********************************** */
fmanzano_dtk 1:9e821e640117 415 p = strstr(comando, VOL_CMD);
fmanzano_dtk 1:9e821e640117 416 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 417 comand_int = CMD_SET_VOLUME;
fmanzano_dtk 1:9e821e640117 418 return(comand_int);
fmanzano_dtk 1:9e821e640117 419 }
fmanzano_dtk 1:9e821e640117 420
fmanzano_dtk 1:9e821e640117 421 p = strstr(comando, Q_VOLUME_LEVEL);
fmanzano_dtk 1:9e821e640117 422 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 423 comand_int = CMD_QUERY_VOLUME_LEVEL;
fmanzano_dtk 1:9e821e640117 424 return(comand_int);
fmanzano_dtk 1:9e821e640117 425 }
fmanzano_dtk 1:9e821e640117 426
fmanzano_dtk 1:9e821e640117 427
fmanzano_dtk 1:9e821e640117 428
fmanzano_dtk 1:9e821e640117 429 /** **********************************
fmanzano_dtk 1:9e821e640117 430 * COMANDOS DE SENSOR DE LLUVIA
fmanzano_dtk 1:9e821e640117 431 * ********************************** */
fmanzano_dtk 1:9e821e640117 432 p = strstr(comando, RAIN_ENA_CMD);
fmanzano_dtk 1:9e821e640117 433 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 434 comand_int = CMD_RAIN_ENABLE;
fmanzano_dtk 1:9e821e640117 435 return(comand_int);
fmanzano_dtk 1:9e821e640117 436 }
fmanzano_dtk 1:9e821e640117 437
fmanzano_dtk 1:9e821e640117 438 p = strstr(comando, RAIN_DIS_CMD);
fmanzano_dtk 1:9e821e640117 439 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 440 comand_int = CMD_RAIN_DISABLE;
fmanzano_dtk 1:9e821e640117 441 return(comand_int);
fmanzano_dtk 1:9e821e640117 442 }
fmanzano_dtk 1:9e821e640117 443
fmanzano_dtk 1:9e821e640117 444 p = strstr(comando, Q_RAIN_SENSOR_STATUS);
fmanzano_dtk 1:9e821e640117 445 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 446 comand_int = CMD_RAIN_QUERY;
fmanzano_dtk 1:9e821e640117 447 return(comand_int);
fmanzano_dtk 1:9e821e640117 448 }
fmanzano_dtk 1:9e821e640117 449
fmanzano_dtk 1:9e821e640117 450 p = strstr(comando, CHANGE_RAIN_TIMER);
fmanzano_dtk 1:9e821e640117 451 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 452 comand_int = CMD_CHANGE_RAIN_TIMER;
fmanzano_dtk 1:9e821e640117 453 return(comand_int);
fmanzano_dtk 1:9e821e640117 454 }
fmanzano_dtk 1:9e821e640117 455
fmanzano_dtk 1:9e821e640117 456 p = strstr(comando, Q_RAIN_TIMER);
fmanzano_dtk 1:9e821e640117 457 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 458 comand_int = CMD_QUERY_RAIN_TIMER;
fmanzano_dtk 1:9e821e640117 459 return(comand_int);
fmanzano_dtk 1:9e821e640117 460 }
fmanzano_dtk 1:9e821e640117 461
fmanzano_dtk 1:9e821e640117 462 p = strstr(comando, RAIN_SILENT_ENABLE);
fmanzano_dtk 1:9e821e640117 463 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 464 comand_int = CMD_RAIN_SILENT_MODE_ENA;
fmanzano_dtk 1:9e821e640117 465 return(comand_int);
fmanzano_dtk 1:9e821e640117 466 }
fmanzano_dtk 1:9e821e640117 467
fmanzano_dtk 1:9e821e640117 468 p = strstr(comando, RAIN_SILENT_DISABLE);
fmanzano_dtk 1:9e821e640117 469 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 470 comand_int = CMD_RAIN_SILENT_MODE_DIS;
fmanzano_dtk 1:9e821e640117 471 return(comand_int);
fmanzano_dtk 1:9e821e640117 472 }
fmanzano_dtk 1:9e821e640117 473
fmanzano_dtk 1:9e821e640117 474 p = strstr(comando, RAIN_SILENT_QUERY);
fmanzano_dtk 1:9e821e640117 475 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 476 comand_int = CMD_RAIN_SILENT_MODE_Q;
fmanzano_dtk 1:9e821e640117 477 return(comand_int);
fmanzano_dtk 1:9e821e640117 478 }
fmanzano_dtk 1:9e821e640117 479
fmanzano_dtk 1:9e821e640117 480
fmanzano_dtk 1:9e821e640117 481
fmanzano_dtk 1:9e821e640117 482
fmanzano_dtk 1:9e821e640117 483 /** **********************************
fmanzano_dtk 1:9e821e640117 484 * COMANDOS DE LIMITE DE VELOCIDAD
fmanzano_dtk 1:9e821e640117 485 * ********************************** */
fmanzano_dtk 1:9e821e640117 486 p = strstr(comando, CHANGE_WSL_TXT);
fmanzano_dtk 1:9e821e640117 487 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 488 comand_int = CMD_CHANGE_WSL;
fmanzano_dtk 1:9e821e640117 489 return(comand_int);
fmanzano_dtk 1:9e821e640117 490 }
fmanzano_dtk 1:9e821e640117 491
fmanzano_dtk 1:9e821e640117 492 p = strstr(comando, CHANGE_WSW_TXT);
fmanzano_dtk 1:9e821e640117 493 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 494 comand_int = CMD_CHANGE_WSW;
fmanzano_dtk 1:9e821e640117 495 return(comand_int);
fmanzano_dtk 1:9e821e640117 496 }
fmanzano_dtk 1:9e821e640117 497
fmanzano_dtk 1:9e821e640117 498 p = strstr(comando, CHANGE_DSL_TXT);
fmanzano_dtk 1:9e821e640117 499 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 500 comand_int = CMD_CHANGE_DSL;
fmanzano_dtk 1:9e821e640117 501 return(comand_int);
fmanzano_dtk 1:9e821e640117 502 }
fmanzano_dtk 1:9e821e640117 503
fmanzano_dtk 1:9e821e640117 504 p = strstr(comando, CHANGE_DSW_TXT);
fmanzano_dtk 1:9e821e640117 505 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 506 comand_int = CMD_CHANGE_DSW;
fmanzano_dtk 1:9e821e640117 507 return(comand_int);
fmanzano_dtk 1:9e821e640117 508 }
fmanzano_dtk 1:9e821e640117 509
fmanzano_dtk 1:9e821e640117 510 p = strstr(comando, QUERY_SPEED_LIMIT);
fmanzano_dtk 1:9e821e640117 511 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 512 comand_int = CMD_QUERY_SPEED_LIMIT;
fmanzano_dtk 1:9e821e640117 513 return(comand_int);
fmanzano_dtk 1:9e821e640117 514 }
fmanzano_dtk 1:9e821e640117 515
fmanzano_dtk 1:9e821e640117 516
fmanzano_dtk 1:9e821e640117 517
fmanzano_dtk 1:9e821e640117 518
fmanzano_dtk 1:9e821e640117 519 /** **********************************
fmanzano_dtk 1:9e821e640117 520 * COMANDOS DE CINTURON DE SEGURIDAD
fmanzano_dtk 1:9e821e640117 521 * ********************************** */
fmanzano_dtk 1:9e821e640117 522 p = strstr(comando, SEATBELT_ENA_CMD);
fmanzano_dtk 1:9e821e640117 523 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 524 comand_int = CMD_SEATBELT_ENABLE;
fmanzano_dtk 1:9e821e640117 525 return(comand_int);
fmanzano_dtk 1:9e821e640117 526 }
fmanzano_dtk 1:9e821e640117 527
fmanzano_dtk 1:9e821e640117 528 p = strstr(comando, SEATBELT_DIS_CMD);
fmanzano_dtk 1:9e821e640117 529 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 530 comand_int = CMD_SEATBELT_DISABLE;
fmanzano_dtk 1:9e821e640117 531 return(comand_int);
fmanzano_dtk 1:9e821e640117 532 }
fmanzano_dtk 1:9e821e640117 533
fmanzano_dtk 1:9e821e640117 534 p = strstr(comando, SEATBELT_QUERY_CMD);
fmanzano_dtk 1:9e821e640117 535 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 536 comand_int = CMD_SEATBELT_QUERY;
fmanzano_dtk 1:9e821e640117 537 return(comand_int);
fmanzano_dtk 1:9e821e640117 538 }
fmanzano_dtk 1:9e821e640117 539
fmanzano_dtk 1:9e821e640117 540 p = strstr(comando, FORCE_BUCLKE_ENA_CMD);
fmanzano_dtk 1:9e821e640117 541 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 542 comand_int = CMD_FORCE_BUCLKE_ENABLE;
fmanzano_dtk 1:9e821e640117 543 return(comand_int);
fmanzano_dtk 1:9e821e640117 544 }
fmanzano_dtk 1:9e821e640117 545
fmanzano_dtk 1:9e821e640117 546 p = strstr(comando, FORCE_BUCLKE_DIS_CMD);
fmanzano_dtk 1:9e821e640117 547 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 548 comand_int = CMD_FORCE_BUCLKE_DISABLE;
fmanzano_dtk 1:9e821e640117 549 return(comand_int);
fmanzano_dtk 1:9e821e640117 550 }
fmanzano_dtk 1:9e821e640117 551
fmanzano_dtk 1:9e821e640117 552 p = strstr(comando, Q_FORCE_SEATBELT_STATUS);
fmanzano_dtk 1:9e821e640117 553 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 554 comand_int = CMD_QUERY_FORCE_SEATBELT;
fmanzano_dtk 1:9e821e640117 555 return(comand_int);
fmanzano_dtk 1:9e821e640117 556 }
fmanzano_dtk 1:9e821e640117 557
fmanzano_dtk 1:9e821e640117 558 p = strstr(comando, INPUT_NORMALLY_OPEN);
fmanzano_dtk 1:9e821e640117 559 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 560 comand_int = CMD_SET_INPUT_NORMAL_O;
fmanzano_dtk 1:9e821e640117 561 return(comand_int);
fmanzano_dtk 1:9e821e640117 562 }
fmanzano_dtk 1:9e821e640117 563
fmanzano_dtk 1:9e821e640117 564 p = strstr(comando, INPUT_NORMALLY_CLOSE);
fmanzano_dtk 1:9e821e640117 565 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 566 comand_int = CMD_SET_INPUT_NORMAL_C;
fmanzano_dtk 1:9e821e640117 567 return(comand_int);
fmanzano_dtk 1:9e821e640117 568 }
fmanzano_dtk 1:9e821e640117 569
fmanzano_dtk 1:9e821e640117 570 p = strstr(comando, Q_DIGITAL_INPUT_CONF);
fmanzano_dtk 1:9e821e640117 571 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 572 comand_int = CMD_QUERY_DIN_CONFIG;
fmanzano_dtk 1:9e821e640117 573 return(comand_int);
fmanzano_dtk 1:9e821e640117 574 }
fmanzano_dtk 1:9e821e640117 575
fmanzano_dtk 1:9e821e640117 576 p = strstr(comando, PILOT_BUCKLE_N_OPEN);
fmanzano_dtk 1:9e821e640117 577 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 578 comand_int = CMD_PILOT_BUCKLE_NO;
fmanzano_dtk 1:9e821e640117 579 return(comand_int);
fmanzano_dtk 1:9e821e640117 580 }
fmanzano_dtk 1:9e821e640117 581
fmanzano_dtk 1:9e821e640117 582 p = strstr(comando, PILOT_BUCKLE_N_CLOSE);
fmanzano_dtk 1:9e821e640117 583 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 584 comand_int = CMD_PILOT_BUCKLE_NC;
fmanzano_dtk 1:9e821e640117 585 return(comand_int);
fmanzano_dtk 1:9e821e640117 586 }
fmanzano_dtk 1:9e821e640117 587
fmanzano_dtk 1:9e821e640117 588 p = strstr(comando, Q_PILOT_BUCLE_TYPE);
fmanzano_dtk 1:9e821e640117 589 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 590 comand_int = CMD_QUERY_PILOT_BT;
fmanzano_dtk 1:9e821e640117 591 return(comand_int);
fmanzano_dtk 1:9e821e640117 592 }
fmanzano_dtk 1:9e821e640117 593
fmanzano_dtk 1:9e821e640117 594 p = strstr(comando, COPILOT_BUCKLE_N_OPEN);
fmanzano_dtk 1:9e821e640117 595 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 596 comand_int = CMD_COPILOT_BUCKLE_NO;
fmanzano_dtk 1:9e821e640117 597 return(comand_int);
fmanzano_dtk 1:9e821e640117 598 }
fmanzano_dtk 1:9e821e640117 599
fmanzano_dtk 1:9e821e640117 600 p = strstr(comando, COPILOT_BUCKLE_N_CLOSE);
fmanzano_dtk 1:9e821e640117 601 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 602 comand_int = CMD_COPILOT_BUCKLE_NC;
fmanzano_dtk 1:9e821e640117 603 return(comand_int);
fmanzano_dtk 1:9e821e640117 604 }
fmanzano_dtk 1:9e821e640117 605
fmanzano_dtk 1:9e821e640117 606 p = strstr(comando, Q_COPILOT_BUCLE_TYPE);
fmanzano_dtk 1:9e821e640117 607 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 608 comand_int = CMD_QUERY_COPILOT_BT;
fmanzano_dtk 1:9e821e640117 609 return(comand_int);
fmanzano_dtk 1:9e821e640117 610 }
fmanzano_dtk 1:9e821e640117 611
fmanzano_dtk 1:9e821e640117 612 p = strstr(comando, CREW_BUCKLE_N_OPEN);
fmanzano_dtk 1:9e821e640117 613 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 614 comand_int = CMD_CREW_BUCKLE_NO;
fmanzano_dtk 1:9e821e640117 615 return(comand_int);
fmanzano_dtk 1:9e821e640117 616 }
fmanzano_dtk 1:9e821e640117 617
fmanzano_dtk 1:9e821e640117 618 p = strstr(comando, CREW_BUCKLE_N_CLOSE);
fmanzano_dtk 1:9e821e640117 619 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 620 comand_int = CMD_CREW_BUCKLE_NC;
fmanzano_dtk 1:9e821e640117 621 return(comand_int);
fmanzano_dtk 1:9e821e640117 622 }
fmanzano_dtk 1:9e821e640117 623
fmanzano_dtk 1:9e821e640117 624 p = strstr(comando, Q_CREW_BUCLE_TYPE);
fmanzano_dtk 1:9e821e640117 625 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 626 comand_int = CMD_QUERY_CREW_BT;
fmanzano_dtk 1:9e821e640117 627 return(comand_int);
fmanzano_dtk 1:9e821e640117 628 }
fmanzano_dtk 1:9e821e640117 629
fmanzano_dtk 1:9e821e640117 630
fmanzano_dtk 1:9e821e640117 631
fmanzano_dtk 1:9e821e640117 632
fmanzano_dtk 1:9e821e640117 633 /** **********************************
fmanzano_dtk 1:9e821e640117 634 * COMANDOS DE APAGADO POR RALENTI
fmanzano_dtk 1:9e821e640117 635 * ********************************** */
fmanzano_dtk 1:9e821e640117 636 p = strstr(comando, IDLE_SHUTDOWN_ENA_CMD);
fmanzano_dtk 1:9e821e640117 637 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 638 comand_int = CMD_IDLE_SHUTDOWN_ENABLE;
fmanzano_dtk 1:9e821e640117 639 return(comand_int);
fmanzano_dtk 1:9e821e640117 640 }
fmanzano_dtk 1:9e821e640117 641
fmanzano_dtk 1:9e821e640117 642 p = strstr(comando, IDLE_SHUTDOWN_DIS_CMD);
fmanzano_dtk 1:9e821e640117 643 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 644 comand_int = CMD_IDLE_SHUTDOWN_DISABLE;
fmanzano_dtk 1:9e821e640117 645 return(comand_int);
fmanzano_dtk 1:9e821e640117 646 }
fmanzano_dtk 1:9e821e640117 647
fmanzano_dtk 1:9e821e640117 648 p = strstr(comando, IDLE_SHUTDOWN_QUERY);
fmanzano_dtk 1:9e821e640117 649 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 650 comand_int = CMD_IDLE_SHUTDOWN_QUERY;
fmanzano_dtk 1:9e821e640117 651 return(comand_int);
fmanzano_dtk 1:9e821e640117 652 }
fmanzano_dtk 1:9e821e640117 653
fmanzano_dtk 1:9e821e640117 654 p = strstr(comando, Q_IDLE_SHUTDOWN_STATUS);
fmanzano_dtk 1:9e821e640117 655 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 656 comand_int = CMD_IDLE_SHUTDOWN_QUERY;
fmanzano_dtk 1:9e821e640117 657 return(comand_int);
fmanzano_dtk 1:9e821e640117 658 }
fmanzano_dtk 1:9e821e640117 659
fmanzano_dtk 1:9e821e640117 660 p = strstr(comando, CHANGE_IDLE_TIMER);
fmanzano_dtk 1:9e821e640117 661 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 662 comand_int = CMD_CHANGE_IDLE_SHUTDOWN_T;
fmanzano_dtk 1:9e821e640117 663 return(comand_int);
fmanzano_dtk 1:9e821e640117 664 }
fmanzano_dtk 1:9e821e640117 665
fmanzano_dtk 1:9e821e640117 666 p = strstr(comando, QUERY_IDLE_TIMER);
fmanzano_dtk 1:9e821e640117 667 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 668 comand_int = CMD_QUERY_IDLE_SHUTDOWN_T;
fmanzano_dtk 1:9e821e640117 669 return(comand_int);
fmanzano_dtk 1:9e821e640117 670 }
fmanzano_dtk 1:9e821e640117 671
fmanzano_dtk 1:9e821e640117 672
fmanzano_dtk 1:9e821e640117 673
fmanzano_dtk 1:9e821e640117 674
fmanzano_dtk 1:9e821e640117 675 /** **********************************
fmanzano_dtk 1:9e821e640117 676 * COMANDOS DE RECORDATORIO POR RALENTI
fmanzano_dtk 1:9e821e640117 677 * ********************************** */
fmanzano_dtk 1:9e821e640117 678 p = strstr(comando, IDLE_REMINDER_ENABLE);
fmanzano_dtk 1:9e821e640117 679 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 680 comand_int = CMD_IDLE_REMINDER_ENABLE;
fmanzano_dtk 1:9e821e640117 681 return(comand_int);
fmanzano_dtk 1:9e821e640117 682 }
fmanzano_dtk 1:9e821e640117 683
fmanzano_dtk 1:9e821e640117 684 p = strstr(comando, IDLE_REMINDER_DISABLE);
fmanzano_dtk 1:9e821e640117 685 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 686 comand_int = CMD_IDLE_REMINDER_DISABLE;
fmanzano_dtk 1:9e821e640117 687 return(comand_int);
fmanzano_dtk 1:9e821e640117 688 }
fmanzano_dtk 1:9e821e640117 689
fmanzano_dtk 1:9e821e640117 690 p = strstr(comando, QUERY_IDLE_REMINDER);
fmanzano_dtk 1:9e821e640117 691 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 692 comand_int = CMD_IDLE_REMINDER_QUERY;
fmanzano_dtk 1:9e821e640117 693 return(comand_int);
fmanzano_dtk 1:9e821e640117 694 }
fmanzano_dtk 1:9e821e640117 695
fmanzano_dtk 1:9e821e640117 696 p = strstr(comando, IDLE_REMINDER_TIMER);
fmanzano_dtk 1:9e821e640117 697 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 698 comand_int = CMD_CHANGE_IDLE_REMINDER_T;
fmanzano_dtk 1:9e821e640117 699 return(comand_int);
fmanzano_dtk 1:9e821e640117 700 }
fmanzano_dtk 1:9e821e640117 701
fmanzano_dtk 1:9e821e640117 702 p = strstr(comando, QUERY_IDLE_REMINDER_T);
fmanzano_dtk 1:9e821e640117 703 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 704 comand_int = CMD_QUERY_IDLE_REMINDER_T;
fmanzano_dtk 1:9e821e640117 705 return(comand_int);
fmanzano_dtk 1:9e821e640117 706 }
fmanzano_dtk 1:9e821e640117 707
fmanzano_dtk 1:9e821e640117 708
fmanzano_dtk 1:9e821e640117 709
fmanzano_dtk 1:9e821e640117 710
fmanzano_dtk 1:9e821e640117 711 /** **********************************
fmanzano_dtk 1:9e821e640117 712 * COMANDOS DE TIP DE SEGURIDAD
fmanzano_dtk 1:9e821e640117 713 * ********************************** */
fmanzano_dtk 1:9e821e640117 714 p = strstr(comando, SAFETY_TIP_ENABLE);
fmanzano_dtk 1:9e821e640117 715 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 716 comand_int = CMD_SAFETY_TIP_ENABLE;
fmanzano_dtk 1:9e821e640117 717 return(comand_int);
fmanzano_dtk 1:9e821e640117 718 }
fmanzano_dtk 1:9e821e640117 719
fmanzano_dtk 1:9e821e640117 720 p = strstr(comando, SAFETY_TIP_DISABLE);
fmanzano_dtk 1:9e821e640117 721 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 722 comand_int = CMD_SAFETY_TIP_DISABLE;
fmanzano_dtk 1:9e821e640117 723 return(comand_int);
fmanzano_dtk 1:9e821e640117 724 }
fmanzano_dtk 1:9e821e640117 725
fmanzano_dtk 1:9e821e640117 726 p = strstr(comando, QUERY_SAFETY_TIP);
fmanzano_dtk 1:9e821e640117 727 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 728 comand_int = CMD_QUERY_SAFETY_TIP_TIME;
fmanzano_dtk 1:9e821e640117 729 return(comand_int);
fmanzano_dtk 1:9e821e640117 730 }
fmanzano_dtk 1:9e821e640117 731
fmanzano_dtk 1:9e821e640117 732 p = strstr(comando, CHANGE_SAFETY_TIME);
fmanzano_dtk 1:9e821e640117 733 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 734 comand_int = CHANGE_SAFETY_TIP_TIME;
fmanzano_dtk 1:9e821e640117 735 return(comand_int);
fmanzano_dtk 1:9e821e640117 736 }
fmanzano_dtk 1:9e821e640117 737
fmanzano_dtk 1:9e821e640117 738
fmanzano_dtk 1:9e821e640117 739
fmanzano_dtk 1:9e821e640117 740
fmanzano_dtk 1:9e821e640117 741 /** **********************************
fmanzano_dtk 1:9e821e640117 742 * COMANDOS SOBRE INFO DE ICS5
fmanzano_dtk 1:9e821e640117 743 * ********************************** */
fmanzano_dtk 1:9e821e640117 744 p = strstr(comando, Q_HARDWARE_VERSION);
fmanzano_dtk 1:9e821e640117 745 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 746 comand_int = CMD_QUERY_HARDWARE_VER;
fmanzano_dtk 1:9e821e640117 747 return(comand_int);
fmanzano_dtk 1:9e821e640117 748 }
fmanzano_dtk 1:9e821e640117 749
fmanzano_dtk 1:9e821e640117 750 p = strstr(comando, Q_FIRMWARE_VERSION);
fmanzano_dtk 1:9e821e640117 751 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 752 comand_int = CMD_QUERY_FIRMWARE_VER;
fmanzano_dtk 1:9e821e640117 753 return(comand_int);
fmanzano_dtk 1:9e821e640117 754 }
fmanzano_dtk 1:9e821e640117 755
fmanzano_dtk 1:9e821e640117 756
fmanzano_dtk 1:9e821e640117 757
fmanzano_dtk 1:9e821e640117 758
fmanzano_dtk 1:9e821e640117 759 /** **********************************
fmanzano_dtk 1:9e821e640117 760 * COMANDOS DE AUTORESET DE BLUETOOTH
fmanzano_dtk 1:9e821e640117 761 * ********************************** */
fmanzano_dtk 1:9e821e640117 762 p = strstr(comando, BLE_AUTORESET_ENABLE);
fmanzano_dtk 1:9e821e640117 763 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 764 comand_int = CMD_BLE_AUTORESET_ENABLE;
fmanzano_dtk 1:9e821e640117 765 return(comand_int);
fmanzano_dtk 1:9e821e640117 766 }
fmanzano_dtk 1:9e821e640117 767
fmanzano_dtk 1:9e821e640117 768 p = strstr(comando, BLE_AUTORESET_DISABLE);
fmanzano_dtk 1:9e821e640117 769 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 770 comand_int = CMD_BLE_AUTORESET_DISABLE;
fmanzano_dtk 1:9e821e640117 771 return(comand_int);
fmanzano_dtk 1:9e821e640117 772 }
fmanzano_dtk 1:9e821e640117 773
fmanzano_dtk 1:9e821e640117 774 p = strstr(comando, BLE_AUTORESET_TIME);
fmanzano_dtk 1:9e821e640117 775 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 776 comand_int = CMD_BLE_AUTORESET_TIME;
fmanzano_dtk 1:9e821e640117 777 return(comand_int);
fmanzano_dtk 1:9e821e640117 778 }
fmanzano_dtk 1:9e821e640117 779
fmanzano_dtk 1:9e821e640117 780 p = strstr(comando, BLE_AUTORESET_QUERY);
fmanzano_dtk 1:9e821e640117 781 if (p!=NULL) {
fmanzano_dtk 1:9e821e640117 782 comand_int = CMD_BLE_AUTORESET_QUERY;
fmanzano_dtk 1:9e821e640117 783 return(comand_int);
fmanzano_dtk 1:9e821e640117 784 }
fmanzano_dtk 1:9e821e640117 785
fmanzano_dtk 1:9e821e640117 786 return(comand_int);
fmanzano_dtk 1:9e821e640117 787 }