idsdecode.py 文件源码

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

项目:python-ids-alarm 作者: kellerza 项目源码 文件源码
def getparam(ser, p_name, p_data):
    """Decode a specific parameter from the serial port."""
    printc(Back.RED + p_name, prepend='\n')
    for typ in p_data:
        schr = ser.read()
        if typ == 'h':
            printc(c2hex(schr), Fore.GREEN)
        elif typ == 'H':
            if len(HIGHLIGHT):
                HIGHLIGHT.popleft()
            HIGHLIGHT.append(c2hex(schr))
            printc(c2hex(schr), Fore.BLUE)
        elif typ == 'a':
            printc(c2ascii(schr) or c2hex(schr), Fore.WHITE, prepend='')
        else:
            printc(c2hex(schr), Fore.WHITE)
    printc(Style.RESET_ALL, prepend='')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号