交互式USSD代码问题串口 [英] Interactive USSD Code Problem serial port

查看:57
本文介绍了交互式USSD代码问题串口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿伙计们!这是我的问题,我正在使用GSM调制解调器进行交互式USSD一切都很好但是当我要用我的C#代码回复USSD时会出现问题。
超级终端上的
一切都是好的,工作正常。

超级终端查看:

AT + CUSD = 1,* 111#,15

确定


+ CUSD:1,MAIN

1.启用漫游

2.禁用漫游

,15

>

之后,我必须写1或2然后使用 Ctrl + Z 发送我的回复

所以hyperTerminal还可以

但是当我尝试在我的代码中实现 Ctrl + Z 时我一直面临问题我认为它是正确的但是它没有工作

 serialPort.Write(  2 +( char  13  +( char  26 ); 
Thread.Sleep( 100 );



Iam也使用所有技巧发送 Ctrl + Z 它有效,但USSD中心回复无效请求

  //  < span class =code-comment> byte [] endbyte = new byte [1];  
// endbyte [0] = 0x1A;

// serialPort .Write(char.ConvertFromUtf32(26));
// char [] arr = new char [1];

// arr [0] =(炭)26; // Ctrl-Z的ascii值

// serialPort.Write( arr,0,1); //数组,开始,长度





谢谢大家。

解决方案

CTRL-Z只是字符26,而不是2个字符。您可以这样做:



SerialPort.Write(2+(char)26);







SerialPort.Write(2\\\);





请参阅 http://stackoverflow.com/questions/3042743/how-to-send-ctrlz [ ^ ]

hey guys! Here is my Problem, I`m working on interactive USSD with a GSM modem everything is fine but there is problem when i`m going to reply a USSD by my C# code.
on hyper Terminal everything is ok and work fine .
Hyper Terminal View :
AT+CUSD=1,"*111#",15
OK

+CUSD: 1,"MAIN
1. Enable Roaming
2. Disable Roaming
",15
>
after this , i have to write 1 or 2 then using Ctrl+Z to send my Reply
So hyperTerminal is ok
but I've been facing problem when try to implement Ctrl+Z into my code i think it`s correct but it does n`t work

serialPort.Write("2" + (char)13 + (char)26);
           Thread.Sleep(100);


Iam Also using all tricks for sending Ctrl+Z it`s works but USSD Center Reply Invalid Request

//byte[] endbyte = new byte[1];
         //endbyte[0] = 0x1A;

        // serialPort.Write(char.ConvertFromUtf32(26));
         //char[] arr = new char[1];

         //arr[0] = (char)26; //ascii value of Ctrl-Z

        // serialPort.Write(arr, 0, 1); //array, start, length



Thank you All guys.

解决方案

CTRL-Z is simply the character 26, not 2 characters. You can do either:

SerialPort.Write("2" + (char)26);

or

SerialPort.Write("2\u001A");


See http://stackoverflow.com/questions/3042743/how-to-send-ctrlz[^]


这篇关于交互式USSD代码问题串口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆