Author Topic: USSD command using nrGSM.  (Read 4314 times)

mande

  • Newbie
  • *
  • Posts: 8
    • View Profile
USSD command using nrGSM.
« on: May 13, 2012, 11:18:21 am »
Hi!

Is it possible to send USSD commands using nrGSM.


Thanks.

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: USSD command using nrGSM.
« Reply #1 on: May 14, 2012, 05:25:19 am »
Hello

You can use CmdSendAndWaitResult(atCommand:string) method for call any additional AT commands.

You can test this method in GSMDemo. Open options tab.

Code: [Select]
 
  s := nrGsm1.CmdSendAndWaitResult(eCmd.Text);
  ShowMessage('Reply:' + s);

Roman Novgorodov
DeepSoftware LLC
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

mande

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: USSD command using nrGSM.
« Reply #2 on: May 14, 2012, 08:58:08 am »
Thank you!

When I send command to get balance "*100#", I can give only "OK" in reply, not something like "Balance: 1.00 USD". How to get such a reply?

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: USSD command using nrGSM.
« Reply #3 on: May 14, 2012, 09:06:42 am »
Hello

Please try handle  OnSmsReceived event.
If I'm right the mobile provider returns PDU info after your request.

Roman Novgorodov
DeepSoftware LLC
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

mande

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: USSD command using nrGSM.
« Reply #4 on: May 14, 2012, 09:23:04 am »
I'm handling nrGsm1SmsReceived event, but there is no sms.
Even if I send wrong command on reply I get "OK". How do you control the reply, maybe, at this moment I can control reply message.

Thank you!

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: USSD command using nrGSM.
« Reply #5 on: May 14, 2012, 09:30:35 am »
Hello

Please show me exact sample code. We will test on our side.
Also upload here diagnostic LOG file, possible nrComm does not support your device.
More details read here:
http://forums.nrcommlib.com/index.php?topic=6.0

Roman Novgorodov
DeepSoftware LLC
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

mande

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: USSD command using nrGSM.
« Reply #6 on: May 14, 2012, 10:13:57 am »
Even if I use GSMDemo I get only "OK" message. "On SMS Received" is set to "Read and Show".
On start gsmdemo cannot autodetect my modem, only when I manually select gsm driver to "ZTE" then gsm device connects.
I cannot find your email  :-[ . Or "noro at d...com"?

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: USSD command using nrGSM.
« Reply #7 on: May 14, 2012, 10:19:13 am »
Hello

You can post log file here. Use attachments options in reply form.

I want to see exact string that you pass to CmdSendAndWaitResult() method.

Roman Novgorodov
DeepSoftware LLC
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

mande

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: USSD command using nrGSM.
« Reply #8 on: May 14, 2012, 10:24:28 am »
Code: [Select]
void __fastcall TForm1::Button5Click(TObject *Sender)
{
String s;

s=Form1->nrGsm1->CmdSendAndWaitResult(Form1->Edit1->Text);
Form1->Memo1->Lines->Add("USSD Reply "+s);
}

Code: [Select]
Form1->Edit1->Text="*100#";

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: USSD command using nrGSM.
« Reply #9 on: May 14, 2012, 10:59:24 am »
Hello

Please try something like this:

Form1->Edit1->Text="at+cusd=1,\"*100#\",1<cr>";

or

Form1->Edit1->Text="at+cusd=1,\"*100#\"<cr>";

or

Form1->Edit1->Text="at+cusd=1,\"*100#\",15<cr>";

Roman Novgorodov
DeepSoftware LLC
« Last Edit: May 14, 2012, 11:00:59 am by Roman Novgorodov »
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

Halter

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: USSD command using nrGSM.
« Reply #10 on: May 14, 2012, 05:14:35 pm »
Delphi:

Var
   S:String;
Begin
   GSM.CmdSendAndWaitResult('at+cusd=1,"*100#",15'+#13);
   S:= GSM.ReplyLast.sDataUseful;

mande

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: USSD command using nrGSM.
« Reply #11 on: May 23, 2012, 11:10:02 am »
Delphi:

Var
   S:String;
Begin
   GSM.CmdSendAndWaitResult('at+cusd=1,"*100#",15'+#13);
   S:= GSM.ReplyLast.sDataUseful;


Did you test this code. Does S returning reply?
I tried, but with no result, S returns empty string.

I tried also
Hello

Please try something like this:

Form1->Edit1->Text="at+cusd=1,\"*100#\",1<cr>";

or

Form1->Edit1->Text="at+cusd=1,\"*100#\"<cr>";

or

Form1->Edit1->Text="at+cusd=1,\"*100#\",15<cr>";

Roman Novgorodov
DeepSoftware LLC

with no result.

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: USSD command using nrGSM.
« Reply #12 on: May 23, 2012, 11:20:54 am »
Hello

Possible your device does not support these commands.
You need open terminal and check manually.
Or try another device.

Roman Novgorodov
DeepSoftware llc
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

mande

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: USSD command using nrGSM.
« Reply #13 on: May 24, 2012, 10:10:56 am »
Hello

Possible your device does not support these commands.
You need open terminal and check manually.
Or try another device.

Roman Novgorodov
DeepSoftware llc

Everything is ok.
I've found out the reason.
I listened all modem commands via serial-port sniffer. And I saw that to all my ussd commands modem is returning reply, but S is empty everytime.
At all I tried to get reply on nrComm1AfterReceive event. And I got it.
I got hex string from Buffer

       
Code: [Select]
AnsiString rcv;
for(int i=0;i<=Received-1;i++)
{
rcv=rcv+PAnsiChar(Buffer)[i];
}
and converted hex to string using HexToBin().
That's all.

Thanks for all!

bonparadorn

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: USSD command using nrGSM.
« Reply #14 on: August 11, 2013, 08:41:08 pm »
hi
my reply
Code: [Select]
+CUSD: 1,"0E170E230E390E210E310E190E190E350E48000A0031002E0E400E150E340E21000A0032002E0E080E480E320E22000A0033002E0E420E2D0E19000A0034002E0E160E2D0E19000A0035002E0E010E230E300E400E1B0E4B0E320E170E230E390E210E310E190E190E350E48",72

OK
use the function?  Thank.