Kindly assist me in using SendATCommand please

14 posts / 0 new
Last post
dweebz
Kindly assist me in using SendATCommand please
Hi, I'm sorry that I informed you guys just now regarding the usage of the SendATCommand. I was caught up on a different project when I was almost finished with our project using your brilliant GXSMS. Mikko sent me a code snip of generally how to use it. But when I try to implement it, I still get the error that the port was not opened. I already assigned a port for this (COM4) and also did a query modem test and the modem has responded perfectly. I'm using a Lightwave GPRS/GSM (LW-UGPRS) and running on WinXP. My code is still unpublished in VB6. The code snip is as follows: Dim sms1 As IGXSMS4 Dim reply Set sms1 = CreateObject("GuruxSMS.GXSMS") sms1.Port = "COM4" reply = sms1.SendATCommand("ATM0\r", 2000, "OK") Any help would be gratefully appreciated. Thank you. BTW, thanks for sending me my new account details. Regards, Jade Ryan
dweebz
I issued the sms1.Open after assigning the port. But now its telling me the following error: GXSMS::Open failed: Access is denied. What could my mistake be?

Jade Ryan

Kurumi
Kurumi's picture
Hi, I believe that your problem is that serial port "COM4" is used by some other program. You should try to close the other programs that use the "COM4" port. Best regards, Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

dweebz
A different error is showing up now (complete error): Run-time error '-2147467259 (8004005)': GXSMS::Open failed. Open Failed. Modem did not responsed. modem not answered. my function is: Dim sms1 As IGXSMS4 Dim reply Set sms1 = CreateObject("GuruxSMS.GXSMS") sms1.Port = "COM4" sms1.SMSCheckInterval = 0 sms1.Open reply = sms1.SendATCommand("ATI", 2000, "OK") MsgBox reply

Jade Ryan

Kurumi
Kurumi's picture
Hi, I believe that there is no modem on "COM4". If you have several serial ports, are you sure that you are using right one? BTW, for me, it is very common that I have forgotten to switch the power on to the modem. :-) Best regards Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

dweebz
Hi Mikko! thanks for the reply. I finally got it to work until its printing OK. But I don't get the desired output. I am trying to fetch the AT+CUSD output, but its only displaying OK. The following is my code snip: Function checkBalance() Dim BalStat, chkBal GXSMS1.Open chkBal = "1, " & Chr(34) & "*135#" & Chr(34) & ", 15" & vbCr BalStat = GXSMS1.SendATCommand(chkBal, 2000, "OK") & BalStat txtBal.Text = BalStat Below is an actual output of the command under a specific network (got it from using hyperterminal): OK +CUSD: 0,"Your 'more time' balance is AED 0.02",0 +CUSD: 0,"Thank you for using du's interactive balance inquiry.",0 OK Sometimes It returns this message, depending on the SIM's credit: +CUSD: 0,"Your 'more credit' balance is AED 7.77",0 +CUSD: 0,"This 'more credit' balance is valid for 22 days ",0 +CUSD: 0,"Your 'more time' balance is AED 0.32",0 +CUSD: 0,"Thank you for using du's interactive balance inquiry.",0 It sometimes return two (2) "OK" or one (1).. Is it possible to get the entire output? My assumption is that the logic ends after an issued command sees a first match of the expectedResult (String) (ref. http://www.gurux.fi/gxdn/). All the output I receive is: OK Can you help me shed light to my confusion? Any advice would be deeply appreciated. Thank you. Best regards, Jade

Jade Ryan

dweebz
I finally got the output i needed and it was all on my parsing of the AT command. my command was: chkBal = "AT+CUSD=1" & Chr(44) & Chr(34) & value1 & Chr(34) & Chr(44) & value2 & vbCr and that's it! i just formatted the return value to the one i want to display. Thank you so much for the help. More power to you guys! Best regards to everyone! Jade

Jade Ryan

Kurumi
Kurumi's picture
Hi dweebz, I am glad that you found solution for your problem. BR, Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

dweebz
Its me again. Before my vb program used to send SMS in bulk. But now, still with the same code as before, When bulk SMS are queued, ALL SMS goes to the first record's mobile number. For example the queue is 10 SMS to different numbers. But When its time to send, all messages are goind to the first record's number. I have checked to code thoroughly but to no luck, still the same thing. I know that you have to close the port to re-assign settings and my code implements it but still does not send properly. I also managed to display mobile numbers before sending and after sending and its displaying correctly. All comes down on sending. Does not deliver properly. I tried installing versions 5.0.0.4, 5.0.0.18 and the current one, with x86. But all emits the same thing. Any thoughts on this? Any help would be gratefully appreciated. Best regards to all

Jade Ryan

dweebz
I didn't noticed that things have changed on sending SMS. I just wondered how the example in VB works and got the idea that I should instantiate the class needed in order to send. Before when i first encountered GXSMS, it works even without using this class. But nevertheless, this method is far better than what i use before. Thanks again and more power to you guys!

Jade Ryan

Kurumi
Kurumi's picture
Hi We have not changed anything about sending in long time. :-) If I understand correctly you have tried to send SMS directly without GXSMSMessage class. Sending plain text without GXSMSMessage is an old functionality. We have old users who are sending plain text and this functionality is still supported for compatibility for old programs. It is not recommended to use this old way. 'Old way. Do not use.. GXSms1.Send "Hello world." 'New way. Dim msg As GXSMSMessage Set msg = CreateObject("GuruxSMS.GXSMSMessage") msg.Data = SendText.Text msg.Number = "phone number" GXSMS1.Send msg BR, Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

dweebz
Hi, I have been trying out this function but it doesn't seem to work at all. Even my code above does not work. I am using the latest version of GXSMS. I am writing a send and receive of SMS through a GPRS modem in Visual Basic 6. Any changes were made for this function?

Jade Ryan

suteme
Hi dweebz, sorry to say, but right at this moment I cannot answer Your question. Our component developers are back at the office on Thursday. Of course I passed this question to them by E-mail, and hopefully they check their mails even out of the office, so we'd get this sorted the soonest. Sorry for the delay, MerjaS
Kurumi
Kurumi's picture

Hi,

You should add line feed to the end of AT command.
In VB this is vbCrLf

Like this:
reply = sms1.SendATCommand("ATI" + vbCrLf, 2000, "OK")
msgbox reply;

If you do not add Line feed modem does not return anything.

Let me know if there is any proglems.

Happy Coding. :-)

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi