×

Discussion Board

Results 1 to 10 of 10
  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    3

    Handling asynch USSD response from operator

    I'm able to successfully send an USSD command to the operator using at commands (AT+CUSD), and read the synchronous OK response back from the modem as well, on both Nokia 6680 and Nokia 7610. However, on both phones, the asynchronous URC (unsolicited result code) containing the response from the operator is never read by my application (although I'm trying to read it). In stead, the message is presented as a Global note on the phone. Has anyone been able to read the URC containing the USSD response in their application? Is anything in my code snippet wrong?

    Code:
      _LIT8(cmd,"AT+CUSD=1,\"*101#\",15\r\n");
      comm.Write(status,cmd);
      User::WaitForRequest(status);
      User::LeaveIfError(status.Int());
      User::After(10000);
    
      // read synchronous response
      //todo: check that response is OK
      comm.Read(status, TTimeIntervalMicroSeconds32(1000000), rsp);
      User::WaitForRequest(status);
      User::LeaveIfError(status.Int());
      User::After(10000);
    
      // try reading asynch response (URC) for 10 secs
      comm.Read(status, TTimeIntervalMicroSeconds32(10000000), rsp);
      User::WaitForRequest(status);
      if ( status.Int() != KErrNone && status.Int() != KErrTimedOut )
      {
        User::Leave( status.Int() );
      }
    
      
      // here, we should have the URC containing the USSD response
      // in stead, a global note is displayed outside this app containing
      // the incoming ussd message response!! rsp is empty.
      
    
      // cleanup code
      CleanupStack::Pop(&comm);
      comm.Close();
      CleanupStack::Pop(&rCommServ1);
      rCommServ1.Close();

  2. #2
    Registered User
    Join Date
    Mar 2003
    Posts
    3

    Re: Handling asynch USSD response from operator

    By the way, I'm using dataport::1 for sending at commands, since I get a KerrInUse (-14) when trying to use dataport::0. It seems reasonable to assume that URCs are received on dataport::0 (since nothing appears on dataport::1...). If this is the case, has anyone been able to read/write successfully on dataport::0 on any of the above mentioned phones?

    As you can see from the code below, I'm using ECommShared (TCommAccess parameter), and ECommRoleDTE (TCommRole parameter) when opening the comm port.

    Code:
      _LIT (KPortName, "DATAPORT::1");
      User::LeaveIfError(comm.Open(rCommServ1, KPortName, ECommShared, ECommRoleDTE));

  3. #3
    Registered User
    Join Date
    Oct 2005
    Posts
    1

    Re: Handling asynch USSD response from operator

    Hi,

    Im tryin to send USSD commands from the J2ME and am unsure how to send them. Would it be possible to send me some information about the at commands (at+cusd) that you us and an example of how to send a USSD command to the network?

    Do you know if it is possible to do this in java or is the Symbian C++ the only way to use it?

    Thanks

  4. #4
    Registered User
    Join Date
    Jul 2005
    Posts
    37

    Re: Handling asynch USSD response from operator

    Hi....

    I tried your program just now...and eventhough I use dataport::1, it still gave me error (-33) -> KErrTimeOut....

    but It can give me replies from the operator....through window outside the Application....

    Have you found out the mystery ??

    please...do share your code with us...

    thank you


    irma

  5. #5
    Regular Contributor
    Join Date
    May 2003
    Posts
    91

    Re: Handling asynch USSD response from operator

    Read()
    void Read(TRequestStatus &aStatus, TDes8 &aDes);
    void Read(TRequestStatus &aStatus, TDes8 &aDes, TInt aLength);
    void Read(TRequestStatus &aStatus, TTimeIntervalMicroSeconds32 aTimeOut,TDes8 &aDes);
    void Read(TRequestStatus &aStatus, TTimeIntervalMicroSeconds32 aTimeOut,TDes8 &aDes, TInt aLength);
    Description
    Reads data from a serial port. All reads from the serial device use 8-bit descriptors as data buffers, even on a Unicode system.

    Note:

    The length of the TDes8 is set to zero on entry, which means that buffers can be reused without having to be zeroed first.

    The amount of data to be read from the serial driver depends upon which overload of Read() is used. Normally the length used is the maximum length of the descriptor. In the version which takes an explicit length this value is used in preference to the descriptor’s maximum length.

    If a read is issued with a data length of zero (either explicitly or implicit in the descriptor) the Read() will complete immediately with the side effect that the serial hardware will have been powered up.

    In the case of a read terminating with KErrTimedOut, different protocol modules may show different behavior. Some may write any data received into the aDes buffer. Others may always return an empty descriptor: in that case, any data in the buffer can be read through ReadOneOrMore().

    Parameters
    TRequestStatus &aStatus The request status used to contain completion information for the function. On completion, contains System-wide error code

    TTimeIntervalMicroSeconds32 aTimeOut If present, the read will terminate after aTimeout microseconds if the data requested has not arrived. A KErrTimedOut status is returned.

    TDes8 &aDes A buffer to store the incoming data. The length of the descriptor is the default for the number of bytes to be read.

    TInt aLength An optional explicit length of data to be read. If present, this overrides the length of the TDes8 default

  6. #6
    Registered User
    Join Date
    Aug 2008
    Posts
    8

    Re: Handling asynch USSD response from operator

    It had to look further for the right snippet
    or maybe the problem with my compiler

  7. #7
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,167

    Re: Handling asynch USSD response from operator

    you could do the sending & receiving with AT commands: http://wiki.forum.nokia.com/index.ph...T_Commands.zip

    Note that the default note for the received reply will always be shown, and currently I'm not aware any method on disabling it, and I actually did some research on the issue.

  8. #8
    Registered User
    Join Date
    May 2006
    Posts
    13

    Re: Handling asynch USSD response from operator

    symbianyucca,thank u so much!!
    Can u tell me if I can use AT commands to only listen and receive the coming ussd message? somebody who use AT command successfully mostly sent ussd command and then received the response with AT Command. could u plz pay a little more attention to my problem or I will be code ash! thx u again in advace.

  9. #9
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,167

    Re: Handling asynch USSD response from operator

    Basically all AT commands should be rather easy to be located by searcing a bit with Google.

    anyway, I have a feeling that you can only receive the reply for the USSD messages that you originally sent by yourself.

  10. #10
    Regular Contributor
    Join Date
    Jan 2009
    Posts
    264

    Re: Handling asynch USSD response from operator

    you can do one thing just insert this line after sending the request.
    console->getch();
    and wait for the global message to display on the screen..once that message is displayed. exit it and den press any key to start reading from the port...
    same global message would be read from the port + the command you have sent....

    iam pasting my code for the same...

    void Cports::sendUSSD()
    {
    _LIT(KDataPort,"DATAPORT::1");
    TInt count=0;
    TRequestStatus aStatus=1;
    RCommServ commServer;
    RComm commPort;
    //connecting to server
    console->Printf(_L("Connecting to server..\n"));
    User::After(2000000);
    User::LeaveIfError(commServer.Connect());
    console->Printf(_L("Successfully Connected..\n"));
    User::After(1000000);
    //opening port for writing in sharedMode
    console->Printf(_L("Opening Comm Port...\n"));
    User::After(2000000);
    User::LeaveIfError(commPort.Open(commServer, KDataPort, ECommShared));
    //User::LeaveIfError(comm.Open (commServer, KDataPort, ECommShared));
    console->Printf(_L("Comm Opened..\n"));
    User::After(2000000);
    //_LIT8(KData,"Data");
    console->Printf(_L("Sending USSD Request..\n"));
    _LIT8(KWriteCommand, "AT+CUSD=1,\"*771#\",15\r\n");
    //_LIT8(KWriteCommand, "AT+CGSN\r\n");
    TRequestStatus aWriteStatus;
    commPort.Write(aWriteStatus,KWriteCommand());
    TRequestStatus aReadStatus;
    // now we will read from the port..
    //User::After(5000000);
    console->Printf(_L("Press any key to continue...\n"));
    console->Getch();
    TBuf8<1024> des;
    TBuf<1024> des16;
    console->Printf(_L("Reading from Comm Port...\n"));
    // User::After(2000000);
    while(count<2)
    {
    commPort.ReadOneOrMore(aReadStatus,des);
    des16.Copy(des);
    count++;
    console->Printf(_L("Data Read from Com Port...\n %S"),&des16);
    }
    console->Getch();
    console->Printf(_L("Closing Com Port...\n"));
    User::After(2000000);
    commPort.Close();
    console->Printf(_L("Closing Connection with server..\n"));
    User::After(2000000);
    commServer.Close();
    }

Similar Threads

  1. Replies: 2
    Last Post: 2004-11-17, 10:20
  2. 'Response Unknown' when downloading midlet
    By Weevil in forum Mobile Java General
    Replies: 3
    Last Post: 2004-05-30, 17:01
  3. Operator Menu
    By sbraines in forum General Development Questions
    Replies: 0
    Last Post: 2004-02-23, 23:17
  4. nokia 7210 modem via IR doesn't work !
    By oussamaaiadi in forum PC Suite API and PC Connectivity SDK
    Replies: 1
    Last Post: 2003-03-06, 10:46
  5. can not successfully link any sample using .NET
    By lobotomat in forum Symbian Tools & SDKs
    Replies: 2
    Last Post: 2002-08-20, 00:29

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×