SIM卡SMSP

7F10/6F42 SMSP

FF FF FF FF      Alpha-Identifier记录别名   (长度为Y字节了,不固定, 可以为0 )

F4               Parameter Indicators :    (FD: only SMSC phone number)
1     TP-Destination Address.
2     TS-Service Centre Address.
3     TP-Protocol Identifier.
4     TP-Data Coding Scheme.
5     TP-Validity Period.
6     reserved, set to 1.
7     reserved, set to 1.
8     reserved, set to 1.
1111 0100  (F4,  TP-Data Coding Scheme 存在,TS-Service Centre Address , TP-Destination Address)
1111 1101   (仅TS-Service Centre Address 存在)
    0才表示参数存在, 比较另类



00 80 FF FF      TP-Destination Address
FF FF FF FF
FF FF FF FF

08 E4 68 31     TS-Service Centre Address
10 70 10 05
F0 FF FF FF

FF                 TP-Protocol Identifier
08                 TP-Data Coding Scheme
FF                 TP-Validity Period

编码方法

def encode_smsp(smsc, operator_len = 12):
    _al = operator_len * [0xFF]    #alpha Operator Name
    _p_ind = [0xFD]      # Parameters indicator : only SMSC phone number
    _dest_addr = 12*[0xFF] # blank TP-Destination address

    l = (len(smsc) + 3) // 2    # Required bytes
    prefix_flag = 0x91
    digit_str = smsc[:20] + 'F'*(20-len(smsc[:20]))
    _sc_addr = [l, prefix_flag] +  [(int(digit_str[i+1],16)<<4)+int(digit_str[i],16) \
            for i in range(0, 20, 2)]
            
    _pid = [0xFF] # blank protocol ID
    _dcs = [0xFF] # Data Coding Scheme 
    _val = [0xFF] # blank validity period
    
    SMSP = _al + _p_ind + _dest_addr + _sc_addr + _pid + _dcs + _val   
    
    return SMSP 

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注