TON/NPI

例如:0X91

地址类型:10010001       

Bits 7: 始终为1

Bits 6,5,4:Type-of-Number(号码类型):001,代表Internation Number。也即是号码前加“+”。注意:对某些比较特殊的号码,例如手机与小灵通的互通时,这里不能设置为001,而要设置成000,代表号码前没有 “+”,否则无法接收。
下面是GSM03.40协议号码类型的解释:
 0 0 0   Unknown
 0 0 1   International number
 0 1 0   National number
 0 1 1   Network specific number
 1 0 0   Subscriber number
 1 0 1   Alphanumeric(coded according to TS03.38 7-bit default alphabet)
 1 1 0   Abbreviated number
 1 1 1   Reserved for extension
 ll not interpret reserved values but will store them as received.

 

 Bits 3,2,1,0:Numbering-plan-identification(号码鉴别),0000—未知,0001—ISDN/电话号码(E.164 /E.163),1111—留作扩展;一般默认为0001,表示电话号码类型的。下面是GSM03.40号码鉴别的解释:
Bits4 3 2 1
0 0 0 0    Unknown
0 0 0 1    ISDN/telephone numbering plan (E.164/E.163)
0 0 1 1    Data numbering plan (X.121)
0 1 0 0    Telex numbering plan
1 0 0 0    National numbering plan
1 0 0 1    Private numbering plan
1 0 1 0    ERMES numbering plan (ETSI DE/PS 3 01-3)
1 1 1 1    Reserved for extension
All other values are reserved.

解释下面代码static UINT8 libTXT2PDU( UINT8* msgData, UINT16 msgLen, UINT8* pTpdu, AtciMsgInfo *pAtSmsMessage, AtciCharacterSet chset_type ) { UINT8 offset = 0; UINT16 len=0; //CPUartLogPrintf("%s: enter", __FUNCTION__); //int i; //for(i=0;i<msgLen;i++) //CPUartLogPrintf("%s: msgData[%d] %d 0x%x", __FUNCTION__, i, msgData[i], msgData[i]); /* Copy the first octet */ /*SIMCom xiaokai.yang sync sms code @2023-02-06 begin*/ #ifdef FEATURE_SIMCOM_SMS char headbuf[PDU_HEAD_SIZE] = {0x05,0x00,0x03}; scCmssexInfoT* p_CmgsexInfo = (scCmssexInfoT*)getCmgsexInfoInd(); if(pAtSmsMessage->udhPresent) { pTpdu[ offset++ ] = (pAtSmsMessage->fo)|(0x1<<6); } else #endif /*SIMCom xiaokai.yang sync sms code @2023-02-06 end*/ pTpdu[ offset++ ] = pAtSmsMessage->fo; /* Message Reference */ pTpdu[ offset++ ] = pAtSmsMessage->msgRef; /* Originating Address (TP-OA) */ { UINT8 idx; UINT8 *data; data = pTpdu + offset; /* Set the Address Length octet */ *data++ = strlen( (char *)pAtSmsMessage->destAddr ); #ifdef FEATURE_SIMCOM_SMS PAL_LogIo(SC_MODULE_SMS,PAL_DBG_LEVEL_INFO,"destAddr [%s]",( (char *)pAtSmsMessage->destAddr )); #endif /* Format the TON/NPI octet */ *data++ = (UINT8)((pAtSmsMessage->addrType << 4) | pAtSmsMessage->addrPlan | 0x80); /* Format the BCD digits */ for ( idx = 0; idx < strlen( (char *)pAtSmsMessage->destAddr ); idx++ ) { libPutPackedBcd( data, idx, pAtSmsMessage->destAddr[ idx ], TRUE ); } /* check if we need to tack on a filler */ if( idx & 0x01 ) { /* Yup -- do it! , reversed nibbles */ libPutPackedBcd( data, idx, ATCI_BCD_FILLER, TRUE ); ++idx; } /* We're done -- update the PDU byte index */ offset += idx/2 + ATCI_SMS_BCD_POS; } /* Protocol Identifier (TP-PID) */ pTpdu[ offset++ ] = pAtSmsMessage->pid; /* Data Coding Scheme (TP-DCS) */ pTpdu[ offset++ ] = pAtSmsMessage->dcs; if(((pAtSmsMessage->fo&ATCI_TP_MTI_MASK)==ATCI_SMS_SUBMIT_MTI)&&((pAtSmsMessage->fo&ATCI_SMS_TP_VPF)==0x10)) { pTpdu[ offset++ ] = pAtSmsMessage->vp; } /*SIMCom xiaokai.yang sync sms code @2023-02-06 begin*/ #ifdef FEATURE_SIMCOM_SMS if(pAtSmsMessage->udhPresent) { headbuf[3] = p_CmgsexInfo->mr; headbuf[4] = p_CmgsexInfo->msg_total; headbuf[5] = p_CmgsexInfo->msg_seg; memmove(msgData+PDU_HEAD_SIZE,msgData,msgLen); memcpy(msgData, headbuf, PDU_HEAD_SIZE); msgLen+=PDU_HEAD_SIZE; } PAL_LogIo(SC_MODULE_SMS,PAL_DBG_LEVEL_INFO,"offset1 [%d],msgLen=%d",offset,msgLen);//274 #endif /*SIMCom xiaokai.yang sync sms code @2023-02-06 end*/ /* Now for the Message Data (TP-UDL + TP-UD) */ //ScShowDataByHex((char *)pTpdu, offset); //CPUartLogPrintf("[sms]msgLen=%d",msgLen); libMsgEncodeUserData( pAtSmsMessage->udhPresent, pAtSmsMessage->dcs, pTpdu, msgData, msgLen, offset, &len,chset_type); return len; }
最新发布
06-08
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值