Sony Ericsson Simple Telemetry Application, Embedded Applications Simple Telemetry Application Application Note

Page 1
Application Note
Embedded Applications
Simple Telemetry Application
Page 2
First edition (November 2004)
Sony Ericsson Mobile Communications. publishes this manual without making any warranty as to the content contained herein. Further Sony Ericsson Mobile Communications. reserves the right to make modifications,
additions and deletions to this manual due to typographical errors, inaccurate information, or improvements to programs and/or equipment at any time and without notice. Such changes will, nevertheless be incorporated into new editions of this manual.
All rights reserved.
© Sony Ericsson Mobile Communications., 2004
Page 3
EMBEDDED APPLICATIONS FCT
Contents
Contents.....................................................................................................3
1 Introduction ........................................................................................4
2 Simple Telematics Solution with Embedded Applications................. 5
2.1 System Overview.......................................................................................5
2.2 TCS Script Flowchart.................................................................................6
2.3 TCS IFL Support........................................................................................7
2.3.1 General Hardware Library..............................................................7
2.3.2 AT Commands Library...................................................................7
2.3.3 SMS Library (OTA Communication) ..............................................7
2.3.4 GPS Library ...................................................................................7
2.4 Telematics Core Service Script {TCS_SMS.sc} ........................................8
LZT 123 8017 R1A 3
Page 4
EMBEDDED APPLICATIONS FCT
1 Introduction
The example covered here utilizes a Demo Board that can be plugged into the Development Board. The Demo Board is preconfigured thus:- LED jumpers 1-9 are connected, SWITCH jumpers 1-9 are disconnected. Jumpers I1, O1, O2, O3, O4 are connected, as is ADC1 to the THERM jumper. All other jumpers are disconnected.
LZT 123 8017 R1A 4
Page 5
EMBEDDED APPLICATIONS FCT
2 Simple Telematics Solution with Embedded Applications
2.1 System Overview
This application note illustrates how an embedded application can be created to provide a simple Telematics demonstrator.
The radio device is connected to a GPS receiver via UART3, a Telematics Core Service (TCS) is provided by an embedded application script described here.
The script can be triggered to route data from the GPS receiver via SMS on receipt of a command SMS. An Administrative Front End application or GSM handset can be used to issue the command, once the command has been accepted the application in the radio device will reply to the originator with an SMS containing positioning data captured from the GPS receiver.
The Administrative Front End application may process the data by plotting the position on a map for example.
The commands supported are:
Request – send a single GPS update
Schedule x – send GPS updates continually at ‘x’
second intervals
Stop – stop the current schedule process
The system is illustrated in figure 6.1
Figure 6.1 System Overview
LZT 123 8017 R1A 5
Page 6
EMBEDDED APPLICATIONS FCT
2.2 TCS Script Flowchart
This flowchart below describes the TCS script.
Start
Initialise AT
Channel
Create an AT Channel using the IFL
Function ATCRT
AT Channel
Created ?
Initialise
SMS
Yes
Exit Script
No
Initialise SMS Service for OTA
Communication using the IFL Function
SMSI
No
SMS
Service
Created ?
New
SMS?
No
Yes
Read SMS
Read SMS using the following IFL Functions: SMSRS - Get the SMS Slot Number SMSRM - Read Message Data from Slot SMSRA - Read Message Address from Slot (this is the ATF Address) SMSD - Delete the Message
Message
Valid?
Initialise
GPS
GPS
Service
Initialised ?
Initialise the GPS Service to SiRF Binary Messages from the GPS Device. Using the IFL Function SIRFC
Yes
No
Filter SiRF
Binary
Message
Send Position
Data to ATF
Filter SiRF Binary Message (MID 98) and get position data from the GPS Device. Using the IFL Fundction SBFM
Send the filtered position Data via OTA Communication to ATF. Using the IFL Function SMSS
Yes
No
Exit Script
Message =
Request
Filter SiRF
Binary
Message
Send Position
Data to ATF
Delay x
Seconds
Yes
No
New
SMS?
Message =
Schedulex
Filter SiRF Binary Message (MID 98) and get position data from the GPS Device. Using the IFL Fundction SBFM
Read SMS
Message
Valid?
No
Message =
Stop
Send the filtered position Data via OTA Communication to ATF. Using the IFL Function SMSS
Pass x to DLYS to pause
LZT 123 8017 R1A 6
Page 7
EMBEDDED APPLICATIONS FCT
2.3 TCS IFL Support
The intrinsic functions utilised by the application include the following :
2.3.1 General Hardware Library
gtf - Check for incoming SMS messages.
dlys - Set delay values including scheduling intervals.
2.3.2 AT Commands Library
atcrt - Create an AT Channel for SMS transactions.
2.3.3 SMS Library (OTA Communication)
smsi - Initialise the SMS ME and SM memory.
smsrs - Read an SMS message slot number.
smsrm - Read the SMS message data.
smsra - Read and store the SMS message address. This address becomes the address for sending position data back to an AFE.
smsd - Delete an SMS message once read.
smss - Send position data to an AFE.
2.3.4 GPS Library
sirfc - Initialise the SiRF binary protocol and GPS device to send binary messages at 19200 baud via UART 3.
sbfm - Request and filter data from the GPS receiver in SiRF Binary message MID 98 format.
LZT 123 8017 R1A 7
Page 8
EMBEDDED APPLICATIONS FCT
2.4 Telematics Core Service Script {TCS_SMS.sc}
Below is a listing of the TCS application.
char *msgRequest = "Request"; char *msgSchedule = "Schedule"; char *msgStop = "Stop";
/***************************************************** * Name: ReadSMS * Arguments: char *d_p, int dLen * char *a_p, int aLen * Return: int 1 or 0 * Description: Reads the first un-read SMS *****************************************************/ ReadSMS (char *d_p, int dLen, char *a_p, int aLen) { int sNo = 0;
if (gtf(29) > 0) { sNo = smsrs (); smsrm(d_p, dLen, sNo); smsra(a_p, aLen, sNo); smsd(sNo); prtf("\nReceived SMS [%s,%s]\n", d_p, a_p); return (1); } return (0); }
/***************************************************** * Name: SendNavData * Arguments: char *adrs, int format * Return: int 1 or 0 * Description: Send navigation data SMS. * format=0 Raw, format=1 ASCII *****************************************************/ SendNavData (char *adrs, int format) { char pL_p[255]; int pLSze = 0; int pLCSum = 0;
sbfm(98, format, 0, pL_p, 255, &pLSze, &pLCSum); prtf("\nReceived NavData Format:%d Size:%d CSum:%d\nData[%s]\n", format, pLSze, pLCSum, pL_p);
LZT 123 8017 R1A 8
Page 9
EMBEDDED APPLICATIONS FCT
LZT 123 8017 R1A 9
prtf("\nSending SMS to [%s]\n", adrs); if (smss(adrs, pL_p, 145, slen(adrs), slen(pL_p)) > 0) { prtf("\nSMS Send Error\n"); return (0); } prtf("\nSMS Sent OK\n"); return (1); }
/******************************************************* * Name: ScheduleNavData * Arguments: char *aMsg, char *sAdrs, int sInterval * Return: None. * Description: Request navigation if the SMS * message Schedule'x' received * Delay is 'x' second intervals * Max delay = 255 seconds *******************************************************/ ScheduleNavData (char *sMsg, char *sAdrs, int sInterval) { while (1) { prtf("\nSending Nav Data on Schedule\n"); SendNavData (sAdrs, 1); if (ReadSMS(sMsg, 160, sAdrs, 160) == 1) { if (scmp(sMsg, msgStop) == 0) { prtf("\nSchedule Stopped\n"); return; } prtf("\nIgnored SMS Command[%s]\n", sMsg); } prtf("\nWaiting %d Seconds\n", sInterval); dlys(sInterval); } }
main () { char sMsg[160]; char sAdrs[160]; char msg[16]; int sRes = 0;
prs(0); prtf("\tRunning:TCS Demo 14/07/03-11:40\n"); prtf("\nInitilising SMS Memory\n"); if ((atcrt() == 0)&&(smsi(1, 1) == 0)) { /* create SIRF UART3 channel for Binary at 19200 */
Page 10
EMBEDDED APPLICATIONS FCT
LZT 123 8017 R1A 10
if (sirfc (0, 4) > 0) { while (1) { prtf("\nAwaiting SMS Command\n"); if (ReadSMS(sMsg, 160, sAdrs, 160) == 1) { if (scmp(sMsg, msgRequest) == 0) { prtf("\nSending Nav Data on Request\n"); SendNavData(sAdrs, 1); } else { sncpy(msg, sMsg, 8); msg[8] = '\0'; if (scmp(msg, msgSchedule) == 0) { sRes = atoi(sMsg); prtf("\nUpdating Schedule to %d Seconds\n", sRes); ScheduleNavData(sMsg, sAdrs, sRes); } } } dlys(1); } } } prtf("\nInitialisation Error\n"); atdst(); }
Loading...