Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get or wait for the result code of an AT Command?

Status
Not open for further replies.

jhayahywhy

Programmer
Oct 5, 2015
2
PH
How can I get or wait for the result code of an AT Command without using the `Sleep()` function in PowerBuilder? I am using the MSComm OLE Control for PowerBuilder. Could I do a While Loop unti the `MSCOmm.Input` property returns the proper buffer?(e.g, `OK`) However, I tried this but the `Input` returns an empty string.

Here is my PB Code:

Code:
String numbers[]

    numbers[1] = "+639394854493"
    numbers[2] = "+639394854491"
    numbers[3] = "+639394854492"
    numbers[4] = "+639394854493"
    numbers[5] = "+639394854494"

    int cnt = 1 
    for cnt = 1 to 5
	    Sleep(0.5)
	    ole_1.object.Output = "AT" + Char(13) + Char(10)
	    Sleep(0.5)
	    ole_1.object.Output = "AT+CMGF=1" + Char(13) + Char(10)
	    Sleep(0.5)
	    ole_1.object.Output = "AT+CMGS=" + Char(34) + numbers[cnt] + Char(34) + Char(13) + Char(10)
	    Sleep(0.5)
	    ole_1.object.Output = sle_2.text + " - " + string(cnt) + Char(26)
    next

And here is the port settings:

Code:
ole_1.object.CommPort = 7
	ole_1.object.Settings = "115200,n,8,1"
	ole_1.object.RThreshold = 1
	ole_1.object.InputLen = 0
	ole_1.object.InputMode = 0
	ole_1.object.PortOpen = True

Any suggestions? Or am I doing something wrong?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top