CDMA PDU解析在Android [英] CDMA PDU parsing on Android

查看:654
本文介绍了CDMA PDU解析在Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个程序来解除codeA CDMA 3GPP2点对点短信。我测试了一对夫妇CDMA PDU六角串,我发现在互联网上,它完美的作品。然而,当我尝试实施它在Android平台上的所有传入的文本信息,它总是失败。

我接过一看进来的PDU,它似乎并没有遵循同样的模式,我一直看惯了。谁能解释什么格式这PDU是,还是什么我缺少C此PDU正确去$ C $?是否有额外的头或字段我没有考虑到?

为例PDU从收到的短信拉着我的手机上:

<$p$p><$c$c>000000000000100200000000000000000A36373839313031363734000000000000000000001B000310864D000306120624205611010B104C2CF9F3F5EBD73E7000

所有CDMA的PDU我发现,测试了我的解析器看起来更像的:

  00000210020207028CE95DCC65800601FC08150003168D3001061024183060800306101004044847
 

载: Verizon公司 电话:三星Galaxy S着迷运行安卓2.3.3

解决方案

请参阅从的javadoc $ SDK /来源/ Android为16 / COM /安卓/内部/电话/ CDMA / SmsMessage:

  / **
 *创建从短信对象的字节数组(伪PDU)。
 *注意:不要调用这个方法不是每个对象的更多!
 * /
 

...所以它不会遵循任何特定的CDMA标准。你可以去code然而它;所以在精细ASCII艺术: -

<$p$p><$c$c>000000000000100200000000000000000A36373839313031363734000000000000000000001B000310864D000306120624205611010B104C2CF9F3F5EBD73E7000 --------为messageType --digitMode -------- bearerReply ----------------------------- -------------------------承载数据         --------电信业务--ton -------------------- SRC --replySeqNo --messageID --msts --userdata                 -------- serviceCategory --errorClass --len --xx - LEN --len                           --numberMode --cause code ------ ------------ 2012/06/24 20时56分11秒                               --npi -------- bearerDataLength ----------------------用户数据                                 --len

请注意,我认为你在你的消息做了剪切/粘贴错误 - 00字节的标有XX我觉得不应该存在 - 幸运的是,这是容易被发现的日期和工作倒退。因此,这是一个6789101674消息用户数​​据:

104C2CF9F3F5EBD73E7000中,前五位,其中表明,它的7位连接codeD(0X02)。有移位的用户数据5位向左余,我们留下了:

  09859f3e7ebd7ae7ce00
--len(七位)9七位== 63位,因此我们预计8个字节的身体
  ---------------- 7位体
 

所以,你的7位体德codeD是Bggguuugg。

I have written a program to decode a CDMA 3GPP2 point-to-point SMS message. I tested it on a couple CDMA PDU hex strings I found on the internet, and it works perfectly. However, when I try to implement it on all incoming text messages on the Android platform, it always fails.

I took a look at the incoming PDU, and it doesn't seem to follow the same pattern I have been used to seeing. Can anyone explain what format this PDU is in, or what I am missing to correctly decode this PDU? Is there additional header or fields I am not taking into account?

Example PDU pulled from a incoming text message on my phone:

000000000000100200000000000000000A36373839313031363734000000000000000000001B000310864D000306120624205611010B104C2CF9F3F5EBD73E7000

All of the CDMA pdus I found and tested my parser on look more like:

00000210020207028CE95DCC65800601FC08150003168D3001061024183060800306101004044847

Carrier: Verizon Phone: Samsung Galaxy S Fascinate running Android 2.3.3

解决方案

See the javadoc from $SDK/sources/android-16/com/android/internal/telephony/cdma/SmsMessage:

/**
 * Creates byte array (pseudo pdu) from SMS object.
 * Note: Do not call this method more than once per object!
 */

...so it's not following any particular CDMA standard. You can decode it however; so in fine ASCII art:-

000000000000100200000000000000000A36373839313031363734000000000000000000001B000310864D000306120624205611010B104C2CF9F3F5EBD73E7000
--------messageType     --digitMode                   --------bearerReply   ------------------------------------------------------bearer data
        --------teleService --ton --------------------src     --replySeqNo  --messageID --msts          --userdata
                --------serviceCategory                         --errorClass  --len   --XX--len           --len
                          --numberMode                            --causeCode   ------      ------------2012/06/24 20:56:11
                              --npi                                 --------bearerDataLength                ----------------------userdata
                                --len                                           

Note that I think you made a cut/paste error in your message - the 00 byte marked 'XX' I think shouldn't be there - luckily it's easy to spot the date and work backwards. So this is a message from 6789101674 with userdata:

104C2CF9F3F5EBD73E7000, the first five bits of which show that it's 7-bit encoded (0x02). Having shifted the remainder of the userdata 5 bits to the left, we're left with:

09859f3e7ebd7ae7ce00
--len(septets) 9 septets == 63 bits, so we expect 8 bytes of body
  ----------------7bit-body

So your 7bit-body decoded is "Bggguuugg".

这篇关于CDMA PDU解析在Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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