Sending USSD commands
Article Metadata
Code Example
Platform Security
Article
This article explains how to send USSD commands using AT commands.
Introduction
How to dial a string (with pause characters) explains how to Dial a string in S60 3rd edition using CPhCltDialer and TPhCltExtPhoneDialData. This does not work on S60 3rd edition Feature Pack 1.
This article shows how to workaround this problem. The solution is to send USSD commands using AT commands (APIs used are RCommServ and RComm).
Code
Header Files:
C32COMM.H
Libraries:
c32.lib
Capabilities:
CommDD ReadDeviceData WriteDeviceData NetworkControl SwEvent NetworkServices LocalServices
ReadUserData WriteUserData UserEnvironment
code Examples
Initializing code
_LIT(KCsyName,"DATAPORT");
_LIT(KDataPort,"DATAPORT::1");// this works with CUSD
//Start the service to the RCommServ
User::LeaveIfError(StartC32());
RCommServ iCommServer;
// Connect the server
User::LeaveIfError(iCommServer.Connect());
// Load the CSY module
User::LeaveIfError(iCommServer.LoadCommModule(KCsyName()));
RComm iComm;
// Open the port
User::LeaveIfError(iComm.Open (iCommServer, KDataPort, ECommShared));
Issue Request Code
Sending Ordinary Message
_LIT(KTestCommandEnd,"\r\n");
//iSendString has the data which is entered through a Dialog Box
//It should be appended with KTestCommandEnd
iSendString.Append(KTestCommandEnd);
iReplyData.Copy(iSendString);
//We write this information to the serial port
iComm.Write(iStatus,iReplyData);
SetActive();
Handling code after the Request is done
_//Reset the Buffer to read more information
iReplyData.Zero();
//Issue Request for more Information
iComm.ReadOneOrMore(iStatus, iReplyData);
SetActive();
Releasing code
iComm.Close();
iCommServer.Close();
The following is the document which describes how to pass AT commands for Call Waiting and Forwarding:
File:AT-Commands.doc
Example Project


Hamed.farid - receive USSD
is this code also receive the result ??hamed.farid 14:24, 12 October 2011 (EEST)
Hamishwillee - @Hamed.farid - see Symbian C++ forums
Hi Hamed
This article was written in 2007 and it is possible the author is no longer monitoring it. I suggest you raise this query on the Symbian C++ Discussion board.
That said, I don't think it does receive the result.
My dim recollection is that even if you receive the result, there is a default handler in the system that will also receive the result and display the message, an there is no way around that.
Regards
Hhamishwillee 03:20, 13 October 2011 (EEST)