19 pages
Slovak

Boomerang-GSM-tutorial

-

Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres
19 pages
Slovak
Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres

Description

Boomerang GSM Tutorial Editor: Tomáš Mandys, tomas.mandys@2p.cz (2p plus) Home site: http://www.2p.cz Document status: Version 1.0 First release Boomerang GSM Tutorial Table of Contents 1. Introduction ...........................................................................................................................3 2. Basic functionality .................................................................................................................3 2.1. Submit message ............................................................................................................4 2.2. Deliver message ............................................................................................................4 2.3. Status report ..................................................................................................................6 2.4. Serial communication.....................................................................................................7 2.5. Character set .................................................................................................................8 2.6. Message classes ...........................................................................................................9 2.7. Blinking (flash) messages ..............................................................................................9 3. Smart Messages® ............. ...

Informations

Publié par
Nombre de lectures 43
Langue Slovak

Extrait









Boomerang GSM Tutorial



















Editor:
Tomáš Mandys, tomas.mandys@2p.cz (2p plus)

Home site:
http://www.2p.cz

Document status:
Version 1.0 First release Boomerang GSM Tutorial


Table of Contents

1. Introduction ...........................................................................................................................3
2. Basic functionality .................................................................................................................3
2.1. Submit message ............................................................................................................4
2.2. Deliver message ............................................................................................................4
2.3. Status report ..................................................................................................................6
2.4. Serial communication.....................................................................................................7
2.5. Character set .................................................................................................................8
2.6. Message classes ...........................................................................................................9
2.7. Blinking (flash) messages ..............................................................................................9
3. Smart Messages® ................................................................................................................9
3.1. vCard ...........................................................................................................................10
3.2. Logo.............................................................................................................................11
3.3. Ringing tone / melody ..................................................................................................11
3.4. Picture message ..........................................................................................................12
4. EMS ....................................................................................................................................12
4.1. Picture..........................................................................................................................14
4.2. Animation.....................................................................................................................14
4.3. Sound ..........................................................................................................................14
5. Siemens Exchange Object (SEO).......................................................................................15
6. WAP Push...........................................................................................................................16
7. Advanced delivery processing ............................................................................................17













Disclaimer

The information of this document is provided ‚“AS IS‘, with no warranties whatsoever, excluding
in particular any warranty of merchantability, fitness for any particular purpose, or any warranty
otherwise arising out of any proposal, specification, or sample. This document is provided for
information purposes only.
- ii - Boomerang GSM Tutorial

1. Introduction
This document describes how to create a simple application based on Boomerang library for
SMS communication. GSM specifications are published at ETSI (European
Telecommunications Standards Institute – http://www.etsi.org) in GSM 3.38 and 3.40 standards
(ETSI TS 100 900/901).


2. Basic functionality
Create new application and place TGSM Assign Comm1 as GSM1.COMDevice
and TComm components on a form. Both
are located probably on Communication
palette.




TGSM component must be active to work. Call GSM1.Open method or set GSM1.Active=True.
Component establishes communication with a GSM module.

procedure TForm1.FormShow(Sender: TObject);
begin
GSM1.Open;
end;

GSM component requires some mandatory parameters. Recommended places for setup are in
GSM1.OnBeforeOpen and Comm1.BeforeOpen events. You should know which serial port is
the GSM module connected to, GSM operator parameters and SIM card security code (PIN).

procedure TForm1.GSM1BeforeOpen(DataSet: TConnection);
begin
with DataSet as TGSM do
begin
Equipment:= eqM35;
PIN:= '1234'; // or empty string if PIN is not required
SCA:= '+420602909909'; // phone number of operator service center
SMSFormat:= smsfPDU; // or smsfText according to GSM module
end;
end;
- 3 - Boomerang GSM Tutorial


procedure TForm1.Comm1BeforeOpen(DataSet: TConnection);
begin
with DataSet as TComm do
begin
DeviceName:= 'Com1';
BaudRate:= br19200;
end;
end;

GSM components are ready for communication. You setup parameters in design time using
object inspector, of course.
2.1. Submit message
Create a button and in OnClick event do SMS sending functionality. First it’s necessary to
define what to send via TSMSSubmit class instance and then send it using GSM1.SendSMS
method.

procedure TForm1.Button1Click(Sender: TObject);
var
SMS: TSMSSubmit;
begin
SMS:= TSMSSubmit.Create;
try
SMS.GSM:= GSM1;
SMS.DA:= '+420604690589'; // destination address
SMS.UD:= 'My first SMS send using Boomerang library'; // text of message
GSM1.SendSMS(SMS);
finally
SMS.Free; // destroy object instance
end;
end;
2.2. Deliver message
Now the application can send simple text message and we implement delivery message
functionality.

First after GSM1 component is open then the GSM module will be checked if messages are
stored in memory.

procedure TForm1.GSM1AfterOpen(DataSet: TConnection);
var
Sg: TStrings;
I, J: Integer;
begin
// retrieve messages from module memory
if (DataSet as TGSM).Equipment in [eqM20, eqNokia9110, eqWavecom, eqFasttrack] then
Sg:= GSM1.GetSMSList(4{all})
else
Sg:= GSM1.GetSMSList(-1);
try
for I:= 0 to Sg.Count-1 do // process all retrieved messages
begin
J:= StrToInt(Sg.Names[I]);
if StrToInt(Sg.Values[Sg.Names[I]]) in [0{unreaed}] then
begin
if Sg.Objects[I] <> nil then
- 4 - Boomerang GSM Tutorial

ProcessSMS(Sg.Objects[I] as TSMS);
end;
GSM1.DeleteSMS(J);
end;
finally
Sg.Free;
end;
end;

There are two possibilities how to process delivered messages. The application can periodically
check the GSM module if a message has been delivered using GSM1.GetSMSList method or
take advantage that the GSM module alerts application that a message has been delivered
using GSM1.OnUnsolicitedSMS event. But alerting, i.e. unsolicited indication, must be enabled
using GSM1.UnsolicitedIndication property – add it in GSM1.OnBeforeOpen event.

Note that some mobile phones (e.g. Siemens S55) do not alert application if message is
delivered unless uindOnlyIndication feature is enabled.

procedure TForm1.GSM1BeforeOpen(DataSet: TConnection);
begin
with DataSet as TGSM do
begin
...
UnsolicitedIndication:= [uindSMSDeliver, uindOnlyIndication];
end;
end;

To the OnUnsolicitedSMS are passed two important parameters, Idx and aSMS. Idx is byte
identifier of message in GSM module memory and aSMS is instance carrying delivered
message data. If aSMS is nil it’s necessary to read it explicitly from GSM module memory using
GSM1.ReadSMS method.

procedure TForm1.GSM1UnsolicitedSMS(Sender: TObject; Idx: Integer;
aSMS: TSMS);
var
Stat: Integer;
begin
if aSMS = nil then
begin
try
aSMS:= GSM1.ReadSMS(Idx, Stat);
if Stat in [0{unread}] then
ProcessSMS(aSMS); // process only unreaded messages
finally
GSM1.DeleteSMS(Idx); // delete message from module memory
end;
end
else
begin
ProcessSMS(aSMS);
if Idx <> -1 then
GSM1.DeleteSMS(Idx);
end;
end;

- 5 - Boomerang GSM Tutorial

Message is passed to ProcessSMS where message is processed. It’s necessary to test type of
aSMS instance because more message types are delivered by this manner. Delivered message
is defined as TSMSDeliver class.

procedure TForm1.ProcessSMS(aSMS: TSMS);
var
S: string;
begin
if aSMS is TSMSDeliver then
begin
with aSMS as TSMSDeliver do
S:= Format('>%s, OA: %s, UD: %s',
[Da

  • Univers Univers
  • Ebooks Ebooks
  • Livres audio Livres audio
  • Presse Presse
  • Podcasts Podcasts
  • BD BD
  • Documents Documents
Alternate Text