Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: CRC16 FreescaleIAP FreescaleWatchdog GGSProtocol LM75B PIMA Parameters PersistentCircularQueue SerialNumberV2COM mbed-dev-watchdog_2016_03_04
Fork of smartRamalKW by
lerAlarmes.cpp
00001 #include "appCommands.h" 00002 #include "alarm.h" 00003 00004 #define ALARMES_FALHA 1 00005 #define ALARMES_FIM 2 00006 00007 extern Alarm alarm; 00008 char* respAlarm; 00009 00010 void cmdLerAlarmes(int block){ 00011 if(block == 0){ 00012 free(respAlarm); 00013 respAlarm = alarm.getAllAlarms(); 00014 } 00015 00016 if(respAlarm == NULL){ 00017 exec.enviaResposta(RESP_LER_ALARMES, ALARMES_FALHA); 00018 } else{ 00019 int alarmSize = APP_PARAMETERS.ALARMS_QUEUE_SIZE; 00020 if(alarmSize < 0 || alarmSize > 127){ 00021 alarmSize = 100; // Use default 00022 } 00023 int blocks = ceil(alarmSize / 25.0); 00024 if(blocks < 0 || blocks > 6){ 00025 blocks = 4; // Use default of 100 entries 00026 } 00027 if(block >= blocks){ 00028 exec.enviaResposta(RESP_LER_ALARMES, ALARMES_FIM); 00029 free(respAlarm); 00030 } else{ 00031 int size = 8*25; 00032 if(block == blocks-1){ 00033 size = 8*(APP_PARAMETERS.ALARMS_QUEUE_SIZE % 25); 00034 if(size == 0){ 00035 size = 8*25; 00036 } 00037 } 00038 exec.enviaResposta(RESP_LER_ALARMES, respAlarm+block*8*25, size); 00039 } 00040 } 00041 }
Generated on Thu Jul 14 2022 00:24:57 by
1.7.2
