hi all.. I am working on Automatic Meter Reading system. Using GSM modem to send and receive SMS. I am getting the SMS string as
>>AA5500101#0000440585#000000000.820#0000000.000#0.3.689#TE=Y,RF=N#0000440585#0000000000#0000000000#000#000#212#55AA
Now I am breaking it as
Flowmeter Id :- 001
GSM/GPRS :- 01 (02 for GPRS)
Current Meter Reading :- 820
Battery Voltage :-3.689
TE=Y, RF=N
the pseudo code,,
Get the Message string
Detect Flowmeter_ID
Find Previous Meter reading(PMR) for the same( If it is for the first time then PMR=0 else the Meter reading taken last time
Subtract PMR from Current Meter reading to get Consumed Water
Now Store Current meter reading as Previous Meter reading for the next Time
Similarly if I am getting the Message string as following
AA5500201#0000440585#000000000.620#0000000.000#0.3.689#TE=Y,RF=N#0000440585#0000000000#0000000000#000#000#212#55AA
Flowmeter Id :- 002
GSM/GPRS :- 01 (02 for GPRS)
Current Meter Reading :- 620
Battery Voltage :-3.689
TE=Y, RF=N
In this case device id is different so it will search the PMR for device id 002 and subtract it from the Current meter reading of the same device.
there will be a database column
Device Number
Date Time
Flowmeter_ID(PKey)
GSM/GPRS
Current Meter Reading
Battery voltage
TE, RF
Consumed Water
Charge/Ltr
Amount
then in the reporting I will be create a view in which I will combine customer table with Device table
and finally I will have following in the report
Customer ID
Customer Name
Address
Device Number
Date Time
Flowmeter_ID(PKey)
GSM/GPRS
Current Meter Reading
Battery voltage
TE, RF
Consumed Water
Charge/Ltr
Amount
I am cant able to write the code for shifting PMR and CMR………
please help me out.