HAHA! commit
Initial commit
This commit is contained in:
Executable
+1765
File diff suppressed because it is too large
Load Diff
Executable
+634
@@ -0,0 +1,634 @@
|
||||
/*! \file WaspFrame.h
|
||||
\brief Library for creating formated frames
|
||||
|
||||
Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.
|
||||
http://www.libelium.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 2.1 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Version: 1.0
|
||||
Design: David Gascón
|
||||
Implementation: Yuri Carmona, Javier Siscart, Joaquín Ruiz
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/*! \def WaspFrame_h
|
||||
*/
|
||||
#ifndef WaspFrame_h
|
||||
#define WaspFrame_h
|
||||
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* Includes
|
||||
******************************************************************************/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <inttypes.h>
|
||||
#include <WConstants.h>
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* Definitions & Declarations
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
|
||||
/// Gases Board sensor measurements
|
||||
|
||||
/*! \def SENSOR_CO
|
||||
\brief Carbon Monoxide measurement type
|
||||
*/
|
||||
/*! \def SENSOR_CO2
|
||||
\brief Carbon Dioxide measurement type
|
||||
*/
|
||||
/*! \def SENSOR_O2
|
||||
\brief Oxygen measurement type
|
||||
*/
|
||||
/*! \def SENSOR_CH4
|
||||
\brief Methane measurement type
|
||||
*/
|
||||
/*! \def SENSOR_LPG
|
||||
\brief Liquefied Pretoleum Gases measurement type
|
||||
*/
|
||||
/*! \def SENSOR_NH3
|
||||
\brief Ammonia measurement type
|
||||
*/
|
||||
/*! \def SENSOR_AP1
|
||||
\brief Air Pollutans 1 measurement type
|
||||
*/
|
||||
/*! \def SENSOR_AP2
|
||||
\brief Air Pollutans 2 measurement type
|
||||
*/
|
||||
/*! \def SENSOR_SV
|
||||
\brief Solvent Vapors measurement type
|
||||
*/
|
||||
/*! \def SENSOR_NO2
|
||||
\brief Nitrogen Dioxide measurement type
|
||||
*/
|
||||
/*! \def SENSOR_O3
|
||||
\brief Ozone measurement type
|
||||
*/
|
||||
/*! \def SENSOR_VOC
|
||||
\brief Hydrocarbons measurement type
|
||||
*/
|
||||
/*! \def SENSOR_TC
|
||||
\brief Temperature Celsius measurement type
|
||||
*/
|
||||
/*! \def SENSOR_TF
|
||||
\brief Temperature Fahrenheit measurement type
|
||||
*/
|
||||
/*! \def SENSOR_HUM
|
||||
\brief Humidity measurement type
|
||||
*/
|
||||
/*! \def SENSOR_PA
|
||||
\brief Pressure atmospheric measurement type
|
||||
*/
|
||||
|
||||
|
||||
/// Events Board Sensor measurements
|
||||
|
||||
/*! \def SENSOR_PW
|
||||
\brief Pressure/Weight measurement type
|
||||
*/
|
||||
/*! \def SENSOR_BEND
|
||||
\brief Bend measurement type
|
||||
*/
|
||||
/*! \def SENSOR_VBR
|
||||
\brief Vibration measurement type
|
||||
*/
|
||||
/*! \def SENSOR_HALL
|
||||
\brief Hall Effect measurement type
|
||||
*/
|
||||
/*! \def SENSOR_LP
|
||||
\brief Liquid Presence measurement type
|
||||
*/
|
||||
/*! \def SENSOR_LL
|
||||
\brief Liquid Level measurement type
|
||||
*/
|
||||
/*! \def SENSOR_LUM
|
||||
\brief Luminosity measurement type
|
||||
*/
|
||||
/*! \def SENSOR_PIR
|
||||
\brief Presence measurement type
|
||||
*/
|
||||
/*! \def SENSOR_ST
|
||||
\brief Stretch measurement type
|
||||
*/
|
||||
|
||||
|
||||
/// Smart cities sensor measurements
|
||||
|
||||
/*! \def SENSOR_MCP
|
||||
\brief Microphone measurement type
|
||||
*/
|
||||
/*! \def SENSOR_CDG
|
||||
\brief Crack detection gauge measurement type
|
||||
*/
|
||||
/*! \def SENSOR_CPG
|
||||
\brief Crack propagation gauge measurement type
|
||||
*/
|
||||
/*! \def SENSOR_LD
|
||||
\brief Linear Displacement measurement type
|
||||
*/
|
||||
/*! \def SENSOR_DUST
|
||||
\brief Dust measurement type
|
||||
*/
|
||||
/*! \def SENSOR_US
|
||||
\brief Ultrasound measurement type
|
||||
*/
|
||||
|
||||
|
||||
/// Smart parking sensor measurements
|
||||
|
||||
/*! \def SENSOR_MF
|
||||
\brief Magnetic Field measurement type
|
||||
*/
|
||||
/*! \def SENSOR_PS
|
||||
\brief Parking Spot Status measurement type
|
||||
*/
|
||||
|
||||
/// Agriculture sensor measurements
|
||||
|
||||
/*! \def SENSOR_AIR
|
||||
\brief Air Temperature / Humidity measurement type
|
||||
*/
|
||||
/*! \def SENSOR_SOIL
|
||||
\brief Soil Temperature / Moisture measurement type
|
||||
*/
|
||||
/*! \def SENSOR_LW
|
||||
\brief Leaf Wetness measurement type
|
||||
*/
|
||||
/*! \def SENSOR_PAR
|
||||
\brief Solar Radiation measurement type
|
||||
*/
|
||||
/*! \def SENSOR_UV
|
||||
\brief Ultraviolet Radiation measurement type
|
||||
*/
|
||||
/*! \def SENSOR_TD
|
||||
\brief Trunk Diameter measurement type
|
||||
*/
|
||||
/*! \def SENSOR_SD
|
||||
\brief Stem Diameter measurement type
|
||||
*/
|
||||
/*! \def SENSOR_FD
|
||||
\brief Fruit Diameter measurement type
|
||||
*/
|
||||
/*! \def SENSOR_ANE
|
||||
\brief Anemometer measurement type
|
||||
*/
|
||||
/*! \def SENSOR_WV
|
||||
\brief Wind Vane measurement type
|
||||
*/
|
||||
/*! \def SENSOR_PLV
|
||||
\brief Pluviometer measurement type
|
||||
*/
|
||||
|
||||
|
||||
/// Radiation sensor measurements
|
||||
|
||||
/*! \def SENSOR_RAD
|
||||
\brief Geiger tube measurement type
|
||||
*/
|
||||
|
||||
|
||||
/// Smart meetering sensor measurements
|
||||
|
||||
/*! \def SENSOR_CU
|
||||
\brief Current measurement type
|
||||
*/
|
||||
/*! \def SENSOR_WF
|
||||
\brief Water flow measurement type
|
||||
*/
|
||||
/*! \def SENSOR_LC
|
||||
\brief Load cell measurement type
|
||||
*/
|
||||
/*! \def SENSOR_DF
|
||||
\brief Distance foil measurement type
|
||||
*/
|
||||
|
||||
|
||||
/// Additional sensor measurements
|
||||
|
||||
/*! \def SENSOR_BAT
|
||||
\brief Battery measurement type
|
||||
*/
|
||||
/*! \def SENSOR_GPS
|
||||
\brief Global Positioning System measurement type
|
||||
*/
|
||||
/*! \def SENSOR_RSSI
|
||||
\brief RSSI measurement type
|
||||
*/
|
||||
/*! \def SENSOR_MAC
|
||||
\brief MAC Address measurement type
|
||||
*/
|
||||
/*! \def SENSOR_NA
|
||||
\brief Network Address measurement type
|
||||
*/
|
||||
/*! \def SENSOR_NID
|
||||
\brief Network Identifier origin measurement type
|
||||
*/
|
||||
/*! \def SENSOR_DATE
|
||||
\brief Date measurement type
|
||||
*/
|
||||
/*! \def SENSOR_TIME
|
||||
\brief Time measurement type
|
||||
*/
|
||||
/*! \def SENSOR_GMT
|
||||
\brief GMT measurement type
|
||||
*/
|
||||
/*! \def SENSOR_RAM
|
||||
\brief RAM measurement type
|
||||
*/
|
||||
/*! \def SENSOR_IN_TEMP
|
||||
\brief Internal temperature measurement type
|
||||
*/
|
||||
/*! \def SENSOR_MILLIS
|
||||
\brief Millis measurement type
|
||||
*/
|
||||
|
||||
/// Special sensor measurements
|
||||
|
||||
/*! \def SENSOR_STR
|
||||
\brief String type
|
||||
*/
|
||||
|
||||
// Gases
|
||||
#define SENSOR_CO 0
|
||||
#define SENSOR_CO2 1
|
||||
#define SENSOR_O2 2
|
||||
#define SENSOR_CH4 3
|
||||
#define SENSOR_LPG 4
|
||||
#define SENSOR_NH3 5
|
||||
#define SENSOR_AP1 6
|
||||
#define SENSOR_AP2 7
|
||||
#define SENSOR_SV 8
|
||||
#define SENSOR_NO2 9
|
||||
#define SENSOR_O3 10
|
||||
#define SENSOR_VOC 11
|
||||
#define SENSOR_TCA 12
|
||||
#define SENSOR_TFA 13
|
||||
#define SENSOR_HUMA 14
|
||||
#define SENSOR_PA 15
|
||||
|
||||
// Events
|
||||
#define SENSOR_PW 16
|
||||
#define SENSOR_BEND 17
|
||||
#define SENSOR_VBR 18
|
||||
#define SENSOR_HALL 19
|
||||
#define SENSOR_LP 20
|
||||
#define SENSOR_LL 21
|
||||
#define SENSOR_LUM 22
|
||||
#define SENSOR_PIR 23
|
||||
#define SENSOR_ST 24
|
||||
|
||||
// Smart Cities
|
||||
#define SENSOR_MCP 25
|
||||
#define SENSOR_CDG 26
|
||||
#define SENSOR_CPG 27
|
||||
#define SENSOR_LD 28
|
||||
#define SENSOR_DUST 29
|
||||
#define SENSOR_US 30
|
||||
|
||||
// Smart parking
|
||||
#define SENSOR_MF 31
|
||||
#define SENSOR_PS 32
|
||||
|
||||
// Agriculture
|
||||
#define SENSOR_TCB 33
|
||||
#define SENSOR_TFB 34
|
||||
#define SENSOR_HUMB 35
|
||||
#define SENSOR_SOILT 36
|
||||
#define SENSOR_SOIL 37
|
||||
#define SENSOR_LW 38
|
||||
#define SENSOR_PAR 39
|
||||
#define SENSOR_UV 40
|
||||
#define SENSOR_TD 41
|
||||
#define SENSOR_SD 42
|
||||
#define SENSOR_FD 43
|
||||
#define SENSOR_ANE 44
|
||||
#define SENSOR_WV 45
|
||||
#define SENSOR_PLV 46
|
||||
|
||||
// Radiation
|
||||
#define SENSOR_RAD 47
|
||||
|
||||
// Smart meetering
|
||||
#define SENSOR_CU 48
|
||||
#define SENSOR_WF 49
|
||||
#define SENSOR_LC 50
|
||||
#define SENSOR_DF 51
|
||||
|
||||
// Additional
|
||||
#define SENSOR_BAT 52
|
||||
#define SENSOR_GPS 53
|
||||
#define SENSOR_RSSI 54
|
||||
#define SENSOR_MAC 55
|
||||
#define SENSOR_NA 56
|
||||
#define SENSOR_NID 57
|
||||
#define SENSOR_DATE 58
|
||||
#define SENSOR_TIME 59
|
||||
#define SENSOR_GMT 60
|
||||
#define SENSOR_RAM 61
|
||||
#define SENSOR_IN_TEMP 62
|
||||
#define SENSOR_ACC 63
|
||||
#define SENSOR_MILLIS 64
|
||||
|
||||
// Special
|
||||
#define SENSOR_STR 65
|
||||
|
||||
// Meshlium
|
||||
#define SENSOR_MBT 66
|
||||
#define SENSOR_MWIFI 67
|
||||
|
||||
// RFID
|
||||
#define SENSOR_UID 68
|
||||
#define SENSOR_RB 69
|
||||
|
||||
// CRITICAL INFRASTRUCTURE
|
||||
#define SENSOR_CI0 70
|
||||
#define SENSOR_CI1 71
|
||||
#define SENSOR_CI2 72
|
||||
#define SENSOR_CI3 73
|
||||
#define SENSOR_CI4 74
|
||||
|
||||
|
||||
|
||||
|
||||
// define MACROS in order to manage bits inside Bytes
|
||||
#define bitRead(value, bit) (((value) >> (bit)) & 0x01)
|
||||
#define bitSet(value, bit) ((value) |= (1UL << (bit)))
|
||||
#define bitClear(value, bit) ((value) &= ~(1UL << (bit)))
|
||||
#define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit))
|
||||
|
||||
|
||||
/*! \def MAX_FRAME
|
||||
\brief maximum size in bytes of the frame
|
||||
*/
|
||||
#define MAX_FRAME 150
|
||||
|
||||
|
||||
|
||||
/*! \def UNICAST_16B
|
||||
\brief
|
||||
*/
|
||||
/*! \def UNICAST_64B
|
||||
\brief
|
||||
*/
|
||||
/*! \def BROADCAST_MODE
|
||||
\brief
|
||||
*/
|
||||
#define UNICAST_16B 0
|
||||
#define UNICAST_64B 1
|
||||
#define BROADCAST_MODE 2
|
||||
|
||||
|
||||
|
||||
/*! \def EXAMPLE_FRAME
|
||||
\brief
|
||||
*/
|
||||
/*! \def TIMEOUT_FRAME
|
||||
\brief
|
||||
*/
|
||||
/*! \def EVENT_FRAME
|
||||
\brief
|
||||
*/
|
||||
/*! \def ALARM_FRAME
|
||||
\brief
|
||||
*/
|
||||
/*! \def SERVICE1_FRAME
|
||||
\brief
|
||||
*/
|
||||
/*! \def SERVICE2_FRAME
|
||||
\brief
|
||||
*/
|
||||
#define EXAMPLE_FRAME 0
|
||||
#define TIMEOUT_FRAME 1
|
||||
#define EVENT_FRAME 2
|
||||
#define ALARM_FRAME 3
|
||||
#define SERVICE1_FRAME 4
|
||||
#define SERVICE2_FRAME 5
|
||||
|
||||
|
||||
/*! \def TYPE_UINT8
|
||||
\brief TYPE_UINT8 defines the constant for uint8_t variables types (1 Byte)
|
||||
*/
|
||||
/*! \def TYPE_INT
|
||||
\brief TYPE_INT defines the constant for int (int16_t) variables types (2 Bytes)
|
||||
*/
|
||||
/*! \def TYPE_FLOAT
|
||||
\brief TYPE_FLOAT defines the constant for double/float variables types (4 Bytes)
|
||||
*/
|
||||
/*! \def TYPE_CHAR
|
||||
\brief TYPE_CHAR defines the constant for char* (strings) variables types (variable Bytes)
|
||||
*/
|
||||
/*! \def TYPE_ULONG
|
||||
\brief TYPE_ULONG defines the constant for unsigned long int variables types (4 Bytes)
|
||||
*/
|
||||
#define TYPE_UINT8 0
|
||||
#define TYPE_INT 1
|
||||
#define TYPE_FLOAT 2
|
||||
#define TYPE_CHAR 3
|
||||
#define TYPE_ULONG 4
|
||||
|
||||
|
||||
|
||||
/*! \def ASCII
|
||||
\brief ASCII frame mode
|
||||
*/
|
||||
/*! \def BINARY
|
||||
\brief BINARY frame mode
|
||||
*/
|
||||
#define ASCII 1
|
||||
#define BINARY 0
|
||||
|
||||
|
||||
//! Variable : Waspmote serial id
|
||||
/*!
|
||||
*/
|
||||
extern volatile unsigned long _serial_id;
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* Class
|
||||
******************************************************************************/
|
||||
|
||||
//! WaspFrame Class
|
||||
/*!
|
||||
WaspFrame Class defines all the variables and functions used to create the
|
||||
sensor frames in Waspmote
|
||||
*/
|
||||
class WaspFrame
|
||||
{
|
||||
|
||||
private:
|
||||
|
||||
//! Function : store the sequence number in EEPROM
|
||||
/*! This function stores the sequence number in the EEPROM address specified
|
||||
* by the SEQUENCE_ADDR address.
|
||||
*/
|
||||
void storeSequence(uint8_t seqNumber);
|
||||
|
||||
//! Function : read the sequence number from EEPROM
|
||||
/*! This function reads the sequence number from the EEPROM address specified
|
||||
* by the SEQUENCE_ADDR address.
|
||||
*/
|
||||
uint8_t readSequence(void);
|
||||
|
||||
//! Function : check if maximum length is reached
|
||||
/*! Check if maximum length is reached when introducing a new frame field
|
||||
*/
|
||||
uint8_t checkLength(int sum);
|
||||
|
||||
//! Variable : sequence number
|
||||
/*!
|
||||
This is the frame sequence number in order to control if any packet is lost
|
||||
*/
|
||||
uint8_t sequence;
|
||||
|
||||
//! Variable : number of sensor values within the frame
|
||||
/*!
|
||||
*/
|
||||
uint8_t numFields;
|
||||
|
||||
//! Variable : frame format: ASCII (0) or BINARY (1)
|
||||
/*!
|
||||
*/
|
||||
uint8_t _mode;
|
||||
|
||||
//! Variable : maximum frame size
|
||||
/*!
|
||||
*/
|
||||
uint8_t _maxSize;
|
||||
|
||||
public:
|
||||
|
||||
//! class constructor
|
||||
/*!
|
||||
Initialize the class attributes
|
||||
\param void
|
||||
\return void
|
||||
*/
|
||||
WaspFrame();
|
||||
|
||||
//! Function : set the frame maximum size
|
||||
/*! This function sets the frame maximum size
|
||||
\param uint8_t size size to set as maximum size. It can't exceed the
|
||||
MAX_FRAME constant
|
||||
\return void
|
||||
*/
|
||||
void setFrameSize( uint8_t size);
|
||||
|
||||
//! Function : set the frame maximum size
|
||||
/*! This function sets the frame maximum size depending on the protocol,
|
||||
addressing, linkEncryption mode, AESEncryption.
|
||||
\param uint8_t protocol defines the procotol used
|
||||
\param uint8_t linkEncryption defines if XBee encryption is enabled or not
|
||||
\param uint8_t AESEncryption defines if AES encryption is used or not
|
||||
\return void
|
||||
*/
|
||||
void setFrameSize( uint8_t protocol,
|
||||
uint8_t linkEncryption,
|
||||
uint8_t AESEncryption);
|
||||
|
||||
//! Function : set the frame maximum size
|
||||
/*! This function sets the frame maximum size depending on the protocol,
|
||||
addressing, linkEncryption mode, AESEncryption.
|
||||
\param uint8_t protocol defines the procotol used
|
||||
\param uint8_t addressing defines the addressing used
|
||||
\param uint8_t linkEncryption defines if XBee encryption is enabled or not
|
||||
\param uint8_t AESEncryption defines if AES encryption is used or not
|
||||
\return void
|
||||
*/
|
||||
void setFrameSize( uint8_t protocol,
|
||||
uint8_t addressing,
|
||||
uint8_t linkEncryption,
|
||||
uint8_t AESEncryption);
|
||||
|
||||
//! Function : get the frame maximum size
|
||||
/*! This function gets the frame maximum size
|
||||
\return uint8_t indicating the value of _maxSize
|
||||
*/
|
||||
uint8_t getFrameSize( void );
|
||||
|
||||
//! Function : creates a new frame
|
||||
/*! This function creates a new ASCII frame getting the mote ID from the
|
||||
* EEPROM memory.
|
||||
*/
|
||||
void createFrame(void);
|
||||
|
||||
//! Function : creates a new frame
|
||||
/*! This function creates a new frame.
|
||||
\param uint8_t mode specifies the frame mode: BINARY or ASCII
|
||||
\return const char* moteID defines the mote Identifier
|
||||
*/
|
||||
void createFrame(uint8_t mode, const char* moteID);
|
||||
|
||||
//! Function : set the frame type
|
||||
/*! This function sets the frame type (fourth byte of the frame header)
|
||||
\param uint8_t type specifies the frame type:
|
||||
EXAMPLE_FRAME
|
||||
TIMEOUT_FRAME
|
||||
EVENT_FRAME
|
||||
ALARM_FRAME
|
||||
SERVICE1_FRAME
|
||||
SERVICE2_FRAME
|
||||
\return void
|
||||
*/
|
||||
void setFrameType(uint8_t type);
|
||||
|
||||
//! Function : shows the frame
|
||||
/*! This function prints the actual frame
|
||||
*/
|
||||
void showFrame(void);
|
||||
|
||||
int8_t addSensor(uint8_t type, int value);
|
||||
int8_t addSensor(uint8_t type, unsigned long value);
|
||||
int8_t addSensor(uint8_t type, double value);
|
||||
int8_t addSensor(uint8_t type, double value, int N);
|
||||
int8_t addSensor(uint8_t type, char* str);
|
||||
|
||||
int8_t addSensor(uint8_t type, double val1, double val2);
|
||||
int8_t addSensor(uint8_t type, uint8_t val1, uint8_t val2, uint8_t val3);
|
||||
int8_t addSensor(uint8_t type, uint8_t val1, uint8_t val2, uint8_t val3, int val4);
|
||||
int8_t addSensor(uint8_t type, int val1,int val2,int val3);
|
||||
int8_t addSensor(uint8_t type, double val1,double val2,double val3);
|
||||
|
||||
int8_t checkFields(uint8_t type, uint8_t typeVal, uint8_t fields);
|
||||
|
||||
void setID(char* moteID);
|
||||
void getID(char* moteID);
|
||||
|
||||
// Sends Waspmote unique ID with the frame
|
||||
void setCloudCompatibility(void);
|
||||
|
||||
//! Variable : buffer where the frame is created in
|
||||
/*!
|
||||
*/
|
||||
uint8_t buffer[MAX_FRAME+1];
|
||||
|
||||
//! Variable : length of the frame
|
||||
/*!
|
||||
*/
|
||||
uint16_t length;
|
||||
|
||||
};
|
||||
|
||||
extern WaspFrame frame;
|
||||
|
||||
#endif
|
||||
|
||||
+574
@@ -0,0 +1,574 @@
|
||||
|
||||
|
||||
#ifndef WaspFrameconstants_h
|
||||
#define WaspFrameconstants_h
|
||||
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
|
||||
|
||||
|
||||
/// Flash defines //////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* The following Flash strings, define the tags for all Waspmote sensors.
|
||||
* These TAGs are used in ASCII frames in order to indicate every sensor field
|
||||
* that has been included inside the frame.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
// Gases
|
||||
prog_char str_CO[] PROGMEM = "CO"; // 0
|
||||
prog_char str_CO2[] PROGMEM = "CO2"; // 1
|
||||
prog_char str_O2[] PROGMEM = "O2"; // 2
|
||||
prog_char str_CH4[] PROGMEM = "CH4"; // 3
|
||||
prog_char str_LPG[] PROGMEM = "LPG"; // 4
|
||||
prog_char str_NH3[] PROGMEM = "NH3"; // 5
|
||||
prog_char str_AP1[] PROGMEM = "AP1"; // 6
|
||||
prog_char str_AP2[] PROGMEM = "AP2"; // 7
|
||||
prog_char str_SV[] PROGMEM = "SV"; // 8
|
||||
prog_char str_NO2[] PROGMEM = "NO2"; // 9
|
||||
prog_char str_O3[] PROGMEM = "O3"; // 10
|
||||
prog_char str_VOC[] PROGMEM = "VOC"; // 11
|
||||
prog_char str_TCA[] PROGMEM = "TCA"; // 12
|
||||
prog_char str_TFA[] PROGMEM = "TFA"; // 13
|
||||
prog_char str_HUMA[] PROGMEM = "HUMA"; // 14
|
||||
prog_char str_PA[] PROGMEM = "PA"; // 15
|
||||
|
||||
// Events
|
||||
prog_char str_PW[] PROGMEM = "PW"; // 16
|
||||
prog_char str_BEND[] PROGMEM = "BEND"; // 17
|
||||
prog_char str_VBR[] PROGMEM = "VBR"; // 18
|
||||
prog_char str_HALL[] PROGMEM = "HALL"; // 19
|
||||
prog_char str_LP[] PROGMEM = "LP"; // 20
|
||||
prog_char str_LL[] PROGMEM = "LL"; // 21
|
||||
prog_char str_LUM[] PROGMEM = "LUM"; // 22
|
||||
prog_char str_PIR[] PROGMEM = "PIR"; // 23
|
||||
prog_char str_ST[] PROGMEM = "ST"; // 24
|
||||
|
||||
// Smart cities
|
||||
prog_char str_MCP[] PROGMEM = "MCP"; // 25
|
||||
prog_char str_CDG[] PROGMEM = "CDG"; // 26
|
||||
prog_char str_CPG[] PROGMEM = "CPG"; // 27
|
||||
prog_char str_LD[] PROGMEM = "LD"; // 28
|
||||
prog_char str_DUST[] PROGMEM = "DUST"; // 29
|
||||
prog_char str_US[] PROGMEM = "US"; // 30
|
||||
|
||||
// Smart parking
|
||||
prog_char str_MF[] PROGMEM = "MF"; // 31
|
||||
prog_char str_PS[] PROGMEM = "PS"; // 32
|
||||
|
||||
// Agriculture
|
||||
prog_char str_TCB[] PROGMEM = "TCB"; // 33
|
||||
prog_char str_TFB[] PROGMEM = "TFB"; // 34
|
||||
prog_char str_HUMB[] PROGMEM = "HUMB"; // 35
|
||||
prog_char str_SOILT[] PROGMEM = "SOILT"; // 36
|
||||
prog_char str_SOIL[] PROGMEM = "SOIL"; // 37
|
||||
prog_char str_LW[] PROGMEM = "LW"; // 38
|
||||
prog_char str_PAR[] PROGMEM = "PAR"; // 39
|
||||
prog_char str_UV[] PROGMEM = "UV"; // 40
|
||||
prog_char str_TD[] PROGMEM = "TD"; // 41
|
||||
prog_char str_SD[] PROGMEM = "SD"; // 42
|
||||
prog_char str_FD[] PROGMEM = "FD"; // 43
|
||||
prog_char str_ANE[] PROGMEM = "ANE"; // 44
|
||||
prog_char str_WV[] PROGMEM = "WV"; // 45
|
||||
prog_char str_PLV[] PROGMEM = "PLV"; // 46
|
||||
|
||||
// Radiation
|
||||
prog_char str_RAD[] PROGMEM = "RAD"; // 47
|
||||
|
||||
// Smart meetering
|
||||
prog_char str_CU[] PROGMEM = "CU"; // 48
|
||||
prog_char str_WF[] PROGMEM = "WF"; // 49
|
||||
prog_char str_LC[] PROGMEM = "LC"; // 50
|
||||
prog_char str_DF[] PROGMEM = "DF"; // 51
|
||||
|
||||
// Additional
|
||||
prog_char str_BAT[] PROGMEM = "BAT"; // 52
|
||||
prog_char str_GPS[] PROGMEM = "GPS"; // 53
|
||||
prog_char str_RSSI[] PROGMEM = "RSSI"; // 54
|
||||
prog_char str_MAC[] PROGMEM = "MAC"; // 55
|
||||
prog_char str_NA[] PROGMEM = "NA"; // 56
|
||||
prog_char str_NID[] PROGMEM = "NID"; // 57
|
||||
prog_char str_DATE[] PROGMEM = "DATE"; // 58
|
||||
prog_char str_TIME[] PROGMEM = "TIME"; // 59
|
||||
prog_char str_GMT[] PROGMEM = "GMT"; // 60
|
||||
prog_char str_RAM[] PROGMEM = "RAM"; // 61
|
||||
prog_char str_IN_TEMP[] PROGMEM = "IN_TEMP"; // 62
|
||||
prog_char str_ACC[] PROGMEM = "ACC"; // 63
|
||||
prog_char str_MILLIS[] PROGMEM = "MILLIS"; // 64
|
||||
|
||||
// Special
|
||||
prog_char str_STR[] PROGMEM = "STR"; // 65
|
||||
|
||||
// Meshlium
|
||||
prog_char str_MBT[] PROGMEM = "MBT"; // 66
|
||||
prog_char str_MWIFI[] PROGMEM = "MWIFI"; // 67
|
||||
|
||||
// RFID
|
||||
prog_char str_UID[] PROGMEM = "UID"; // 68
|
||||
prog_char str_RB[] PROGMEM = "RB"; // 69
|
||||
|
||||
// CRITICAL INFRASTRUCTURE
|
||||
prog_char str_CI0[] PROGMEM = "CI0"; // 70
|
||||
prog_char str_CI1[] PROGMEM = "CI1"; // 71
|
||||
prog_char str_CI2[] PROGMEM = "CI2"; // 72
|
||||
prog_char str_CI3[] PROGMEM = "CI3"; // 73
|
||||
prog_char str_CI4[] PROGMEM = "CI4"; // 74
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* SENSOR_TABLE - Sensor label table
|
||||
*
|
||||
* This table specifies the tag for each sensor. Every tag has been previously
|
||||
* defined in Flash memory
|
||||
******************************************************************************/
|
||||
PROGMEM const char* SENSOR_TABLE[] =
|
||||
{
|
||||
// Gases
|
||||
str_CO, // 0
|
||||
str_CO2, // 1
|
||||
str_O2, // 2
|
||||
str_CH4, // 3
|
||||
str_LPG, // 4
|
||||
str_NH3, // 5
|
||||
str_AP1, // 6
|
||||
str_AP2, // 7
|
||||
str_SV, // 8
|
||||
str_NO2, // 9
|
||||
str_O3, // 10
|
||||
str_VOC, // 11
|
||||
str_TCA, // 12
|
||||
str_TFA, // 13
|
||||
str_HUMA, // 14
|
||||
str_PA, // 15
|
||||
|
||||
// Events
|
||||
str_PW, // 16
|
||||
str_BEND, // 17
|
||||
str_VBR, // 18
|
||||
str_HALL, // 19
|
||||
str_LP, // 20
|
||||
str_LL, // 21
|
||||
str_LUM, // 22
|
||||
str_PIR, // 23
|
||||
str_ST, // 24
|
||||
|
||||
// Smart cities
|
||||
str_MCP, // 25
|
||||
str_CDG, // 26
|
||||
str_CPG, // 27
|
||||
str_LD, // 28
|
||||
str_DUST, // 29
|
||||
str_US, // 30
|
||||
|
||||
// Smart parking
|
||||
str_MF, // 31
|
||||
str_PS, // 32
|
||||
|
||||
// Agriculture
|
||||
str_TCB, // 33
|
||||
str_TFB, // 34
|
||||
str_HUMB, // 35
|
||||
str_SOILT, // 36
|
||||
str_SOIL, // 37
|
||||
str_LW, // 38
|
||||
str_PAR, // 39
|
||||
str_UV, // 40
|
||||
str_TD, // 41
|
||||
str_SD, // 42
|
||||
str_FD, // 43
|
||||
str_ANE, // 44
|
||||
str_WV, // 45
|
||||
str_PLV, // 46
|
||||
|
||||
// Radiation
|
||||
str_RAD, // 47
|
||||
|
||||
// Smart meetering
|
||||
str_CU, // 48
|
||||
str_WF, // 49
|
||||
str_LC, // 50
|
||||
str_DF, // 51
|
||||
|
||||
// Additional
|
||||
str_BAT, // 52
|
||||
str_GPS, // 53
|
||||
str_RSSI, // 54
|
||||
str_MAC, // 55
|
||||
str_NA, // 56
|
||||
str_NID, // 57
|
||||
str_DATE, // 58
|
||||
str_TIME, // 59
|
||||
str_GMT, // 60
|
||||
str_RAM, // 61
|
||||
str_IN_TEMP, // 62
|
||||
str_ACC, // 63
|
||||
str_MILLIS, // 64
|
||||
|
||||
// Special
|
||||
str_STR, // 65
|
||||
|
||||
// Meshlium
|
||||
str_MBT, // 66
|
||||
str_MWIFI, // 67
|
||||
|
||||
// RFID
|
||||
str_UID, // 68
|
||||
str_RB, // 69
|
||||
|
||||
// CRITICAL INFRASTRUCTURE
|
||||
str_CI0, // 70
|
||||
str_CI1, // 71
|
||||
str_CI2, // 72
|
||||
str_CI3, // 73
|
||||
str_CI4 // 74
|
||||
|
||||
};
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* SENSOR_TYPE_TABLE - Binary frames sensor types
|
||||
*
|
||||
* This table specifies the type of sensor depending on the type of value the
|
||||
* user must put as input. These are the possibilities:
|
||||
*
|
||||
* 0: uint8_t
|
||||
* 1: int (the same as int16_t)
|
||||
* 2: double
|
||||
* 3: char*
|
||||
* 4: unsigned long
|
||||
* 5: uint8_t*
|
||||
******************************************************************************/
|
||||
PROGMEM const uint8_t SENSOR_TYPE_TABLE[] =
|
||||
{
|
||||
// Gases
|
||||
2, // str_CO, // 0
|
||||
2, // str_CO2, // 1
|
||||
2, // str_O2, // 2
|
||||
2, // str_CH4, // 3
|
||||
2, // str_LPG, // 4
|
||||
2, // str_NH3, // 5
|
||||
2, // str_AP1, // 6
|
||||
2, // str_AP2, // 7
|
||||
2, // str_SV, // 8
|
||||
2, // str_NO2, // 9
|
||||
2, // str_O3, // 10
|
||||
2, // str_VOC, // 11
|
||||
2, // str_TCA, // 12
|
||||
2, // str_TFA, // 13
|
||||
2, // str_HUMA, // 14
|
||||
2, // str_PA, // 15
|
||||
|
||||
// Events
|
||||
2, // str_PW, // 16
|
||||
2, // str_BEND, // 17
|
||||
0, // str_VBR, // 18
|
||||
0, // str_HALL, // 19
|
||||
0, // str_LP, // 20
|
||||
0, // str_LL, // 21
|
||||
2, // str_LUM, // 22
|
||||
0, // str_PIR, // 23
|
||||
2, // str_ST, // 24
|
||||
|
||||
// Smart cities
|
||||
0, // str_MCP, // 25
|
||||
0, // str_CDG, // 26
|
||||
2, // str_CPG, // 27
|
||||
2, // str_LD, // 28
|
||||
2, // str_DUST, // 29
|
||||
2, // str_US, // 30
|
||||
|
||||
// Smart parking
|
||||
1, //str_MF, // 31
|
||||
0, //str_PS, // 32
|
||||
|
||||
// Agriculture
|
||||
2, // str_TCB, // 33
|
||||
2, // str_TFB, // 34
|
||||
2, // str_HUMB, // 35
|
||||
2, // str_SOILT, // 36
|
||||
2, // str_SOIL, // 37
|
||||
0, // str_LW, // 38
|
||||
2, // str_PAR, // 39
|
||||
2, // str_UV, // 40
|
||||
2, // str_TD, // 41
|
||||
2, // str_SD, // 42
|
||||
2, // str_FD, // 43
|
||||
2, // str_ANE, // 44
|
||||
0, // str_WV, // 45
|
||||
2, // str_PLV, // 46
|
||||
|
||||
// Radiation
|
||||
2, // str_RAD, // 47
|
||||
|
||||
// Smart meetering
|
||||
2, // str_CU, // 48
|
||||
2, // str_WF, // 49
|
||||
2, // str_LC, // 50
|
||||
2, // str_DF, // 51
|
||||
|
||||
// Additional
|
||||
0, // str_BAT, // 52
|
||||
2, // str_GPS, // 53
|
||||
1, // str_RSSI, // 54
|
||||
3, // str_MAC, // 55
|
||||
3, // str_NA, // 56
|
||||
3, // str_NID, // 57
|
||||
0, // str_DATE, // 58
|
||||
0, // str_TIME, // 59
|
||||
1, // str_GMT, // 60
|
||||
1, // str_RAM, // 61
|
||||
2, // str_IN_TEMP, // 62
|
||||
1, // str_ACC, // 63
|
||||
4, // str_MILLIS, // 64
|
||||
|
||||
|
||||
// Special
|
||||
3, // str_STR // 65
|
||||
|
||||
// Meshlium
|
||||
3, // str_MBT // 66
|
||||
3, //str_MWIFI // 67
|
||||
|
||||
// RFID
|
||||
3, //str_UID // 68
|
||||
3, //str_RB // 69
|
||||
|
||||
// CRITICAL INFRASTRUCTURE
|
||||
1, //str_CI0 //70
|
||||
1, //str_CI1 //71
|
||||
1, //str_CI2 //72
|
||||
1, //str_CI3 //73
|
||||
1 //str_CI4 //74
|
||||
|
||||
};
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* SENSOR_FIELD_TABLE - Sensor fields
|
||||
*
|
||||
* This table specifies the number of fields per sensor.
|
||||
*
|
||||
* For example, a temperature sensor indicates the temperature in a single field.
|
||||
* On the other hand, the GPS module indicates the position with two fields:
|
||||
* latitude and longitude
|
||||
******************************************************************************/
|
||||
PROGMEM const uint8_t SENSOR_FIELD_TABLE[] =
|
||||
{
|
||||
// Gases
|
||||
1, // str_CO, // 0
|
||||
1, // str_CO2, // 1
|
||||
1, // str_O2, // 2
|
||||
1, // str_CH4, // 3
|
||||
1, // str_LPG, // 4
|
||||
1, // str_NH3, // 5
|
||||
1, // str_AP1, // 6
|
||||
1, // str_AP2, // 7
|
||||
1, // str_SV, // 8
|
||||
1, // str_NO2, // 9
|
||||
1, // str_O3, // 10
|
||||
1, // str_VOC, // 11
|
||||
1, // str_TCA, // 12
|
||||
1, // str_TFA, // 13
|
||||
1, // str_HUMA, // 14
|
||||
1, // str_PA, // 15
|
||||
|
||||
// Events
|
||||
1, // str_PW, // 16
|
||||
1, // str_BEND, // 17
|
||||
1, // str_VBR, // 18
|
||||
1, // str_HALL, // 19
|
||||
1, // str_LP, // 20
|
||||
1, // str_LL, // 21
|
||||
1, // str_LUM, // 22
|
||||
1, // str_PIR, // 23
|
||||
1, // str_ST, // 24
|
||||
|
||||
// Smart cities
|
||||
1, // str_MCP, // 25
|
||||
1, // str_CDG, // 26
|
||||
1, // str_CPG, // 27
|
||||
1, // str_LD, // 28
|
||||
1, // str_DUST, // 29
|
||||
1, // str_US, // 30
|
||||
|
||||
// Smart parking
|
||||
3, //str_MF, // 31
|
||||
1, //str_PS, // 32
|
||||
|
||||
// Agriculture
|
||||
1, // str_TCB, // 33
|
||||
1, // str_TFB, // 34
|
||||
1, // str_HUMB, // 35
|
||||
1, // str_SOILT, // 36
|
||||
1, // str_SOIL, // 37
|
||||
1, // str_LW, // 38
|
||||
1, // str_PAR, // 39
|
||||
1, // str_UV, // 40
|
||||
1, // str_TD, // 41
|
||||
1, // str_SD, // 42
|
||||
1, // str_FD, // 43
|
||||
1, // str_ANE, // 44
|
||||
1, // str_WV, // 45
|
||||
1, // str_PLV, // 46
|
||||
|
||||
// Radiation
|
||||
1, // str_RAD, // 47
|
||||
|
||||
// Smart meetering
|
||||
1, // str_CU, // 48
|
||||
1, // str_WF, // 49
|
||||
1, // str_LC, // 50
|
||||
1, // str_DF, // 51
|
||||
|
||||
// Additional
|
||||
1, // str_BAT, // 52
|
||||
2, // str_GPS, // 53
|
||||
1, // str_RSSI, // 54
|
||||
1, // str_MAC, // 55
|
||||
1, // str_NA, // 56
|
||||
1, // str_NID, // 57
|
||||
3, // str_DATE, // 58
|
||||
3, // str_TIME, // 59
|
||||
1, // str_GMT, // 60
|
||||
1, // str_RAM, // 61
|
||||
1, // str_IN_TEMP, // 62
|
||||
3, // str_ACC, // 63
|
||||
1, // str_MILLIS, // 64
|
||||
|
||||
// Special
|
||||
1, // str_STR // 65
|
||||
|
||||
// Meshlium
|
||||
1, // str_MBT // 66
|
||||
1, //str_MWIFI // 67
|
||||
|
||||
// RFID
|
||||
1, //str_UID // 68
|
||||
1, //str_RB // 69
|
||||
|
||||
// CRITICAL INFRASTRUCTURE
|
||||
1, //str_CI0 //70
|
||||
1, //str_CI1 //71
|
||||
1, //str_CI2 //72
|
||||
1, //str_CI3 //73
|
||||
1 //str_CI4 //74
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* DECIMAL_TABLE - number of default decimals for each sensor for ASCII frames
|
||||
*
|
||||
* This table specifies the number of decimals for each sensor for ASCII frames
|
||||
******************************************************************************/
|
||||
PROGMEM const uint8_t DECIMAL_TABLE[] =
|
||||
{
|
||||
// Gases
|
||||
3, // str_CO, // 0
|
||||
3, // str_CO2, // 1
|
||||
3, // str_O2, // 2
|
||||
3, // str_CH4, // 3
|
||||
3, // str_LPG, // 4
|
||||
3, // str_NH3, // 5
|
||||
3, // str_AP1, // 6
|
||||
3, // str_AP2, // 7
|
||||
3, // str_SV, // 8
|
||||
3, // str_NO2, // 9
|
||||
3, // str_O3, // 10
|
||||
3, // str_VOC, // 11
|
||||
2, // str_TCA, // 12
|
||||
2, // str_TFA, // 13
|
||||
1, // str_HUMA, // 14
|
||||
2, // str_PA, // 15
|
||||
|
||||
// Events
|
||||
3, // str_PW, // 16
|
||||
3, // str_BEND, // 17
|
||||
0, // str_VBR, // 18
|
||||
|
||||
0, // str_HALL, // 19
|
||||
0, // str_LP, // 20
|
||||
0, // str_LL, // 21
|
||||
3, // str_LUM, // 22
|
||||
0, // str_PIR, // 23
|
||||
3, // str_ST, // 24
|
||||
|
||||
// Smart cities
|
||||
0, // str_MCP, // 25
|
||||
0, // str_CDG, // 26
|
||||
3, // str_CPG, // 27
|
||||
3, // str_LD, // 28
|
||||
3, // str_DUST, // 29
|
||||
2, // str_US, // 30
|
||||
|
||||
// Smart parking
|
||||
0, //str_MF, // 31
|
||||
0, //str_PS, // 32
|
||||
|
||||
// Agriculture
|
||||
2, // str_TCB, // 33
|
||||
2, // str_TFB, // 34
|
||||
1, // str_HUMB, // 35
|
||||
2, // str_SOILT, // 36
|
||||
2, // str_SOIL, // 37
|
||||
0, // str_LW, // 38
|
||||
2, // str_PAR, // 39
|
||||
2, // str_UV, // 40
|
||||
3, // str_TD, // 41
|
||||
3, // str_SD, // 42
|
||||
3, // str_FD, // 43
|
||||
2, // str_ANE, // 44
|
||||
0, // str_WV, // 45
|
||||
2, // str_PLV, // 46
|
||||
|
||||
// Radiation
|
||||
6, // str_RAD, // 47
|
||||
|
||||
// Smart meetering
|
||||
2, // str_CU, // 48
|
||||
3, // str_WF, // 49
|
||||
3, // str_LC, // 50
|
||||
3, // str_DF, // 51
|
||||
|
||||
// Additional
|
||||
0, // str_BAT, // 52
|
||||
6, // str_GPS, // 53
|
||||
0, // str_RSSI, // 54
|
||||
0, // str_MAC, // 55
|
||||
0, // str_NA, // 56
|
||||
0, // str_NID, // 57
|
||||
0, // str_DATE, // 58
|
||||
0, // str_TIME, // 59
|
||||
0, // str_GMT, // 60
|
||||
0, // str_RAM, // 61
|
||||
2, // str_IN_TEMP, // 62
|
||||
0, // str_ACC, // 63
|
||||
0, // str_MILLIS, // 64
|
||||
|
||||
// Special
|
||||
0, // str_STR // 65
|
||||
|
||||
// Meshlium
|
||||
0, // str_MBT // 66
|
||||
0, //str_MWIFI // 67
|
||||
|
||||
// RFID
|
||||
0, //str_UID // 68
|
||||
0, //str_RB // 69
|
||||
|
||||
// CRITICAL INFRASTRUCTURE
|
||||
0, //str_CI0 //70
|
||||
0, //str_CI1 //71
|
||||
0, //str_CI2 //72
|
||||
0, //str_CI3 //73
|
||||
0 //str_CI4 //74
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user