コード例 #1
0
def build_mbus_message():
    logging.info(
        "Build your MBus message. All values hex. Leading 0x optional. Ctrl-C to Quit."
    )
    addr = m3_common.default_value("Address      ",
                                   "0xA5").replace('0x', '').decode('hex')
    data = m3_common.default_value("   Data",
                                   "0x12345678").replace('0x',
                                                         '').decode('hex')
    return add, data
コード例 #2
0
ファイル: mbus_message.py プロジェクト: hoangt/M-ulator
def get_mbus_message_to_send():
    logger.info("Which message would you like to send?")
    logger.info("\t0) Custom")
    logger.info("\t1) Enumerate          (0xF0000000, 0x24000000)")
    logger.info("\t2) SNS Config Bits    (0x40, 0x0423dfef)")
    logger.info("\t3) SNS Sample Setup   (0x40, 0x030bf0f0)")
    logger.info("\t4) SNS Sample Start   (0x40, 0x030af0f0)")
    selection = m3_common.default_value("Choose a message type", "-1")
    if selection == '0':
        return build_mbus_message()
    elif selection == '1':
        return ("F0000000".decode('hex'), "24000000".decode('hex'))
    elif selection == '2':
        return ("40".decode('hex'), "0423dfef".decode('hex'))
    elif selection == '3':
        return ("40".decode('hex'), "030bf0f0".decode('hex'))
    elif selection == '4':
        return ('40'.decode('hex'), '030af0f0'.decode('hex'))
    else:
        logging.info("Please choose one of the numbered options")
        return get_mbus_message_to_send()
コード例 #3
0
def get_mbus_message_to_send():
    logging.info("Which message would you like to send?")
    logging.info("\t0) Custom")
    logging.info("\t1) Enumerate          (0xF0000000, 0x24000000)")
    logging.info("\t2) SNS Config Bits    (0x40, 0x0423dfef)")
    logging.info("\t2) SNS Sample Setup   (0x40, 0x030bf0f0)")
    logging.info("\t3) SNS Sample Start   (0x40, 0x030af0f0)")
    selection = m3_common.default_value("Choose a message type", "-1")
    if selection == '0':
        return build_mbus_message()
    elif selection == '1':
        return ("F0000000".decode('hex'), "24000000".decode('hex'))
    elif selection == '2':
        return ("40".decode('hex'), "0423dfef".decode('hex'))
    elif selection == '3':
        return ("40".decode('hex'), "030bf0f0".decode('hex'))
    elif selection == '4':
        return ('40'.decode('hex'), '030af0f0'.decode('hex'))
    else:
        logging.info("Please choose one of the numbered options")
        return get_mbus_message_to_send()
コード例 #4
0
ファイル: mbus_message.py プロジェクト: hoangt/M-ulator
def build_mbus_message():
    logging.info("Build your MBus message. All values hex. Leading 0x optional. Ctrl-C to Quit.")
    addr = m3_common.default_value("Address      ", "0xA5").replace('0x','').decode('hex')
    data = m3_common.default_value("   Data", "0x12345678").replace('0x','').decode('hex')
    return addr, data