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
cmd/lerAlarmes.cpp
- Committer:
- tpadovani
- Date:
- 2015-07-28
- Revision:
- 13:eed9484a89bc
File content as of revision 13:eed9484a89bc:
#include "appCommands.h" #include "alarm.h" #define ALARMES_FALHA 1 #define ALARMES_FIM 2 extern Alarm alarm; char* respAlarm; void cmdLerAlarmes(int block){ if(block == 0){ free(respAlarm); respAlarm = alarm.getAllAlarms(); } if(respAlarm == NULL){ exec.enviaResposta(RESP_LER_ALARMES, ALARMES_FALHA); } else{ int alarmSize = APP_PARAMETERS.ALARMS_QUEUE_SIZE; if(alarmSize < 0 || alarmSize > 127){ alarmSize = 100; // Use default } int blocks = ceil(alarmSize / 25.0); if(blocks < 0 || blocks > 6){ blocks = 4; // Use default of 100 entries } if(block >= blocks){ exec.enviaResposta(RESP_LER_ALARMES, ALARMES_FIM); free(respAlarm); } else{ int size = 8*25; if(block == blocks-1){ size = 8*(APP_PARAMETERS.ALARMS_QUEUE_SIZE % 25); if(size == 0){ size = 8*25; } } exec.enviaResposta(RESP_LER_ALARMES, respAlarm+block*8*25, size); } } }