Esempio n. 1
0
def hdl_wid_36(desc):
    """
    Implements: SEND_UNSEGMENTED_DATA
    :param desc: Please send the unsegmented packet encrypted with application
                 key with source address 0x%04X and destination address 0x%04X
    :return:
    """

    # This pattern is matching source and destination addresses
    pattern = re.compile(
        r'(source\saddress|destination\saddress)\s+([0][xX][0-9a-fA-F]+)')
    params = pattern.findall(desc)
    if not params:
        logging.error("%s parsing error", hdl_wid_36.__name__)
        return False

    params = dict(params)

    btp.mesh_model_send(int(params.get('source address'), 16),
                        int(params.get('destination address'), 16), 'ff' * 2)
    return True
Esempio n. 2
0
def hdl_wid_44(desc):
    """
    Implements: SEND_SEGMENTED_DATA_VIRTUAL
    :param desc: Please send a segmented message encrypted with an application
                 key with source address 0x%04X and destination label %s
                 (address 0x%04X)
    :return:
    """

    # This pattern is matching source and destination label addresses
    pattern = re.compile(
        r'(source\saddress|\(address)\s+([0][xX][0-9a-fA-F]+)')
    params = pattern.findall(desc)
    if not params:
        logging.error("%s parsing error", hdl_wid_44.__name__)
        return False

    params = dict(params)

    btp.mesh_model_send(int(params.get('source address'), 16),
                        int(params.get('(address'), 16), 'ff' * 16)
    return True