Records
Reading internal records
To read collected sensor values ReadRecord(); function has to be used. if any data is available function will return 1 - success. So option would be check that there is information and when needed read it. All read information could be deleted with ConfirmRecord(); function. Keep in mind that sensors data have to be saved in flash memory by using MQTT_PublishSensor(); or by configuring FMSET before using ReadRecord:
Reading internal records
new SensorBuffer[1000];
new tmp;
new status;
new idL;
new idH;
new Float:float_tmp;
main()
{
while(1)
{
MQTT_PublishSensor(Sensor_GSM_PWR); // publish sensor data
status = ReadRecord(PARSE_RECORD, SensorBuffer, 0); //check if ReadRecord is not empty and store record information into an array named SensorBuffer
if(status != 0)
{
GetSensor(SensorBuffer, Sensor_GSM_PWR, tmp); //get sensor data into variable named tmp from array named SensorBuffer
GetSensor(SensorBuffer, Sensor_Ibutton_ID, idL, Bit64_low);
GetSensor(SensorBuffer, Sensor_Ibutton_ID, idH, Bit64_high);
GetSensor(SensorBuffer, Sensor_Longitude, float_tmp, CONVERT_TO_FLOAT);
}
ConfirmRecord(); // this will erase all read Sensor_GSM_PWR information
Delay(1000);
}
}When sensor data is not erased and next point wanted to be read, sensorBuffer element must be selected. Keep in mind that after using ConfirmRecord(); will delete all read data.