Sony Ericsson RC function, RC function for remote script download Application Note

Page 1
Application Note
Use of the RC function
for remote script download
Page 2
First edition (January 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
Remote script download using RC intrinsic function
Contents
1
INTRODUCTION.............................................................................................................. 4
2 OVERVIEW...................................................................................................................... 5
2.1 GENERAL ....................................................................................................................... 5
2.2 CONTROL PC SETUP....................................................................................................... 5
2.3 REMOTE GR47 SETUP .................................................................................................... 6
2.4 SECURITY ASPECTS ........................................................................................................ 6
2.4.1 SMS ...................................................................................................................... 6
2.4.2 CLIP ...................................................................................................................... 6
APPENDIX I EMBEDDED APPLICATION CODE...................................................................... 7
LZT 123 7799 R1A 3
Page 4
Remote script download using RC intrinsic function
1 Introduction
The GR47 has been designed so that scripts embedded within the device can be updated either through a serial interface on UART1 or where this is not feasible, due to location, remotely using the air interface. The script resident in the device must be written in a way that makes remote access permissible and preferably with some form of authentication of the calling party.
LZT 123 7799 R1A 4
Page 5
Remote script download using RC intrinsic function
2 Overview
2.1 General
The remote script download is dependant on the currently active script within the GR47 having the RC intrinsic function capability written in such a way that once a CSD data call is received, the RC intrinsic function is called and the remote script download takes place. Once the script is down loaded into GR47 memory and all checksums are verified, the GR47 is reset and on completion of the power up routine the new downloaded script is activated.
It is imperative that the new script downloaded using the over the air routine also has the RC functionality written into it as once the new script is activated and running, then without having the RC functionality active, the script will not be able to be updated again.
The remote download process takes care of script number allocation and will use whatever script number is not being used by the activated script. This ensures that the original script is not lost and can be activated again if the new script is not functioning as expected.
Note.
It is very important that the new script to be downloaded using the remote download facility has been checked thoroughly for possible bugs or run time errors. As once the script is downloaded and activated, it is not possible to gain remote access again if the script has crashed and is not running.
2.2 Control PC setup
The remote PC will require the latest IDE to be installed and preferably connected by UART1 to a GSM modem and the script to be downloaded needs to be open in the main IDE screen.
Select the yellow telephone icon next to the main script download button in the tools menu. A pop up box will ask for the data telephone number of the GR47 you are going to download a script to. Enter the number and select OK and wait for the remote download pop up to appear.
Once the remote download popup appears select download and the script will be downloaded to the remote device. Progress can be monitored on the download bar as a percentage to completion. Once the download has finished, you must select the EXIT button on the download popup which will reset the remote device and the new script will be run on power up.
LZT 123 7799 R1A 5
Page 6
Remote script download using RC intrinsic function
2.3 Remote GR47 Setup
The GR47 that is to have its script updated by using the RC function must have a script with the RC functionality active as part of the main loop within the script structure (example below). The remote GR47 must also have a SIM card with a data number to allow the setup of a CSD data call. Progress of the remote script download can be monitored on UART2 as part of the debug data. This is done with the use of printf statements within the RC function and with PRS(0) set to turn off normal debug.
2.4 Security aspects
When implementing the code some thought should be given to ensuring that no one else can dial into the module and perform an unauthorised download which might disable the application or cause it to run incorrectly.
Two methods are described below which should be easy to implement and are quite secure in their operation as they use standard functionality which is built into most GSM networks
2.4.1 SMS
The script attached to this application note relies upon a data call being received and then switching the RC function on. This can also be done in reverse i.e. the unit can make a phone call and then the RC function switched on. The call could be triggered by an incoming SMS, the format of which, is recognised by the script i.e. the text of the SMS could be
‘Update required: code 1234 call service centre’
this should be sent from known number
This method has the additional advantage of not requiring data phone numbers for each of your SIM’s as all units can make data calls.
2.4.2 CLIP
Alternatively the script below could be adjusted to activate CLIP (Caller Line Presentation) and only answer the call if it recognised that the call was from its service centre.
LZT 123 7799 R1A 6
Page 7
Remote script download using RC intrinsic function
Appendix I Embedded Application Code
The following code sample (using Sony Ericsson’s M2mpower help file) can be used to set-up the RC functionality within a script.
/* This example shows how simple Over the Air Download can work using the RC function. */
int Rslt;
RemoteMode () { int st = 0; int first; int num; int connect; int cnt;
st = 0; cnt = 0;
chcrt (1); prtf("\nRemote Mode\n");
/* auto answer on data channel */ chw (1, "ATS0=1\n\r", 8);
/* wait for data mode */ st = 0; first = 1;
while (st == 0 && cnt < 60) { /* check status of call every second */ dlys (1); cnt++; st = chsts (1);
/* check for DCD */ st = st & 0x02; }
/* setup remote control */ while (st != 0) { if (first == 1) { st = rc (1); prtf ("rc status NUMBER 1 = %d\n", st); first = 0;
LZT 123 7799 R1A 7
Page 8
Remote script download using RC intrinsic function
} else { /* check status of call every second */ dlys (1);
prtf ("online status NUMBER 1 = %d\n", st);
st = chsts(1); st = st & 0x02; } }
if (first == 0) { /* disable remote control and reset the module */ prtf ("disable rc\n"); rc(0); rst(0); } }
EstablishTCP() { return(0); }
main () { int chlerr; char chlsts; int APPS_NETWORK_STATUSBYTE = 10; int AT_NET_REGISTERED = 1;
prs(0); prtf("\r\n Waiting for Network registration...");
while(gtb(APPS_NETWORK_STATUSBYTE) != AT_NET_REGISTERED) { dlys(1); } prtf("\r\n Now registered!");
while (1) {
prtf ("\r\n - Beginning TCP setup..."); Rslt = EstablishTCP(); prtf ("\r\n >>> EstablishTCP() result: ");
if (Rslt == 0) { prtf ("\r\nOK!"); } else
LZT 123 7799 R1A 8
Page 9
Remote script download using RC intrinsic function
{ prtf ("\r\nFAILED!"); }
RemoteMode (); prtf ("\r\n\nScript Complete!");
} }
LZT 123 7799 R1A 9
Loading...