EZR

Dependencies:   CRC16 FreescaleIAP FreescaleWatchdog GGSProtocol LM75B PIMA Parameters PersistentCircularQueue SerialNumberV2COM mbed-dev-watchdog_2016_03_04

Fork of smartRamalKW by Equipe Firmware V2COM

Revision:
5:1bc98277c257
Child:
10:7a1d1abb5172
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmd/gravarNumeroSerie.cpp	Fri Jun 19 21:03:50 2015 +0000
@@ -0,0 +1,24 @@
+#include "appCommands.h"
+#include "serialNumber.h"
+
+#define BOUNDARY_ERROR      -99    //Commands may not span several sectors
+#define ALIGN_ERROR         -98    //Data must be aligned on longword (two LSBs zero)
+#define PROTECTION_ERROR    -97    //Flash sector is protected
+#define ACCESS_ERROR        -96    //Something went wrong
+#define COLLISION_ERROR     -95    //During writing something tried to flash which was written to
+#define LENGTH_ERROR        -94    //The length must be multiples of 4
+#define RUNTIME_ERROR       -93
+#define ERASE_ERROR         -92    //The flash was not erased before writing to it
+#define PAYLOAD_INVALIDO    -1     //Payload nao possui 8 bytes
+#define SUCESSO             0
+
+void cmdGravarNumeroSerie(unsigned char * dados, unsigned char tamanhoDados){
+    
+    if(tamanhoDados != SERIAL_LENGTH){
+        exec.enviaResposta(RESP_GRAVAR_NUM_SERIE, (char)PAYLOAD_INVALIDO);
+        return;
+    }
+    
+    int resp = sn.set(dados);
+    exec.enviaResposta(RESP_GRAVAR_NUM_SERIE, resp);
+}