如何在不使用Sleep()
PowerBuilder 中的函数的情况下获取或等待 AT 命令的结果代码?我正在为 PowerBuilder 使用 MSComm OLE 控件。我可以在MSCOmm.Input
属性返回正确的缓冲区之前执行 While 循环吗?(例如,OK
) 但是,我尝试了这个,但Input
返回一个空字符串。
这是我的 PB 代码:
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
这是端口设置:
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
有什么建议么?还是我做错了什么?