help urgent........2-way sms
| Wed, 2007-09-12 11:24 | |
|
Hi friends, I have to mke a ppt on it as soon as possible. What is a 2-way sms? can it be impemented in "symbian" using "GSM modem"? Then , how to implement the concept of 2-way SMS on symbian? I also do not know what is a "GSM MODEM" I have to mke a "PPT" on it as soon as possible. Please reply soon.......... With regards |
|






Forum posts: 80
2-way SMS is not a generalized concept as such.
First you should try and clear yourself as to why do you want a 2-way SMS application.
Then you can decide how to implement it.
You cannot build an application or present anything until you aren't clear with its utility or requirement.
Forum posts: 111
Ok,
I got my part
------------------------------
i need to listen for all messages coming to a phone.
if the message has a particular header, the application should read the body of sms.
This body contains some commands. depending on the commands different tasks are to be
performed.
My current need is to know
1.which symbian classes to use.
2.Should I write a dll for this or normal application would do the job.
Thanx in advance
sandeep mohapatra
Forum posts: 80
hi sandeep,
If you are programming for the S60 2nd Edition SDK, you can study the "smssend" example in your SDK.
Other useful links are:
http://wiki.forum.nokia.com/index.php/SMS_Operations
http://wiki.forum.nokia.com/index.php/Sending-Receiving_SMS_through_an_Exe_%28Server%29
If you want a .app, dll or .exe depends on your requirements.
Forum posts: 111
I get errors in the following lines:-
CSmsSettings* serviceSettings;
if ( !serviceSettings->NumSCAddresses() )
{
HBufC* text = StringLoader::LoadLC( R_SMS_SC_NBR_MISSING );
CAknWarningNote* warningNote = new ( ELeave ) CAknWarningNote;
warningNote->ExecuteLD( *text );
CleanupStack::PopAndDestroy( text );
// Remember to pop settings even if this branch is taken.
CleanupStack::PopAndDestroy( settings );
return EFalse; // quit creating the message
}
else
{
// Set service center address to default.
// The caller does not take ownership of the returned object.
CSmsNumber* smsCenter =
&( serviceSettings->SCAddress( serviceSettings->DefaultSC() ) );
header.Message().SetServiceCenterAddressL( smsCenter->Address() );
}
The program build is successfull if I comment them out.
Forum posts: 80
There is as such no problem with these lines.
You need to post the error codes and descriptions to be more clear about your problem.
Please make sure you understand the working of SMS APIs in Symbian before you start developing an application.
Forum posts: 111
Ok!!!!!!
My work is to listen for incoming "sms"es.
So, I think my approach should be(from what I have understood):-
1.create instance of CMsvSession with a class inheriting MMsvSessionObserver as parameter
2.In HandleSessionEvent(), I should handle "EMsvEntriesCreated" for listening to incoming messages
3.there I should decode the header and body of the sms
Tell me if I am write or wrong!!!!!!!!!!!!
Then again I think one problem should arise:-- If the sms goes into INBOX, then it will cause the sms ringtone to be played
and I dont want any such sounds.Can I disable the sound?
Forum posts: 80
Yes I think you are right. But don't take the hassle to write the code again for SMS handling.
There is an example "smssend" in SDK. Simply take the SMSHandler from there (or from the links i already gave earlier in this post) and implement it in your code. But simultanesouly, you also need to understand the working of SMSHandler class.
You can disable the sound of the SMS received using the following code in your MessageReceivedL() function:
TMsvEntry entry = serverEntry->Entry(); // currently handled message entry
entry.SetInPreparation(EFalse);
entry.SetNew( EFalse );
entry.SetUnread( EFalse );
entry.SetVisible( EFalse );
serverEntry->ChangeL( entry ); // commit changes
But this does not give uniform results on Nokia 6600 and FP1 phones. Sometimes you may hear the SMS tone. But it will work flawlessly for FP2 phones and above. But I think this is the only way....
Forum posts: 111
I wiil take some time to try this out.
Forum posts: 111
I got some help from sdk
I am pasting it here for references to others
Incoming messages
Messaging receives SMS messages via a number of watcher components that listen to the CDMA stack for incoming messages that belong to particular teleservices (WMT, WEMT, VMN, WPT). When an incoming message belonging to one of these teleservices is received, its contents are read, and a new entry for the message is created in the message server's store (in the global inbox folder). The usual case is that these messages will then be read by the user through the email application, but other messaging clients can receive notifications when a new message is created in the store, and process the message if appropriate.
To receive such notifications, a class must implement the session observer interface MMsvSessionObserver. The interface has just one function:
void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3)=0;
When a new message is created in the store, the framework calls this function with aEvent set to EMsvEntriesCreated, and aArg1 is set to a CMsvEntrySelection* that specifies the IDs of the entries that have been created. The following checks the event type, and gets the entry ID selection:
void CClientApp::HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* , TAny* )
{
CMsvEntrySelection* entries = NULL;
switch (aEvent)(aArg1);
{
case EMsvEntriesCreated:
entries = static_cast
break;
default:
break;
}
The observer will receive notifications for all types of entry, not just SMS, so it's necessary to read the message properties to check that the entry is appropriate to process.
The following code does the first stage in this checking. It:
gets the index entry for the message. Getting an index entry is cheap and quick compared to getting the entire message, so it's a good idea to do any required checks on this first.
tests if the entry is an SMS message, by checking the index entry's iMtm and iType fields
tests if it's an incoming message, by checking that the entry is in the Inbox
if (entries)
{
TInt count = entries->Count();
// check each entry to see if we want to process it
while (count--)
{
// get the index entry
TMsvId serviceId;
TMsvEntry entry;
iMtm->Session().GetEntry((*entries)[count], serviceId, entry);
// if the entry is an SMS message
if (entry.iMtm == KUidMsgTypeSMS && entry.iType == KUidMsvMessageEntry
// and if it's an incoming message (as its in the inbox)
&& entry.Parent() == KMsvGlobalInBoxIndexEntryId)
An application can now perform further checks, e.g. for particular message content. For example, the following code:
sets the client MTM's context to the message
reads the message body and tests that it begins with the string specified by a value iMatchText
gets the message teleservice ID and tests that it is equal to a value iMatchTeleservice
iMtm->SwitchCurrentEntryL((*entries)[count]);
iMtm->LoadMessageL();
TBool match = ETrue;
// Check the message body against any specified match text
if (iMatchText.Length())
{
CRichText& body = iMtm->Body();
TPtrC text(body.Read(0, iMatchText.Length()));
match = (text.Compare(iMatchText) == 0);
}
// Check the message teleservice against the match teleservice
if (iMatchTeleservice)
{
match &= (iMtm->SmsHeader().CdmaMessage().TeleserviceId() == iMatchTeleservice);
}
If you determine that your application should process the message, you can prevent the user from seeing the message in the Inbox of the standard messaging application. To do this, you can set the message entry's visible flag to false, using TMsvEntry::SetVisible(EFalse). You should delete the message (as the user will not be able to do so) once its processing is complete.
--------------------------------------------------------------------------------
Common GSM/CDMA message fields
Common GSM and CDMA message fields are accessed through the TMsvMessageSms class and its base class TMsvMessageBio.
Use CSmsHeader::SmsMessage() to get a TMsvMessageSms object:
TMsvMessageSms& fields = iMtm->SmsHeader().SmsMessage();
The fields include:
Character set for SMS messages (Encoding(), SetEncoding()): text is stored in Unicode on the Symbian OS phone and is converted into the appropriate character set when the message is sent.
Originating address
Message Service Center Time Stamp
Validity period
Functions to manipulate the EMS Information Elements in a message are also provided by this class: see EMS.
--------------------------------------------------------------------------------
Originating address
The Originating Address is a mandatory parameter on all point-to-point SMS messages.
It does not need to be set on outgoing messages, as the address of the originating phone is set by default.
For incoming messages, the parameter can be got as follows:
TPtrC originatingAddress = fields.OriginatingAddress();
When a reply message is created using CSmsClientMtm::ReplyL(), the reply address is set to this value unless a CDMA call-back number (see below) has been specified.
--------------------------------------------------------------------------------
Message Service Center Time Stamp
Delivered messages can include a Message Center Time Stamp that gives the time that the message was accepted by the destination message center.
The following gets the time stamp. The time is expressed as the message center's local time plus the difference between the message center's time zone and Coordinated Universal Time (UTC) in quarter of hours.
TDateTime timeStamp;
TInt quarterHourUTCOffset;
User::LeaveIfError(iFields->GetMessageServiceCenterTimeStamp(timeStamp,quarterHourUTCOffset));
--------------------------------------------------------------------------------
Validity period
The message validity period sets a time after which the message center should discard the message if it has not been delivered to the destination. The time can be expressed either as an absolute value or relative to the time the message is received by the message center.
An absolute time is represented using the standard Symbian OS type TDateTime. The following sets the message validity period to 10:30am on 2004/01/01:
TDateTime time(2004,EJanuary,01,10,30,0,0);
iFields->SetValidityPeriodAbsoluteL(time);
A relative time can be expressed in one of a number of units [C.S0015-A Table 4.5.6-1], such as days or weeks. Flags for these unit types are given in the enum TSmsRelativeTimeUnit. The following sets a relativity validity period of 1 day:
TSmsRelativeTimeUnit timeUnit=ETimeUnitDays;
TUint32 relativeTime=1;
iFields->SetValidityPeriodRelativeL(timeUnit, relativeTime);
The validity period can be got and set only on outgoing messages (as incoming messages must either be valid or will have been discarded by the message center).
--------------------------------------------------------------------------------
CDMA-specific message fields
CDMA-specific message fields are held in a TMsvMessageCdma object, which can be obtained using CSmsHeader::CdmaMessage().
In the following example, CDMAFields is an TMsvMessageCdma reference.
TMsvMessageCdma& CDMAFields = iMtm->SmsHeader().CdmaMessage();
The fields are:
Teleservice
Originating Subaddress
Deferred Delivery Time
Priority
Privacy
Number of Messages
Callback Number
Message Display Mode
Message Deposit Index
User Response Code
Alert On Message Delivery
Language Indicator
--------------------------------------------------------------------------------
Teleservice
SMS messages received in the messaging inbox belong to one of the teleservices WMT, WEMT, VMN, or WPT. You can find which one using TeleserviceId():
tia637::TTeleserviceId teleserviceId = CDMAFields.TeleserviceId();
tia637::TTeleserviceId is an integer type; constants to identify each teleservice are defined in the tia637 namespace.
There is no corresponding function to set the teleservice.
--------------------------------------------------------------------------------
Originating Subaddress
As well as an originating address, a message can have an originating subaddress. The originating subaddress can be got for incoming messages as follows:
HBufC* originatingSubAddress = fields.GetOriginatingSubAddressL();
Note that ownership of the returned HBufC* is passed to the caller.
--------------------------------------------------------------------------------
Deferred Delivery Time
The deferred delivery time sets a time at which the message center should deliver the message. Similiarly to the validity period field, this can be got and set on outgoing messages, and can be specified either as an absolute time or relative to when the message is received by the message center.
The setter functions are SetDeferredDeliveryTimeAbsoluteL() and SetValidityPeriodRelativeL(). The following sets the desired delivery time to be 09:30 am on 2004/03/02:
TDateTime time(2004,EMarch,02,09,30,0,0);
CDMAFields.SetDeferredDeliveryTimeAbsoluteL(time);
The getter functions are GetDeferredDeliveryTimeAbsoluteL() and GetDeferredDeliveryTimeRelativeL(). The following tests if the format is relative, and if so, gets the relative time:
TSmsTimePeriodFormat deliveryTimeFormat = CDMAFields.DeliveryTimeFormat();
if (deliveryTimeFormat == ESmsTimePeriodRelative)
{
// Relative format
TSmsRelativeTimeUnit timeUnit;
TUint32 relativeTime;
CDMAFields.GetDeferredDeliveryTimeRelativeL(timeUnit, relativeTime);
Note the difference with the scheduled sending functionality, which controls when the message is sent from the phone to the message center.
--------------------------------------------------------------------------------
Number of Messages
The Number of Messages is a decimal number with range (0 to 99) representing the number of messages stored at the Voice Mail System.
To get the number of messages, use GetNumberOfMessages(). It is set only by the Voice Mail Notification service.
--------------------------------------------------------------------------------
Priority
A message can have one of four priority levels, from Normal to Emergency [C.S0015-A 4.5.9-1].
The priority level does not alter the phone's handling of the message, but can be used at application level, for example to highlight urgent messages for the user's attention.
The level can be got and set on outgoing messages, and got on incoming messages. The priority levels are specified by constants in the tia637 namespace. The following sets the priority level to urgent.
tia637::TPriorityIndicator priority = tia637::KBdUrgent;
CDMAFields.SetPriorityIndicatorL(priority);
A default priority level for new messages is set from the current default message settings.
--------------------------------------------------------------------------------
Privacy
A message can have one of four privacy levels: Unrestricted, Restricted, Confidential, and Secret.
The privacy level does not alter the phone's handling of the message, and can be used at application level for any suitable purpose.
The level can be got and set on outgoing messages, and got on incoming messages. The privacy levels are specified by constants in the tia637 namespace. The following sets the privacy level to confidential.
tia637::TPrivacy privacy = tia637::KBdConfidential;
CDMAFields.SetPrivacyIndicatorL(privacy);
A default privacy level for new messages is set from the current default message settings.
--------------------------------------------------------------------------------
Callback Number
The callback number sets the number to be dialled in reply to a received SMS message. This does not need to be set by the application unless the number is different from the number of the sending phone.
The callback number can be got and set on outgoing messages, and got on incoming messages. It is passed as a descriptor.
CDMAFields.SetCallbackNumberL(iInput);
A default callback number for new messages is set from the current default message settings.
When a reply message is created using CSmsClientMtm::ReplyL(), the reply address is set to this value if it is specified (or to the originator address if it is not).
--------------------------------------------------------------------------------
Message Display Mode
A delivered message can specify a flag setting to indicate to the phone when to display the received message: the options are to display immediately, or according to a default or user configured setting.
The modes are defined by constants in the tia637 namespace, which belong to the tia637::TBdMode integer type. The following gets the mode:
tia637::TBdMode display = 0;
err = CDMAFields.GetMessageDisplayModeL(display);
The message display mode for new outgoing messages is set from the current service settings.
--------------------------------------------------------------------------------
Message Deposit Index
A delivered message can have a Message Deposit Index field that provides a unique reference to the message's user data. This allows a phone, when replying to a received message, to include the Message Deposit Index of the received message to indicate to the message center that the original contents of the message are to be included in the reply.
The MTM sets the index field in this way when a reply message is created, so an application does not normally need to access this field.
Index values belong to the tia637::TMessageDepositIndex integer type. The following gets the index:
tia637::TMessageDepositIndex index;
err = CDMAFields.GetMessageDepositIndexL(index);
--------------------------------------------------------------------------------
User Response Code
The User Response Code is used in SMS User Acknowledgement Messages to respond to previously received short messages. The GetUserResponseCodeL() and SetUserResponseCodeL() functions allow this to be retrieved and set. The code is message centre-specific and identifies a predefined response.
--------------------------------------------------------------------------------
Alert On Message Delivery
The Alert on Message Delivery subparameter indicates that alerting is requested. Such methods as vibrating and sound may be used (e.g. by a UI MTM). The possible values are defined by tia637::TAlertPriority.
The subparameter can be retrieved from deliver messages, and set on submit messages. The following sets the alert to high:
CDMAFields.SetAlertOnDeliveryL(tia637::KBdUseHighPriorityAlert);
--------------------------------------------------------------------------------
Language Indicator
The Language Indicator subparameter indicates the language of the message so that the receiving mobile station can discard those messages that are not in the user’s preferred language. The possible language values are defined by tia637::TLanguageIndicator.
The subparameter can be retrieved from deliver messages, and set on submit messages. The following sets the language indicator value to Spanish:
CDMAFields.SetLanguageIndicatorL(tia637::KLanguageSpanish);
Forum posts: 80
Kindly give a link of the SDK that you are using for the information that you have provided instead of so much text so that it becomes easy for the reader to locate in his SDK.
Forum posts: 111
I dont know how to find a link in the sdk
but in top of my sdk page, it displays
» Symbian OS v9.2 » Symbian OS guide » Messaging » Using CDMA SMS Messaging » How to use the CDMA SMS MTM
is that the link?
Forum posts: 80
Yes exactly. That is the way I have now come to know that you are programming for the 3rd Edition. Actually that should have been the first thing that you specify before giving any query.
There are quite a lot of differences between 2nd and 3rd edition S60, hence the solutions also differ. All the time i thought you were working into 2nd edition.
And also the link you have given is CDMA specific. I am currently programming for 2nd edition GSM devices.
Forum posts: 111
I use the following lines:-
CRichText& body=iSmsMtm->Body();
TPtrC SmsBody(body.Read(0));
TInt separator=SmsBody.Locate(",");//get error here
What am I doing wrong?
Forum posts: 1210
You can't just write string constants like that in Symbian. Use _L() or _LIT.
René Brunner
Forum posts: 80
Please make it a point to always write what error you are getting, I mean the error description and also the error code.
How do I know whether its a compile time or build time or run time error?
I think the syntax of your Locate() is wrong.
The correct way is:
TInt separator=SmsBody.Locate(','); // Use single quotes instead of double quotes