如何编写一个 AT+CUSD ussd 命令来支持最大的手机 [英] How to write a AT+CUSD ussd command to support maximum handsets

查看:22
本文介绍了如何编写一个 AT+CUSD ussd 命令来支持最大的手机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了与 AT+CUSD 命令相关的问题.在某些 Gsm 调制解调器上,此命令需要三个参数,而在其他调制解调器上,它只需要两个参数.而且,这些参数的值不同.

I am facing an issue related to AT+CUSD command. On some Gsm modems, this command expects three parameters while on the others, it expects just two parameters. Moreover, different values of those parameters.

我想知道,如何配置 Gsm 调制解调器,以便可以在大多数 Gsm 调制解调器上以统一方式执行此命令.

例如:在Nokia c6-01上,只有这样才能成功执行cusd命令:

Forexample: On Nokia c6-01, the cusd command is executed successfully only in this way:

AT+CUSD=1,"*123#",15

而在索尼爱立信 K750 上:

Whereas on Sony Ericsson K750:

AT+CUSD=1,"*123#"

如果我给第三个参数会报错.

It gives an error if I give a third parameter.

推荐答案

该命令定义在 27.007,语法为

The command is defined in 27.007, and the syntax is given as

+CUSD=[<n>[,<str>[,<dcs>]]]

所以实际上所有参数都是可选的,使用 0、1、2 或 3 个参数调用命令是有效的.

so actually all parameters are optional and it is valid to invoke the command with either 0, 1, 2 or 3 arguments.

关于<dsc>值,其指定的默认值0映射到带有德语的GSM 7位默认字母表,值15是没有任何特定语言的GSM 7位默认字母表23.038 据我所知.它还说

Regarding the <dsc> value, its specified default value 0 maps to GSM 7 bit default alphabet with German language and value 15 is GSM 7 bit default alphabet without any specific language according to 23.038 as far as I can tell. It also says

GSM 7 位默认字母表的实施是强制性的.其他字符集的支持是可选的.

Implementation of the GSM 7 bit default alphabet is mandatory. Support of other character sets is optional.

因此,如果诺基亚设备出现 AT+CUSD=1,"*123#" 错误,我会将其解释为它没有任何德语支持,因此失败.至于索尼爱立信手机,如果给定 <dcs> 任何值的参数(当然会有几个它会失败,但它应该支持)15).尝试迭代语言,看看是否有任何成功(例如是否支持英语?).

so if the Nokia device gives error with AT+CUSD=1,"*123#" I would interpret that as it not having any German language support and thus fails. As for the Sony Ericsson phone I cannot say why it fails if it fails given a <dcs> argument of any value (of course there will be several values it will fail for, but it ought to support 15). Try to iterate over the languages and see if you get any hit (is for instance English supported?).

您可以尝试以其他方式指定 GSM 7 位,例如32(或可能通过探索任何保留的编码都应假定为接收实体的 GSM 7 位默认字母表(与代码点 00001111 相同).,尽管这可能不适用于所有手机).

You might try to specify GSM 7 bit in alternative ways e.g. 32 (or possibly by exploring Any reserved codings shall be assumed to be the GSM 7 bit default alphabet (the same as codepoint 00001111) by a receiving entity., although that might not work on all phones).

由于您正在检查在任何情况下发出的任何 AT 命令的最终结果代码(你是,对吗?),实现回退算法并没有那么多额外的工作:>

Since you are checking the final result codes for any AT command you issue in any case (you are, right?), it is not that much extra work to implement a fallback algorithm:

  1. 首先尝试使用 dcs = 15 调用
  2. 如果失败,则使用 dcs = 32 调用
  3. 最后,如果以上所有方法都失败,请尝试不使用 dcs.

这应该是在大量手机上调用 AT+CUSD 的最便携方式.

This should be the most portable way to invoke AT+CUSD on a large set of handsets.

顺便说一下,请注意 0 值在 27.007 规范中带有下划线.这有点微妙,但这意味着它是默认值,没有明确说明(例如为 所做的那样).所以 AT+CUSD=AT+CUSD=0 是一样的(实际上你甚至可以调用 AT+CUSD=,"*123#"code> 与 AT+CUSD=0,"*123#" 相同,但您可能会遇到无法正确解析此代码的手机.索尼爱立信早期生产的所有手机/调制解调器,以及几乎所有稍后生产,所有基于 ST-Ericsson 平台的手机都会正确解析它).

By the way, notice that the 0 value for <n> is underlined in the 27.007 specification. It is a bit subtle but it means that it is a default value, without saying so explicitly (like done for <dsc> for instance). So AT+CUSD= is the same as AT+CUSD=0 (and actually you could even invoke AT+CUSD=,"*123#" as the same as AT+CUSD=0,"*123#", although you might encounter phones that fail to parse this correctly. All phones/modems produced early by Sony Ericson, and almost all produced later, and all phones based on platforms from ST-Ericsson will parse this correctly).

如果你想自动化测试,你可以使用我的atinout 程序,例如:

If you want to automate testing you can do so using my atinout program, e.g.:

echo ATE1 | atinout - /dev/ttyACM0 -
for i in $(seq 0 15) 32; 
do 
        echo AT+CUSD=1,"xxxx",$i; 
done | atinout - /dev/ttyACM0 -

如果您的调制解调器设备是/dev/ttyASM0.

if your modem device is /dev/ttyASM0.

更新:您为字符串选择的字符集很可能是这里的问题,如此答案中所述.尝试运行 AT+CSCS="GSM" 看看是否有帮助.

Update: Your selected character set for strings might quite possibly be the problem here like described in this answer. Try to run AT+CSCS="GSM" and see if that helps.

这篇关于如何编写一个 AT+CUSD ussd 命令来支持最大的手机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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