示例#1
0
文件: mmdl.py 项目: tedd-an/auto-pts
def hdl_wid_660(desc):
    params = parse_params(desc)
    log("%r", params)
    if desc.startswith('Please send') or desc.startswith(
            'Please confirm the received'):
        return parse_send(params)
    elif desc.startswith(
            'Please confirm IUT has successfully set the new state.'):
        if params:
            parse_send(params)
            return True
        else:
            stack = get_stack()
            if stack.mesh.expect_status_data_get("Ack") == False:
                return True
            elif stack.mesh.expect_status_data.data == stack.mesh.recv_status_data.data:
                return True
            else:
                return False
    else:
        return False
示例#2
0
def gap_passkey_confirm_rsp(bd_addr, bd_addr_type, passkey):
    logging.debug("%s %r %r", gap_passkey_confirm_rsp.__name__, bd_addr,
                  bd_addr_type)
    iutctl = get_iut()

    data_ba = bytearray()
    bd_addr_ba = addr2btp_ba(bd_addr)

    data_ba.extend(chr(bd_addr_type).encode('utf-8'))
    data_ba.extend(bd_addr_ba)

    if isinstance(passkey, str):
        passkey = int(passkey)

    match = int(passkey == int(get_stack().gap.get_passkey()))

    data_ba.extend(chr(match).encode('utf-8'))

    iutctl.btp_socket.send(*GAP['passkey_confirm_rsp'], data=data_ba)

    gap_command_rsp_succ()
示例#3
0
def gap_direct_adv_on(addr, addr_type, high_duty=0):
    logging.debug("%s %r %r", gap_direct_adv_on.__name__, addr, high_duty)

    stack = get_stack()

    if stack.gap.current_settings_get(
            gap_settings_btp2txt[defs.GAP_SETTINGS_ADVERTISING]):
        return

    iutctl = get_iut()

    data_ba = bytearray()
    bd_addr_ba = addr2btp_ba(addr)
    data_ba.extend(chr(addr_type).encode('utf-8'))
    data_ba.extend(bd_addr_ba)
    data_ba.extend(chr(high_duty).encode('utf-8'))

    iutctl.btp_socket.send(*GAP['start_direct_adv'], data=data_ba)

    tuple_data = gap_command_rsp_succ(defs.GAP_START_DIRECT_ADV)
    __gap_current_settings_update(tuple_data)
示例#4
0
文件: mmdl.py 项目: tedd-an/auto-pts
def hdl_wid_13(desc):
    """
    Implements: RE_PROVISIONING_PROVISIONER
    :param desc: There is no shared security information. Please remove any
                 security information if any. PTS is waiting for beacon to
                 start provisioning from
    :return:
    """
    stack = get_stack()

    if not stack.mesh.is_initialized:
        btp.mesh_config_prov()
        btp.mesh_init()

    if stack.mesh.is_provisioned.data:
        # Wait a few seconds so that Mesh is initialized and everything is loaded from flash
        time.sleep(7)
        btp.mesh_reset()
        time.sleep(5)

    return True
示例#5
0
def hdl_wid_75(desc):
    # This pattern is matching IUT handle and characteristic value
    pattern = re.compile("(handle|value)\s?=\s?'([0-9a-fA-F]+)'")
    params = pattern.findall(desc)
    if not params:
        logging.error("parsing error")
        return False

    params = dict(params)

    handle = int(params.get('handle'), 16)
    value = int(params.get('value'), 16)

    stack = get_stack()

    val = stack.gatt.wait_attr_value_changed(handle, 10)
    if val is None:
        return False

    val = int(val, 16)

    return val == value
示例#6
0
def main():
    """Main."""
    if os.geteuid() == 0:  # root privileges are not needed
        sys.exit("Please do not run this program as root.")

    args = parse_args()

    callback_thread = autoptsclient.init_core()

    ptses = autoptsclient.init_pts(args, callback_thread)

    btp.init(get_iut)

    autoprojects.iutctl.AUTO_PTS_LOCAL = autoptsclient.AUTO_PTS_LOCAL
    autoprojects.iutctl.init(args.btpclient_path)

    stack.init_stack()
    stack_inst = stack.get_stack()
    stack_inst.synch_init(callback_thread.set_pending_response,
                          callback_thread.clear_pending_responses)

    autoprojects.gap.set_pixits(ptses[0])
    autoprojects.sm.set_pixits(ptses[0])

    test_cases = autoprojects.gap.test_cases(ptses[0])
    test_cases += autoprojects.sm.test_cases(ptses[0])

    autoptsclient.run_test_cases(ptses, test_cases, args)

    autoprojects.iutctl.cleanup()

    print "\nBye!"
    sys.stdout.flush()

    for pts in ptses:
        pts.unregister_xmlrpc_ptscallback()

    # not the cleanest but the easiest way to exit the server thread
    os._exit(0)
示例#7
0
文件: mmdl.py 项目: sshyran/auto-pts
def mmdl_wid_hdl(wid, description, test_case_name):
    log("%s, %r, %r, %s", mmdl_wid_hdl.__name__, wid, description,
        test_case_name)
    module = sys.modules[__name__]

    try:
        handler = getattr(module, "hdl_wid_%d" % wid)

        stack = get_stack()
        if not stack.synch or not stack.synch.is_required_synch(test_case_name, wid):
            return handler(description)

        response = hdl_pending_mmdl_wids(wid, test_case_name, description)

        if response == "WAIT":
            return response

        stack.synch.set_pending_responses_if_any()
        return "WAIT"

    except AttributeError as e:
        logging.exception(e.message)
示例#8
0
文件: mesh.py 项目: ryanjh/auto-pts
def hdl_wid_18(desc):
    """
    Implements: CONFIRM_NETWORK_DATA
    :param desc: Please confirm the following network packet was received: %s
    :return:
    """
    stack = get_stack()

    stack.mesh.net_recv_ev_store.data = False

    if stack.mesh.net_recv_ev_data.data is None:
        logging.error("Network Packet not received!")
        return False

    # This pattern is matching Time to Live (TTL) value, Control (CTL),
    # Source (SRC) Destination (DST) and Payload of the network packet
    # to be received
    pattern = re.compile(r'(TTL|CTL|SRC|DST|TransportPDU)\:'
                         r'\s+\[([0][xX][0-9a-fA-F]+)\]')
    params = pattern.findall(desc)
    if not params:
        logging.error("%s parsing error", hdl_wid_18.__name__)
        return False

    params = dict(params)
    pdu = hex(int(params['TransportPDU'], 16))
    ttl = int(params.get('TTL'), 16)
    ctl = int(params.get('CTL'), 16)
    src = int(params.get('SRC'), 16)
    dst = int(params.get('DST'), 16)

    (recv_ttl, recv_ctl, recv_src, recv_dst, recv_pdu) = \
        stack.mesh.net_recv_ev_data.data
    recv_pdu = hex(int(recv_pdu, 16))

    if pdu == recv_pdu and ttl == recv_ttl and ctl == recv_ctl \
            and src == recv_src and dst == recv_dst:
        return True
    return False
示例#9
0
def hdl_wid_46(desc):
    """
    :param desc: Please send an L2CAP Connection Parameter Update request using valid parameters.
    :return:
    """
    btp.gap_wait_for_connection()

    stack = get_stack()
    bd_addr = btp.pts_addr_get()
    bd_addr_type = btp.pts_addr_type_get()

    new_params = copy.deepcopy(stack.gap.conn_params.data)

    new_params.conn_latency += 1

    btp.gap_conn_param_update(bd_addr, bd_addr_type,
                              new_params.conn_itvl,
                              new_params.conn_itvl,
                              new_params.conn_latency,
                              new_params.supervision_timeout)

    return True
示例#10
0
文件: mesh.py 项目: ryanjh/auto-pts
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:
    """
    stack = get_stack()

    # 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
示例#11
0
文件: mesh.py 项目: ryanjh/auto-pts
def hdl_wid_19(desc):
    """
    Implements: SEND_NETWORK_DATA
    :param desc: Please send a network packet with maximum TransportPDU size
                 with the following network header: %s
    :return:
    """
    stack = get_stack()

    # This pattern is matching Time to Live (TTL) value, Source (SRC) and
    # Destination (DST) of the network packet to be sent
    pattern = re.compile(r'(TTL|SRC|DST)\:\s+\[([0][xX][0-9a-fA-F]+)\]')
    params = pattern.findall(desc)
    if not params:
        logging.error("%s parsing error", hdl_wid_19.__name__)
        return False

    params = dict(params)

    btp.mesh_net_send(params.get('TTL', None), params.get('SRC'),
                      params.get('DST'), '01020304')
    return True
示例#12
0
文件: mesh.py 项目: ryanjh/auto-pts
def hdl_wid_604(desc):
    """
    Implements: CONFIRM_HEALTH_FAULT_STATUS_STATUS_2
    :param desc: Please confirm the test ID %x and the registered fault array
                 %s.
    :return:
    """
    stack = get_stack()

    # Pattern looking for fault array and test ID
    pattern = re.compile(r"(array|ID)\s+([0-9a-fA-F]+)", re.IGNORECASE)
    found = pattern.findall(desc)
    if not found:
        logging.error("%s Parsing error!", hdl_wid_604.__name__)
        return False

    found = dict(found)

    if int(stack.mesh.health_test_id.data) != int(found.get('ID')) or \
            stack.mesh.health_registered_faults.data != found.get('array'):
        return False
    return True
示例#13
0
文件: mesh.py 项目: ryanjh/auto-pts
def hdl_wid_603(desc):
    """
    Implements: CONFIRM_HEALTH_FAULT_STATUS_STATUS_1
    :param desc: Please confirm the test ID %x and no registered faults.
    :return:
    """
    stack = get_stack()

    # Pattern looking for test ID
    pattern = re.compile(r"(ID)\s+([0-9a-fA-F]+)", re.IGNORECASE)
    found = pattern.findall(desc)
    if not found:
        logging.error("%s Parsing error!", hdl_wid_603.__name__)
        return False

    found = dict(found)

    # Fail if test ID does not match or IUT has faults
    if int(stack.mesh.health_test_id.data) != int(found.get('ID')) or \
            stack.mesh.health_registered_faults.data:
        return False
    return True
示例#14
0
文件: mesh.py 项目: ryanjh/auto-pts
def hdl_wid_601(desc):
    """
    Implements: CONFIRM_HEALTH_CURRENT_STATUS
    :param desc: Please confirm the fault array = %s.
    :return:
    """
    stack = get_stack()

    # This pattern is matching fault array
    pattern = re.compile(r'array\s=\s([0-9a-fA-F]+)')
    params = pattern.findall(desc)
    if not params:
        logging.error("%s parsing error", hdl_wid_601.__name__)
        return False

    current_faults = stack.mesh.health_current_faults.data

    if params[0].upper() != current_faults.upper():
        logging.error("Fault array does not match %r vs %r", params[0],
                      current_faults)
        return False
    return True
示例#15
0
def hdl_wid_40(desc):
    """
    Implements: TSC_MMI_upper_tester_confirm_data_receive
    :param desc: Please confirm the Upper Tester receive data = xxxx. Click Yes if it matched, otherwise click No.
    :return:
    """
    # This pattern is matching data received
    pattern = re.compile(r"data\s=\s([0-9a-fA-F]+)")
    data = pattern.findall(desc)
    if not data:
        logging.error("%s parsing error", hdl_wid_40.__name__)
        return False

    stack = get_stack()
    rx_data = stack.l2cap.rx_data_get_all(10)

    for value in data:
        if value.upper() in rx_data:
            rx_data.remove(value)
        else:
            return False

    return True
示例#16
0
文件: mesh.py 项目: ryanjh/auto-pts
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:
    """
    stack = get_stack()

    # 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

    params = dict(params)

    btp.mesh_model_send(int(params.get('source address'), 16),
                        int(params.get('(address'), 16), 'ff' * 16)
    return True
示例#17
0
文件: mesh.py 项目: ryanjh/auto-pts
def hdl_wid_35(desc):
    """
    Implements: CONFIRM_TRANSPORT_DATA
    :param desc: Please confirm the following transport packet was received: %s
    :return:
    """
    stack = get_stack()

    # FIXME: stack.mesh.net_recv_ev_store.data = False

    if stack.mesh.net_recv_ev_data.data is None:
        return False

    # This pattern is matching Time to Live (TTL) value, Control (CTL),
    # Source (SRC) and Destination (DST)
    pattern = re.compile(r'(TTL|CTL|SRC|DST)\:\s+\[([0][xX][0-9a-fA-F]+)\]')
    params = pattern.findall(desc)
    if not params:
        logging.error("%s parsing error", hdl_wid_35.__name__)
        return False

    params = dict(params)

    # Normalize parameters for comparison
    ttl = int(params.get('TTL'), 16)
    ctl = int(params.get('CTL'), 16)
    src = int(params.get('SRC'), 16)
    dst = int(params.get('DST'), 16)

    (recv_ttl, recv_ctl, recv_src, recv_dst, recv_pdu) = \
        stack.mesh.net_recv_ev_data.data
    recv_pdu = hex(int(recv_pdu, 16))

    if ttl == recv_ttl and ctl == recv_ctl and src == recv_src \
            and dst == recv_dst:
        return True
    return False
示例#18
0
def event_handler(hdr, data):
    logging.debug("%s %r %r", event_handler.__name__, hdr, data)

    stack = get_stack()
    if not stack:
        logging.info("Stack not initialized")
        return False

    cb = None

    if hdr.svc_id == defs.BTP_SERVICE_ID_MESH:
        if hdr.op in MESH_EV and stack.mesh:
            cb = MESH_EV[hdr.op]
            cb(stack.mesh, data[0], hdr.data_len)
            return True

    elif hdr.svc_id == defs.BTP_SERVICE_ID_L2CAP:
        if hdr.op in L2CAP_EV and stack.l2cap:
            cb = L2CAP_EV[hdr.op]
            cb(stack.l2cap, data[0], hdr.data_len)
            return True

    elif hdr.svc_id == defs.BTP_SERVICE_ID_GAP:
        if hdr.op in GAP_EV and stack.gap:
            cb = GAP_EV[hdr.op]
            cb(stack.gap, data[0], hdr.data_len)
            return True

    elif hdr.svc_id == defs.BTP_SERVICE_ID_GATT:
        if hdr.op in GATT_EV and stack.gatt:
            cb = GATT_EV[hdr.op]
            cb(stack.gatt, data[0], hdr.data_len)
            return True

    # TODO: Raise BTP error instead of logging
    logging.error("Unhandled event! svc_id %s op %s", hdr.svc_id, hdr.op)
    return False
示例#19
0
def hdl_wid_37(desc):
    """
    Implements: TSC_MMI_upper_tester_confirm_LE_data
    :param desc: Did the Upper Tester send first data frame of xxxx to the PTS.
                 Click Yes if it matched, otherwise click No.
    :return:
    """
    # This pattern is matching first data frame
    pattern = re.compile(r"frame\sof\s([0-9a-fA-F]+)")
    data = pattern.findall(desc)
    if not data:
        logging.error("%s parsing error", hdl_wid_37.__name__)
        return False

    stack = get_stack()
    tx_data = stack.l2cap.tx_data_get(0)
    if tx_data is None:
        return False

    for i in range(len(data[0])):
        if data[0][i].upper() != tx_data[i].upper():
            return False

    return True
def mesh_wid_hdl(wid, description, test_case_name):
    log("%s, %r, %r, %s", mesh_wid_hdl.__name__, wid, description,
        test_case_name)
    module = sys.modules[__name__]
    pending_responses = None

    try:
        handler = getattr(module, "hdl_wid_%d" % wid)
        current_response = handler(description)

        stack = get_stack()
        if stack.synch:
            response = hdl_pending_mesh_wids(wid, test_case_name, description)

            if response == "WAIT":
                return response

        if stack.synch:
            stack.synch.set_pending_responses_if_any()

        return current_response

    except AttributeError as e:
        logging.exception(e.message)
示例#21
0
def run_tests(args, iut_config, tty):
    """Run test cases
    :param args: AutoPTS arguments
    :param iut_config: IUT configuration
    :param tty path
    :return: tuple of (status, results) dictionaries
    """
    results = {}
    status = {}
    descriptions = {}
    total_regressions = []
    _args = {}

    config_default = "prj.conf"
    _args[config_default] = PtsInitArgs(args)

    for config, value in list(iut_config.items()):
        if 'test_cases' not in value:
            # Rename default config
            _args[config] = _args.pop(config_default)
            config_default = config
            continue

        if config != config_default:
            _args[config] = PtsInitArgs(args)

        _args[config].test_cases = value.get('test_cases', [])

        if 'overlay' in value:
            _args[config_default].excluded += _args[config].test_cases

    while True:
        try:
            ptses = autoptsclient.init_pts(_args[config_default],
                                           "zephyr_" + str(args["board"]))

            btp.init(get_iut)

            # Main instance of PTS
            pts = ptses[0]

            # Read PTS Version and keep it for later use
            args['pts_ver'] = "%s" % pts.get_version()
        except Exception as exc:
            if _args[config_default].recovery:
                ptses = exc.args[1]
                for pts in ptses:
                    autoptsclient.recover_autoptsserver(pts)
                time.sleep(20)
                continue
            else:
                raise exc
        break

    stack.init_stack()
    stack_inst = stack.get_stack()
    stack_inst.synch_init([pts.callback_thread for pts in ptses])

    for config, value in list(iut_config.items()):
        if 'overlay' in value:
            apply_overlay(args["project_path"], config_default, config,
                          value['overlay'])

        build_and_flash(args["project_path"], autopts2board[args["board"]],
                        tty, config)
        logging.debug("TTY path: %s" % tty)

        flush_serial(tty)
        time.sleep(10)

        autoprojects.iutctl.init(args["kernel_image"], tty, args["board"])

        # Setup project PIXITS
        autoprojects.gap.set_pixits(ptses[0])
        autoprojects.gatt.set_pixits(ptses)
        autoprojects.sm.set_pixits(ptses[0])
        autoprojects.l2cap.set_pixits(ptses[0])
        autoprojects.mesh.set_pixits(ptses)

        test_cases = get_test_cases(ptses)

        status_count, results_dict, regressions = autoptsclient.run_test_cases(
            ptses, test_cases, _args[config])
        total_regressions += regressions

        for k, v in list(status_count.items()):
            if k in list(status.keys()):
                status[k] += v
            else:
                status[k] = v

        results.update(results_dict)
        autoprojects.iutctl.cleanup()

    for test_case_name in list(results.keys()):
        project_name = test_case_name.split('/')[0]
        descriptions[test_case_name] = \
            pts.get_test_case_description(project_name, test_case_name)

    for pts in ptses:
        pts.unregister_xmlrpc_ptscallback()

    return status, results, descriptions, total_regressions
示例#22
0
def test_cases_server(pts):
    """Returns a list of GATT Server test cases"""

    pts_bd_addr = pts.q_bd_addr
    stack = get_stack()

    pre_conditions = [TestFunc(btp.core_reg_svc_gap),
                      TestFunc(btp.gap_read_ctrl_info),
                      TestFunc(lambda: pts.update_pixit_param(
                          "GATT", "TSPX_bd_addr_iut",
                          stack.gap.iut_addr_get_str())),
                      TestFunc(lambda: pts.update_pixit_param(
                          "GATT", "TSPX_iut_use_dynamic_bd_addr",
                          "TRUE" if stack.gap.iut_addr_is_random()
                          else "FALSE")),
                      TestFunc(btp.core_reg_svc_gatt),
                      TestFunc(btp.gap_set_conn),
                      TestFunc(btp.gap_set_gendiscov)]

    pre_conditions_1 = [TestFunc(btp.core_reg_svc_gap),
                        TestFunc(btp.core_reg_svc_gatt),
                        TestFunc(btp.gap_read_ctrl_info),
                        TestFunc(lambda: pts.update_pixit_param(
                            "GATT", "TSPX_bd_addr_iut",
                            stack.gap.iut_addr_get_str())),
                        TestFunc(lambda: pts.update_pixit_param(
                            "GATT", "TSPX_iut_use_dynamic_bd_addr",
                            "TRUE" if stack.gap.iut_addr_is_random()
                            else "FALSE")),
                        TestFunc(stack.gatt_init)]

    init_server_1 = [TestFunc(btp.gatts_add_svc, 0, UUID.VND16_1),
                     TestFunc(btp.gatts_add_char, 0,
                              Prop.read | Prop.write | Prop.nofity,
                              Perm.read | Perm.write, UUID.VND16_2),
                     TestFunc(btp.gatts_set_val, 0, Value.eight_bytes_1 * 10),
                     TestFunc(btp.gatts_add_svc, 0, UUID.VND16_3),
                     TestFunc(btp.gatts_add_inc_svc, 1),
                     TestFunc(btp.gatts_add_char, 0, 0x00, 0x00, UUID.VND16_4),
                     TestFunc(btp.gatts_set_val, 0, Value.one_byte),
                     TestFunc(btp.gatts_add_char, 0, Prop.read, Perm.read_authz,
                              UUID.VND128_1),
                     TestFunc(btp.gatts_set_val, 0, Value.one_byte),
                     TestFunc(btp.gatts_add_char, 0, Prop.read,
                              Perm.read_authn, UUID.VND128_2),
                     TestFunc(btp.gatts_set_val, 0, Value.one_byte),
                     TestFunc(btp.gatts_add_char, 0, Prop.read,
                              Perm.read_enc, UUID.VND16_2),
                     TestFunc(btp.gatts_set_val, 0, Value.one_byte),
                     TestFunc(btp.gatts_set_enc_key_size, 0, 0x0f),
                     TestFunc(btp.gatts_add_char, 0,
                              Prop.read | Prop.write,
                              Perm.read | Perm.write, UUID.VND16_5),
                     TestFunc(btp.gatts_set_val, 0, Value.long_1),
                     TestFunc(btp.gatts_add_desc, 0,
                              Perm.read | Perm.write, UUID.VND16_3),
                     TestFunc(btp.gatts_set_val, 0, Value.long_1),
                     TestFunc(btp.gatts_start_server)]

    init_server_2 = [TestFunc(btp.gatts_add_svc, 0, UUID.VND16_1),
                     TestFunc(btp.gatts_add_char, 0,
                              Prop.read | Prop.write_wo_resp | Prop.auth_swrite,
                              Perm.read | Perm.write, UUID.VND128_1),
                     TestFunc(btp.gatts_set_val, 0, Value.one_byte),
                     TestFunc(btp.gatts_add_char, 0,
                              Prop.read | Prop.write | Prop.nofity | Prop.indicate,
                              Perm.read | Perm.write, UUID.VND16_2),
                     TestFunc(btp.gatts_set_val, 0, Value.eight_bytes_1),
                     TestFunc(btp.gatts_add_desc, 0,
                              Perm.read | Perm.write, UUID.CCC),
                     TestFunc(btp.gatts_add_char, 0,
                              Prop.read | Prop.write,
                              Perm.read | Perm.write_authz, UUID.VND128_2),
                     TestFunc(btp.gatts_set_val, 0, Value.one_byte),
                     TestFunc(btp.gatts_add_char, 0,
                              Prop.read | Prop.write,
                              Perm.read | Perm.write_authn, UUID.VND16_2),
                     TestFunc(btp.gatts_set_val, 0, Value.one_byte),
                     TestFunc(btp.gatts_add_char, 0, Prop.read | Prop.write,
                              Perm.read | Perm.write_enc, UUID.VND16_2),
                     TestFunc(btp.gatts_set_val, 0, Value.two_bytes),
                     TestFunc(btp.gatts_set_enc_key_size, 0, 0x0f),
                     TestFunc(btp.gatts_add_char, 0,
                              Prop.read | Prop.write,
                              Perm.read | Perm.write, UUID.VND16_2),
                     TestFunc(btp.gatts_set_val, 0, Value.long_1),
                     TestFunc(btp.gatts_add_char, 0,
                              Prop.read | Prop.write,
                              Perm.read | Perm.write_authz, UUID.VND16_3),
                     TestFunc(btp.gatts_set_val, 0, Value.long_1),
                     TestFunc(btp.gatts_add_char, 0, Prop.read | Prop.write,
                              Perm.read | Perm.write_authn, UUID.VND16_2),
                     TestFunc(btp.gatts_set_val, 0, Value.long_1),
                     TestFunc(btp.gatts_add_char, 0, Prop.read | Prop.write,
                              Perm.read | Perm.write_enc, UUID.VND16_2),
                     TestFunc(btp.gatts_set_val, 0, Value.long_1),
                     TestFunc(btp.gatts_set_enc_key_size, 0, 0x0f),
                     TestFunc(btp.gatts_start_server)]

    init_server_3 = [TestFunc(btp.gatts_add_svc, 1, UUID.VND16_1),
                     TestFunc(btp.gatts_add_char, 0, Prop.read,
                              Perm.read, UUID.VND16_2),
                     TestFunc(btp.gatts_set_val, 0, '1234'),
                     TestFunc(btp.gatts_add_svc, 0, UUID.VND16_3),
                     TestFunc(btp.gatts_add_inc_svc, 1),
                     TestFunc(btp.gatts_add_char, 0,
                              Prop.read | Prop.write | Prop.ext_prop,
                              Perm.read | Perm.write, UUID.VND16_2),
                     TestFunc(btp.gatts_set_val, 0, '1234'),
                     TestFunc(btp.gatts_add_desc, 0, Perm.read, UUID.CEP),
                     TestFunc(btp.gatts_set_val, 0, '0100'),
                     TestFunc(btp.gatts_add_char, 0,
                              Prop.read, Perm.read, UUID.VND16_2),
                     TestFunc(btp.gatts_set_val, 0, '1234'),
                     TestFunc(btp.gatts_add_desc, 0, Perm.read, UUID.CUD),
                     TestFunc(btp.gatts_set_val, 0, '73616d706c652074657874'),
                     TestFunc(btp.gatts_add_desc, 0,
                              Perm.read | Perm.write_authz | Perm.write_authn,
                              UUID.SCC),
                     TestFunc(btp.gatts_set_val, 0, '0000'),
                     TestFunc(btp.gatts_add_char, 0, Prop.read, Perm.read,
                              UUID.VND16_2),
                     TestFunc(btp.gatts_set_val, 0, '0000'),
                     TestFunc(btp.gatts_add_desc, 0, Perm.read, UUID.CPF),
                     TestFunc(btp.gatts_set_val, 0, '0600A327010100'),
                     TestFunc(btp.gatts_start_server),
                     TestFunc(btp.gap_adv_ind_on, start_wid=1)]

    test_cases = [
        ZTestCase("GATT", "GATT/SR/GAC/BV-01-C",
                  pre_conditions_1 + init_server_1,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAD/BV-01-C",
                  pre_conditions_1 + init_server_1,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAD/BV-02-C",
                  pre_conditions_1 + init_server_1,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAD/BV-03-C",
                  pre_conditions_1 + init_server_1,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAD/BV-04-C",
                  pre_conditions_1,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAD/BV-05-C",
                  pre_conditions_1,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAD/BV-06-C",
                  pre_conditions_1,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAR/BV-01-C",
                  pre_conditions_1,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAR/BI-01-C",
                  pre_conditions_1 + init_server_1,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAR/BI-02-C",
                  pre_conditions_1 + init_server_1,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAR/BI-03-C",
                  pre_conditions_1 + init_server_1,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAR/BI-04-C",
                  pre_conditions_1 + init_server_1,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAR/BI-05-C",
                  pre_conditions_1 + init_server_1,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAR/BV-03-C",
                  pre_conditions_1 + init_server_1,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAR/BI-06-C",
                  pre_conditions_1,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAR/BI-07-C",
                  pre_conditions_1 + init_server_1,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAR/BI-08-C",
                  pre_conditions_1 + init_server_1,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAR/BI-09-C",
                  pre_conditions_1 + init_server_1,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAR/BI-10-C",
                  pre_conditions_1 + init_server_1,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAR/BI-11-C",
                  pre_conditions_1 + init_server_1,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAR/BV-04-C",
                  pre_conditions_1 + init_server_1,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAR/BI-12-C",
                  pre_conditions_1 + init_server_1,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAR/BI-13-C",
                  pre_conditions_1 + init_server_1,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAR/BI-14-C",
                  pre_conditions_1,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAR/BI-15-C",
                  pre_conditions_1 + init_server_1,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAR/BI-16-C",
                  pre_conditions_1 + init_server_1,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAR/BI-17-C",
                  pre_conditions_1 + init_server_1,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAR/BV-05-C",
                  pre_conditions_1 + init_server_1,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAR/BI-18-C",
                  pre_conditions_1 + init_server_1,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAR/BI-19-C",
                  pre_conditions_1 + init_server_1,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAR/BI-20-C",
                  pre_conditions_1 + init_server_1,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAR/BI-21-C",
                  pre_conditions_1 + init_server_1,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAR/BI-22-C",
                  pre_conditions_1 + init_server_1,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAR/BV-06-C",
                  pre_conditions_1 + init_server_3,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAR/BV-07-C",
                  pre_conditions_1 + init_server_1,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAR/BV-08-C",
                  pre_conditions_1 + init_server_1,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAW/BV-01-C",
                  pre_conditions_1 + init_server_2,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAW/BV-02-C",
                  pre_conditions_1 + init_server_2,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAW/BI-01-C",
                  pre_conditions_1 + init_server_2,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAW/BV-03-C",
                  pre_conditions_1 + init_server_2,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAW/BI-02-C",
                  pre_conditions_1 + init_server_2,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAW/BI-03-C",
                  pre_conditions_1 + init_server_2,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAW/BI-04-C",
                  pre_conditions_1 + init_server_2,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAW/BI-05-C",
                  pre_conditions_1 + init_server_2,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAW/BI-06-C",
                  pre_conditions_1 + init_server_2,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAW/BV-05-C",
                  pre_conditions_1 + init_server_2,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAW/BI-07-C",
                  pre_conditions_1 + init_server_2,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAW/BI-08-C",
                  pre_conditions_1 + init_server_1,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAW/BI-09-C",
                  pre_conditions_1 + init_server_2,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAW/BI-11-C",
                  pre_conditions_1 + init_server_2,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAW/BI-12-C",
                  pre_conditions_1 + init_server_2,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAW/BI-13-C",
                  pre_conditions_1 + init_server_2,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAW/BV-06-C",
                  pre_conditions_1 + init_server_2,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAW/BV-10-C",
                  pre_conditions_1 + init_server_2,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAW/BV-11-C",
                  pre_conditions_1 + init_server_2,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAW/BV-07-C",
                  pre_conditions_1 + init_server_2,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAW/BV-08-C",
                  pre_conditions_1 + init_server_2,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAW/BV-09-C",
                  pre_conditions_1 + init_server_1,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAW/BI-32-C",
                  pre_conditions_1 + init_server_1,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAW/BI-33-C",
                  pre_conditions_1 + init_server_2,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAN/BV-01-C",
                  pre_conditions_1 + init_server_2,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAI/BV-01-C",
                  pre_conditions_1 + init_server_2,
                  generic_wid_hdl=gatt_wid_hdl),
        # TODO rewrite GATT/SR/GAS/BV-01-C
        ZTestCase("GATT", "GATT/SR/GAS/BV-01-C",
                  cmds=pre_conditions +
                  [TestFunc(btp.gap_set_io_cap, IOCap.display_only),

                   # Service Changed is triggered for bonded devices only
                   TestFunc(btp.gap_wait_for_connection,
                            post_wid=1, skip_call=(2,)),
                   TestFunc(btp.gap_pair, post_wid=1, skip_call=(2,)),

                   TestFunc(btp.gap_wait_for_disconnection, post_wid=96),
                   TestFunc(btp.gatts_add_svc, 0, UUID.VND16_1, post_wid=96),
                   TestFunc(btp.gatts_start_server, post_wid=96)],
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GAT/BV-01-C",
                  pre_conditions_1 + init_server_2,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GPA/BV-01-C",
                  pre_conditions_1 + init_server_2,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GPA/BV-02-C",
                  pre_conditions_1 + init_server_3,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GPA/BV-03-C",
                  pre_conditions_1 + init_server_1,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GPA/BV-04-C",
                  pre_conditions_1 + init_server_1,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GPA/BV-05-C",
                  pre_conditions_1 + init_server_3,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GPA/BV-06-C",
                  pre_conditions_1 + init_server_3,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GPA/BV-07-C",
                  pre_conditions_1 + init_server_1,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GPA/BV-08-C",
                  pre_conditions_1 + init_server_3,
                  generic_wid_hdl=gatt_wid_hdl),
        # TODO rewrite GATT/SR/GPA/BV-11-C
        ZTestCase("GATT", "GATT/SR/GPA/BV-11-C",
                  cmds=pre_conditions +
                  [TestFunc(btp.gatts_add_svc, 0, UUID.VND16_1),
                   TestFunc(btp.gatts_add_char, 0, Prop.read | Prop.write,
                            Perm.read, UUID.VND16_2),
                   TestFunc(btp.gatts_set_val, 0, '65'),
                   TestFunc(btp.gatts_add_desc, 0, Perm.read, UUID.CPF),
                   TestFunc(btp.gatts_set_val, 0, '04000127010100'),
                   TestFunc(btp.gatts_add_char, 0, Prop.read | Prop.write,
                            Perm.read, UUID.VND16_3),
                   TestFunc(btp.gatts_set_val, 0, '1234'),
                   TestFunc(btp.gatts_add_desc, 0, Perm.read, UUID.CPF),
                   TestFunc(btp.gatts_set_val, 0, '06001027010200'),
                   TestFunc(btp.gatts_add_char, 0, Prop.read | Prop.write,
                            Perm.read, UUID.VND16_5),
                   TestFunc(btp.gatts_set_val, 0, '651234'),
                   TestFunc(btp.gatts_add_desc, 0, Perm.read, UUID.CAF),
                   TestFunc(btp.gatts_set_val, 0, '13001600'),
                   TestFunc(btp.gatts_start_server)],
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/GPA/BV-12-C",
                  pre_conditions_1 + init_server_3,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/UNS/BI-01-C",
                  pre_conditions_1,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/SR/UNS/BI-02-C",
                  pre_conditions_1,
                  generic_wid_hdl=gatt_wid_hdl),
    ]

    return test_cases
示例#23
0
def test_cases_client(pts):
    """Returns a list of GATT Client test cases

    pts -- Instance of PyPTS

    """

    pts_bd_addr = pts.q_bd_addr
    stack = get_stack()

    pre_conditions = [TestFunc(btp.core_reg_svc_gap),
                      TestFunc(btp.gap_read_ctrl_info),
                      TestFunc(lambda: pts.update_pixit_param(
                          "GATT", "TSPX_bd_addr_iut",
                          stack.gap.iut_addr_get_str())),
                      TestFunc(btp.core_reg_svc_gatt),
                      TestFunc(btp.set_pts_addr, pts_bd_addr, Addr.le_public)]

    test_cases = [
        ZTestCase("GATT", "GATT/CL/GAC/BV-01-C",
                  pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAD/BV-01-C",
                  pre_conditions,
                  generic_wid_hdl=gattc_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAD/BV-02-C",
                  pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAD/BV-03-C",
                  pre_conditions,
                  generic_wid_hdl=gattc_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAD/BV-04-C",
                  pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAD/BV-05-C",
                  pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAD/BV-06-C",
                  pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAR/BV-01-C",
                  cmds=pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAR/BI-01-C",
                  cmds=pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAR/BI-02-C",
                  cmds=pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAR/BI-03-C",
                  cmds=pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAR/BI-04-C",
                  cmds=pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAR/BI-05-C",
                  cmds=pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAR/BI-06-C",
                  cmds=pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAR/BI-07-C",
                  cmds=pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAR/BI-09-C",
                  cmds=pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAR/BI-10-C",
                  cmds=pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAR/BI-11-C",
                  cmds=pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAR/BV-03-C",
                  cmds=pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAR/BV-04-C",
                  cmds=pre_conditions +
                  [TestFunc(btp.gap_conn, pts_bd_addr,
                            Addr.le_public, start_wid=2),
                   TestFunc(btp.gattc_read, Addr.le_public,
                            pts_bd_addr, MMI.arg_1, start_wid=48),
                   TestFunc(btp.gattc_read_rsp, store_val=True,
                            start_wid=48),
                   TestFunc(btp.gap_disconn, pts_bd_addr,
                            Addr.le_public, start_wid=3)],
                  verify_wids={52: btp.verify_description}),
        ZTestCase("GATT", "GATT/CL/GAR/BI-12-C",
                  cmds=pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAR/BI-13-C",
                  cmds=pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAR/BI-14-C",
                  cmds=pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAR/BI-15-C",
                  cmds=pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAR/BI-16-C",
                  cmds=pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAR/BI-17-C",
                  cmds=pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAR/BV-05-C",
                  cmds=pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAR/BI-18-C",
                  cmds=pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAR/BI-19-C",
                  cmds=pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAR/BI-20-C",
                  cmds=pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAR/BI-21-C",
                  cmds=pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAR/BI-22-C",
                  cmds=pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAR/BV-06-C",
                  cmds=pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAR/BV-07-C",
                  cmds=pre_conditions +
                  [TestFunc(btp.gap_conn, pts_bd_addr,
                            Addr.le_public, start_wid=2),
                   TestFunc(btp.gattc_read, Addr.le_public,
                            pts_bd_addr, MMI.arg_1, start_wid=58),
                   TestFunc(btp.gattc_read_rsp, store_val=True,
                            start_wid=58),
                   TestFunc(btp.gap_disconn, pts_bd_addr,
                            Addr.le_public, start_wid=3)],
                  verify_wids={52: btp.verify_description}),
        ZTestCase("GATT", "GATT/CL/GAR/BI-35-C",
                  cmds=pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAW/BV-01-C",
                  pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        # PTS issue #15965
        ZTestCase("GATT", "GATT/CL/GAW/BV-02-C",
                  pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAW/BV-03-C",
                  pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAW/BI-02-C",
                  pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAW/BI-03-C",
                  pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAW/BI-04-C",
                  pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAW/BI-05-C",
                  pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAW/BI-06-C",
                  pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAW/BV-05-C",
                  pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAW/BI-07-C",
                  pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAW/BI-08-C",
                  pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAW/BI-09-C",
                  pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAW/BI-11-C",
                  pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAW/BI-12-C",
                  pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAW/BI-13-C",
                  pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAW/BV-08-C",
                  pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAW/BV-09-C",
                  pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAW/BI-33-C",
                  pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAW/BI-34-C",
                  pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAN/BV-01-C",
                  cmds=pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAI/BV-01-C",
                  cmds=pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        ZTestCase("GATT", "GATT/CL/GAS/BV-01-C",
                  pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        # PTS CASE0036198
        ZTestCase("GATT", "GATT/CL/GAT/BV-01-C",
                  pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
        # PTS CASE0036198
        ZTestCase("GATT", "GATT/CL/GAT/BV-02-C",
                  pre_conditions,
                  generic_wid_hdl=gatt_wid_hdl),
    ]

    return test_cases
示例#24
0
def test_cases(ptses):
    """Returns a list of L2CAP test cases
    ptses -- list of PyPTS instances"""

    pts = ptses[0]

    pts_bd_addr = pts.q_bd_addr

    stack = get_stack()

    stack.gap_init(iut_device_name)

    common = [
        TestFunc(btp.core_reg_svc_gap),
        TestFunc(btp.core_reg_svc_l2cap),
        TestFunc(btp.gap_read_ctrl_info),
        TestFunc(lambda: pts.update_pixit_param("L2CAP", "TSPX_bd_addr_iut",
                                                stack.gap.iut_addr_get_str())),
        TestFunc(lambda: pts.update_pixit_param("L2CAP", "TSPX_bd_addr_iut_le",
                                                stack.gap.iut_addr_get_str())),
        TestFunc(lambda: pts.update_pixit_param(
            "L2CAP", "TSPX_iut_address_type_random", "TRUE"
            if stack.gap.iut_addr_is_random() else "FALSE")),
        TestFunc(btp.set_pts_addr, pts_bd_addr, Addr.le_public)
    ]

    pre_conditions = common + [
        TestFunc(stack.l2cap_init, le_psm, le_initial_mtu),
        TestFunc(btp.l2cap_le_listen, le_psm)
    ]
    pre_conditions_auth = common + [
        TestFunc(stack.l2cap_init, psm_authentication_required,
                 le_initial_mtu),
        TestFunc(btp.l2cap_le_listen, psm_authentication_required)
    ]
    pre_conditions_keysize = common + [
        TestFunc(stack.l2cap_init, psm_encryption_key_size_required,
                 le_initial_mtu),
        TestFunc(btp.l2cap_le_listen, psm_encryption_key_size_required)
    ]
    pre_conditions_author = common + [
        TestFunc(stack.l2cap_init, psm_authorization_required, le_initial_mtu),
        TestFunc(btp.l2cap_le_listen, psm_authorization_required)
    ]
    pre_conditions_eatt = common + [
        TestFunc(lambda: pts.update_pixit_param(
            "L2CAP", "TSPX_iut_supported_max_channels", "2")),
        TestFunc(stack.l2cap_init, le_psm_eatt, le_initial_mtu),
        TestFunc(btp.l2cap_le_listen, le_psm_eatt)
    ]
    pre_conditions_eatt_sec = common + [
        TestFunc(lambda: pts.update_pixit_param(
            "L2CAP", "TSPX_iut_supported_max_channels", "2")),
        TestFunc(stack.l2cap_init, le_psm_eatt, le_initial_mtu)
    ]

    custom_test_cases = [
        # Connection Parameter Update
        ZTestCase("L2CAP",
                  "L2CAP/LE/CFC/BV-04-C",
                  pre_conditions +
                  [TestFunc(lambda: stack.l2cap.psm_set(psm_unsupported))],
                  generic_wid_hdl=l2cap_wid_hdl),
        ZTestCase(
            "L2CAP",
            "L2CAP/LE/CFC/BV-10-C",
            pre_conditions + [
                TestFunc(
                    lambda: stack.l2cap.psm_set(psm_authentication_required))
            ],
            generic_wid_hdl=l2cap_wid_hdl),
        ZTestCase("L2CAP",
                  "L2CAP/LE/CFC/BV-11-C",
                  pre_conditions_auth,
                  generic_wid_hdl=l2cap_wid_hdl),
        ZTestCase(
            "L2CAP",
            "L2CAP/LE/CFC/BV-12-C",
            pre_conditions + [
                TestFunc(
                    lambda: stack.l2cap.psm_set(psm_authorization_required))
            ],
            generic_wid_hdl=l2cap_wid_hdl),
        ZTestCase("L2CAP",
                  "L2CAP/LE/CFC/BV-13-C",
                  pre_conditions_author,
                  generic_wid_hdl=l2cap_wid_hdl),
        ZTestCase("L2CAP",
                  "L2CAP/LE/CFC/BV-14-C",
                  pre_conditions + [
                      TestFunc(lambda: stack.l2cap.psm_set(
                          psm_encryption_key_size_required))
                  ],
                  generic_wid_hdl=l2cap_wid_hdl),
        ZTestCase("L2CAP",
                  "L2CAP/LE/CFC/BV-15-C",
                  pre_conditions_keysize,
                  generic_wid_hdl=l2cap_wid_hdl),
        # Enhanced Credit Based Flow Control Channel
        ZTestCase(
            "L2CAP",
            "L2CAP/ECFC/BV-11-C",
            pre_conditions_eatt_sec + [
                TestFunc(btp.l2cap_listen, le_psm_eatt, le_initial_mtu,
                         defs.L2CAP_TRANSPORT_LE, L2capSecLevels.authen, 0)
            ],
            generic_wid_hdl=l2cap_wid_hdl),
        ZTestCase(
            "L2CAP",
            "L2CAP/ECFC/BV-13-C",
            pre_conditions_eatt_sec + [
                TestFunc(btp.l2cap_listen, le_psm_eatt, le_initial_mtu,
                         defs.L2CAP_TRANSPORT_LE, L2capSecLevels.author, 0)
            ],
            generic_wid_hdl=l2cap_wid_hdl),
        ZTestCase(
            "L2CAP",
            "L2CAP/ECFC/BV-15-C",
            pre_conditions_eatt_sec + [
                TestFunc(btp.l2cap_listen, le_psm_eatt, le_initial_mtu,
                         defs.L2CAP_TRANSPORT_LE, L2capSecLevels.no_sec, 16)
            ],
            generic_wid_hdl=l2cap_wid_hdl),
        ZTestCase("L2CAP",
                  "L2CAP/ECFC/BV-23-C",
                  pre_conditions,
                  generic_wid_hdl=l2cap_wid_hdl),
        ZTestCase("L2CAP",
                  "L2CAP/ECFC/BI-01-C",
                  pre_conditions,
                  generic_wid_hdl=l2cap_wid_hdl),
        ZTestCase("L2CAP",
                  "L2CAP/COS/ECFC/BV-01-C",
                  pre_conditions_eatt,
                  generic_wid_hdl=l2cap_wid_hdl),
        ZTestCase("L2CAP",
                  "L2CAP/COS/ECFC/BV-02-C",
                  pre_conditions_eatt,
                  generic_wid_hdl=l2cap_wid_hdl),
        ZTestCase("L2CAP",
                  "L2CAP/COS/ECFC/BV-03-C",
                  pre_conditions_eatt,
                  generic_wid_hdl=l2cap_wid_hdl),
    ]

    test_case_name_list = pts.get_test_case_list('L2CAP')
    test_cases = []

    for tc_name in test_case_name_list:
        if tc_name.startswith('L2CAP/ECFC'):
            instance = ZTestCase('L2CAP',
                                 tc_name,
                                 pre_conditions_eatt,
                                 generic_wid_hdl=l2cap_wid_hdl)
        else:
            instance = ZTestCase('L2CAP',
                                 tc_name,
                                 pre_conditions,
                                 generic_wid_hdl=l2cap_wid_hdl)

        for custom_tc in custom_test_cases:
            if tc_name == custom_tc.name:
                instance = custom_tc
                break

        test_cases.append(instance)

    return test_cases
示例#25
0
文件: sm.py 项目: ryanjh/auto-pts
def test_cases(pts):
    """Returns a list of SM test cases
    pts -- Instance of PyPTS"""

    pts_bd_addr = pts.q_bd_addr

    stack = get_stack()
    iut_device_name = 'Tester'

    pre_conditions = [
        TestFunc(btp.core_reg_svc_gap),
        TestFunc(stack.gap_init, iut_device_name),
        TestFunc(btp.gap_read_ctrl_info),
        TestFunc(lambda: pts.update_pixit_param("SM", "TSPX_bd_addr_iut",
                                                stack.gap.iut_addr_get_str())),
        TestFunc(lambda: pts.update_pixit_param(
            "SM", "TSPX_iut_device_name_in_adv_packet_for_random_address",
            iut_device_name)),
        TestFunc(lambda: pts.update_pixit_param(
            "SM", "TSPX_peer_addr_type", "01"
            if stack.gap.iut_addr_is_random() else "00")),
        TestFunc(lambda: pts.update_pixit_param(
            "SM", "TSPX_Bonding_Flags", "01"
            if stack.gap.current_settings_get('Bondable') else "00")),
        # FIXME Find better place to store PTS bdaddr
        TestFunc(btp.set_pts_addr, pts_bd_addr, Addr.le_public)
    ]

    test_cases = [
        ZTestCase("SM",
                  "SM/MAS/PROT/BV-01-C",
                  pre_conditions,
                  generic_wid_hdl=sm_wid_hdl),
        ZTestCase("SM",
                  "SM/SLA/PROT/BV-02-C",
                  pre_conditions,
                  generic_wid_hdl=sm_wid_hdl),
        ZTestCase("SM",
                  "SM/SLA/JW/BV-02-C",
                  pre_conditions,
                  generic_wid_hdl=sm_wid_hdl),
        ZTestCase("SM",
                  "SM/MAS/JW/BV-05-C",
                  pre_conditions +
                  [TestFunc(btp.gap_set_io_cap, IOCap.display_only)],
                  generic_wid_hdl=sm_wid_hdl),
        ZTestCase("SM",
                  "SM/MAS/JW/BI-01-C",
                  pre_conditions +
                  [TestFunc(btp.gap_set_io_cap, IOCap.display_only)],
                  generic_wid_hdl=sm_wid_hdl),
        ZTestCase("SM",
                  "SM/SLA/JW/BI-02-C",
                  pre_conditions,
                  generic_wid_hdl=sm_wid_hdl),
        ZTestCase("SM",
                  "SM/SLA/JW/BI-03-C",
                  pre_conditions,
                  generic_wid_hdl=sm_wid_hdl),
        ZTestCase("SM",
                  "SM/MAS/JW/BI-04-C",
                  pre_conditions +
                  [TestFunc(btp.gap_set_io_cap, IOCap.display_only)],
                  generic_wid_hdl=sm_wid_hdl),
        ZTestCase("SM",
                  "SM/MAS/PKE/BV-01-C",
                  pre_conditions + [
                      TestFunc(btp.gap_set_io_cap, IOCap.display_only),
                      TestFunc(btp.gap_set_bondable_off)
                  ],
                  generic_wid_hdl=sm_wid_hdl),
        ZTestCase("SM",
                  "SM/SLA/PKE/BV-02-C",
                  pre_conditions +
                  [TestFunc(btp.gap_set_io_cap, IOCap.display_only)],
                  generic_wid_hdl=sm_wid_hdl),
        ZTestCase("SM",
                  "SM/MAS/PKE/BV-04-C",
                  pre_conditions +
                  [TestFunc(btp.gap_set_io_cap, IOCap.display_only)],
                  generic_wid_hdl=sm_wid_hdl),
        ZTestCase("SM",
                  "SM/SLA/PKE/BV-05-C",
                  pre_conditions +
                  [TestFunc(btp.gap_set_io_cap, IOCap.display_only)],
                  generic_wid_hdl=sm_wid_hdl),
        ZTestCase("SM",
                  "SM/MAS/PKE/BI-01-C",
                  pre_conditions +
                  [TestFunc(btp.gap_set_io_cap, IOCap.display_only)],
                  generic_wid_hdl=sm_wid_hdl),
        ZTestCase("SM",
                  "SM/MAS/PKE/BI-02-C",
                  pre_conditions +
                  [TestFunc(btp.gap_set_io_cap, IOCap.display_only)],
                  generic_wid_hdl=sm_wid_hdl),
        ZTestCase("SM",
                  "SM/MAS/SCJW/BV-01-C",
                  pre_conditions + [
                      TestFunc(btp.gap_set_io_cap, IOCap.display_only),
                      TestFunc(btp.gap_set_bondable_off),
                  ],
                  generic_wid_hdl=sm_wid_hdl),
        ZTestCase("SM",
                  "SM/MAS/SCJW/BV-04-C",
                  pre_conditions + [
                      TestFunc(btp.gap_set_io_cap, IOCap.display_only),
                      TestFunc(btp.gap_set_bondable_off),
                  ],
                  generic_wid_hdl=sm_wid_hdl),
        ZTestCase("SM",
                  "SM/MAS/SCPK/BV-01-C",
                  pre_conditions + [
                      TestFunc(btp.gap_set_io_cap, IOCap.display_only),
                      TestFunc(btp.gap_set_bondable_off),
                  ],
                  generic_wid_hdl=sm_wid_hdl),
        ZTestCase("SM",
                  "SM/MAS/SCPK/BV-04-C",
                  pre_conditions + [
                      TestFunc(btp.gap_set_io_cap, IOCap.display_only),
                      TestFunc(btp.gap_set_bondable_off),
                  ],
                  generic_wid_hdl=sm_wid_hdl),
        ZTestCase("SM",
                  "SM/MAS/SCPK/BI-01-C",
                  pre_conditions + [
                      TestFunc(btp.gap_set_io_cap, IOCap.display_only),
                      TestFunc(btp.gap_set_bondable_off),
                  ],
                  generic_wid_hdl=sm_wid_hdl),
        ZTestCase("SM",
                  "SM/MAS/SCPK/BI-02-C",
                  pre_conditions + [
                      TestFunc(btp.gap_set_io_cap, IOCap.display_only),
                      TestFunc(btp.gap_set_bondable_on),
                  ],
                  generic_wid_hdl=sm_wid_hdl),
        ZTestCase("SM",
                  "SM/SLA/SCJW/BV-02-C",
                  pre_conditions + [
                      TestFunc(btp.gap_set_io_cap, IOCap.display_only),
                      TestFunc(btp.gap_set_bondable_off),
                  ],
                  generic_wid_hdl=sm_wid_hdl),
        ZTestCase("SM",
                  "SM/SLA/SCJW/BV-03-C",
                  pre_conditions + [
                      TestFunc(btp.gap_set_io_cap, IOCap.display_only),
                      TestFunc(btp.gap_set_bondable_off),
                  ],
                  generic_wid_hdl=sm_wid_hdl),
        ZTestCase("SM",
                  "SM/SLA/PKE/BI-03-C",
                  pre_conditions +
                  [TestFunc(btp.gap_set_io_cap, IOCap.display_only)],
                  generic_wid_hdl=sm_wid_hdl),
        ZTestCase("SM",
                  "SM/MAS/OOB/BV-05-C",
                  pre_conditions +
                  [TestFunc(btp.gap_set_io_cap, IOCap.display_only)],
                  generic_wid_hdl=sm_wid_hdl),
        ZTestCase("SM",
                  "SM/SLA/OOB/BV-06-C",
                  pre_conditions +
                  [TestFunc(btp.gap_set_io_cap, IOCap.display_only)],
                  generic_wid_hdl=sm_wid_hdl),
        ZTestCase("SM",
                  "SM/MAS/OOB/BV-07-C",
                  pre_conditions +
                  [TestFunc(btp.gap_set_io_cap, IOCap.display_only)],
                  generic_wid_hdl=sm_wid_hdl),
        ZTestCase("SM",
                  "SM/SLA/OOB/BV-08-C",
                  pre_conditions +
                  [TestFunc(btp.gap_set_io_cap, IOCap.display_only)],
                  generic_wid_hdl=sm_wid_hdl),
        ZTestCase("SM",
                  "SM/MAS/EKS/BV-01-C",
                  pre_conditions +
                  [TestFunc(btp.gap_set_io_cap, IOCap.display_only)],
                  generic_wid_hdl=sm_wid_hdl),
        ZTestCase("SM",
                  "SM/SLA/EKS/BV-02-C",
                  pre_conditions +
                  [TestFunc(btp.gap_set_io_cap, IOCap.display_only)],
                  generic_wid_hdl=sm_wid_hdl),
        ZTestCase("SM",
                  "SM/MAS/EKS/BI-01-C",
                  pre_conditions +
                  [TestFunc(btp.gap_set_io_cap, IOCap.display_only)],
                  generic_wid_hdl=sm_wid_hdl),
        ZTestCase("SM",
                  "SM/SLA/EKS/BI-02-C",
                  pre_conditions +
                  [TestFunc(btp.gap_set_io_cap, IOCap.display_only)],
                  generic_wid_hdl=sm_wid_hdl),
        ZTestCase("SM",
                  "SM/MAS/SIGN/BV-01-C",
                  pre_conditions + [
                      TestFunc(btp.gap_set_io_cap, IOCap.display_only),
                      TestFunc(btp.core_reg_svc_gatt)
                  ],
                  generic_wid_hdl=sm_wid_hdl),
        ZTestCase("SM",
                  "SM/MAS/SIGN/BV-03-C",
                  pre_conditions +
                  [TestFunc(btp.gap_set_io_cap, IOCap.display_only)],
                  generic_wid_hdl=sm_wid_hdl),
        ZTestCase("SM",
                  "SM/MAS/SIGN/BI-01-C",
                  pre_conditions +
                  [TestFunc(btp.gap_set_io_cap, IOCap.display_only)],
                  generic_wid_hdl=sm_wid_hdl),
        ZTestCase("SM",
                  "SM/SLA/KDU/BV-01-C",
                  pre_conditions +
                  [TestFunc(btp.gap_set_io_cap, IOCap.display_only)],
                  generic_wid_hdl=sm_wid_hdl),
        ZTestCase("SM",
                  "SM/SLA/KDU/BV-02-C",
                  pre_conditions +
                  [TestFunc(btp.gap_set_io_cap, IOCap.display_only)],
                  generic_wid_hdl=sm_wid_hdl),
        ZTestCase("SM",
                  "SM/SLA/KDU/BV-03-C",
                  pre_conditions +
                  [TestFunc(btp.gap_set_io_cap, IOCap.display_only)],
                  generic_wid_hdl=sm_wid_hdl),
        ZTestCase("SM",
                  "SM/MAS/KDU/BV-04-C",
                  pre_conditions +
                  [TestFunc(btp.gap_set_io_cap, IOCap.display_only)],
                  generic_wid_hdl=sm_wid_hdl),
        ZTestCase("SM",
                  "SM/MAS/KDU/BV-05-C",
                  pre_conditions +
                  [TestFunc(btp.gap_set_io_cap, IOCap.display_only)],
                  generic_wid_hdl=sm_wid_hdl),
        ZTestCase("SM",
                  "SM/MAS/KDU/BV-06-C",
                  pre_conditions +
                  [TestFunc(btp.gap_set_io_cap, IOCap.display_only)],
                  generic_wid_hdl=sm_wid_hdl),
        ZTestCase("SM",
                  "SM/SLA/KDU/BI-01-C",
                  pre_conditions +
                  [TestFunc(btp.gap_set_io_cap, IOCap.display_only)],
                  generic_wid_hdl=sm_wid_hdl),
        ZTestCase("SM",
                  "SM/MAS/KDU/BI-01-C",
                  pre_conditions +
                  [TestFunc(btp.gap_set_io_cap, IOCap.display_only)],
                  generic_wid_hdl=sm_wid_hdl),
        ZTestCase("SM",
                  "SM/SLA/KDU/BV-07-C",
                  pre_conditions +
                  [TestFunc(btp.gap_set_io_cap, IOCap.display_only)],
                  generic_wid_hdl=sm_wid_hdl),
        ZTestCase("SM",
                  "SM/SLA/SIP/BV-01-C",
                  pre_conditions +
                  [TestFunc(btp.gap_set_io_cap, IOCap.keyboard_display)],
                  generic_wid_hdl=sm_wid_hdl),
        ZTestCase("SM",
                  "SM/MAS/SIP/BV-02-C",
                  pre_conditions +
                  [TestFunc(btp.gap_set_io_cap, IOCap.keyboard_display)],
                  generic_wid_hdl=sm_wid_hdl),
        ZTestCase("SM",
                  "SM/SLA/SIE/BV-01-C",
                  pre_conditions + [
                      TestFunc(btp.gap_set_io_cap, IOCap.no_input_output),
                  ],
                  generic_wid_hdl=sm_wid_hdl),
    ]

    return test_cases
示例#26
0
def hdl_wid_1002(desc):
    stack = get_stack()
    return stack.gap.get_passkey()
示例#27
0
def hdl_wid_24(desc):
    stack = get_stack()

    btp.gap_adv_ind_on(ad=stack.gap.ad)

    return True
示例#28
0
def hdl_wid_1(desc):
    stack = get_stack()
    btp.gap_set_conn()
    btp.gap_set_gendiscov()
    btp.gap_adv_ind_on(ad=stack.gap.ad)
    return True
示例#29
0
def hdl_wid_255(desc):
    stack = get_stack()
    l2cap = stack.l2cap

    btp.l2cap_conn(None, None, l2cap.psm, l2cap.initial_mtu, 2)
    return True
示例#30
0
def hdl_wid_254(desc):
    # TODO: Fix to actually verify result of 'Insufficient Encryption Key Size' 0x0007 error
    return get_stack().l2cap.wait_for_disconnection(0, 30)