This will help understand the basic methods of data conversions from the MC to the data seen in the Database
Here is the payload in the MessageUp table;
410000002D9F255E0C02BB41CDCCCC3F8FC269410DC8164900000000000000000000000000000000000000000ED80D000000010101000000
This is how it looks in the MC Transaction Table;
Here is the spec of what we needed to upload from the MC;
Now, we needed to reorganize the data into the struct, due of the 32bits memory organization on uC, else we have spare bytes in the structure
NB: the data structs are on the file Data_Structs.h on main/srs/libraries
struct Transaction_Str // Transactions Data Struct
{
uint32_t Transaction;
uint32_t DateTime;
float Value;
float Liters;
float Price;
float Totalizer;
uint32_t Odometer;
uint32_t Hourmeter;
byte VehicleTAG[TAG_LENGTH];
byte DriverTAG[TAG_LENGTH];
byte AttendantTAG[TAG_LENGTH];
byte Nozzle_Number;
byte Type;
byte Status;
byte Fuelling_Time;
byte Reserved[2];
};
41000000 [Tran#-4]
2D9F255E [DateTime-4]
0C02BB41 [Value-4]
CDCCCC3F [Litres-4]
8FC26941 [Price-4]
0DC81649 [Totalizer-4]
00000000 [Odometer-4]
00000000 [HourMeter-4]
000000000000 [VehicleTag-6]
000000000000 [DriverTag-6]
0ED80D000000 [Attendant-6]
01 [Nozzle#-1]
01 [Type -1
01 [Status -1]
00 [Fuelling Time -1]
0000 [ Reserved – 2]
Lets cover some of the basic conversions
Transaction number
To workout the data, you would need decode the data from the Little Endian format that it is in.
So the Tran# of 41000000 = 0x00000041 which is 65 in decimal
DateTime
The field is a uint32 and the value is in unixtimestamp format
https://www.unixtimestamp.com/
See attached doc
use this doc to work out the Date time: Master Controller How to set the Time.docx
2D9F255E
Value
Convert from Little Endian 0C02BB41 use this web site to assist in the conversion;
https://gregstoll.com/~gregstoll/floattohex/
As we can see the on the LCD the Sale value = 23.37 and on the DB is it 23.38 the MC Server would need to truncate to 2 decimals after the point to be identical to the display
Tags
The Tags are also in Little Endian so 0ED80D000000 is 0000000DD80E