ambe_bridge.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:dmr_utils 作者: n0mjs710 项目源码 文件源码
def __encode_voice_header( self, _rx_slot, _sync, _dtype ):
        _src_id = _rx_slot.rf_src
        _dst_id = _rx_slot.dst_id
        _cc = _rx_slot.cc
        # create lc
        lc = '\x00\x00\x00' + _dst_id + _src_id         # PF + Reserved + FLCO + FID + Service Options + Group Address + Source Address
        # encode lc into info
        full_lc_encode = bptc.encode_header_lc(lc)
        _rx_slot.emblc = bptc.encode_emblc(lc)          # save off the emb lc for voice frames B-E
        _rx_slot.emblc[5] = bitarray(32)                # NULL message (F)
        # create slot_type
        slot_type = chr((_cc << 4) | (_dtype & 0x0f))   # data type is Header or Term
        # generate FEC for slot type
        slot_with_fec  = BitArray(uint=golay.encode_2087(slot_type), length=20)
        # construct final frame - info[0:98] + slot_type[0:10] + DMR_DATA_SYNC_MS + slot_type[10:20] + info[98:196]
        frame_bits = full_lc_encode[0:98] + slot_with_fec[0:10] + decode.to_bits(_sync) + slot_with_fec[10:20] + full_lc_encode[98:196]
        return decode.to_bytes(frame_bits)

    # Create a voice header DMR frame
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号