• Welcome to Forum.Deepsoftware.Com. Please login or sign up.
 
April 25, 2024, 05:05:55 am

News:

SMF - Just Installed!


USSD command using nrGSM.

Started by mande, May 13, 2012, 08:18:21 am

Previous topic - Next topic

mande

Hi!

Is it possible to send USSD commands using nrGSM.


Thanks.

Roman Novgorodov

Hello

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

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

 
  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

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

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

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

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

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

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

void __fastcall TForm1::Button5Click(TObject *Sender)
{
String s;

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


Form1->Edit1->Text="*100#";

Roman Novgorodov

May 14, 2012, 07:59:24 am #9 Last Edit: May 14, 2012, 08:00:59 am by Roman Novgorodov
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
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

Halter

Delphi:

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

mande

Quote from: Halter on May 14, 2012, 02:14:35 pm
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
Quote from: Roman Novgorodov on May 14, 2012, 07: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


with no result.

Roman Novgorodov

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

Quote from: Roman Novgorodov on May 23, 2012, 08: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


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

        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

hi
my reply

+CUSD: 1,"0E170E230E390E210E310E190E190E350E48000A0031002E0E400E150E340E21000A0032002E0E080E480E320E22000A0033002E0E420E2D0E19000A0034002E0E160E2D0E19000A0035002E0E010E230E300E400E1B0E4B0E320E170E230E390E210E310E190E190E350E48",72

OK
use the function?  Thank.