diff options
92 files changed, 27509 insertions, 26172 deletions
diff --git a/acts/framework/acts/controllers/power_metrics.py b/acts/framework/acts/controllers/power_metrics.py new file mode 100644 index 0000000000..f68edccbfc --- /dev/null +++ b/acts/framework/acts/controllers/power_metrics.py @@ -0,0 +1,420 @@ +#!/usr/bin/env python3 +# +# Copyright 2019 - The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the 'License'); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an 'AS IS' BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import math + +# Metrics timestamp keys +START_TIMESTAMP = 'start' +END_TIMESTAMP = 'end' + +# Unit type constants +CURRENT = 'current' +POWER = 'power' +TIME = 'time' +VOLTAGE = 'voltage' + +# Unit constants +MILLIVOLT = 'mV' +VOLT = 'V' +MILLIAMP = 'mA' +AMP = 'A' +AMPERE = AMP +MILLIWATT = 'mW' +WATT = 'W' +MILLISECOND = 'ms' +SECOND = 's' +MINUTE = 'm' +HOUR = 'h' + +CONVERSION_TABLES = { + CURRENT: { + MILLIAMP: 0.001, + AMP: 1 + }, + POWER: { + MILLIWATT: 0.001, + WATT: 1 + }, + TIME: { + MILLISECOND: 0.001, + SECOND: 1, + MINUTE: 60, + HOUR: 3600 + }, + VOLTAGE: { + MILLIVOLT: 0.001, + VOLT : 1 + } +} + + +class AbsoluteThresholds(object): + """Class to represent thresholds in absolute (non-relative) values. + + Attributes: + lower: Lower limit of the threshold represented by a measurement. + upper: Upper limit of the threshold represented by a measurement. + unit_type: Type of the unit (current, power, etc). + unit: The unit for this threshold (W, mW, uW). + """ + + def __init__(self, lower, upper, unit_type, unit): + self.unit_type = unit_type + self.unit = unit + self.lower = Metric(lower, unit_type, unit) + self.upper = Metric(upper, unit_type, unit) + + @staticmethod + def from_percentual_deviation(expected, percentage, unit_type, unit): + """Creates an AbsoluteThresholds object from an expected value and its + allowed percentual deviation (also in terms of the expected value). + + For example, if the expected value is 20 and the deviation 25%, this + would imply that the absolute deviation is 20 * 0.25 = 5 and therefore + the absolute threshold would be from (20-5, 20+5) or (15, 25). + + Args: + expected: Central value from which the deviation will be estimated. + percentage: Percentage of allowed deviation, the percentage itself + is in terms of the expected value. + unit_type: Type of the unit (current, power, etc). + unit: Unit for this threshold (W, mW, uW). + """ + return AbsoluteThresholds(expected * (1 - percentage / 100), + expected * (1 + percentage / 100), + unit_type, + unit) + + @staticmethod + def from_threshold_conf(thresholds_conf): + """Creates a AbsoluteThresholds object from a ConfigWrapper describing + a threshold (either absolute or percentual). + + Args: + thresholds_conf: ConfigWrapper object that describes a threshold. + Returns: + AbsolutesThresholds object. + Raises: + ValueError if configuration is incorrect or incomplete. + """ + if 'unit_type' not in thresholds_conf: + raise ValueError( + 'A threshold config must contain a unit_type. %s is incorrect' + % str(thresholds_conf)) + + if 'unit' not in thresholds_conf: + raise ValueError( + 'A threshold config must contain a unit. %s is incorrect' + % str(thresholds_conf)) + + unit_type = thresholds_conf['unit_type'] + unit = thresholds_conf['unit'] + + is_relative = ( + 'expected_value' in thresholds_conf and + 'percent_deviation' in thresholds_conf) + + is_almost_relative = ( + 'expected_value' in thresholds_conf or + 'percent_deviation' in thresholds_conf) + + is_absolute = ('lower_limit' in thresholds_conf or + 'upper_limit' in thresholds_conf) + + if is_absolute and is_almost_relative: + raise ValueError( + 'Thresholds can either be absolute (with lower_limit and' + 'upper_limit defined) or by percentual deviation (with' + 'expected_value and percent_deviation defined), but never' + 'a mixture of both. %s is incorrect' + % str(thresholds_conf)) + + if is_almost_relative and not is_relative: + if 'expected_value' not in thresholds_conf: + raise ValueError( + 'Incomplete definition of a threshold by percentual ' + 'deviation. percent_deviation given, but missing ' + 'expected_value. %s is incorrect' + % str(thresholds_conf)) + + if 'percent_deviation' not in thresholds_conf: + raise ValueError( + 'Incomplete definition of a threshold by percentual ' + 'deviation. expected_value given, but missing ' + 'percent_deviation. %s is incorrect' + % str(thresholds_conf)) + + if not is_absolute and not is_relative: + raise ValueError( + 'Thresholds must be either absolute (with lower_limit and' + 'upper_limit defined) or defined by percentual deviation (with' + 'expected_value and percent_deviation defined). %s is incorrect' + % str(thresholds_conf)) + + if is_relative: + expected = thresholds_conf.get_numeric('expected_value') + percent = thresholds_conf.get_numeric('percent_deviation') + + thresholds = ( + AbsoluteThresholds.from_percentual_deviation( + expected, + percent, + unit_type, unit)) + + else: + lower_value = thresholds_conf.get_numeric('lower_limit', + float('-inf')) + upper_value = thresholds_conf.get_numeric('upper_limit', + float('inf')) + thresholds = AbsoluteThresholds(lower_value, upper_value, unit_type, + unit) + return thresholds + + +class Metric(object): + """Base class for describing power measurement values. Each object contains + an value and a unit. Enables some basic arithmetic operations with other + measurements of the same unit type. + + Attributes: + value: Numeric value of the measurement + _unit_type: Unit type of the measurement (e.g. current, power) + unit: Unit of the measurement (e.g. W, mA) + """ + + def __init__(self, value, unit_type, unit, name=None): + if unit_type not in CONVERSION_TABLES: + raise TypeError( + '%s is not a valid unit type, valid unit types are %s' % ( + unit_type, str(CONVERSION_TABLES.keys))) + self.value = value + self.unit = unit + self.name = name + self._unit_type = unit_type + + # Convenience constructor methods + @staticmethod + def amps(amps, name=None): + """Create a new current measurement, in amps.""" + return Metric(amps, CURRENT, AMP, name=name) + + @staticmethod + def watts(watts, name=None): + """Create a new power measurement, in watts.""" + return Metric(watts, POWER, WATT, name=name) + + @staticmethod + def seconds(seconds, name=None): + """Create a new time measurement, in seconds.""" + return Metric(seconds, TIME, SECOND, name=name) + + # Comparison methods + + def __eq__(self, other): + return self.value == other.to_unit(self.unit).value + + def __lt__(self, other): + return self.value < other.to_unit(self.unit).value + + def __le__(self, other): + return self == other or self < other + + # Addition and subtraction with other measurements + + def __add__(self, other): + """Adds measurements of compatible unit types. The result will be in the + same units as self. + """ + return Metric(self.value + other.to_unit(self.unit).value, + self._unit_type, self.unit, name=self.name) + + def __sub__(self, other): + """Subtracts measurements of compatible unit types. The result will be + in the same units as self. + """ + return Metric(self.value - other.to_unit(self.unit).value, + self._unit_type, self.unit, name=self.name) + + # String representation + + def __str__(self): + return '%g%s' % (self.value, self.unit) + + def __repr__(self): + return str(self) + + def to_unit(self, new_unit): + """Create an equivalent measurement under a different unit. + e.g. 0.5W -> 500mW + + Args: + new_unit: Target unit. Must be compatible with current unit. + + Returns: A new measurement with the converted value and unit. + """ + try: + new_value = self.value * ( + CONVERSION_TABLES[self._unit_type][self.unit] / + CONVERSION_TABLES[self._unit_type][new_unit]) + except KeyError: + raise TypeError('Incompatible units: %s, %s' % + (self.unit, new_unit)) + return Metric(new_value, self._unit_type, new_unit, self.name) + + +def import_raw_data(path): + """Create a generator from a Monsoon data file. + + Args: + path: path to raw data file + + Returns: generator that yields (timestamp, sample) per line + """ + with open(path, 'r') as f: + for line in f: + time, sample = line.split() + yield float(time[:-1]), float(sample) + + +def generate_test_metrics(raw_data, timestamps=None, + voltage=None): + """Split the data into individual test metrics, based on the timestamps + given as a dict. + + Args: + raw_data: raw data as list or generator of (timestamp, sample) + timestamps: dict following the output format of + instrumentation_proto_parser.get_test_timestamps() + voltage: voltage used during measurements + """ + + # Initialize metrics for each test + if timestamps is None: + timestamps = {} + test_starts = {} + test_ends = {} + test_metrics = {} + for seg_name, times in timestamps.items(): + test_metrics[seg_name] = PowerMetrics(voltage) + try: + test_starts[seg_name] = Metric( + times[START_TIMESTAMP], TIME, MILLISECOND).to_unit( + SECOND).value + except KeyError: + raise ValueError( + 'Missing start timestamp for test scenario "%s". Refer to ' + 'instrumentation_proto.txt for details.' % seg_name) + try: + test_ends[seg_name] = Metric( + times[END_TIMESTAMP], TIME, MILLISECOND).to_unit( + SECOND).value + except KeyError: + raise ValueError( + 'Missing end timestamp for test scenario "%s". Test ' + 'scenario may have terminated with errors. Refer to ' + 'instrumentation_proto.txt for details.' % seg_name) + + # Assign data to tests based on timestamps + for timestamp, amps in raw_data: + for seg_name in timestamps: + if test_starts[seg_name] <= timestamp <= test_ends[seg_name]: + test_metrics[seg_name].update_metrics(amps) + + result = {} + for seg_name, power_metrics in test_metrics.items(): + result[seg_name] = [ + power_metrics.avg_current, + power_metrics.max_current, + power_metrics.min_current, + power_metrics.stdev_current, + power_metrics.avg_power] + return result + + +class PowerMetrics(object): + """Class for processing raw power metrics generated by Monsoon measurements. + Provides useful metrics such as average current, max current, and average + power. Can generate individual test metrics. + + See section "Numeric metrics" below for available metrics. + """ + + def __init__(self, voltage): + """Create a PowerMetrics. + + Args: + voltage: Voltage of the measurement + """ + self._voltage = voltage + self._num_samples = 0 + self._sum_currents = 0 + self._sum_squares = 0 + self._max_current = None + self._min_current = None + self.test_metrics = {} + + def update_metrics(self, sample): + """Update the running metrics with the current sample. + + Args: + sample: A current sample in Amps. + """ + self._num_samples += 1 + self._sum_currents += sample + self._sum_squares += sample ** 2 + if self._max_current is None or sample > self._max_current: + self._max_current = sample + if self._min_current is None or sample < self._min_current: + self._min_current = sample + + # Numeric metrics + @property + def avg_current(self): + """Average current, in milliamps.""" + if not self._num_samples: + return Metric.amps(0).to_unit(MILLIAMP) + return (Metric.amps(self._sum_currents / self._num_samples, + 'avg_current') + .to_unit(MILLIAMP)) + + @property + def max_current(self): + """Max current, in milliamps.""" + return Metric.amps(self._max_current or 0, 'max_current').to_unit( + MILLIAMP) + + @property + def min_current(self): + """Min current, in milliamps.""" + return Metric.amps(self._min_current or 0, 'min_current').to_unit( + MILLIAMP) + + @property + def stdev_current(self): + """Standard deviation of current values, in milliamps.""" + if self._num_samples < 2: + return Metric.amps(0, 'stdev_current').to_unit(MILLIAMP) + stdev = math.sqrt( + (self._sum_squares - ( + self._num_samples * self.avg_current.to_unit(AMP).value ** 2)) + / (self._num_samples - 1)) + return Metric.amps(stdev, 'stdev_current').to_unit(MILLIAMP) + + @property + def avg_power(self): + """Average power, in milliwatts.""" + return Metric.watts(self.avg_current.to_unit(AMP).value * self._voltage, + 'avg_power').to_unit(MILLIWATT) diff --git a/acts/framework/acts/controllers/power_monitor.py b/acts/framework/acts/controllers/power_monitor.py index eb13f54c00..694edd0208 100644 --- a/acts/framework/acts/controllers/power_monitor.py +++ b/acts/framework/acts/controllers/power_monitor.py @@ -14,6 +14,11 @@ # See the License for the specific language governing permissions and # limitations under the License. +import tempfile +import logging +from acts.controllers.monsoon_lib.api.common import MonsoonError +from acts.controllers import power_metrics + class ResourcesRegistryError(Exception): pass @@ -45,3 +50,130 @@ def update_registry(registry): def get_registry(): return _REGISTRY + + +def _write_raw_data_in_standard_format(raw_data, path, start_time): + """Writes the raw data to a file in (seconds since epoch, amps). + + TODO(b/155294049): Deprecate this once Monsoon controller output + format is updated. + + Args: + start_time: Measurement start time in seconds since epoch + raw_data: raw data as list or generator of (timestamp, sample) + path: path to write output + """ + with open(path, 'w') as f: + for timestamp, amps in raw_data: + f.write('%s %s\n' % + (timestamp + start_time, amps)) + + +class BasePowerMonitor(object): + + def setup(self, **kwargs): + raise NotImplementedError() + + def connect_usb(self, **kwargs): + raise NotImplementedError() + + def measure(self, **kwargs): + raise NotImplementedError() + + def release_resources(self, **kwargs): + raise NotImplementedError() + + def disconnect_usb(self, **kwargs): + raise NotImplementedError() + + def get_metrics(self, **kwargs): + raise NotImplementedError() + + def teardown(self, **kwargs): + raise NotImplementedError() + + +class PowerMonitorMonsoonFacade(BasePowerMonitor): + + def __init__(self, monsoon): + """Constructs a PowerMonitorFacade. + + Args: + monsoon: delegate monsoon object, either + acts.controllers.monsoon_lib.api.hvpm.monsoon.Monsoon or + acts.controllers.monsoon_lib.api.lvpm_stock.monsoon.Monsoon. + """ + self.monsoon = monsoon + self._log = logging.getLogger() + + def setup(self, monsoon_config=None, **__): + """Set up the Monsoon controller for this testclass/testcase.""" + + if monsoon_config is None: + raise MonsoonError('monsoon_config can not be None') + + self._log.info('Setting up Monsoon %s' % self.monsoon.serial) + voltage = monsoon_config.get_numeric('voltage', 4.2) + self.monsoon.set_voltage_safe(voltage) + if 'max_current' in monsoon_config: + self.monsoon.set_max_current( + monsoon_config.get_numeric('max_current')) + + def connect_usb(self, **__): + self.monsoon.usb('on') + + def measure(self, measurement_args=None, start_time=None, + output_path=None, **__): + if measurement_args is None: + raise MonsoonError('measurement_args can not be None') + + with tempfile.NamedTemporaryFile(prefix='monsoon_') as tmon: + self.monsoon.measure_power(**measurement_args, + output_path=tmon.name) + + if output_path and start_time is not None: + _write_raw_data_in_standard_format( + power_metrics.import_raw_data(tmon.name), + output_path, + start_time) + + def release_resources(self, **__): + # nothing to do + pass + + def disconnect_usb(self, **__): + self.monsoon.usb('off') + + def get_metrics(self, start_time=None, voltage=None, monsoon_file_path=None, + timestamps=None, **__): + """Parses a monsoon_file_path to compute the consumed power and other + power related metrics. + + Args: + start_time: Time when the measurement started, this is used to + correlate timestamps from the device and from the power samples. + voltage: Voltage used when the measurement started. Used to compute + power from current. + monsoon_file_path: Path to a monsoon file. + timestamps: Named timestamps delimiting the segments of interest. + **__: + + Returns: + A list of power_metrics.Metric. + """ + if start_time is None: + raise MonsoonError('start_time can not be None') + if voltage is None: + raise MonsoonError('voltage can not be None') + if monsoon_file_path is None: + raise MonsoonError('monsoon_file_path can not be None') + if timestamps is None: + raise MonsoonError('timestamps can not be None') + + return power_metrics.generate_test_metrics( + power_metrics.import_raw_data(monsoon_file_path), + timestamps=timestamps, voltage=voltage) + + def teardown(self, **__): + # nothing to do + pass diff --git a/acts/framework/acts/test_utils/gnss/gnss_testlog_utils.py b/acts/framework/acts/test_utils/gnss/gnss_testlog_utils.py index 1611018b8b..54d47d789e 100644 --- a/acts/framework/acts/test_utils/gnss/gnss_testlog_utils.py +++ b/acts/framework/acts/test_utils/gnss/gnss_testlog_utils.py @@ -117,11 +117,12 @@ CONFIG_GPSTTFFLOG = { r'(?P<start_datetime>\d+\/\d+\/\d+-\d+:\d+:\d+.\d+)\s+' r'(?P<stop_datetime>\d+\/\d+\/\d+-\d+:\d+:\d+.\d+)\s+' r'(?P<ttff>\d+.\d+)\s+' - r'\[Avg Top4 : (?P<avg_top4_cn0>\d+.\d+)\]\s' - r'\[Avg : (?P<avg_cn0>\d+.\d+)\]\s+\[(?P<fix_type>\d+\w+ fix)\]\s+' + r'\[Antenna_Avg Top4 : (?P<ant_avg_top4_cn0>\d+.\d+)\]\s' + r'\[Antenna_Avg : (?P<ant_avg_cn0>\d+.\d+)\]\s' + r'\[Baseband_Avg Top4 : (?P<bb_avg_top4_cn0>\d+.\d+)\]\s' + r'\[Baseband_Avg : (?P<<bb_avg_cn0>\d+.\d+)\]\s+\[(?P<fix_type>\d+\w+ fix)\]\s+' r'\[Satellites used for fix : (?P<satnum_for_fix>\d+)\]' } - LOGPARSE_UTIL_LOGGER = logger.create_logger() diff --git a/acts/framework/acts/test_utils/tel/tel_data_utils.py b/acts/framework/acts/test_utils/tel/tel_data_utils.py index 3dbe92d46d..3b6207eac6 100644 --- a/acts/framework/acts/test_utils/tel/tel_data_utils.py +++ b/acts/framework/acts/test_utils/tel/tel_data_utils.py @@ -22,11 +22,14 @@ from acts.utils import rand_ascii_str from acts.test_utils.tel.tel_subscription_utils import \ get_subid_from_slot_index from acts.test_utils.tel.tel_subscription_utils import set_subid_for_data +from acts.test_utils.tel.tel_subscription_utils import get_outgoing_message_sub_id +from acts.test_utils.tel.tel_subscription_utils import get_outgoing_voice_sub_id from acts.test_utils.tel.tel_defines import MAX_WAIT_TIME_NW_SELECTION from acts.test_utils.tel.tel_defines import NETWORK_SERVICE_DATA from acts.test_utils.tel.tel_defines import WAIT_TIME_ANDROID_STATE_SETTLING from acts.test_utils.tel.tel_defines import WAIT_TIME_BETWEEN_STATE_CHECK from acts.test_utils.tel.tel_defines import MAX_WAIT_TIME_FOR_STATE_CHANGE +from acts.test_utils.tel.tel_defines import WAIT_TIME_AFTER_REBOOT from acts.test_utils.tel.tel_subscription_utils import get_default_data_sub_id from acts.test_utils.tel.tel_test_utils import start_youtube_video from acts.test_utils.tel.tel_test_utils import start_wifi_tethering @@ -607,3 +610,108 @@ def browsing_test(log, ad, wifi_ssid=None, pass_threshold_in_mb = 1.0): usage = "unknown" ad.log.info("Usage of browsing: %s MB" % usage) return False + +def reboot_test(log, ad, wifi_ssid=None): + """ Reboot test to verify the service availability after reboot. + + Test procedure: + 1. Reboot + 2. Wait WAIT_TIME_AFTER_REBOOT for reboot complete. + 3. Check service state. False will be returned if service state is not "IN_SERVICE". + 4. Check if network is connected. False will be returned if not. + 5. Check if cellular data or Wi-Fi connection is available. False will be returned if not. + 6. Check if internet connection is available. False will be returned if not. + 7. Check if DSDS mode, data sub ID, voice sub ID and message sub ID still keep the same. + + Args: + log: log object. + ad: android object. + wifi_ssid: SSID of Wi-Fi AP for Wi-Fi connection. + + Returns: + True if pass; False if fail. + """ + try: + wifi_connected = False + if wifi_ssid and check_is_wifi_connected(ad.log, ad, wifi_ssid): + wifi_connected = True + + data_subid = get_default_data_sub_id(ad) + voice_subid = get_outgoing_voice_sub_id(ad) + sms_subid = get_outgoing_message_sub_id(ad) + + ad.reboot() + time.sleep(WAIT_TIME_AFTER_REBOOT) + + if not wait_for_state( + get_service_state_by_adb, + "IN_SERVICE", + MAX_WAIT_TIME_FOR_STATE_CHANGE, + WAIT_TIME_BETWEEN_STATE_CHECK, + log, + ad): + ad.log.error("Current service state: %s" % service_state) + return False + + if not ad.droid.connectivityNetworkIsConnected(): + ad.log.error("Network is NOT connected!") + return False + + if wifi_connected: + if not check_is_wifi_connected(ad.log, ad, wifi_ssid): + return False + else: + if not wait_for_cell_data_connection(log, ad, True): + ad.log.error("Failed to enable data connection.") + return False + + if not verify_internet_connection(log, ad): + ad.log.error("Internet connection is not available") + return False + + sim_mode = ad.droid.telephonyGetPhoneCount() + if hasattr(ad, "dsds"): + if sim_mode == 1: + ad.log.error("Phone is in single SIM mode after reboot.") + return False + elif sim_mode == 2: + ad.log.info("Phone keeps being in dual SIM mode after reboot.") + else: + if sim_mode == 1: + ad.log.info("Phone keeps being in single SIM mode after reboot.") + elif sim_mode == 2: + ad.log.error("Phone is in dual SIM mode after reboot.") + return False + + data_subid_after_reboot = get_default_data_sub_id(ad) + if data_subid_after_reboot != data_subid: + ad.log.error( + "Data sub ID changed! (Before reboot: %s; after reboot: %s)", + data_subid, data_subid_after_reboot) + return False + else: + ad.log.info("Data sub ID does not change after reboot.") + + voice_subid_after_reboot = get_outgoing_voice_sub_id(ad) + if voice_subid_after_reboot != voice_subid: + ad.log.error( + "Voice sub ID changed! (Before reboot: %s; after reboot: %s)", + voice_subid, voice_subid_after_reboot) + return False + else: + ad.log.info("Voice sub ID does not change after reboot.") + + sms_subid_after_reboot = get_outgoing_message_sub_id(ad) + if sms_subid_after_reboot != sms_subid: + ad.log.error( + "Message sub ID changed! (Before reboot: %s; after reboot: %s)", + sms_subid, sms_subid_after_reboot) + return False + else: + ad.log.info("Message sub ID does not change after reboot.") + + except Exception as e: + ad.log.error(e) + return False + + return True
\ No newline at end of file diff --git a/acts/framework/acts/test_utils/tel/tel_test_utils.py b/acts/framework/acts/test_utils/tel/tel_test_utils.py index d863c9c6d0..b0ef193221 100644 --- a/acts/framework/acts/test_utils/tel/tel_test_utils.py +++ b/acts/framework/acts/test_utils/tel/tel_test_utils.py @@ -41,7 +41,8 @@ from acts.controllers.android_device import DEFAULT_SDM_LOG_PATH from acts.controllers.android_device import SL4A_APK_NAME from acts.libs.proc import job from acts.test_utils.tel.loggers.protos.telephony_metric_pb2 import TelephonyVoiceTestResult -from acts.test_utils.tel.tel_defines import CarrierConfigs +from acts.test_utils.tel.tel_defines import CarrierConfigs, CARRIER_NTT_DOCOMO, CARRIER_KDDI, CARRIER_RAKUTEN, \ + CARRIER_SBM from acts.test_utils.tel.tel_defines import AOSP_PREFIX from acts.test_utils.tel.tel_defines import CARD_POWER_DOWN from acts.test_utils.tel.tel_defines import CARD_POWER_UP @@ -180,6 +181,7 @@ from acts.test_utils.tel.tel_subscription_utils import get_outgoing_voice_sub_id from acts.test_utils.tel.tel_subscription_utils import get_incoming_voice_sub_id from acts.test_utils.tel.tel_subscription_utils import get_incoming_message_sub_id from acts.test_utils.tel.tel_subscription_utils import set_subid_for_outgoing_call +from acts.test_utils.tel.tel_subscription_utils import set_incoming_voice_sub_id from acts.test_utils.tel.tel_subscription_utils import set_subid_for_message from acts.test_utils.tel.tel_subscription_utils import get_subid_on_same_network_of_host_ad from acts.test_utils.wifi import wifi_test_utils @@ -2091,6 +2093,28 @@ def call_reject_leave_message(log, verify_caller_func, wait_time_in_call) +def check_reject_needed_for_voice_mail(log, ad_callee): + """Check if the carrier requires reject call to receive voice mail or just keep ringing + Requested in b//155935290 + Four Japan carriers do not need to reject + SBM, KDDI, Ntt Docomo, Rakuten + Args: + log: log object + ad_callee: android device object + Returns: + True if callee's carrier is not one of the four Japan carriers + False if callee's carrier is one of the four Japan carriers + """ + + operators_no_reject = [CARRIER_NTT_DOCOMO, + CARRIER_KDDI, + CARRIER_RAKUTEN, + CARRIER_SBM] + operator_name = get_operator_name(log, ad_callee) + + return operator_name not in operators_no_reject + + def call_reject_leave_message_for_subscription( log, ad_caller, @@ -2145,9 +2169,15 @@ def call_reject_leave_message_for_subscription( if not initiate_call(log, ad_caller, callee_number): ad_caller.log.error("Initiate call failed.") return False + if check_reject_needed_for_voice_mail(log, ad_callee): + carrier_specific_delay_reject = 30 + else: + carrier_specific_delay_reject = 2 + carrier_reject_call = not check_reject_needed_for_voice_mail(log, ad_callee) if not wait_and_reject_call_for_subscription( - log, ad_callee, subid_callee, incoming_number=caller_number): + log, ad_callee, subid_callee, incoming_number=caller_number, delay_reject=carrier_specific_delay_reject, + reject=carrier_reject_call): ad_callee.log.error("Reject call fail.") return False @@ -4945,16 +4975,25 @@ def show_enhanced_4g_lte(ad, sub_id): if capabilities: if "hide_enhanced_4g_lte" in capabilities: result = False - ad.log.info('"Enhanced 4G LTE MODE" is hidden for sub ID %s.', sub_id) - show_enhanced_4g_lte_mode = getattr(ad, "show_enhanced_4g_lte_mode", False) + ad.log.info( + '"Enhanced 4G LTE MODE" is hidden for sub ID %s.', sub_id) + show_enhanced_4g_lte_mode = getattr( + ad, "show_enhanced_4g_lte_mode", False) if show_enhanced_4g_lte_mode in ["true", "True"]: current_voice_sub_id = get_outgoing_voice_sub_id(ad) if sub_id != current_voice_sub_id: set_incoming_voice_sub_id(ad, sub_id) - ad.log.info('Show "Enhanced 4G LTE MODE" forcibly for sub ID %s.', sub_id) - ad.adb.shell("am broadcast -a com.google.android.carrier.action.LOCAL_OVERRIDE -n com.google.android.carrier/.ConfigOverridingReceiver --ez hide_enhanced_4g_lte_bool false") - ad.telephony["subscription"][sub_id]["capabilities"].remove("hide_enhanced_4g_lte") + ad.log.info( + 'Show "Enhanced 4G LTE MODE" forcibly for sub ID %s.', + sub_id) + ad.adb.shell( + "am broadcast \ + -a com.google.android.carrier.action.LOCAL_OVERRIDE \ + -n com.google.android.carrier/.ConfigOverridingReceiver \ + --ez hide_enhanced_4g_lte_bool false") + ad.telephony["subscription"][sub_id]["capabilities"].remove( + "hide_enhanced_4g_lte") if sub_id != current_voice_sub_id: set_incoming_voice_sub_id(ad, current_voice_sub_id) @@ -4965,11 +5004,13 @@ def show_enhanced_4g_lte(ad, sub_id): def toggle_volte(log, ad, new_state=None): """Toggle enable/disable VoLTE for default voice subscription. + Args: ad: Android device object. new_state: VoLTE mode state to set to. True for enable, False for disable. If None, opposite of the current state. + Raises: TelTestUtilsError if platform does not support VoLTE. """ @@ -4982,7 +5023,8 @@ def toggle_volte_for_subscription(log, ad, sub_id, new_state=None): Args: ad: Android device object. - sub_id: subscription ID + sub_id: Optional. If not assigned the default sub ID for voice call will + be used. new_state: VoLTE mode state to set to. True for enable, False for disable. If None, opposite of the current state. @@ -4991,19 +5033,74 @@ def toggle_volte_for_subscription(log, ad, sub_id, new_state=None): if not show_enhanced_4g_lte(ad, sub_id): return False - current_state = ad.droid.imsMmTelIsAdvancedCallingEnabled(sub_id) - if new_state is None: - new_state = not current_state - if new_state != current_state: - ad.log.info("Toggle Enhanced 4G LTE Mode from %s to %s on sub_id %s", current_state, - new_state, sub_id) - ad.droid.imsMmTelSetAdvancedCallingEnabled(sub_id, new_state) - check_state = ad.droid.imsMmTelIsAdvancedCallingEnabled(sub_id) - if check_state != new_state: - ad.log.error("Failed to toggle Enhanced 4G LTE Mode to %s, still set to %s on sub_id %s", - new_state, check_state, sub_id) - return False - return True + current_state = None + result = True + + if sub_id is None: + sub_id = ad.droid.subscriptionGetDefaultVoiceSubId() + + try: + current_state = ad.droid.imsMmTelIsAdvancedCallingEnabled(sub_id) + except Exception as e: + ad.log.warning(e) + + if current_state is not None: + if new_state is None: + new_state = not current_state + if new_state != current_state: + ad.log.info( + "Toggle Enhanced 4G LTE Mode from %s to %s on sub_id %s", + current_state, new_state, sub_id) + ad.droid.imsMmTelSetAdvancedCallingEnabled(sub_id, new_state) + check_state = ad.droid.imsMmTelIsAdvancedCallingEnabled(sub_id) + if check_state != new_state: + ad.log.error("Failed to toggle Enhanced 4G LTE Mode to %s, still \ + set to %s on sub_id %s", new_state, check_state, sub_id) + result = False + return result + else: + # TODO: b/26293960 No framework API available to set IMS by SubId. + voice_sub_id_changed = False + current_sub_id = get_incoming_voice_sub_id(ad) + if current_sub_id != sub_id: + set_incoming_voice_sub_id(ad, sub_id) + voice_sub_id_changed = True + + # b/139641554 + ad.terminate_all_sessions() + bring_up_sl4a(ad) + + if not ad.droid.imsIsEnhanced4gLteModeSettingEnabledByPlatform(): + ad.log.info( + "Enhanced 4G Lte Mode Setting is not enabled by platform for \ + sub ID %s.", sub_id) + return False + + current_state = ad.droid.imsIsEnhanced4gLteModeSettingEnabledByUser() + ad.log.info("Current state of Enhanced 4G Lte Mode Setting for sub \ + ID %s: %s", sub_id, current_state) + ad.log.info("New desired state of Enhanced 4G Lte Mode Setting for sub \ + ID %s: %s", sub_id, new_state) + + if new_state is None: + new_state = not current_state + if new_state != current_state: + ad.log.info( + "Toggle Enhanced 4G LTE Mode from %s to %s for sub ID %s.", + current_state, new_state, sub_id) + ad.droid.imsSetEnhanced4gMode(new_state) + time.sleep(5) + + check_state = ad.droid.imsIsEnhanced4gLteModeSettingEnabledByUser() + if check_state != new_state: + ad.log.error("Failed to toggle Enhanced 4G LTE Mode to %s, \ + still set to %s on sub_id %s", new_state, check_state, sub_id) + result = False + + if voice_sub_id_changed: + set_incoming_voice_sub_id(ad, current_sub_id) + + return result def toggle_wfc(log, ad, new_state=None): @@ -5012,43 +5109,124 @@ def toggle_wfc(log, ad, new_state=None): Args: log: Log object ad: Android device object. - new_state: True or False + new_state: WFC state to set to. + True for enable, False for disable. + If None, opposite of the current state. """ - if not ad.droid.imsIsWfcEnabledByPlatform(): - ad.log.info("WFC is not enabled by platform") - return False - current_state = ad.droid.imsIsWfcEnabledByUser() - if current_state is None: - new_state = not current_state - if new_state != current_state: - ad.log.info("Toggle WFC user enabled from %s to %s", current_state, - new_state) - ad.droid.imsSetWfcSetting(new_state) - return True + return toggle_wfc_for_subscription( + log, ad, new_state, get_outgoing_voice_sub_id(ad)) -def toggle_wfc_for_subscription(ad, new_state=None, sub_id=None): - """ Toggle WFC enable/disable +def toggle_wfc_for_subscription(log, ad, new_state=None, sub_id=None): + """ Toggle WFC enable/disable for specified voice subscription. Args: ad: Android device object. - sub_id: subscription Id - new_state: True or False + sub_id: Optional. If not assigned the default sub ID for voice call will + be used. + new_state: WFC state to set to. + True for enable, False for disable. + If None, opposite of the current state. """ + current_state = None + result = True + if sub_id is None: sub_id = ad.droid.subscriptionGetDefaultVoiceSubId() - current_state = ad.droid.imsMmTelIsVoWiFiSettingEnabled(sub_id) - if current_state is None: - new_state = not current_state - if new_state != current_state: - ad.log.info("SubId %s - Toggle WFC from %s to %s", sub_id, - current_state, new_state) - ad.droid.imsMmTelSetVoWiFiSettingEnabled(sub_id, new_state) + + try: + current_state = ad.droid.imsMmTelIsVoWiFiSettingEnabled(sub_id) + except Exception as e: + ad.log.warning(e) + + if current_state is not None: + if new_state is None: + new_state = not current_state + if new_state != current_state: + ad.log.info( + "Toggle Enhanced 4G LTE Mode from %s to %s on sub_id %s", + current_state, new_state, sub_id) + ad.droid.imsMmTelSetVoWiFiSettingEnabled(sub_id, new_state) + check_state = ad.droid.imsMmTelIsVoWiFiSettingEnabled(sub_id) + if check_state != new_state: + ad.log.error("Failed to toggle Enhanced 4G LTE Mode to %s, \ + still set to %s on sub_id %s", new_state, check_state, sub_id) + result = False + return result + else: + voice_sub_id_changed = False + if not sub_id: + sub_id = get_outgoing_voice_sub_id(ad) + else: + current_sub_id = get_incoming_voice_sub_id(ad) + if current_sub_id != sub_id: + set_incoming_voice_sub_id(ad, sub_id) + voice_sub_id_changed = True + + # b/139641554 + ad.terminate_all_sessions() + bring_up_sl4a(ad) + + if not ad.droid.imsIsWfcEnabledByPlatform(): + ad.log.info("WFC is not enabled by platform for sub ID %s.", sub_id) + return False + + current_state = ad.droid.imsIsWfcEnabledByUser() + ad.log.info("Current state of WFC Setting for sub ID %s: %s", + sub_id, current_state) + ad.log.info("New desired state of WFC Setting for sub ID %s: %s", + sub_id, new_state) + + if new_state is None: + new_state = not current_state + if new_state != current_state: + ad.log.info("Toggle WFC user enabled from %s to %s for sub ID %s", + current_state, new_state, sub_id) + ad.droid.imsSetWfcSetting(new_state) + + if voice_sub_id_changed: + set_incoming_voice_sub_id(ad, current_sub_id) + + return True + +def is_enhanced_4g_lte_mode_setting_enabled(ad, sub_id, enabled_by="platform"): + voice_sub_id_changed = False + current_sub_id = get_incoming_voice_sub_id(ad) + if current_sub_id != sub_id: + set_incoming_voice_sub_id(ad, sub_id) + voice_sub_id_changed = True + if enabled_by == "platform": + res = ad.droid.imsIsEnhanced4gLteModeSettingEnabledByPlatform() + else: + res = ad.droid.imsIsEnhanced4gLteModeSettingEnabledByUser() + if not res: + ad.log.info("Enhanced 4G Lte Mode Setting is NOT enabled by %s for sub \ + ID %s.", enabled_by, sub_id) + if voice_sub_id_changed: + set_incoming_voice_sub_id(ad, current_sub_id) + return False + if voice_sub_id_changed: + set_incoming_voice_sub_id(ad, current_sub_id) + ad.log.info("Enhanced 4G Lte Mode Setting is enabled by %s for sub ID %s.", + enabled_by, sub_id) return True +def set_enhanced_4g_mode(ad, sub_id, state): + voice_sub_id_changed = False + current_sub_id = get_incoming_voice_sub_id(ad) + if current_sub_id != sub_id: + set_incoming_voice_sub_id(ad, sub_id) + voice_sub_id_changed = True + + ad.droid.imsSetEnhanced4gMode(state) + time.sleep(5) + + if voice_sub_id_changed: + set_incoming_voice_sub_id(ad, current_sub_id) def wait_for_enhanced_4g_lte_setting(log, ad, + sub_id, max_time=MAX_WAIT_TIME_FOR_STATE_CHANGE): """Wait for android device to enable enhance 4G LTE setting. @@ -5062,9 +5240,13 @@ def wait_for_enhanced_4g_lte_setting(log, Return False if timeout. """ return wait_for_state( - ad.droid.imsIsEnhanced4gLteModeSettingEnabledByPlatform, + is_enhanced_4g_lte_mode_setting_enabled, True, - max_wait_time=max_time) + max_time, + WAIT_TIME_BETWEEN_STATE_CHECK, + ad, + sub_id, + enabled_by="platform") def set_wfc_mode(log, ad, wfc_mode): @@ -5080,29 +5262,8 @@ def set_wfc_mode(log, ad, wfc_mode): Returns: True if success. False if ad does not support WFC or error happened. """ - if wfc_mode != WFC_MODE_DISABLED and wfc_mode not in ad.telephony[ - "subscription"][get_outgoing_voice_sub_id(ad)].get("wfc_modes", []): - ad.log.error("WFC mode %s is not supported", wfc_mode) - raise signals.TestSkip("WFC mode %s is not supported" % wfc_mode) - try: - ad.log.info("Set wfc mode to %s", wfc_mode) - if wfc_mode != WFC_MODE_DISABLED: - start_adb_tcpdump(ad, interface="wlan0", mask="all") - if not ad.droid.imsIsWfcEnabledByPlatform(): - if wfc_mode == WFC_MODE_DISABLED: - return True - else: - ad.log.error("WFC not supported by platform.") - return False - ad.droid.imsSetWfcMode(wfc_mode) - mode = ad.droid.imsGetWfcMode() - if mode != wfc_mode: - ad.log.error("WFC mode is %s, not in %s", mode, wfc_mode) - return False - except Exception as e: - log.error(e) - return False - return True + return set_wfc_mode_for_subscription( + ad, wfc_mode, get_outgoing_voice_sub_id(ad)) def set_wfc_mode_for_subscription(ad, wfc_mode, sub_id=None): @@ -5118,22 +5279,97 @@ def set_wfc_mode_for_subscription(ad, wfc_mode, sub_id=None): Returns: True if success. False if ad does not support WFC or error happened. """ + if wfc_mode not in [ + WFC_MODE_WIFI_ONLY, + WFC_MODE_CELLULAR_PREFERRED, + WFC_MODE_WIFI_PREFERRED, + WFC_MODE_DISABLED]: + + ad.log.error("Given WFC mode (%s) is not correct.", wfc_mode) + return False + + current_mode = None + result = True + + if sub_id is None: + sub_id = ad.droid.subscriptionGetDefaultVoiceSubId() + try: - if sub_id is None: - sub_id = ad.droid.subscriptionGetDefaultVoiceSubId() - if not ad.droid.imsMmTelIsVoWiFiSettingEnabled(sub_id): - ad.log.info("SubId %s - Enabling WiFi Calling", sub_id) - ad.droid.imsMmTelSetVoWiFiSettingEnabled(sub_id, True) - ad.log.info("SubId %s - setwfcmode to %s", sub_id, wfc_mode) - ad.droid.imsMmTelSetVoWiFiModeSetting(sub_id, wfc_mode) - mode = ad.droid.imsMmTelGetVoWiFiModeSetting(sub_id) - if mode != wfc_mode: - ad.log.error("SubId %s - getwfcmode shows %s", sub_id, mode) - return False + current_mode = ad.droid.imsMmTelGetVoWiFiModeSetting(sub_id) + ad.log.info("Current WFC mode of sub ID: %s", current_mode) except Exception as e: - ad.log.error(e) - return False - return True + ad.log.warning(e) + + if current_mode is not None: + try: + if not ad.droid.imsMmTelIsVoWiFiSettingEnabled(sub_id): + if wfc_mode is WFC_MODE_DISABLED: + return True + ad.log.info( + "WFC is disabled for sub ID %s. Enabling WFC...", sub_id) + ad.droid.imsMmTelSetVoWiFiSettingEnabled(sub_id, True) + + if wfc_mode is WFC_MODE_DISABLED: + ad.droid.imsMmTelSetVoWiFiSettingEnabled(sub_id, False) + return True + + ad.log.info("Set wfc mode to %s for sub ID %s.", wfc_mode, sub_id) + ad.droid.imsMmTelSetVoWiFiModeSetting(sub_id, wfc_mode) + mode = ad.droid.imsMmTelGetVoWiFiModeSetting(sub_id) + if mode != wfc_mode: + ad.log.error("WFC mode for sub ID %s is %s, not in %s", + sub_id, mode, wfc_mode) + return False + except Exception as e: + ad.log.error(e) + return False + return True + else: + voice_sub_id_changed = False + if not sub_id: + sub_id = get_outgoing_voice_sub_id(ad) + else: + current_sub_id = get_incoming_voice_sub_id(ad) + if current_sub_id != sub_id: + set_incoming_voice_sub_id(ad, sub_id) + voice_sub_id_changed = True + + # b/139641554 + ad.terminate_all_sessions() + bring_up_sl4a(ad) + + if wfc_mode != WFC_MODE_DISABLED and wfc_mode not in ad.telephony[ + "subscription"][get_outgoing_voice_sub_id(ad)].get("wfc_modes", []): + ad.log.error("WFC mode %s is not supported", wfc_mode) + raise signals.TestSkip("WFC mode %s is not supported" % wfc_mode) + try: + ad.log.info("Set wfc mode to %s", wfc_mode) + if wfc_mode != WFC_MODE_DISABLED: + start_adb_tcpdump(ad, interface="wlan0", mask="all") + if not ad.droid.imsIsWfcEnabledByPlatform(): + if wfc_mode == WFC_MODE_DISABLED: + if voice_sub_id_changed: + set_incoming_voice_sub_id(ad, current_sub_id) + return True + else: + ad.log.error("WFC not supported by platform.") + if voice_sub_id_changed: + set_incoming_voice_sub_id(ad, current_sub_id) + return False + ad.droid.imsSetWfcMode(wfc_mode) + mode = ad.droid.imsGetWfcMode() + if voice_sub_id_changed: + set_incoming_voice_sub_id(ad, current_sub_id) + if mode != wfc_mode: + ad.log.error("WFC mode is %s, not in %s", mode, wfc_mode) + return False + except Exception as e: + log.error(e) + if voice_sub_id_changed: + set_incoming_voice_sub_id(ad, current_sub_id) + return False + return True + def set_ims_provisioning_for_subscription(ad, feature_flag, value, sub_id=None): @@ -5564,18 +5800,24 @@ def wait_for_data_attach_for_subscription(log, ad, sub_id, max_time): NETWORK_SERVICE_DATA) -def is_ims_registered(log, ad): +def is_ims_registered(log, ad, sub_id=None): """Return True if IMS registered. Args: log: log object. ad: android device. + sub_id: Optional. If not assigned the default sub ID of voice call will + be used. Returns: Return True if IMS registered. Return False if IMS not registered. """ - return ad.droid.telephonyIsImsRegistered() + if not sub_id: + return ad.droid.telephonyIsImsRegistered() + else: + return change_voice_subid_temporarily( + ad, sub_id, ad.droid.telephonyIsImsRegistered) def wait_for_ims_registered(log, ad, max_time=MAX_WAIT_TIME_WFC_ENABLED): @@ -5592,26 +5834,48 @@ def wait_for_ims_registered(log, ad, max_time=MAX_WAIT_TIME_WFC_ENABLED): """ return _wait_for_droid_in_state(log, ad, max_time, is_ims_registered) +def is_volte_available(log, ad, sub_id): + """Return True if VoLTE is available. + + Args: + log: log object. + ad: android device. + sub_id: Optional. If not assigned the default sub ID of voice call will + be used. + + Returns: + Return True if VoLTE is available. + Return False if VoLTE is not available. + """ + if not sub_id: + return ad.droid.telephonyIsVolteAvailable() + else: + return change_voice_subid_temporarily( + ad, sub_id, ad.droid.telephonyIsVolteAvailable) -def is_volte_enabled(log, ad): +def is_volte_enabled(log, ad, sub_id=None): """Return True if VoLTE feature bit is True. Args: log: log object. ad: android device. + sub_id: Optional. If not assigned the default sub ID of voice call will + be used. Returns: Return True if VoLTE feature bit is True and IMS registered. Return False if VoLTE feature bit is False or IMS not registered. """ - if not is_ims_registered(log, ad): - ad.log.info("IMS is not registered.") + if not is_ims_registered(log, ad, sub_id): + ad.log.info("IMS is not registered for sub ID %s.", sub_id) return False - if not ad.droid.telephonyIsVolteAvailable(): - ad.log.info("IMS is registered, IsVolteCallingAvailble is False") + if not is_volte_available(log, ad, sub_id): + ad.log.info("IMS is registered for sub ID %s, IsVolteCallingAvailable \ + is False", sub_id) return False else: - ad.log.info("IMS is registered, IsVolteCallingAvailble is True") + ad.log.info("IMS is registered for sub ID %s, IsVolteCallingAvailable \ + is True", sub_id) return True @@ -5634,7 +5898,8 @@ def is_video_enabled(log, ad): return video_status -def wait_for_volte_enabled(log, ad, max_time=MAX_WAIT_TIME_VOLTE_ENABLED): +def wait_for_volte_enabled( + log, ad, max_time=MAX_WAIT_TIME_VOLTE_ENABLED,sub_id=None): """Wait for android device to report VoLTE enabled bit true. Args: @@ -5646,7 +5911,11 @@ def wait_for_volte_enabled(log, ad, max_time=MAX_WAIT_TIME_VOLTE_ENABLED): Return True if device report VoLTE enabled bit true within max_time. Return False if timeout. """ - return _wait_for_droid_in_state(log, ad, max_time, is_volte_enabled) + if not sub_id: + return _wait_for_droid_in_state(log, ad, max_time, is_volte_enabled) + else: + return _wait_for_droid_in_state_for_subscription( + log, ad, sub_id, max_time, is_volte_enabled) def wait_for_video_enabled(log, ad, max_time=MAX_WAIT_TIME_VOLTE_ENABLED): @@ -5679,10 +5948,10 @@ def is_wfc_enabled(log, ad): ad.log.info("IMS is not registered.") return False if not ad.droid.telephonyIsWifiCallingAvailable(): - ad.log.info("IMS is registered, IsWifiCallingAvailble is False") + ad.log.info("IMS is registered, IsWifiCallingAvailable is False") return False else: - ad.log.info("IMS is registered, IsWifiCallingAvailble is True") + ad.log.info("IMS is registered, IsWifiCallingAvailable is True") return True @@ -6355,7 +6624,7 @@ def mms_receive_verify_after_call_hangup_for_subscription( if not wait_for_matching_mms(log, ad_rx, phonenumber_tx, message): return False finally: - ad_rx.droid.smsStopTrackingIncomingMmsMessage() + ad_rx.messaging_droid.smsStopTrackingIncomingMmsMessage() return True @@ -10314,44 +10583,59 @@ def wait_for_matching_multiple_sms(log, return True -def is_sms_in_collision_match(event, phonenumber_tx, phonenumber_tx2, text, text2): +def is_sms_in_collision_match( + event, phonenumber_tx, phonenumber_tx2, text, text2): event_text = event['data']['Text'].strip() if event_text.startswith("("): event_text = event_text.split(")")[-1] for phonenumber, txt in [[phonenumber_tx, text], [phonenumber_tx2, text2]]: - if check_phone_number_match(event['data']['Sender'], phonenumber) and txt.startswith(event_text): + if check_phone_number_match( + event['data']['Sender'], phonenumber) and txt.startswith(event_text): return True return False -def is_sms_in_collision_partial_match(event, phonenumber_tx, phonenumber_tx2, text, text2): +def is_sms_in_collision_partial_match( + event, phonenumber_tx, phonenumber_tx2, text, text2): for phonenumber, txt in [[phonenumber_tx, text], [phonenumber_tx2, text2]]: - if check_phone_number_match(event['data']['Sender'], phonenumber) and event['data']['Text'].strip() == txt: + if check_phone_number_match( + event['data']['Sender'], phonenumber) and \ + event['data']['Text'].strip() == txt: return True return False -def is_sms_match_among_multiple_sms(event, phonenumber_tx, phonenumber_tx2, texts=[], texts2=[]): +def is_sms_match_among_multiple_sms( + event, phonenumber_tx, phonenumber_tx2, texts=[], texts2=[]): for txt in texts: - if check_phone_number_match(event['data']['Sender'], phonenumber_tx) and event['data']['Text'].strip() == txt: + if check_phone_number_match( + event['data']['Sender'], phonenumber_tx) and \ + event['data']['Text'].strip() == txt: return True for txt in texts2: - if check_phone_number_match(event['data']['Sender'], phonenumber_tx2) and event['data']['Text'].strip() == txt: + if check_phone_number_match( + event['data']['Sender'], phonenumber_tx2) and \ + event['data']['Text'].strip() == txt: return True return False -def is_sms_partial_match_among_multiple_sms(event, phonenumber_tx, phonenumber_tx2, texts=[], texts2=[]): +def is_sms_partial_match_among_multiple_sms( + event, phonenumber_tx, phonenumber_tx2, texts=[], texts2=[]): event_text = event['data']['Text'].strip() if event_text.startswith("("): event_text = event_text.split(")")[-1] for txt in texts: - if check_phone_number_match(event['data']['Sender'], phonenumber_tx) and txt.startswith(event_text): + if check_phone_number_match( + event['data']['Sender'], phonenumber_tx) and \ + txt.startswith(event_text): return True for txt in texts2: - if check_phone_number_match(event['data']['Sender'], phonenumber_tx2) and txt.startswith(event_text): + if check_phone_number_match( + event['data']['Sender'], phonenumber_tx2) and \ + txt.startswith(event_text): return True return False @@ -10390,3 +10674,19 @@ def datetime_handle(ad, action, set_datetime_value='', get_year=False): ad.adb.shell('am broadcast -a android.intent.action.TIME_SET') return get_value + +def change_voice_subid_temporarily(ad, sub_id, state_check_func): + result = False + voice_sub_id_changed = False + current_sub_id = get_incoming_voice_sub_id(ad) + if current_sub_id != sub_id: + set_incoming_voice_sub_id(ad, sub_id) + voice_sub_id_changed = True + + if state_check_func(): + result = True + + if voice_sub_id_changed: + set_incoming_voice_sub_id(ad, current_sub_id) + + return result
\ No newline at end of file diff --git a/acts/framework/acts/test_utils/tel/tel_voice_utils.py b/acts/framework/acts/test_utils/tel/tel_voice_utils.py index 4294bf3ea6..1c41658fa5 100644 --- a/acts/framework/acts/test_utils/tel/tel_voice_utils.py +++ b/acts/framework/acts/test_utils/tel/tel_voice_utils.py @@ -765,7 +765,6 @@ def phone_setup_iwlan(log, Make sure phone connect to WiFi. (If wifi_ssid is not None.) Wait for phone to be in iwlan data network type. Wait for phone to report wfc enabled flag to be true. - Args: log: Log object. ad: Android device object. @@ -774,14 +773,9 @@ def phone_setup_iwlan(log, wifi_ssid: WiFi network SSID. This is optional. If wifi_ssid is None, then phone_setup_iwlan will not attempt to connect to wifi. wifi_pwd: WiFi network password. This is optional. - Returns: True if success. False if fail. """ - if not get_capability_for_subscription(ad, CAPABILITY_WFC, - get_outgoing_voice_sub_id(ad)): - ad.log.error("WFC is not supported, abort test.") - raise signals.TestSkip("WFC is not supported, abort test.") return phone_setup_iwlan_for_subscription(log, ad, get_outgoing_voice_sub_id(ad), is_airplane_mode, wfc_mode, @@ -801,7 +795,6 @@ def phone_setup_iwlan_for_subscription(log, Make sure phone connect to WiFi. (If wifi_ssid is not None.) Wait for phone to be in iwlan data network type. Wait for phone to report wfc enabled flag to be true. - Args: log: Log object. ad: Android device object. @@ -811,19 +804,19 @@ def phone_setup_iwlan_for_subscription(log, wifi_ssid: WiFi network SSID. This is optional. If wifi_ssid is None, then phone_setup_iwlan will not attempt to connect to wifi. wifi_pwd: WiFi network password. This is optional. - Returns: True if success. False if fail. """ + if not get_capability_for_subscription(ad, CAPABILITY_WFC, sub_id): + ad.log.error("WFC is not supported, abort test.") + raise signals.TestSkip("WFC is not supported, abort test.") toggle_airplane_mode(log, ad, is_airplane_mode, strict_checking=False) - # check if WFC supported phones if wfc_mode != WFC_MODE_DISABLED and not ad.droid.imsIsWfcEnabledByPlatform( ): ad.log.error("WFC is not enabled on this device by checking " "ImsManager.isWfcEnabledByPlatform") return False - if wifi_ssid is not None: if not ensure_wifi_connected(log, ad, wifi_ssid, wifi_pwd, apm=is_airplane_mode): ad.log.error("Fail to bring up WiFi connection on %s.", wifi_ssid) @@ -832,11 +825,9 @@ def phone_setup_iwlan_for_subscription(log, ad.log.info("WiFi network SSID not specified, available user " "parameters are: wifi_network_ssid, wifi_network_ssid_2g, " "wifi_network_ssid_5g") - if not set_wfc_mode(log, ad, wfc_mode): ad.log.error("Unable to set WFC mode to %s.", wfc_mode) return False - if not wait_for_wfc_enabled(log, ad, max_time=MAX_WAIT_TIME_WFC_ENABLED): ad.log.error("WFC is not enabled") return False @@ -1077,8 +1068,9 @@ def phone_setup_csfb_for_subscription(log, ad, sub_id): if not phone_setup_4g_for_subscription(log, ad, sub_id): ad.log.error("Failed to set to 4G data.") return False - if ad.droid.imsIsEnhanced4gLteModeSettingEnabledByPlatform(): - toggle_volte(log, ad, False) + + toggle_volte(log, ad, False) + if not ensure_network_generation_for_subscription( log, ad, sub_id, GEN_4G, voice_or_data=NETWORK_SERVICE_DATA): return False @@ -1111,20 +1103,22 @@ def phone_setup_volte(log, ad): def phone_setup_volte_for_subscription(log, ad, sub_id): """Setup VoLTE enable for subscription id. - Args: log: log object ad: android device object. sub_id: subscription id. - Returns: True: if VoLTE is enabled successfully. False: for errors """ + if not get_capability_for_subscription(ad, CAPABILITY_VOLTE, + get_outgoing_voice_sub_id(ad)): + ad.log.error("VoLTE is not supported, abort test.") + raise signals.TestSkip("VoLTE is not supported, abort test.") if not phone_setup_4g_for_subscription(log, ad, sub_id): ad.log.error("Failed to set to 4G data.") return False - if not wait_for_enhanced_4g_lte_setting(log, ad): + if not wait_for_enhanced_4g_lte_setting(log, ad, sub_id): ad.log.error("Enhanced 4G LTE setting is not available") return False toggle_volte_for_subscription(log, ad, sub_id, True) @@ -1361,7 +1355,6 @@ def phone_idle_volte(log, ad): def phone_idle_volte_for_subscription(log, ad, sub_id): """Return if phone is idle for VoLTE call test for subscription id. - Args: ad: Android device object. sub_id: subscription id. @@ -1371,7 +1364,7 @@ def phone_idle_volte_for_subscription(log, ad, sub_id): voice_or_data=NETWORK_SERVICE_VOICE): ad.log.error("Voice rat not in LTE mode.") return False - if not wait_for_volte_enabled(log, ad, MAX_WAIT_TIME_VOLTE_ENABLED): + if not wait_for_volte_enabled(log, ad, MAX_WAIT_TIME_VOLTE_ENABLED, sub_id): ad.log.error( "Failed to <report volte enabled true> within %s seconds.", MAX_WAIT_TIME_VOLTE_ENABLED) @@ -1699,7 +1692,7 @@ def is_phone_in_call_iwlan(log, ad, call_id=None): ad.log.info("IMS is not registered.") return False if not ad.droid.telephonyIsWifiCallingAvailable(): - ad.log.info("IsWifiCallingAvailble is False") + ad.log.info("IsWifiCallingAvailable is False") return False if not call_id: call_ids = ad.droid.telecomCallGetCallIds() diff --git a/acts/tests/google/ble/api/BleAdvertiseApiTest.py b/acts/tests/google/ble/api/BleAdvertiseApiTest.py deleted file mode 100644 index 26c459f70a..0000000000 --- a/acts/tests/google/ble/api/BleAdvertiseApiTest.py +++ /dev/null @@ -1,1273 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See thea -# License for the specific language governing permissions and limitations under -# the License. -""" -Test script to exercise Ble Advertisement Api's. This exercises all getters and -setters. This is important since there is a builder object that is immutable -after you set all attributes of each object. If this test suite doesn't pass, -then other test suites utilising Ble Advertisements will also fail. -""" - -from acts.controllers.sl4a_lib import rpc_client -from acts.test_decorators import test_tracker_info -from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest -from acts.test_utils.bt.bt_test_utils import adv_fail -from acts.test_utils.bt.bt_test_utils import generate_ble_advertise_objects -from acts.test_utils.bt.bt_constants import ble_advertise_settings_modes -from acts.test_utils.bt.bt_constants import ble_advertise_settings_tx_powers -from acts.test_utils.bt.bt_constants import java_integer - - -class BleAdvertiseVerificationError(Exception): - """Error in fetsching BleScanner Advertise result.""" - - -class BleAdvertiseApiTest(BluetoothBaseTest): - def setup_class(self): - super().setup_class() - self.ad_dut = self.android_devices[0] - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='d6d8d0a6-7b3e-4e4b-a5d0-bcfd6e207474') - def test_adv_settings_defaults(self): - """Tests the default advertisement settings. - - This builder object should have a proper "get" expectation for each - attribute of the builder object once it's built. - - Steps: - 1. Build a new advertise settings object. - 2. Get the attributes of the advertise settings object. - 3. Compare the attributes found against the attributes exp. - - Expected Result: - Found attributes should match expected attributes. - - Returns: - True is pass - False if fail - - TAGS: LE, Advertising - Priority: 0 - """ - test_result = True - droid = self.ad_dut.droid - adv_settings = droid.bleBuildAdvertiseSettings() - adv_mode = droid.bleGetAdvertiseSettingsMode(adv_settings) - tx_power_level = droid.bleGetAdvertiseSettingsTxPowerLevel( - adv_settings) - is_connectable = droid.bleGetAdvertiseSettingsIsConnectable( - adv_settings) - - exp_adv_mode = ble_advertise_settings_modes['low_power'] - exp_tx_power_level = ble_advertise_settings_tx_powers['medium'] - exp_is_connectable = True - if adv_mode != exp_adv_mode: - test_result = False - self.log.debug("exp filtering mode: {}," - " found filtering mode: {}".format( - exp_adv_mode, adv_mode)) - if tx_power_level != exp_tx_power_level: - test_result = False - self.log.debug("exp tx power level: {}," - " found filtering tx power level: {}".format( - exp_tx_power_level, tx_power_level)) - if exp_is_connectable != is_connectable: - test_result = False - self.log.debug("exp is connectable: {}," - " found filtering is connectable: {}".format( - exp_is_connectable, is_connectable)) - return test_result - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='f2a276ae-1436-43e4-aba7-1ede787200ee') - def test_adv_data_defaults(self): - """Tests the default advertisement data. - - This builder object should have a proper "get" expectation for each - attribute of the builder object once it's built. - - Steps: - 1. Build a new AdvertiseData object. - 2. Get the attributes of the advertise settings object. - 3. Compare the attributes found against the attributes exp. - - Expected Result: - Found attributes should match expected attributes. - - Returns: - True is pass - False if fail - - TAGS: LE, Advertising - Priority: 0 - """ - test_result = True - droid = self.ad_dut.droid - adv_data = droid.bleBuildAdvertiseData() - service_uuids = droid.bleGetAdvertiseDataServiceUuids(adv_data) - include_tx_power_level = droid.bleGetAdvertiseDataIncludeTxPowerLevel( - adv_data) - include_device_name = droid.bleGetAdvertiseDataIncludeDeviceName( - adv_data) - - exp_service_uuids = [] - exp_include_tx_power_level = False - exp_include_device_name = False - self.log.debug("Step 4: Verify all defaults match exp values.") - if service_uuids != exp_service_uuids: - test_result = False - self.log.debug("exp filtering service uuids: {}," - " found filtering service uuids: {}".format( - exp_service_uuids, service_uuids)) - if include_tx_power_level != exp_include_tx_power_level: - test_result = False - self.log.debug( - "exp filtering include tx power level:: {}," - " found filtering include tx power level: {}".format( - exp_include_tx_power_level, include_tx_power_level)) - if include_device_name != exp_include_device_name: - test_result = False - self.log.debug( - "exp filtering include tx power level: {}," - " found filtering include tx power level: {}".format( - exp_include_device_name, include_device_name)) - if not test_result: - self.log.debug("Some values didn't match the defaults.") - else: - self.log.debug("All default values passed.") - return test_result - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='8d462e60-6b4e-49f3-9ef4-5a8b612d285d') - def test_adv_settings_set_adv_mode_balanced(self): - """Tests advertise settings balanced mode. - - This advertisement settings from "set" advertisement mode should match - the corresponding "get" function. - - Steps: - 1. Build a new advertise settings object. - 2. Set the advertise mode attribute to balanced. - 3. Get the attributes of the advertise settings object. - 4. Compare the attributes found against the attributes exp. - - Expected Result: - Found attributes should match expected attributes. - - Returns: - True is pass - False if fail - - TAGS: LE, Advertising - Priority: 1 - """ - self.log.debug("Step 1: Setup environment.") - droid = self.ad_dut.droid - exp_adv_mode = ble_advertise_settings_modes['balanced'] - self.log.debug( - "Step 2: Set the filtering settings object's value to {}".format( - exp_adv_mode)) - return self.verify_adv_settings_adv_mode(droid, exp_adv_mode) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='334fefeb-365f-4ee3-9be0-42b1fabe3178') - def test_adv_settings_set_adv_mode_low_power(self): - """Tests advertise settings low power mode. - - This advertisement settings from "set" advertisement mode should match - the corresponding "get" function. - - Steps: - 1. Build a new advertise settings object. - 2. Set the advertise mode attribute to low power mode. - 3. Get the attributes of the advertise settings object. - 4. Compare the attributes found against the attributes exp. - - Expected Result: - Found attributes should match expected attributes. - - Returns: - True is pass - False if fail - - TAGS: LE, Advertising - Priority: 1 - """ - self.log.debug("Step 1: Setup environment.") - droid = self.ad_dut.droid - exp_adv_mode = ble_advertise_settings_modes['low_power'] - self.log.debug( - "Step 2: Set the filtering settings object's value to {}".format( - exp_adv_mode)) - return self.verify_adv_settings_adv_mode(droid, exp_adv_mode) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='ce087782-1535-4694-944a-e962c22638ed') - def test_adv_settings_set_adv_mode_low_latency(self): - """Tests advertise settings low latency mode. - - This advertisement settings from "set" advertisement mode should match - the corresponding "get" function. - - Steps: - 1. Build a new advertise settings object. - 2. Set the advertise mode attribute to low latency mode. - 3. Get the attributes of the advertise settings object. - 4. Compare the attributes found against the attributes exp. - - Expected Result: - Found attributes should match expected attributes. - - Returns: - True is pass - False if fail - - TAGS: LE, Advertising - Priority: 1 - """ - self.log.debug("Step 1: Setup environment.") - droid = self.ad_dut.droid - exp_adv_mode = ble_advertise_settings_modes['low_latency'] - self.log.debug( - "Step 2: Set the filtering settings object's value to {}".format( - exp_adv_mode)) - return self.verify_adv_settings_adv_mode(droid, exp_adv_mode) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='59b52be9-d38b-4814-af08-c68aa8910a16') - def test_adv_settings_set_invalid_adv_mode(self): - """Tests advertise settings invalid advertising mode. - - This advertisement settings from "set" advertisement mode should fail - when setting an invalid advertisement. - - Steps: - 1. Build a new advertise settings object. - 2. Set the advertise mode attribute to -1. - - Expected Result: - Building the advertise settings should fail. - - Returns: - True is pass - False if fail - - TAGS: LE, Advertising - Priority: 2 - """ - self.log.debug("Step 1: Setup environment.") - droid = self.ad_dut.droid - exp_adv_mode = -1 - self.log.debug("Step 2: Set the filtering mode to -1") - return self.verify_invalid_adv_settings_adv_mode(droid, exp_adv_mode) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='d8292633-831f-41c4-974a-ad267e9795e9') - def test_adv_settings_set_adv_tx_power_level_high(self): - """Tests advertise settings tx power level high. - - This advertisement settings from "set" advertisement tx power level - should match the corresponding "get" function. - - Steps: - 1. Build a new advertise settings object. - 2. Set the advertise mode attribute to tx power level high. - 3. Get the attributes of the advertise settings object. - 4. Compare the attributes found against the attributes exp. - - Expected Result: - Found attributes should match expected attributes. - - Returns: - True is pass - False if fail - - TAGS: LE, Advertising - Priority: 1 - """ - self.log.debug("Step 1: Setup environment.") - droid = self.ad_dut.droid - exp_adv_tx_power = ble_advertise_settings_tx_powers['high'] - self.log.debug( - "Step 2: Set the filtering settings object's value to {}".format( - exp_adv_tx_power)) - return self.verify_adv_settings_tx_power_level(droid, exp_adv_tx_power) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='d577de1f-4fd9-43d5-beff-c0696c5e0ea1') - def test_adv_settings_set_adv_tx_power_level_medium(self): - """Tests advertise settings tx power level medium. - - This advertisement settings from "set" advertisement tx power level - should match the corresponding "get" function. - - Steps: - 1. Build a new advertise settings object. - 2. Set the advertise mode attribute to tx power level medium. - 3. Get the attributes of the advertise settings object. - 4. Compare the attributes found against the attributes exp. - - Expected Result: - Found attributes should match expected attributes. - - Returns: - True is pass - False if fail - - TAGS: LE, Advertising - Priority: 1 - """ - self.log.debug("Step 1: Setup environment.") - test_result = True - droid = self.ad_dut.droid - exp_adv_tx_power = ble_advertise_settings_tx_powers['medium'] - self.log.debug( - "Step 2: Set the filtering settings object's value to {}".format( - exp_adv_tx_power)) - return self.verify_adv_settings_tx_power_level(droid, exp_adv_tx_power) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='e972f8b5-a3cf-4b3f-9223-a8a74c0fd855') - def test_adv_settings_set_adv_tx_power_level_low(self): - """Tests advertise settings tx power level low. - - This advertisement settings from "set" advertisement tx power level - should match the corresponding "get" function. - - Steps: - 1. Build a new advertise settings object. - 2. Set the advertise mode attribute to tx power level low. - 3. Get the attributes of the advertise settings object. - 4. Compare the attributes found against the attributes exp. - - Expected Result: - Found attributes should match expected attributes. - - Returns: - True is pass - False if fail - - TAGS: LE, Advertising - Priority: 1 - """ - self.log.debug("Step 1: Setup environment.") - droid = self.ad_dut.droid - exp_adv_tx_power = (ble_advertise_settings_tx_powers['low']) - self.log.debug( - "Step 2: Set the filtering settings object's value to ".format( - exp_adv_tx_power)) - return self.verify_adv_settings_tx_power_level(droid, exp_adv_tx_power) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='e972f8b5-a3cf-4b3f-9223-a8a74c0fd855') - def test_adv_settings_set_adv_tx_power_level_ultra_low(self): - """Tests advertise settings tx power level ultra low. - - This advertisement settings from "set" advertisement tx power level - should match the corresponding "get" function. - - Steps: - 1. Build a new advertise settings object. - 2. Set the advertise mode attribute to tx power level ultra low. - 3. Get the attributes of the advertise settings object. - 4. Compare the attributes found against the attributes exp. - - Expected Result: - Found attributes should match expected attributes. - - Returns: - True is pass - False if fail - - TAGS: LE, Advertising - Priority: 1 - """ - self.log.debug("Step 1: Setup environment.") - droid = self.ad_dut.droid - exp_adv_tx_power = ble_advertise_settings_tx_powers['ultra_low'] - self.log.debug( - "Step 2: Set the filtering settings object's value to ".format( - exp_adv_tx_power)) - return self.verify_adv_settings_tx_power_level(droid, exp_adv_tx_power) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='e972f8b5-a3cf-4b3f-9223-a8a74c0fd855') - def test_adv_settings_set_invalid_adv_tx_power_level(self): - """Tests advertise settings invalid advertising tx power level. - - This advertisement settings from "set" advertisement mode should fail - when setting an invalid advertisement. - - Steps: - 1. Build a new advertise settings object. - 2. Set the advertise tx power level attribute to -1. - - Expected Result: - Building the advertise settings should fail. - - Returns: - True is pass - False if fail - - TAGS: LE, Advertising - Priority: 1 - """ - self.log.debug("Step 1: Setup environment.") - droid = self.ad_dut.droid - exp_adv_tx_power = -1 - self.log.debug("Step 2: Set the filtering mode to -1") - return self.verify_invalid_adv_settings_tx_power_level( - droid, exp_adv_tx_power) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='1be71f77-64af-42b7-84cb-e06df0836966') - def test_adv_settings_set_is_connectable_true(self): - """Tests advertise settings is connectable true. - - This advertisement settings from "set" advertisement tx power level - should match the corresponding "get" function. - - Steps: - 1. Build a new advertise settings object. - 2. Set the advertise is connectable to true. - 3. Get the attributes of the advertise settings object. - 4. Compare the attributes found against the attributes exp. - - Expected Result: - Found attributes should match expected attributes. - - Returns: - True is pass - False if fail - - TAGS: LE, Advertising - Priority: 1 - """ - self.log.debug("Step 1: Setup environment.") - droid = self.ad_dut.droid - exp_is_connectable = True - self.log.debug( - "Step 2: Set the filtering settings object's value to {}".format( - exp_is_connectable)) - return self.verify_adv_settings_is_connectable(droid, - exp_is_connectable) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='f9865333-9198-4385-938d-5fc641ee9968') - def test_adv_settings_set_is_connectable_false(self): - """Tests advertise settings is connectable false. - - This advertisement settings from "set" advertisement tx power level - should match the corresponding "get" function. - - Steps: - 1. Build a new advertise settings object. - 2. Set the advertise is connectable to false. - 3. Get the attributes of the advertise settings object. - 4. Compare the attributes found against the attributes exp. - - Expected Result: - Found attributes should match expected attributes. - - Returns: - True is pass - False if fail - - TAGS: LE, Advertising - Priority: 1 - """ - self.log.debug("Step 1: Setup environment.") - droid = self.ad_dut.droid - exp_is_connectable = False - self.log.debug("Step 2: Set the filtering settings object's value to " - + str(exp_is_connectable)) - return self.verify_adv_settings_is_connectable(droid, - exp_is_connectable) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='a770ed7e-c6cd-4533-8876-e42e68f8b4fb') - def test_adv_data_set_service_uuids_empty(self): - """Tests advertisement data's service uuids to empty. - - This advertisement data from "set" advertisement service uuid - should match the corresponding "get" function. - - Steps: - 1. Build a new AdvertiseData object. - 2. Set the AdvertiseData's service uuid to empty. - 3. Get the attributes of the AdvertiseData object. - 4. Compare the attributes found against the attributes exp. - - Expected Result: - Found attributes should match expected attributes. - - Returns: - True is pass - False if fail - - TAGS: LE, Advertising - Priority: 1 - """ - self.log.debug("Step 1: Setup environment.") - droid = self.ad_dut.droid - exp_service_uuids = [] - self.log.debug("Step 2: Set the filtering data object's value to " + - str(exp_service_uuids)) - return self.verify_adv_data_service_uuids(droid, exp_service_uuids) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='3da511db-d024-45c8-be3c-fe8e123129fa') - def test_adv_data_set_service_uuids_single(self): - """Tests advertisement data's service uuids to empty. - - This advertisement data from "set" advertisement service uuid - should match the corresponding "get" function. - - Steps: - 1. Build a new AdvertiseData object. - 2. Set the AdvertiseData's service uuid to empty. - 3. Get the attributes of the AdvertiseData object. - 4. Compare the attributes found against the attributes exp. - - Expected Result: - Found attributes should match expected attributes. - - Returns: - True is pass - False if fail - - TAGS: LE, Advertising - Priority: 1 - """ - self.log.debug("Step 1: Setup environment.") - droid = self.ad_dut.droid - exp_service_uuids = ["00000000-0000-1000-8000-00805f9b34fb"] - self.log.debug("Step 2: Set the filtering data object's value to " + - str(exp_service_uuids)) - return self.verify_adv_data_service_uuids(droid, exp_service_uuids) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='15073359-d607-4a76-b60a-00a4b34f9a85') - def test_adv_data_set_service_uuids_multiple(self): - """Tests advertisement data's service uuids to multiple uuids. - - This advertisement data from "set" advertisement service uuid - should match the corresponding "get" function. - - Steps: - 1. Build a new AdvertiseData object. - 2. Set the AdvertiseData's service uuid to multiple uuids. - 3. Get the attributes of the AdvertiseData object. - 4. Compare the attributes found against the attributes exp. - - Expected Result: - Found attributes should match expected attributes. - - Returns: - True is pass - False if fail - - TAGS: LE, Advertising - Priority: 1 - """ - self.log.debug("Step 1: Setup environment.") - droid = self.ad_dut.droid - exp_service_uuids = [ - "00000000-0000-1000-8000-00805f9b34fb", - "00000000-0000-1000-8000-00805f9b34fb" - ] - self.log.debug("Step 2: Set the filtering data object's value to " + - str(exp_service_uuids)) - return self.verify_adv_data_service_uuids(droid, exp_service_uuids) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='af783a71-ef80-4974-a077-16a4ed8f0114') - def test_adv_data_set_service_uuids_invalid_uuid(self): - """Tests advertisement data's service uuids to an invalid uuid. - - This advertisement data from "set" advertisement service uuid - should fail when there is an invalid service uuid. - - Steps: - 1. Build a new AdvertiseData object. - 2. Set the AdvertiseData's service uuid to an invalid uuid. - - Expected Result: - Building the AdvertiseData should fail. - - Returns: - True is pass - False if fail - - TAGS: LE, Advertising - Priority: 1 - """ - self.log.debug("Step 1: Setup environment.") - droid = self.ad_dut.droid - exp_service_uuids = ["0"] - self.log.debug("Step 2: Set the filtering data service uuids to " + - str(exp_service_uuids)) - return self.verify_invalid_adv_data_service_uuids( - droid, exp_service_uuids) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='51d634e7-6271-4cc0-a57b-3c1b632a7db6') - def test_adv_data_set_service_data(self): - """Tests advertisement data's service data. - - This advertisement data from "set" advertisement service data - should match the corresponding "get" function. - - Steps: - 1. Build a new AdvertiseData object. - 2. Set the AdvertiseData's service data. - 3. Get the attributes of the AdvertiseData object. - 4. Compare the attributes found against the attributes exp. - - Expected Result: - Found attributes should match expected attributes. - - Returns: - True is pass - False if fail - - TAGS: LE, Advertising - Priority: 1 - """ - self.log.debug("Step 1: Setup environment.") - droid = self.ad_dut.droid - exp_service_data_uuid = "00000000-0000-1000-8000-00805f9b34fb" - exp_service_data = [1, 2, 3] - self.log.debug( - "Step 2: Set the filtering data object's service data uuid to: {}, " - "service data: {}".format(exp_service_data_uuid, exp_service_data)) - return self.verify_adv_data_service_data(droid, exp_service_data_uuid, - exp_service_data) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='aa18b0af-2a41-4b2a-af64-ea639961d561') - def test_adv_data_set_service_data_invalid_service_data(self): - """Tests advertisement data's invalid service data. - - This advertisement data from "set" advertisement service data - should fail on an invalid value. - - Steps: - 1. Build a new AdvertiseData object. - 2. Set the AdvertiseData's service data to an invalid value. - 3. Get the attributes of the AdvertiseData object. - 4. Compare the attributes found against the attributes exp. - - Expected Result: - Found attributes should match expected attributes. - - Returns: - True is pass - False if fail - - TAGS: LE, Advertising - Priority: 1 - """ - self.log.debug("Step 1: Setup environment.") - droid = self.ad_dut.droid - exp_service_data_uuid = "00000000-0000-1000-8000-00805f9b34fb" - exp_service_data = "helloworld" - self.log.debug( - "Step 2: Set the filtering data object's service data uuid to: {}, " - "service data: {}".format(exp_service_data_uuid, exp_service_data)) - return self.verify_invalid_adv_data_service_data( - droid, exp_service_data_uuid, exp_service_data) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='13a75a47-eff4-429f-a436-d244bbfe4496') - def test_adv_data_set_service_data_invalid_service_data_uuid(self): - """Tests advertisement data's invalid service data and uuid. - - This advertisement data from "set" advertisement service data - should fail on an invalid value. - - Steps: - 1. Build a new AdvertiseData object. - 2. Set the AdvertiseData's service data and uuid to an invalid value. - 3. Get the attributes of the AdvertiseData object. - 4. Compare the attributes found against the attributes exp. - - Expected Result: - Found attributes should match expected attributes. - - Returns: - True is pass - False if fail - - TAGS: LE, Advertising - Priority: 1 - """ - self.log.debug("Step 1: Setup environment.") - droid = self.ad_dut.droid - exp_service_data_uuid = "0" - exp_service_data = "1,2,3" - self.log.debug( - "Step 2: Set the filtering data object's service data uuid to: {}, " - "service data: {}".format(exp_service_data_uuid, exp_service_data)) - return self.verify_invalid_adv_data_service_data( - droid, exp_service_data_uuid, exp_service_data) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='386024e2-212e-4eed-8ef3-43d0c0239ea5') - def test_adv_data_set_manu_id(self): - """Tests advertisement data's manufacturers data and id. - - This advertisement data from "set" advertisement manufacturers data - should match the corresponding "get" function. - - Steps: - 1. Build a new AdvertiseData object. - 2. Set the AdvertiseData's manufacturers data and id. - 3. Get the attributes of the AdvertiseData object. - 4. Compare the attributes found against the attributes exp. - - Expected Result: - Found attributes should match expected attributes. - - Returns: - True is pass - False if fail - - TAGS: LE, Advertising - Priority: 1 - """ - self.log.debug("Step 1: Setup environment.") - droid = self.ad_dut.droid - exp_manu_id = 0 - exp_manu_specific_data = [1, 2, 3] - self.log.debug( - "Step 2: Set the filtering data object's service data manu id: {}" - ", manu specific data: {}".format(exp_manu_id, - exp_manu_specific_data)) - return self.verify_adv_data_manu_id(droid, exp_manu_id, - exp_manu_specific_data) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='650ceff2-2760-4a34-90fb-e637a2c5ebb5') - def test_adv_data_set_manu_id_invalid_manu_id(self): - """Tests advertisement data's manufacturers invalid id. - - This advertisement data from "set" advertisement manufacturers data - should not be successful on an invalid id. - - Steps: - 1. Build a new AdvertiseData object. - 2. Set the AdvertiseData's manufacturers id to -1. - 3. Build the advertisement data. - - Expected Result: - Building the advertisement data should fail. - - Returns: - True is pass - False if fail - - TAGS: LE, Advertising - Priority: 1 - """ - self.log.debug("Step 1: Setup environment.") - droid = self.ad_dut.droid - exp_manu_id = -1 - exp_manu_specific_data = [1, 2, 3] - self.log.debug( - "Step 2: Set the filtering data object's service data manu id: {}" - ", manu specific data: {}".format(exp_manu_id, - exp_manu_specific_data)) - return self.verify_invalid_adv_data_manu_id(droid, exp_manu_id, - exp_manu_specific_data) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='27ccd7d7-9cd2-4e95-8198-ef6ca746d1cc') - def test_adv_data_set_manu_id_invalid_manu_specific_data(self): - """Tests advertisement data's manufacturers invalid specific data. - - This advertisement data from "set" advertisement manufacturers data - should not be successful on an invalid specific data. - - Steps: - 1. Build a new AdvertiseData object. - 2. Set the AdvertiseData's manufacturers specific data to helloworld. - 3. Build the advertisement data. - - Expected Result: - Building the advertisement data should fail. - - Returns: - True is pass - False if fail - - TAGS: LE, Advertising - Priority: 1 - """ - self.log.debug("Step 1: Setup environment.") - droid = self.ad_dut.droid - exp_manu_id = 0 - exp_manu_specific_data = ['helloworld'] - self.log.debug( - "Step 2: Set the filtering data object's service data manu id: {}" - ", manu specific data: {}".format(exp_manu_id, - exp_manu_specific_data)) - return self.verify_invalid_adv_data_manu_id(droid, exp_manu_id, - exp_manu_specific_data) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='8e78d444-cd25-4c17-9532-53972a6f0ffe') - def test_adv_data_set_manu_id_max(self): - """Tests advertisement data's manufacturers id to the max size. - - This advertisement data from "set" advertisement manufacturers data - should match the corresponding "get" function. - - Steps: - 1. Build a new AdvertiseData object. - 2. Set the AdvertiseData's manufacturers id to JavaInterger.MAX value. - 3. Get the attributes of the AdvertiseData object. - 4. Compare the attributes found against the attributes exp. - - Expected Result: - Found attributes should match expected attributes. - - Returns: - True is pass - False if fail - - TAGS: LE, Advertising - Priority: 3 - """ - self.log.debug("Step 1: Setup environment.") - droid = self.ad_dut.droid - exp_manu_id = java_integer['max'] - exp_manu_specific_data = [1, 2, 3] - self.log.debug( - "Step 2: Set the filtering data object's service data manu id: {}" - ", manu specific data: {}".format(exp_manu_id, - exp_manu_specific_data)) - return self.verify_adv_data_manu_id(droid, exp_manu_id, - exp_manu_specific_data) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='6c4866b7-ddf5-44ef-a231-0af683c6db80') - def test_adv_data_set_include_tx_power_level_true(self): - """Tests advertisement data's include tx power level to True. - - This advertisement data from "set" advertisement manufacturers data - should match the corresponding "get" function. - - Steps: - 1. Build a new AdvertiseData object. - 2. Set the AdvertiseData's include tx power level to True. - 3. Get the attributes of the AdvertiseData object. - 4. Compare the attributes found against the attributes exp. - - Expected Result: - Found attributes should match expected attributes. - - Returns: - True is pass - False if fail - - TAGS: LE, Advertising - Priority: 1 - """ - self.log.debug("Step 1: Setup environment.") - droid = self.ad_dut.droid - exp_include_tx_power_level = True - self.log.debug( - "Step 2: Set the filtering data object's include tx power level: " - "{}".format(exp_include_tx_power_level)) - return self.verify_adv_data_include_tx_power_level( - droid, exp_include_tx_power_level) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='db06cc5f-60cf-4f04-b0fe-0c354f987541') - def test_adv_data_set_include_tx_power_level_false(self): - """Tests advertisement data's include tx power level to False. - - This advertisement data from "set" advertisement manufacturers data - should match the corresponding "get" function. - - Steps: - 1. Build a new AdvertiseData object. - 2. Set the AdvertiseData's include tx power level to False. - 3. Get the attributes of the AdvertiseData object. - 4. Compare the attributes found against the attributes exp. - - Expected Result: - Found attributes should match expected attributes. - - Returns: - True is pass - False if fail - - TAGS: LE, Advertising - Priority: 1 - """ - self.log.debug("Step 1: Setup environment.") - droid = self.ad_dut.droid - exp_include_tx_power_level = False - self.log.debug( - "Step 2: Set the filtering data object's include tx power level: {}" - .format(exp_include_tx_power_level)) - return self.verify_adv_data_include_tx_power_level( - droid, exp_include_tx_power_level) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='e99480c4-fd37-4791-a8d0-7eb8f8f72d62') - def test_adv_data_set_include_device_name_true(self): - """Tests advertisement data's include device name to True. - - This advertisement data from "set" advertisement manufacturers data - should match the corresponding "get" function. - - Steps: - 1. Build a new AdvertiseData object. - 2. Set the AdvertiseData's include device name to True. - 3. Get the attributes of the AdvertiseData object. - 4. Compare the attributes found against the attributes exp. - - Expected Result: - Found attributes should match expected attributes. - - Returns: - True is pass - False if fail - - TAGS: LE, Advertising - Priority: 1 - """ - self.log.debug("Step 1: Setup environment.") - droid = self.ad_dut.droid - exp_include_device_name = True - self.log.debug( - "Step 2: Set the filtering data object's include device name: {}" - .format(exp_include_device_name)) - return self.verify_adv_data_include_device_name( - droid, exp_include_device_name) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='b89ed642-c426-4777-8217-7bb8c2058592') - def test_adv_data_set_include_device_name_false(self): - """Tests advertisement data's include device name to False. - - This advertisement data from "set" advertisement manufacturers data - should match the corresponding "get" function. - - Steps: - 1. Build a new AdvertiseData object. - 2. Set the AdvertiseData's include device name to False. - 3. Get the attributes of the AdvertiseData object. - 4. Compare the attributes found against the attributes exp. - - Expected Result: - Found attributes should match expected attributes. - - Returns: - True is pass - False if fail - - TAGS: LE, Advertising - Priority: 1 - """ - self.log.debug("Step 1: Setup environment.") - test_result = True - droid = self.ad_dut.droid - exp_include_device_name = False - self.log.debug( - "Step 2: Set the filtering data object's include device name: {}". - format(exp_include_device_name)) - return self.verify_adv_data_include_device_name( - droid, exp_include_device_name) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='5033bcf5-a841-4b8b-af35-92c7237c7b36') - def test_advertisement_greater_than_31_bytes(self): - """Tests advertisement data's size to be greater than 31 bytes. - - This advertisement data from "set" advertisement manufacturers data - should match the corresponding "get" function. - - Steps: - 1. Build a new AdvertiseData object. - 2. Set the AdvertiseData's size to be greater than 31 bytes - 3. Build the advertisement data. - - Expected Result: - Api fails to build the AdvertiseData. - - Returns: - True is pass - False if fail - - TAGS: LE, Advertising - Priority: 1 - """ - test_result = True - droid = self.ad_dut.droid - ed = self.android_devices[0].ed - service_data = [] - for i in range(25): - service_data.append(i) - droid.bleAddAdvertiseDataServiceData( - "0000110D-0000-1000-8000-00805F9B34FB", service_data) - advcallback, adv_data, adv_settings = generate_ble_advertise_objects( - droid) - droid.bleStartBleAdvertising(advcallback, adv_data, adv_settings) - try: - ed.pop_event(adv_fail.format(advcallback)) - except rpc_client.Sl4aApiError: - self.log.info("{} event was not found.".format( - adv_fail.format(advcallback))) - return False - return test_result - - def verify_adv_settings_adv_mode(self, droid, exp_adv_mode): - try: - droid.bleSetAdvertiseSettingsAdvertiseMode(exp_adv_mode) - except BleAdvertiseVerificationError as error: - self.log.debug(str(error)) - return False - self.log.debug("Step 3: Get a filtering settings object's index.") - settings_index = droid.bleBuildAdvertiseSettings() - self.log.debug("Step 4: Get the filtering setting's filtering mode.") - adv_mode = droid.bleGetAdvertiseSettingsMode(settings_index) - if exp_adv_mode is not adv_mode: - self.log.debug("exp value: {}, Actual value: {}".format( - exp_adv_mode, adv_mode)) - return False - self.log.debug("Advertise Setting's filtering mode {} value " - "test Passed.".format(exp_adv_mode)) - return True - - def verify_adv_settings_tx_power_level(self, droid, exp_adv_tx_power): - try: - droid.bleSetAdvertiseSettingsTxPowerLevel(exp_adv_tx_power) - except BleAdvertiseVerificationError as error: - self.log.debug(str(error)) - return False - self.log.debug("Step 3: Get a filtering settings object's index.") - settings_index = droid.bleBuildAdvertiseSettings() - self.log.debug("Step 4: Get the filtering setting's tx power level.") - adv_tx_power_level = droid.bleGetAdvertiseSettingsTxPowerLevel( - settings_index) - if exp_adv_tx_power is not adv_tx_power_level: - self.log.debug("exp value: {}, Actual value: {}".format( - exp_adv_tx_power, adv_tx_power_level)) - return False - self.log.debug("Advertise Setting's tx power level {}" - " value test Passed.".format(exp_adv_tx_power)) - return True - - def verify_adv_settings_is_connectable(self, droid, exp_is_connectable): - try: - droid.bleSetAdvertiseSettingsIsConnectable(exp_is_connectable) - except BleAdvertiseVerificationError as error: - self.log.debug(str(error)) - return False - self.log.debug("Step 3: Get a filtering settings object's index.") - settings_index = droid.bleBuildAdvertiseSettings() - self.log.debug( - "Step 4: Get the filtering setting's is connectable value.") - is_connectable = droid.bleGetAdvertiseSettingsIsConnectable( - settings_index) - if exp_is_connectable is not is_connectable: - self.log.debug("exp value: {}, Actual value: {}".format( - exp_is_connectable, is_connectable)) - return False - self.log.debug("Advertise Setting's is connectable {}" - " value test Passed.".format(exp_is_connectable)) - return True - - def verify_adv_data_service_uuids(self, droid, exp_service_uuids): - try: - droid.bleSetAdvertiseDataSetServiceUuids(exp_service_uuids) - except BleAdvertiseVerificationError as error: - self.log.debug(str(error)) - return False - self.log.debug("Step 3: Get a filtering data object's index.") - data_index = droid.bleBuildAdvertiseData() - self.log.debug("Step 4: Get the filtering data's service uuids.") - service_uuids = droid.bleGetAdvertiseDataServiceUuids(data_index) - if exp_service_uuids != service_uuids: - self.log.debug("exp value: {}, Actual value: {}".format( - exp_service_uuids, service_uuids)) - return False - self.log.debug( - "Advertise Data's service uuids {}, value test Passed.".format( - exp_service_uuids)) - return True - - def verify_adv_data_service_data(self, droid, exp_service_data_uuid, - exp_service_data): - try: - droid.bleAddAdvertiseDataServiceData(exp_service_data_uuid, - exp_service_data) - except BleAdvertiseVerificationError as error: - self.log.debug(str(error)) - return False - self.log.debug("Step 3: Get a filtering data object's index.") - data_index = droid.bleBuildAdvertiseData() - self.log.debug("Step 4: Get the filtering data's service data.") - service_data = droid.bleGetAdvertiseDataServiceData( - data_index, exp_service_data_uuid) - if exp_service_data != service_data: - self.log.debug("exp value: {}, Actual value: {}".format( - exp_service_data, service_data)) - return False - self.log.debug("Advertise Data's service data uuid: {}, service data: " - "{}, value test Passed.".format(exp_service_data_uuid, - exp_service_data)) - return True - - def verify_adv_data_manu_id(self, droid, exp_manu_id, - exp_manu_specific_data): - try: - droid.bleAddAdvertiseDataManufacturerId(exp_manu_id, - exp_manu_specific_data) - except BleAdvertiseVerificationError as error: - self.log.debug(str(error)) - return False - self.log.debug("Step 3: Get a filtering data object's index.") - data_index = droid.bleBuildAdvertiseData() - self.log.debug("Step 5: Get the filtering data's manu specific data.") - manu_specific_data = droid.bleGetAdvertiseDataManufacturerSpecificData( - data_index, exp_manu_id) - if exp_manu_specific_data != manu_specific_data: - self.log.debug("exp value: " + str(exp_manu_specific_data) + - ", Actual value: " + str(manu_specific_data)) - return False - self.log.debug("Advertise Data's manu id: " + str(exp_manu_id) + - ", manu's specific data: " + - str(exp_manu_specific_data) + " value test Passed.") - return True - - def verify_adv_data_include_tx_power_level(self, droid, - exp_include_tx_power_level): - try: - droid.bleSetAdvertiseDataIncludeTxPowerLevel( - exp_include_tx_power_level) - except BleAdvertiseVerificationError as error: - self.log.debug(str(error)) - return False - self.log.debug("Step 3: Get a filtering settings object's index.") - data_index = droid.bleBuildAdvertiseData() - self.log.debug( - "Step 4: Get the filtering data's include tx power level.") - include_tx_power_level = droid.bleGetAdvertiseDataIncludeTxPowerLevel( - data_index) - if exp_include_tx_power_level is not include_tx_power_level: - self.log.debug("exp value: " + str(exp_include_tx_power_level) + - ", Actual value: " + str(include_tx_power_level)) - return False - self.log.debug("Advertise Setting's include tx power level " + str( - exp_include_tx_power_level) + " value test Passed.") - return True - - def verify_adv_data_include_device_name(self, droid, - exp_include_device_name): - try: - droid.bleSetAdvertiseDataIncludeDeviceName(exp_include_device_name) - except BleAdvertiseVerificationError as error: - self.log.debug(str(error)) - return False - self.log.debug("Step 3: Get a filtering settings object's index.") - data_index = droid.bleBuildAdvertiseData() - self.log.debug("Step 4: Get the filtering data's include device name.") - include_device_name = droid.bleGetAdvertiseDataIncludeDeviceName( - data_index) - if exp_include_device_name is not include_device_name: - self.log.debug("exp value: {}, Actual value: {}".format( - exp_include_device_name, include_device_name)) - return False - self.log.debug("Advertise Setting's include device name {}" - " value test Passed.".format(exp_include_device_name)) - return True - - def verify_invalid_adv_settings_adv_mode(self, droid, exp_adv_mode): - try: - droid.bleSetAdvertiseSettingsAdvertiseMode(exp_adv_mode) - droid.bleBuildAdvertiseSettings() - self.log.debug("Set Advertise settings invalid filtering mode " - "passed with input as {}".format(exp_adv_mode)) - return False - except rpc_client.Sl4aApiError: - self.log.debug( - "Set Advertise settings invalid filtering mode " - "failed successfully with input as {}".format(exp_adv_mode)) - return True - - def verify_invalid_adv_settings_tx_power_level(self, droid, - exp_adv_tx_power): - try: - droid.bleSetAdvertiseSettingsTxPowerLevel(exp_adv_tx_power) - droid.bleBuildAdvertiseSettings() - self.log.debug("Set Advertise settings invalid tx power level " + - " with input as {}".format(exp_adv_tx_power)) - return False - except rpc_client.Sl4aApiError: - self.log.debug( - "Set Advertise settings invalid tx power level " - "failed successfullywith input as {}".format(exp_adv_tx_power)) - return True - - def verify_invalid_adv_data_service_uuids(self, droid, exp_service_uuids): - try: - droid.bleSetAdvertiseDataSetServiceUuids(exp_service_uuids) - droid.bleBuildAdvertiseData() - self.log.debug("Set Advertise Data service uuids " + - " with input as {}".format(exp_service_uuids)) - return False - except rpc_client.Sl4aApiError: - self.log.debug( - "Set Advertise Data invalid service uuids failed " - "successfully with input as {}".format(exp_service_uuids)) - return True - - def verify_invalid_adv_data_service_data( - self, droid, exp_service_data_uuid, exp_service_data): - try: - droid.bleAddAdvertiseDataServiceData(exp_service_data_uuid, - exp_service_data) - droid.bleBuildAdvertiseData() - self.log.debug("Set Advertise Data service data uuid: {}," - ", service data: {}".format(exp_service_data_uuid, - exp_service_data)) - return False - except rpc_client.Sl4aApiError: - self.log.debug("Set Advertise Data service data uuid: " + - str(exp_service_data_uuid) + ", service data: " + - str(exp_service_data) + " failed successfully.") - return True - - def verify_invalid_adv_data_manu_id(self, droid, exp_manu_id, - exp_manu_specific_data): - try: - droid.bleAddAdvertiseDataManufacturerId(exp_manu_id, - exp_manu_specific_data) - droid.bleBuildAdvertiseData() - self.log.debug( - "Set Advertise Data manu id: " + str(exp_manu_id) + - ", manu specific data: " + str(exp_manu_specific_data)) - return False - except rpc_client.Sl4aApiError: - self.log.debug("Set Advertise Data manu id: {}," - " manu specific data: {},".format( - exp_manu_id, exp_manu_specific_data)) - return True diff --git a/acts/tests/google/ble/api/BleScanApiTest.py b/acts/tests/google/ble/api/BleScanApiTest.py deleted file mode 100644 index 06f2362079..0000000000 --- a/acts/tests/google/ble/api/BleScanApiTest.py +++ /dev/null @@ -1,1296 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -""" -Test script to exercise Ble Scan Api's. This exercises all getters and -setters. This is important since there is a builder object that is immutable -after you set all attributes of each object. If this test suite doesn't pass, -then other test suites utilising Ble Scanner will also fail. -""" - -from acts.controllers.sl4a_lib import rpc_client -from acts.test_decorators import test_tracker_info -from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest -from acts.test_utils.bt.bt_constants import ble_scan_settings_callback_types -from acts.test_utils.bt.bt_constants import ble_scan_settings_modes -from acts.test_utils.bt.bt_constants import ble_scan_settings_result_types -from acts.test_utils.bt.bt_constants import ble_scan_settings_report_delay_milli_seconds -from acts.test_utils.bt.bt_constants import ble_uuids - - -class BleScanResultsError(Exception): - """Error in getting scan results""" - - -class BleScanVerificationError(Exception): - """Error in comparing BleScan results""" - - -class BleSetScanSettingsError(Exception): - """Error in setting Ble Scan Settings""" - - -class BleSetScanFilterError(Exception): - """Error in setting Ble Scan Settings""" - - -class BleScanApiTest(BluetoothBaseTest): - def setup_class(self): - super().setup_class() - self.ad_dut = self.android_devices[0] - - def _format_defaults(self, input): - """ - Creates a dictionary of default ScanSetting and ScanFilter Values. - :return: input: dict - """ - if 'ScanSettings' not in input.keys(): - input['ScanSettings'] = ( - ble_scan_settings_callback_types['all_matches'], 0, - ble_scan_settings_modes['low_power'], - ble_scan_settings_result_types['full']) - if 'ScanFilterManufacturerDataId' not in input.keys(): - input['ScanFilterManufacturerDataId'] = -1 - if 'ScanFilterDeviceName' not in input.keys(): - input['ScanFilterDeviceName'] = None - if 'ScanFilterDeviceAddress' not in input.keys(): - input['ScanFilterDeviceAddress'] = None - if 'ScanFilterManufacturerData' not in input.keys(): - input['ScanFilterManufacturerData'] = None - return input - - def validate_scan_settings_helper(self, input, droid): - """ - Validates each input of the scan settings object that is matches what - was set or not set such that it matches the defaults. - :return: False at any point something doesn't match. True if everything - matches. - """ - filter_list = droid.bleGenFilterList() - if 'ScanSettings' in input.keys(): - try: - droid.bleSetScanSettingsCallbackType(input['ScanSettings'][0]) - droid.bleSetScanSettingsReportDelayMillis( - input['ScanSettings'][1]) - droid.bleSetScanSettingsScanMode(input['ScanSettings'][2]) - droid.bleSetScanSettingsResultType(input['ScanSettings'][3]) - except rpc_client.Sl4aApiError as error: - self.log.debug("Set Scan Settings failed with: ".format(error)) - return False - if 'ScanFilterDeviceName' in input.keys(): - try: - droid.bleSetScanFilterDeviceName(input['ScanFilterDeviceName']) - except rpc_client.Sl4aApiError as error: - self.log.debug("Set Scan Filter Device Name failed with: {}" - .format(error)) - return False - if 'ScanFilterDeviceAddress' in input.keys(): - try: - droid.bleSetScanFilterDeviceAddress( - input['ScanFilterDeviceAddress']) - except rpc_client.Sl4aApiError as error: - self.log.debug("Set Scan Filter Device Address failed with: {}" - .format(error)) - return False - if ('ScanFilterManufacturerDataId' in input.keys() - and 'ScanFilterManufacturerDataMask' in input.keys()): - try: - droid.bleSetScanFilterManufacturerData( - input['ScanFilterManufacturerDataId'], - input['ScanFilterManufacturerData'], - input['ScanFilterManufacturerDataMask']) - except rpc_client.Sl4aApiError as error: - self.log.debug("Set Scan Filter Manufacturer info with data " - "mask failed with: {}".format(error)) - return False - if ('ScanFilterManufacturerDataId' in input.keys() - and 'ScanFilterManufacturerData' in input.keys() - and 'ScanFilterManufacturerDataMask' not in input.keys()): - try: - droid.bleSetScanFilterManufacturerData( - input['ScanFilterManufacturerDataId'], - input['ScanFilterManufacturerData']) - except rpc_client.Sl4aApiError as error: - self.log.debug( - "Set Scan Filter Manufacturer info failed with: " - "{}".format(error)) - return False - if ('ScanFilterServiceUuid' in input.keys() - and 'ScanFilterServiceMask' in input.keys()): - - droid.bleSetScanFilterServiceUuid(input['ScanFilterServiceUuid'], - input['ScanFilterServiceMask']) - - input = self._format_defaults(input) - scan_settings_index = droid.bleBuildScanSetting() - scan_settings = ( - droid.bleGetScanSettingsCallbackType(scan_settings_index), - droid.bleGetScanSettingsReportDelayMillis(scan_settings_index), - droid.bleGetScanSettingsScanMode(scan_settings_index), - droid.bleGetScanSettingsScanResultType(scan_settings_index)) - - scan_filter_index = droid.bleBuildScanFilter(filter_list) - device_name_filter = droid.bleGetScanFilterDeviceName( - filter_list, scan_filter_index) - device_address_filter = droid.bleGetScanFilterDeviceAddress( - filter_list, scan_filter_index) - manufacturer_id = droid.bleGetScanFilterManufacturerId( - filter_list, scan_filter_index) - manufacturer_data = droid.bleGetScanFilterManufacturerData( - filter_list, scan_filter_index) - - if scan_settings != input['ScanSettings']: - self.log.debug("Scan Settings did not match. expected: {}, found: " - "{}".format(input['ScanSettings'], scan_settings)) - return False - if device_name_filter != input['ScanFilterDeviceName']: - self.log.debug("Scan Filter device name did not match. expected: " - "{}, found {}".format(input['ScanFilterDeviceName'], - device_name_filter)) - return False - if device_address_filter != input['ScanFilterDeviceAddress']: - self.log.debug( - "Scan Filter address name did not match. expected: " - "{}, found: {}".format(input['ScanFilterDeviceAddress'], - device_address_filter)) - return False - if manufacturer_id != input['ScanFilterManufacturerDataId']: - self.log.debug("Scan Filter manufacturer data id did not match. " - "expected: {}, found: {}".format( - input['ScanFilterManufacturerDataId'], - manufacturer_id)) - return False - if manufacturer_data != input['ScanFilterManufacturerData']: - self.log.debug("Scan Filter manufacturer data did not match. " - "expected: {}, found: {}".format( - input['ScanFilterManufacturerData'], - manufacturer_data)) - return False - if 'ScanFilterManufacturerDataMask' in input.keys(): - manufacturer_data_mask = droid.bleGetScanFilterManufacturerDataMask( - filter_list, scan_filter_index) - if manufacturer_data_mask != input['ScanFilterManufacturerDataMask']: - self.log.debug( - "Manufacturer data mask did not match. expected:" - " {}, found: {}".format( - input['ScanFilterManufacturerDataMask'], - manufacturer_data_mask)) - - return False - if ('ScanFilterServiceUuid' in input.keys() - and 'ScanFilterServiceMask' in input.keys()): - - expected_service_uuid = input['ScanFilterServiceUuid'] - expected_service_mask = input['ScanFilterServiceMask'] - service_uuid = droid.bleGetScanFilterServiceUuid( - filter_list, scan_filter_index) - service_mask = droid.bleGetScanFilterServiceUuidMask( - filter_list, scan_filter_index) - if service_uuid != expected_service_uuid.lower(): - self.log.debug("Service uuid did not match. expected: {}, " - "found {}".format(expected_service_uuid, - service_uuid)) - return False - if service_mask != expected_service_mask.lower(): - self.log.debug("Service mask did not match. expected: {}, " - "found {}".format(expected_service_mask, - service_mask)) - return False - self.scan_settings_index = scan_settings_index - self.filter_list = filter_list - self.scan_callback = droid.bleGenScanCallback() - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='5ffc9f7b-c261-4bf0-9a6b-7fda182b6c97') - def test_start_ble_scan_with_default_settings(self): - """Test LE scan with default settings. - - Test to validate all default scan settings values. - - Steps: - 1. Create LE scan objects. - 2. Start LE scan. - - Expected Result: - Scan starts successfully and matches expected settings. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning - Priority: 1 - """ - input = {} - return self.validate_scan_settings_helper(input, self.ad_dut.droid) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='88c3b0cb-b4d4-45d1-be25-9855290a6d03') - def test_stop_ble_scan_default_settings(self): - """Test stopping an LE scan. - - Test default scan settings on an actual scan. Verify it can also stop - the scan. - - Steps: - 1. Validate default scan settings. - 2. Start ble scan. - 3. Stop ble scan. - - Expected Result: - LE scan is stopped successfully. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning - Priority: 0 - """ - input = {} - test_result = self.validate_scan_settings_helper( - input, self.ad_dut.droid) - if not test_result: - self.log.error("Could not setup ble scanner.") - return test_result - self.ad_dut.droid.bleStartBleScan( - self.filter_list, self.scan_settings_index, self.scan_callback) - try: - self.ad_dut.droid.bleStopBleScan(self.scan_callback) - except BleScanResultsError as error: - self.log.error(str(error)) - test_result = False - return test_result - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='5aa7a4c2-0b7d-4000-a980-f00c9329a7b9') - def test_scan_settings_callback_type_all_matches(self): - """Test LE scan settings callback type all matches. - - Test scan settings callback type all matches. - - Steps: - 1. Validate the scan settings callback type with all other settings set - to their respective defaults. - - Expected Result: - Expected Scan settings should match found scan settings. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning - Priority: 1 - """ - input = {} - input["ScanSettings"] = ( - ble_scan_settings_callback_types['all_matches'], 0, - ble_scan_settings_modes['low_power'], - ble_scan_settings_result_types['full']) - return self.validate_scan_settings_helper(input, self.ad_dut.droid) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='fd764861-aa76-480e-b2d2-5d55a888d123') - def test_scan_settings_set_callback_type_first_match(self): - """Test LE scan settings callback type first match - - Test scan settings callback type first match. - - Steps: - 1. Validate the scan settings callback type with all other settings set - to their respective defaults. - - Expected Result: - Expected Scan settings should match found scan settings. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning - Priority: 1 - """ - input = {} - input["ScanSettings"] = ( - ble_scan_settings_callback_types['first_match'], 0, - ble_scan_settings_modes['low_power'], - ble_scan_settings_result_types['full']) - test_result = self.validate_scan_settings_helper( - input, self.ad_dut.droid) - return test_result - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='52e4626e-199c-4755-b9f1-8b38ecb30896') - def test_scan_settings_set_callback_type_match_lost(self): - """Test LE scan settings callback type match lost. - - Test scan settings callback type match lost. - - Steps: - 1. Validate the scan settings callback type with all other settings set - to their respective defaults. - - Expected Result: - Expected Scan settings should match found scan settings. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning - Priority: 1 - """ - input = {} - input["ScanSettings"] = ( - ble_scan_settings_callback_types['match_lost'], 0, - ble_scan_settings_modes['low_power'], - ble_scan_settings_result_types['full']) - test_result = self.validate_scan_settings_helper( - input, self.ad_dut.droid) - return test_result - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='57476b3c-ba7a-4342-86f6-1b56b2c00181') - def test_scan_settings_set_invalid_callback_type(self): - """Test LE scan settings invalid callback type. - - Test scan settings invalid callback type -1. - - Steps: - 1. Build a LE ScanSettings object with an invalid callback type. - - Expected Result: - Api should fail to build object. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning - Priority: 2 - """ - input = {} - input["ScanSettings"] = (-1, 0, ble_scan_settings_modes['low_power'], - ble_scan_settings_result_types['full']) - test_result = self.validate_scan_settings_helper( - input, self.ad_dut.droid) - return not test_result - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='52c80f0c-4f26-4cda-8a6b-291ac52f673a') - def test_scan_settings_set_scan_mode_low_power(self): - """Test LE scan settings scan mode low power mode. - - Test scan settings scan mode low power. - - Steps: - 1. Validate the scan settings scan mode with all other settings set to - their respective defaults. - - Expected Result: - Expected Scan settings should match found scan settings. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning - Priority: 1 - """ - input = {} - input["ScanSettings"] = ( - ble_scan_settings_callback_types['all_matches'], 0, - ble_scan_settings_modes['low_power'], - ble_scan_settings_result_types['full']) - test_result = self.validate_scan_settings_helper( - input, self.ad_dut.droid) - return test_result - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='20f4513c-44a7-435d-be4e-03420093297a') - def test_scan_settings_set_scan_mode_balanced(self): - """Test LE scan settings scan mode balanced. - - Test scan settings scan mode balanced. - - Steps: - 1. Validate the scan settings scan mode with all other settings set to - their respective defaults. - - Expected Result: - Expected Scan settings should match found scan settings. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning - Priority: 1 - """ - input = {} - input["ScanSettings"] = ( - ble_scan_settings_callback_types['all_matches'], 0, - ble_scan_settings_modes['balanced'], - ble_scan_settings_result_types['full']) - return self.validate_scan_settings_helper(input, self.ad_dut.droid) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='bf14e7fd-853b-4833-8fef-8c4bd629374b') - def test_scan_settings_set_scan_mode_low_latency(self): - """Test LE scan settings scan mode low latency. - - Test scan settings scan mode low latency. - - Steps: - 1. Validate the scan settings scan mode with all other settings set to - their respective defaults. - - Expected Result: - Expected Scan settings should match found scan settings. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning - Priority: 1 - """ - input = {} - input["ScanSettings"] = ( - ble_scan_settings_callback_types['all_matches'], 0, - ble_scan_settings_modes['low_latency'], - ble_scan_settings_result_types['full']) - return self.validate_scan_settings_helper(input, self.ad_dut.droid) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='9f3b2e10-98f8-4d6a-b6b6-e8dee87063f0') - def test_scan_settings_set_invalid_scan_mode(self): - """Test LE scan settings scan mode as an invalid value. - Test scan settings invalid scan mode -2. - Steps: - 1. Set the scan settings scan mode to -2. - - Expected Result: - Building the ScanSettings object should fail. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning - Priority: 1 - """ - input = {} - input["ScanSettings"] = ( - ble_scan_settings_callback_types['all_matches'], 0, -2, - ble_scan_settings_result_types['full']) - return not self.validate_scan_settings_helper(input, self.ad_dut.droid) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='cb246be7-4fef-4313-964d-5fb6dbe558c8') - def test_scan_settings_set_report_delay_millis_min(self): - """Test scan settings report delay millis as min value - - Test scan settings report delay millis min acceptable value. - - Steps: - 1. Validate the scan settings report delay millis with all other - settings set to their respective defaults. - - Expected Result: - Expected Scan settings should match found scan settings. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning - Priority: 2 - """ - input = {} - input["ScanSettings"] = ( - ble_scan_settings_callback_types['all_matches'], - ble_scan_settings_report_delay_milli_seconds['min'], - ble_scan_settings_modes['low_power'], - ble_scan_settings_result_types['full']) - return self.validate_scan_settings_helper(input, self.ad_dut.droid) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='db1ea8f6-503d-4e9a-b61a-01210508c5a2') - def test_scan_settings_set_report_delay_millis_min_plus_one(self): - """Test scan settings report delay millis as min value plus one. - - Test scan settings report delay millis as min value plus one. - - Steps: - 1. Validate the scan settings report delay millis with all other - settings set to their respective defaults. - - Expected Result: - Expected Scan settings should match found scan settings. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning - Priority: 4 - """ - input = {} - input["ScanSettings"] = ( - ble_scan_settings_callback_types['all_matches'], - ble_scan_settings_report_delay_milli_seconds['min'] + 1, - ble_scan_settings_modes['low_power'], - ble_scan_settings_result_types['full']) - return self.validate_scan_settings_helper(input, self.ad_dut.droid) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='54e83ff8-92b0-473e-839a-1ff1c7dcea83') - def test_scan_settings_set_report_delay_millis_max(self): - """Test scan settings report delay millis as max value. - - Test scan settings report delay millis max value. - - Steps: - 1. Validate the scan settings report delay millis with all other - settings set to their respective defaults. - - Expected Result: - Expected Scan settings should match found scan settings. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning - Priority: 3 - """ - input = {} - input["ScanSettings"] = ( - ble_scan_settings_callback_types['all_matches'], - ble_scan_settings_report_delay_milli_seconds['max'], - ble_scan_settings_modes['low_power'], - ble_scan_settings_result_types['full']) - return self.validate_scan_settings_helper(input, self.ad_dut.droid) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='45d918ec-7e43-463b-8f07-f009f8808903') - def test_scan_settings_set_report_delay_millis_max_minus_one(self): - """Test scan settings report delay millis as max value minus one. - - Test scan settings report delay millis max value - 1. - - Steps: - 1. Validate the scan settings report delay millis with all other - settings set to their respective defaults. - - Expected Result: - Expected Scan settings should match found scan settings. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning - Priority: 3 - """ - input = {} - input["ScanSettings"] = ( - ble_scan_settings_callback_types['all_matches'], - ble_scan_settings_report_delay_milli_seconds['max'] - 1, - ble_scan_settings_modes['low_power'], - ble_scan_settings_result_types['full']) - return self.validate_scan_settings_helper(input, self.ad_dut.droid) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='eb94b5ee-f2e7-4322-b3df-7bdd3a250262') - def test_scan_settings_set_invalid_report_delay_millis_min_minus_one(self): - """Test scan settings report delay millis as an invalid value. - - Test scan settings invalid report delay millis min value - 1. - - Steps: - 1. Set scan settings report delay millis to min value -1. - 2. Build scan settings object. - - Expected Result: - Building scan settings object should fail. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning - Priority: 2 - """ - droid = self.ad_dut.droid - input = {} - input["ScanSettings"] = ( - ble_scan_settings_callback_types['all_matches'], - ble_scan_settings_report_delay_milli_seconds['min'] - 1, - ble_scan_settings_modes['low_power'], - ble_scan_settings_result_types['full']) - return not self.validate_scan_settings_helper(input, droid) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='8f5a2bd0-6037-4ac6-a962-f11e7fc13920') - def test_scan_settings_set_scan_result_type_full(self): - """Test scan settings result type full. - - Test scan settings result type full. - - Steps: - 1. Validate the scan settings result type with all other settings - set to their respective defaults. - - Expected Result: - Expected Scan settings should match found scan settings. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning - Priority: 1 - """ - input = {} - input["ScanSettings"] = ( - ble_scan_settings_callback_types['all_matches'], 0, - ble_scan_settings_modes['low_power'], - ble_scan_settings_result_types['full']) - return self.validate_scan_settings_helper(input, self.ad_dut.droid) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='610fe301-600e-443e-a28b-cd722cc8a4c1') - def test_scan_settings_set_scan_result_type_abbreviated(self): - """Test scan settings result type abbreviated. - - Test scan settings result type abbreviated. - - Steps: - 1. Validate the scan settings result type with all other settings - set to their respective defaults. - - Expected Result: - Expected Scan settings should match found scan settings. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning - Priority: 1 - """ - input = {} - input["ScanSettings"] = ( - ble_scan_settings_callback_types['all_matches'], 0, - ble_scan_settings_modes['low_power'], - ble_scan_settings_result_types['abbreviated']) - return self.validate_scan_settings_helper(input, self.ad_dut.droid) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='ed58430b-8180-472f-a118-64f5fce5e84c') - def test_scan_settings_set_invalid_scan_result_type(self): - """Test scan settings result type as an invalid value. - - Test scan settings invalid result type -1. - - Steps: - 1. Set scan settings result type as an invalid value. - 2. Build scan settings object. - - Expected Result: - Expected Scan settings should match found scan settings. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning - Priority: 2 - """ - input = {} - input["ScanSettings"] = ( - ble_scan_settings_callback_types['all_matches'], 0, - ble_scan_settings_modes['low_power'], -1) - return not self.validate_scan_settings_helper(input, self.ad_dut.droid) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='6489665f-313d-4b1b-bd7f-f0fdeeaad335') - def test_scan_filter_set_device_name(self): - """Test scan filter set valid device name. - - Test scan filter device name sl4atest. - - Steps: - 1. Validate the scan filter device name with all other settings - set to their respective defaults. - - Expected Result: - Expected Scan filter should match found scan settings. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning - Priority: 1 - """ - input = {} - input['ScanFilterDeviceName'] = "sl4atest" - return self.validate_scan_settings_helper(input, self.ad_dut.droid) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='76021a9a-14ca-4a2f-a908-96ab90db39ce') - def test_scan_filter_set_device_name_blank(self): - """Test scan filter set blank device name. - - Test scan filter device name blank. - - Steps: - 1. Validate the scan filter device name with all other settings - set to their respective defaults. - - Expected Result: - Expected Scan filter should match found scan filter. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning - Priority: 1 - """ - droid = self.ad_dut.droid - input = {} - input['ScanFilterDeviceName'] = "" - return self.validate_scan_settings_helper(input, droid) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='d77c3d81-43a9-4572-a99b-87969117ede5') - def test_scan_filter_set_device_name_special_chars(self): - """Test scan filter set device name as special chars. - - Test scan filter device name special characters. - - Steps: - 1. Validate the scan filter device name with all other settings - set to their respective defaults. - - Expected Result: - Expected Scan filter should match found scan filter. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning - Priority: 1 - """ - input = {} - input['ScanFilterDeviceName'] = "!@#$%^&*()\":<>/" - return self.validate_scan_settings_helper(input, self.ad_dut.droid) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='1697004e-76ab-444b-9419-0437e30444ad') - def test_scan_filter_set_device_address(self): - """Test scan filter set valid device address. - - Test scan filter device address valid. - - Steps: - 1. Validate the scan filter device address with all other settings - set to their respective defaults. - - Expected Result: - Expected Scan filter should match found scan filter. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning - Priority: 1 - """ - input = {} - input['ScanFilterDeviceAddress'] = "01:02:03:AB:CD:EF" - return self.validate_scan_settings_helper(input, self.ad_dut.droid) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='eab0409c-7fc5-4d1f-8fbe-5ee2bb743f7e') - def test_scan_filter_set_invalid_device_address_lower_case(self): - """Test scan filter set invalid device address. - - Test scan filter device address lower case. - - Steps: - 1. Set the scan filter address to an invalid, lowercase mac address - - Expected Result: - Api to build scan filter should fail. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning - Priority: 2 - """ - input = {} - input['ScanFilterDeviceAddress'] = "01:02:03:ab:cd:ef" - return not self.validate_scan_settings_helper(input, self.ad_dut.droid) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='0ec491ac-d273-468e-bbfe-e36a290aeb2a') - def test_scan_filter_set_invalid_device_address_blank(self): - """Test scan filter set invalid device address. - - Test scan filter invalid device address blank. - - Steps: - 1. Set the scan filter address to an invalid, blank mac address - - Expected Result: - Api to build scan filter should fail. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning - Priority: 2 - """ - input = {} - input['ScanFilterDeviceAddress'] = "" - test_result = self.validate_scan_settings_helper( - input, self.ad_dut.droid) - return not test_result - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='5cebc454-091c-4e46-b200-1e52c8dffbec') - def test_scan_filter_set_invalid_device_address_bad_format(self): - """Test scan filter set badly formatted device address. - - Test scan filter badly formatted device address. - - Steps: - 1. Set the scan filter address to an invalid, blank mac address - - Expected Result: - Api to build scan filter should fail. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning - Priority: 2 - """ - input = {} - input['ScanFilterDeviceAddress'] = "10.10.10.10.10" - return not self.validate_scan_settings_helper(input, self.ad_dut.droid) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='d5249d10-1486-4c38-a22d-1f1b077926db') - def test_scan_filter_set_invalid_device_address_bad_address(self): - """Test scan filter device address as an invalid value. - - Test scan filter invalid device address invalid characters. - - Steps: - 1. Set a scan filter's device address as ZZ:ZZ:ZZ:ZZ:ZZ:ZZ - - Expected Result: - Api to build the scan filter should fail. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning - Priority: 1 - """ - input = {} - input['ScanFilterDeviceAddress'] = "ZZ:ZZ:ZZ:ZZ:ZZ:ZZ" - return not self.validate_scan_settings_helper(input, self.ad_dut.droid) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='65c62d50-69f6-4a0b-bd74-2340e0ce32ca') - def test_scan_filter_set_manufacturer_id_data(self): - """Test scan filter manufacturer data. - - Test scan filter manufacturer data with a valid input. - - Steps: - 1. Validate the scan filter manufacturer id with all other settings - set to their respective defaults. - - Expected Result: - Expected Scan filter should match found scan filter. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning - Priority: 1 - """ - expected_manufacturer_id = 0 - expected_manufacturer_data = [1, 2, 1, 3, 4, 5, 6] - input = {} - input['ScanFilterManufacturerDataId'] = expected_manufacturer_id - input['ScanFilterManufacturerData'] = expected_manufacturer_data - return self.validate_scan_settings_helper(input, self.ad_dut.droid) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='12807021-9f66-4784-b34a-80859cf4a32f') - def test_scan_filter_set_manufacturer_id_data_mask(self): - """Test scan filter manufacturer data mask. - - Test scan filter manufacturer data with a valid data mask. - - Steps: - 1. Validate the scan filter manufacturer id with all other settings - set to their respective defaults. - - Expected Result: - Expected Scan filter should match found scan filter. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning - Priority: 1 - """ - expected_manufacturer_id = 1 - expected_manufacturer_data = [1] - expected_manufacturer_data_mask = [1, 2, 1, 3, 4, 5, 6] - input = {} - input['ScanFilterManufacturerDataId'] = expected_manufacturer_id - input['ScanFilterManufacturerData'] = expected_manufacturer_data - input[ - 'ScanFilterManufacturerDataMask'] = expected_manufacturer_data_mask - return self.validate_scan_settings_helper(input, self.ad_dut.droid) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='980e5ab6-5381-4471-8e5b-0b716665a9b8') - def test_scan_filter_set_manufacturer_max_id(self): - """Test scan filter manufacturer data id. - - Test scan filter manufacturer data max id. - - Steps: - 1. Validate the scan filter manufacturer id with all other settings - set to their respective defaults. - - Expected Result: - Expected Scan filter should match found scan filter. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning - Priority: 2 - """ - expected_manufacturer_id = 2147483647 - expected_manufacturer_data = [1, 2, 1, 3, 4, 5, 6] - input = {} - input['ScanFilterManufacturerDataId'] = expected_manufacturer_id - input['ScanFilterManufacturerData'] = expected_manufacturer_data - return self.validate_scan_settings_helper(input, self.ad_dut.droid) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='cf0efe38-8621-4288-be26-742719da2f6c') - def test_scan_filter_set_manufacturer_data_empty(self): - """Test scan filter empty manufacturer data. - - Test scan filter manufacturer data as empty but valid manufacturer data. - - Steps: - 1. Validate the scan filter manufacturer id with all other settings - set to their respective defaults. - - Expected Result: - Expected Scan filter should match found scan filter. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning - Priority: 2 - """ - expected_manufacturer_id = 1 - expected_manufacturer_data = [] - input = {} - input['ScanFilterManufacturerDataId'] = expected_manufacturer_id - input['ScanFilterManufacturerData'] = expected_manufacturer_data - return self.validate_scan_settings_helper(input, self.ad_dut.droid) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='7ea0e82e-e92a-469c-8432-8f21978508cb') - def test_scan_filter_set_manufacturer_data_mask_empty(self): - """Test scan filter empty manufacturer data mask. - - Test scan filter manufacturer mask empty. - - Steps: - 1. Validate the scan filter manufacturer id with all other settings - set to their respective defaults. - - Expected Result: - Expected Scan filter should match found scan filter. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning - Priority: 1 - """ - expected_manufacturer_id = 1 - expected_manufacturer_data = [1, 2, 1, 3, 4, 5, 6] - expected_manufacturer_data_mask = [] - input = {} - input['ScanFilterManufacturerDataId'] = expected_manufacturer_id - input['ScanFilterManufacturerData'] = expected_manufacturer_data - input[ - 'ScanFilterManufacturerDataMask'] = expected_manufacturer_data_mask - return self.validate_scan_settings_helper(input, self.ad_dut.droid) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='88e4a9b8-afae-48cb-873a-fd6b4ef84116') - def test_scan_filter_set_invalid_manufacturer_min_id_minus_one(self): - """Test scan filter invalid manufacturer data. - - Test scan filter invalid manufacturer id min value - 1. - - Steps: - 1. Set the scan filters manufacturer id to -1. - 2. Build the scan filter. - - Expected Result: - Api to build the scan filter should fail. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning - Priority: 2 - """ - expected_manufacturer_id = -1 - expected_manufacturer_data = [1, 2, 1, 3, 4, 5, 6] - input = {} - input['ScanFilterManufacturerDataId'] = expected_manufacturer_id - input['ScanFilterManufacturerData'] = expected_manufacturer_data - return not self.validate_scan_settings_helper(input, self.ad_dut.droid) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='2e8438dc-29cd-4f72-8747-4a161974d4d3') - def test_scan_filter_set_service_uuid(self): - """Test scan filter set valid service uuid. - - Test scan filter service uuid. - - Steps: - 1. Validate the scan filter service uuid with all other settings - set to their respective defaults. - - Expected Result: - Expected Scan filter should match found scan filter. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning - Priority: 1 - """ - expected_service_uuid = "00000000-0000-1000-8000-00805F9B34FB" - expected_service_mask = "00000000-0000-1000-8000-00805F9B34FB" - input = {} - input['ScanFilterServiceUuid'] = expected_service_uuid - input['ScanFilterServiceMask'] = expected_service_mask - return self.validate_scan_settings_helper(input, self.ad_dut.droid) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='e07b9985-44b6-4dc4-b570-0833b5d2893c') - def test_scan_filter_service_uuid_p_service(self): - """Test scan filter service uuid. - - Test scan filter service uuid p service - - Steps: - 1. Validate the scan filter service uuid with all other settings - set to their respective defaults. - - Expected Result: - Expected Scan filter should match found scan filter. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning - Priority: 2 - """ - expected_service_uuid = ble_uuids['p_service'] - expected_service_mask = "00000000-0000-1000-8000-00805F9B34FB" - self.log.debug("Step 1: Setup environment.") - - input = {} - input['ScanFilterServiceUuid'] = expected_service_uuid - input['ScanFilterServiceMask'] = expected_service_mask - return self.validate_scan_settings_helper(input, self.ad_dut.droid) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='0467af19-6e9a-4cfe-9e10-878b0c224df2') - def test_classic_ble_scan_with_service_uuids_p(self): - """Test classic LE scan with valid service uuid. - - Test classic ble scan with scan filter service uuid p service uuids. - - Steps: - 1. Validate the scan filter service uuid with all other settings - set to their respective defaults. - 2. Start classic ble scan. - 3. Stop classic ble scan - - Expected Result: - Expected Scan filter should match found scan filter. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning - Priority: 1 - """ - - droid = self.ad_dut.droid - service_uuid_list = [ble_uuids['p_service']] - scan_callback = droid.bleGenLeScanCallback() - return self.verify_classic_ble_scan_with_service_uuids( - droid, scan_callback, service_uuid_list) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='516c295f-a2df-44f6-b2ad-54451af43ce8') - def test_classic_ble_scan_with_service_uuids_hr(self): - """Test classic LE scan with valid service uuid. - - Test classic ble scan with scan filter service uuid hr service - - Steps: - 1. Validate the scan filter service uuid with all other settings - set to their respective defaults. - 2. Start classic ble scan. - 3. Stop classic ble scan - - Expected Result: - Expected Scan filter should match found scan filter. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning - Priority: 1 - """ - droid = self.ad_dut.droid - service_uuid_list = [ble_uuids['hr_service']] - scan_callback = droid.bleGenLeScanCallback() - return self.verify_classic_ble_scan_with_service_uuids( - droid, scan_callback, service_uuid_list) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='0458b5e0-bb0b-4d6e-ab79-e21169d3256b') - def test_classic_ble_scan_with_service_uuids_empty_uuid_list(self): - """Test classic LE scan with empty but valid uuid list. - - Test classic ble scan with service uuids as empty list. - - Steps: - 1. Validate the scan filter service uuid with all other settings - set to their respective defaults. - 2. Start classic ble scan. - 3. Stop classic ble scan - - Expected Result: - Expected Scan filter should match found scan filter. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning - Priority: 1 - """ - droid = self.ad_dut.droid - service_uuid_list = [] - scan_callback = droid.bleGenLeScanCallback() - return self.verify_classic_ble_scan_with_service_uuids( - droid, scan_callback, service_uuid_list) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='c0d84a37-c86c-43c4-9dc7-d16959fdbc2a') - def test_classic_ble_scan_with_service_uuids_hr_and_p(self): - """Test classic LE scan with multiple service uuids. - - Test classic ble scan with service uuids a list of hr and p service. - - Steps: - 1. Validate the scan filter service uuid with all other settings - set to their respective defaults. - 2. Start classic ble scan. - 3. Stop classic ble scan - - Expected Result: - Expected Scan filter should match found scan filter. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning - Priority: 1 - """ - droid = self.ad_dut.droid - service_uuid_list = [ble_uuids['hr_service'], ble_uuids['p_service']] - scan_callback = droid.bleGenLeScanCallback() - return self.verify_classic_ble_scan_with_service_uuids( - droid, scan_callback, service_uuid_list) - - def verify_classic_ble_scan_with_service_uuids(self, droid, scan_callback, - service_uuid_list): - - test_result = True - try: - test_result = droid.bleStartClassicBleScanWithServiceUuids( - scan_callback, service_uuid_list) - except BleScanResultsError as error: - self.log.error(str(error)) - return False - droid.bleStopClassicBleScan(scan_callback) - if not test_result: - self.log.error( - "Start classic ble scan with service uuids return false " - "boolean value.") - return False - return True diff --git a/acts/tests/google/ble/api/GattApiTest.py b/acts/tests/google/ble/api/GattApiTest.py deleted file mode 100644 index cc87979a73..0000000000 --- a/acts/tests/google/ble/api/GattApiTest.py +++ /dev/null @@ -1,119 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -""" -Test script to exercise Gatt Apis. -""" - -from acts.controllers.sl4a_lib import rpc_client -from acts.test_decorators import test_tracker_info -from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest -from acts.test_utils.bt.bt_test_utils import setup_multiple_devices_for_bt_test - - -class GattApiTest(BluetoothBaseTest): - def setup_class(self): - super().setup_class() - self.ad = self.android_devices[0] - - return setup_multiple_devices_for_bt_test(self.android_devices) - - def setup_test(self): - for a in self.android_devices: - a.ed.clear_all_events() - return True - - def teardown_test(self): - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='fffe5c46-eb97-477b-ac3e-3f70700bb84e') - def test_open_gatt_server(self): - """Test a gatt server. - - Test opening a gatt server. - - Steps: - 1. Create a gatt server callback. - 2. Open the gatt server. - - Expected Result: - Api to open gatt server should not fail. - - Returns: - Pass if True - Fail if False - - TAGS: LE, GATT - Priority: 1 - """ - gatt_server_cb = self.ad.droid.gattServerCreateGattServerCallback() - self.ad.droid.gattServerOpenGattServer(gatt_server_cb) - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='12828c2c-b6ae-4670-a829-9867e75fb711') - def test_open_gatt_server_on_same_callback(self): - """Test repetitive opening of a gatt server. - - Test opening a gatt server on the same callback twice in a row. - - Steps: - 1. Create a gatt server callback. - 2. Open the gatt server. - 3. Open the gatt server on the same callback as step 2. - - Expected Result: - Api to open gatt server should not fail. - - Returns: - Pass if True - Fail if False - - TAGS: LE, GATT - Priority: 2 - """ - gatt_server_cb = self.ad.droid.gattServerCreateGattServerCallback() - self.ad.droid.gattServerOpenGattServer(gatt_server_cb) - self.ad.droid.gattServerOpenGattServer(gatt_server_cb) - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='63fc684d-6c1d-455e-afdb-1887123b4d2f') - def test_open_gatt_server_on_invalid_callback(self): - """Test gatt server an an invalid callback. - - Test opening a gatt server with an invalid callback. - - Steps: - 1. Open a gatt server with the gall callback set to -1. - - Expected Result: - Api should fail to open a gatt server. - - Returns: - Pass if True - Fail if False - - TAGS: LE, GATT - Priority: 2 - """ - invalid_callback_index = -1 - try: - self.ad.droid.gattServerOpenGattServer(invalid_callback_index) - except rpc_client.Sl4aApiError as e: - self.log.info("Failed successfully with exception: {}.".format(e)) - return True - return False diff --git a/acts/tests/google/ble/beacon_tests/BeaconSwarmTest.py b/acts/tests/google/ble/beacon_tests/BeaconSwarmTest.py deleted file mode 100644 index 0df9a7b2be..0000000000 --- a/acts/tests/google/ble/beacon_tests/BeaconSwarmTest.py +++ /dev/null @@ -1,341 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -""" -This test script exercises different testcases with a lot of ble beacon traffic. - -This test script was designed with this setup in mind: -Shield box one: Android Device as DUT. 7x Sprout devices acting as 192 beacons -""" - -import threading - -from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest -from acts.test_utils.bt.BleEnum import AdvertiseSettingsAdvertiseMode -from acts.test_utils.bt.BleEnum import ScanSettingsScanMode -from acts.test_utils.bt.bt_test_utils import adv_succ -from acts.test_utils.bt.bt_test_utils import batch_scan_result -from acts.test_utils.bt.bt_test_utils import scan_result -from acts.test_utils.bt.bt_test_utils import generate_ble_advertise_objects -from acts.test_utils.bt.bt_test_utils import generate_ble_scan_objects -from acts.test_utils.bt.bt_test_utils import reset_bluetooth -from acts.test_utils.bt.bt_test_utils import setup_multiple_devices_for_bt_test -from acts.test_utils.bt.bt_test_utils import take_btsnoop_logs - - -class BeaconSwarmTest(BluetoothBaseTest): - default_timeout = 10 - beacon_swarm_count = 0 - advertising_device_name_list = [] - discovered_mac_address_list = [] - - def setup_test(self): - self.discovered_mac_address_list = [] - for a in self.android_devices: - a.ed.clear_all_events() - return True - - def teardown_test(self): - reset_bluetooth([self.android_devices[0]]) - return True - - def setup_class(self): - self.scn_ad = self.android_devices[0] - if not setup_multiple_devices_for_bt_test(self.android_devices): - return False - return self._start_special_advertisements() - - def cleanup_class(self): - return reset_bluetooth(self.android_devices) - - def on_fail(self, test_name, begin_time): - take_btsnoop_logs(self.android_devices, self, test_name) - reset_bluetooth([self.scn_ad]) - - def _start_advertisements_thread(self, ad, beacon_count, restart=False): - d, e = ad.droid, ad.ed - if restart: - try: - reset_bluetooth([ad]) - except Exception: - self.log.debug("Failed resetting Bluetooth, continuing...") - return - try: - for _ in range(beacon_count): - d.bleSetAdvertiseDataIncludeDeviceName(True) - d.bleSetAdvertiseSettingsAdvertiseMode( - AdvertiseSettingsAdvertiseMode.ADVERTISE_MODE_LOW_LATENCY. - value) - advertise_callback, advertise_data, advertise_settings = ( - generate_ble_advertise_objects(d)) - d.bleStartBleAdvertising(advertise_callback, advertise_data, - advertise_settings) - try: - e.pop_event( - adv_succ.format(advertise_callback), - self.default_timeout) - self.beacon_swarm_count += 1 - local_bt_name = d.bluetoothGetLocalName() - if local_bt_name not in self.advertising_device_name_list: - self.advertising_device_name_list.append( - d.bluetoothGetLocalName()) - except Exception as e: - self.log.info("Advertising failed due to " + str(e)) - self.log.info("Beacons active: {}".format( - self.beacon_swarm_count)) - except Exception: - self.log.debug( - "Something went wrong in starting advertisements, continuing.") - return - - def _start_special_advertisements(self): - self.log.info("Setting up advertisements.") - beacon_serials = [] - beacon_count = 0 - try: - beacon_serials = self.user_params['beacon_devices'] - beacon_count = self.user_params['beacon_count'] - except AttributeError: - self.log.info( - "No controllable devices connected to create beacons with." - " Continuing...") - threads = [] - for a in self.android_devices: - d, e = a.droid, a.ed - serial_no = a.serial - if serial_no not in beacon_serials: - continue - thread = threading.Thread(target=self._start_advertisements_thread, - args=(d, e, beacon_count)) - threads.append(thread) - thread.start() - for t in threads: - t.join() - if self.beacon_swarm_count < (beacon_count * len(beacon_serials)): - self.log.error("Not enough beacons advertising: {}".format( - self.beacon_swarm_count)) - return False - return True - - def _restart_special_advertisements_thread(self): - beacon_serials = [] - beacon_count = 0 - try: - beacon_serials = self.user_params['beacon_devices'] - beacon_count = self.user_params['beacon_count'] - except AttributeError: - self.log.info("No controllable devices connected to create beacons" - " with. Continuing...") - threads = [] - while True: - self.log.info("Restarting advertisements.") - for a in self.android_devices: - d, e = a.droid, a.ed - serial_no = a.serial - if serial_no not in beacon_serials: - continue - thread = threading.Thread( - target=self._start_advertisements_thread, - args=(d, e, beacon_count, True)) - threads.append(thread) - thread.start() - for t in threads: - t.join() - return True - - def test_swarm_1000_on_scan_result(self): - """Test LE scanning in a mass beacon deployment. - - Test finding 1000 LE scan results in a mass beacon deployment. - - Steps: - 1. Assume that mass beacon deployment is setup. - 2. Set LE scanning mode to low latency. - 3. Start LE scan. - 4. Pop scan results off the event dispatcher 1000 times. - 5. Stop LE scanning. - - Expected Result: - 1000 scan results should be found without any exceptions. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning, Beacon - Priority: 1 - """ - self.scn_ad.droid.bleSetScanSettingsScanMode( - ScanSettingsScanMode.SCAN_MODE_LOW_LATENCY.value) - filter_list, scan_settings, scan_callback = generate_ble_scan_objects( - self.scn_ad.droid) - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - for _ in range(1000000): - event_info = self.scn_ad.ed.pop_event( - scan_result.format(scan_callback), self.default_timeout) - mac_address = event_info['data']['Result']['deviceInfo']['address'] - if mac_address not in self.discovered_mac_address_list: - self.discovered_mac_address_list.append(mac_address) - self.log.info("Discovered {} different devices.".format(len( - self.discovered_mac_address_list))) - self.log.debug("Discovered {} different devices.".format(len( - self.discovered_mac_address_list))) - self.scn_ad.droid.bleStopBleScan(scan_callback) - return True - - def test_swarm_10000_on_batch_scan_result(self): - """Test LE batch scanning in a mass beacon deployment. - - Test finding 10000 LE batch scan results in a mass beacon deployment. - - Steps: - 1. Assume that mass beacon deployment is setup. - 2. Set LE scanning mode to low latency and report delay millis to 1 - second. - 3. Start LE scan. - 4. Pop batch scan results off the event dispatcher 10000 times. - 5. Stop LE scanning. - - Expected Result: - 1000 scan results should be found without any exceptions. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning, Beacon - Priority: 1 - """ - self.scn_ad.droid.bleSetScanSettingsScanMode( - ScanSettingsScanMode.SCAN_MODE_LOW_LATENCY.value) - self.scn_ad.droid.bleSetScanSettingsReportDelayMillis(1000) - filter_list, scan_settings, scan_callback = generate_ble_scan_objects( - self.scn_ad.droid) - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - for _ in range(10000): - event_info = self.scn_ad.ed.pop_event( - batch_scan_result.format(scan_callback), self.default_timeout) - for result in event_info['data']['Results']: - mac_address = result['deviceInfo']['address'] - if mac_address not in self.discovered_mac_address_list: - self.discovered_mac_address_list.append(mac_address) - self.log.info("Discovered {} different devices.".format(len( - self.discovered_mac_address_list))) - self.scn_ad.droid.bleStopBleScan(scan_callback) - return True - - def test_swarm_scan_result_filter_each_device_name(self): - """Test basic LE scan filtering in a mass beacon deployment. - - Test finding LE scan results in a mass beacon deployment. This - test specifically tests scan filtering of different device names and - that each device name is found. - - Steps: - 1. Assume that mass beacon deployment is setup with device names - advertising. - 2. Set LE scanning mode to low latency. - 3. Filter device name from one of the known advertising device names - 4. Start LE scan. - 5. Pop scan results matching the scan filter. - 6. Stop LE scanning. - 7. Repeat steps 2-6 until all advertising device names are found. - - Expected Result: - All advertising beacons are found by their device name. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning, Beacon, Filtering - Priority: 1 - """ - for filter_name in self.advertising_device_name_list: - self.scn_ad.droid.bleSetScanSettingsScanMode( - ScanSettingsScanMode.SCAN_MODE_LOW_LATENCY.value) - filter_list, scan_settings, scan_callback = ( - generate_ble_scan_objects(self.scn_ad.droid)) - try: - self.scn_ad.droid.bleSetScanFilterDeviceName(filter_name) - self.scn_ad.droid.bleBuildScanFilter(filter_list) - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - self.log.debug(self.scn_ad.ed.pop_event( - scan_result.format(scan_callback), self.default_timeout)) - except Exception: - self.log.info("Couldn't find advertiser name {}.".format( - filter_name)) - return False - self.scn_ad.droid.bleStopBleScan(scan_callback) - return True - - def test_swarm_rotate_addresses(self): - """Test basic LE scan filtering in a mass beacon deployment. - - Test finding LE scan results in a mass beacon deployment. This test - rotates the mac address of the advertising devices at a consistent - interval in order to make the scanning device think there are - thousands of devices nearby. - - Steps: - 1. Assume that mass beacon deployment is setup with device names - advertising. - 2. Set LE scanning mode to low latency on 28 scan instances. - 3. Start LE scan on each of the scan instances. - 5. Continuously Pop scan results matching the scan filter. - 6. Rotate mac address of each advertising device sequentially. - 7. 5-6 10,000 times. - 8. Stop LE scanning - - Expected Result: - The Bluetooth stack doesn't crash. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning, Beacon - Priority: 1 - """ - scan_callback_list = [] - for _ in range(28): - self.scn_ad.droid.bleSetScanSettingsScanMode( - ScanSettingsScanMode.SCAN_MODE_LOW_LATENCY.value) - filter_list, scan_settings, scan_callback = generate_ble_scan_objects( - self.scn_ad.droid) - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - scan_callback_list.append(scan_callback) - thread = threading.Thread( - target=self._restart_special_advertisements_thread, - args=()) - thread.start() - n = 0 - while n < 10000: - for cb in scan_callback_list: - event_info = self.scn_ad.ed.pop_event( - scan_result.format(cb), self.default_timeout) - mac_address = event_info['data']['Result']['deviceInfo'][ - 'address'] - if mac_address not in self.discovered_mac_address_list: - self.discovered_mac_address_list.append(mac_address) - self.log.info("Discovered {} different devices.".format(len( - self.discovered_mac_address_list))) - n += 1 - self.scn_ad.droid.bleStopBleScan(scan_callback) - return True diff --git a/acts/tests/google/ble/bt5/AdvertisingSetTest.py b/acts/tests/google/ble/bt5/AdvertisingSetTest.py deleted file mode 100644 index de4192f125..0000000000 --- a/acts/tests/google/ble/bt5/AdvertisingSetTest.py +++ /dev/null @@ -1,197 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (C) 2017 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -""" -This test script exercises different Bluetooth 5 specific scan scenarios. -It is expected that the second AndroidDevice is able to advertise. - -This test script was designed with this setup in mind: -Shield box one: Android Device, Android Device -""" - -from queue import Empty - -from acts.asserts import assert_equal -from acts.asserts import assert_true -from acts.test_decorators import test_tracker_info -from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest -from acts.test_utils.bt.bt_constants import ble_scan_settings_modes -from acts.test_utils.bt.bt_constants import advertising_set_started -from acts.test_utils.bt.bt_constants import advertising_set_stopped -from acts.test_utils.bt.bt_constants import advertising_set_enabled -from acts.test_utils.bt.bt_constants import advertising_set_data_set -from acts.test_utils.bt.bt_constants import advertising_set_scan_response_set -from acts.test_utils.bt.bt_constants import advertising_set_parameters_update -from acts.test_utils.bt.bt_constants import advertising_set_periodic_parameters_updated -from acts.test_utils.bt.bt_constants import advertising_set_periodic_data_set -from acts.test_utils.bt.bt_constants import advertising_set_periodic_enable -from acts.test_utils.bt.bt_test_utils import reset_bluetooth -from acts import signals - - -class AdvertisingSetTest(BluetoothBaseTest): - default_timeout = 10 - report_delay = 2000 - scan_callbacks = [] - adv_callbacks = [] - active_scan_callback_list = [] - big_adv_data = { - "includeDeviceName": True, - "manufacturerData": [0x0123, "00112233445566778899AABBCCDDEE"], - "manufacturerData2": - [0x2540, [0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0xFF]], - "serviceData": [ - "b19d42dc-58ba-4b20-b6c1-6628e7d21de4", - "00112233445566778899AABBCCDDEE" - ], - "serviceData2": [ - "000042dc-58ba-4b20-b6c1-6628e7d21de4", - [0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0xFF] - ] - } - - def setup_class(self): - super(AdvertisingSetTest, self).setup_class() - self.adv_ad = self.android_devices[0] - - if not self.adv_ad.droid.bluetoothIsLeExtendedAdvertisingSupported(): - raise signals.TestAbortClass( - "Advertiser does not support LE Extended Advertising") - - def teardown_test(self): - self.active_scan_callback_list = [] - - def on_exception(self, test_name, begin_time): - reset_bluetooth(self.android_devices) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='58182f7e-443f-47fb-b718-1be3ac850287') - def test_reenabling(self): - """Test re-enabling an Advertising Set - - Test GATT notify characteristic value. - - Steps: - 1. Start an advertising set that only lasts for a few seconds - 2. Restart advertising set - 3. Repeat steps 1-2 - - Expected Result: - Verify that advertising set re-enables - - Returns: - Pass if True - Fail if False - - TAGS: LE, GATT, Characteristic - Priority: 1 - """ - adv_callback = self.adv_ad.droid.bleAdvSetGenCallback() - duration = 0 - max_ext_adv_events = 0 - self.adv_ad.droid.bleAdvSetStartAdvertisingSet({ - "connectable": False, - "legacyMode": False, - "primaryPhy": "PHY_LE_1M", - "secondaryPhy": "PHY_LE_1M", - "interval": 320 - }, self.big_adv_data, None, None, None, duration, max_ext_adv_events, - adv_callback) - - set_started_evt = self.adv_ad.ed.pop_event( - advertising_set_started.format(adv_callback), self.default_timeout) - set_id = set_started_evt['data']['setId'] - assert_equal(0, set_started_evt['data']['status']) - assert_equal(0, set_started_evt['data']['status']) - - self.log.info("Successfully started set " + str(set_id)) - - self.adv_ad.droid.bleAdvSetEnableAdvertising(set_id, False, duration, - max_ext_adv_events) - enable_evt = self.adv_ad.ed.pop_event( - advertising_set_enabled.format(adv_callback), self.default_timeout) - assert_equal(set_id, enable_evt['data']['setId']) - assert_equal(False, enable_evt['data']['enable']) - assert_equal(0, enable_evt['data']['status']) - self.log.info("Successfully disabled advertising set " + str(set_id)) - - self.log.info("Enabling advertising for 2 seconds... ") - duration_200 = 200 - self.adv_ad.droid.bleAdvSetEnableAdvertising( - set_id, True, duration_200, max_ext_adv_events) - enable_evt = self.adv_ad.ed.pop_event( - advertising_set_enabled.format(adv_callback), self.default_timeout) - assert_equal(set_id, enable_evt['data']['setId']) - assert_equal(True, enable_evt['data']['enable']) - assert_equal(0, enable_evt['data']['status']) - self.log.info("Enabled. Waiting for disable event ~2s ...") - - enable_evt = self.adv_ad.ed.pop_event( - advertising_set_enabled.format(adv_callback), self.default_timeout) - assert_equal(set_id, enable_evt['data']['setId']) - assert_equal(False, enable_evt['data']['enable']) - assert_equal(0, enable_evt['data']['status']) - self.log.info("Disable event received. Now trying to set data...") - - self.adv_ad.droid.bleAdvSetSetAdvertisingData( - set_id, - {"manufacturerData": [0x0123, "00112233445566778899AABBCCDDEE"]}) - data_set_evt = self.adv_ad.ed.pop_event( - advertising_set_data_set.format(adv_callback), - self.default_timeout) - assert_equal(set_id, data_set_evt['data']['setId']) - assert_equal(0, data_set_evt['data']['status']) - self.log.info("Data changed successfully.") - - max_len = self.adv_ad.droid.bluetoothGetLeMaximumAdvertisingDataLength( - ) - - self.log.info("Will try to set data to maximum possible length") - data_len = max_len - 4 - test_fill = '01' * data_len - self.adv_ad.droid.bleAdvSetSetAdvertisingData( - set_id, {"manufacturerData": [0x0123, test_fill]}) - data_set_evt = self.adv_ad.ed.pop_event( - advertising_set_data_set.format(adv_callback), - self.default_timeout) - assert_equal(set_id, data_set_evt['data']['setId']) - assert_equal(0, data_set_evt['data']['status']) - self.log.info("Data changed successfully.") - - if max_len < 1650: - self.log.info("Will try to set data to more than maximum length") - data_len = max_len - 4 + 1 - test_fill = '01' * data_len - self.adv_ad.droid.bleAdvSetSetAdvertisingData( - set_id, {"manufacturerData": [0x0123, test_fill]}) - data_set_evt = self.adv_ad.ed.pop_event( - advertising_set_data_set.format(adv_callback), - self.default_timeout) - assert_equal(set_id, data_set_evt['data']['setId']) - #TODO(jpawlowski): make nicer error fot this case - assert_true(data_set_evt['data']['status'] != 0, - "Setting data should fail because data too long.") - - self.log.info("Data change failed as expected.") - - self.adv_ad.droid.bleAdvSetStopAdvertisingSet(adv_callback) - try: - self.adv_ad.ed.pop_event( - advertising_set_stopped.format(adv_callback), - self.default_timeout) - except Empty: - self.log.error("Failed to find advertising set stopped event.") - return False - return True diff --git a/acts/tests/google/ble/bt5/Bt5ScanTest.py b/acts/tests/google/ble/bt5/Bt5ScanTest.py deleted file mode 100644 index e2c9c83cc3..0000000000 --- a/acts/tests/google/ble/bt5/Bt5ScanTest.py +++ /dev/null @@ -1,480 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -""" -This test script exercises different Bluetooth 5 specific scan scenarios. -It is expected that the second AndroidDevice is able to advertise. - -This test script was designed with this setup in mind: -Shield box one: Android Device, Android Device -""" - -from queue import Empty - -from acts import asserts -from acts.test_decorators import test_tracker_info -from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest -from acts.test_utils.bt.bt_constants import ble_scan_settings_phys -from acts.test_utils.bt.bt_constants import ble_scan_settings_modes -from acts.test_utils.bt.bt_constants import batch_scan_result -from acts.test_utils.bt.bt_test_utils import cleanup_scanners_and_advertisers -from acts.test_utils.bt.bt_test_utils import generate_ble_advertise_objects -from acts.test_utils.bt.bt_test_utils import generate_ble_scan_objects -from acts.test_utils.bt.bt_test_utils import reset_bluetooth -from acts.test_utils.bt.bt_constants import scan_result -from acts.test_utils.bt.bt_constants import advertising_set_on_own_address_read -from acts.test_utils.bt.bt_constants import advertising_set_started -from acts import signals - - -class Bt5ScanTest(BluetoothBaseTest): - default_timeout = 10 - report_delay = 2000 - scan_callbacks = [] - adv_callbacks = [] - active_scan_callback_list = [] - big_adv_data = { - "includeDeviceName": True, - "manufacturerData": [0x0123, "00112233445566778899AABBCCDDEE"], - "manufacturerData2": - [0x2540, [0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0xFF]], - "serviceData": [ - "b19d42dc-58ba-4b20-b6c1-6628e7d21de4", - "00112233445566778899AABBCCDDEE" - ], - "serviceData2": [ - "000042dc-58ba-4b20-b6c1-6628e7d21de4", - [0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0xFF] - ] - } - - def setup_class(self): - super(Bt5ScanTest, self).setup_class() - self.scn_ad = self.android_devices[0] - self.adv_ad = self.android_devices[1] - - if not self.scn_ad.droid.bluetoothIsLeExtendedAdvertisingSupported(): - raise signals.TestAbortClass( - "Scanner does not support LE Extended Advertising") - - if not self.adv_ad.droid.bluetoothIsLeExtendedAdvertisingSupported(): - raise signals.TestAbortClass( - "Advertiser does not support LE Extended Advertising") - - def teardown_test(self): - cleanup_scanners_and_advertisers( - self.scn_ad, self.active_scan_callback_list, self.adv_ad, []) - self.active_scan_callback_list = [] - - def on_exception(self, test_name, begin_time): - reset_bluetooth(self.android_devices) - - # This one does not relly test anything, but display very helpful - # information that might help with debugging. - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='787e0877-269f-4b9b-acb0-b98a8bb3770a') - def test_capabilities(self): - """Test capabilities - - Test BT 5.0 scan scapabilities - - Steps: - 1. Test various vapabilities. - - Expected Result: - Pass - - Returns: - Pass if True - Fail if False - - TAGS: BT5.0, Scanning - Priority: 2 - """ - d = self.scn_ad.droid - sup2M = d.bluetoothIsLe2MPhySupported() - supCoded = d.bluetoothIsLeCodedPhySupported() - supExt = d.bluetoothIsLeExtendedAdvertisingSupported() - supPeriodic = d.bluetoothIsLePeriodicAdvertisingSupported() - maxDataLen = d.bluetoothGetLeMaximumAdvertisingDataLength() - self.log.info("Scanner capabilities:") - self.log.info("LE 2M: " + str(sup2M) + ", LE Coded: " + str( - supCoded) + ", LE Extended Advertising: " + str( - supExt) + ", LE Periodic Advertising: " + str(supPeriodic) + - ", maximum advertising data length: " + str(maxDataLen)) - d = self.adv_ad.droid - sup2M = d.bluetoothIsLe2MPhySupported() - supCoded = d.bluetoothIsLeCodedPhySupported() - supExt = d.bluetoothIsLeExtendedAdvertisingSupported() - supPeriodic = d.bluetoothIsLePeriodicAdvertisingSupported() - maxDataLen = d.bluetoothGetLeMaximumAdvertisingDataLength() - self.log.info("Advertiser capabilities:") - self.log.info("LE 2M: " + str(sup2M) + ", LE Coded: " + str( - supCoded) + ", LE Extended Advertising: " + str( - supExt) + ", LE Periodic Advertising: " + str(supPeriodic) + - ", maximum advertising data length: " + str(maxDataLen)) - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='62d36679-bb91-465e-897f-2635433aac2f') - def test_1m_1m_extended_scan(self): - """Test scan on LE 1M PHY using LE 1M PHY as secondary. - - Tests test verify that device is able to receive extended advertising - on 1M PHY when secondary is 1M PHY. - - Steps: - 1. Start advertising set on dut1 - 2. Start scanning on dut0, scan filter set to advertiser's device name - 3. Try to find an event, expect found - 4. Stop advertising - - Expected Result: - Scan finds a advertisement. - - Returns: - Pass if True - Fail if False - - TAGS: LE Advertising Extension, BT5, LE, Advertising, Scanning - Priority: 1 - """ - adv_callback = self.adv_ad.droid.bleAdvSetGenCallback() - self.adv_ad.droid.bleAdvSetStartAdvertisingSet({ - "connectable": True, - "legacyMode": False, - "primaryPhy": "PHY_LE_1M", - "secondaryPhy": "PHY_LE_1M", - "interval": 320 - }, self.big_adv_data, None, None, None, 0, 0, adv_callback) - - self.scn_ad.droid.bleSetScanSettingsLegacy(False) - self.scn_ad.droid.bleSetScanSettingsPhy(ble_scan_settings_phys['1m']) - - filter_list, scan_settings, scan_callback = generate_ble_scan_objects( - self.scn_ad.droid) - - adv_device_name = self.adv_ad.droid.bluetoothGetLocalName() - self.scn_ad.droid.bleSetScanFilterDeviceName(adv_device_name) - self.scn_ad.droid.bleBuildScanFilter(filter_list) - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - self.active_scan_callback_list.append(scan_callback) - - try: - self.scn_ad.ed.pop_event( - scan_result.format(scan_callback), self.default_timeout) - except Empty: - self.log.error("Scan result not found") - self.adv_ad.droid.bleAdvSetStopAdvertisingSet(adv_callback) - return False - - self.adv_ad.droid.bleAdvSetStopAdvertisingSet(adv_callback) - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='3e3c9757-f7b6-4d1d-a2d6-8e2330d1a18e') - def test_1m_2m_extended_scan(self): - """Test scan on LE 1M PHY using LE 2M PHY as secondary. - - Tests test verify that device is able to receive extended advertising - on 1M PHY when secondary is 2M PHY. - - Steps: - 1. Start advertising set on dut1 - 2. Start scanning on dut0, scan filter set to advertiser's device name - 3. Try to find an event, expect found - 4. Stop advertising - - Expected Result: - Scan finds a advertisement. - - Returns: - Pass if True - Fail if False - - TAGS: LE Advertising Extension, BT5, LE, Advertising, Scanning - Priority: 1 - """ - adv_callback = self.adv_ad.droid.bleAdvSetGenCallback() - self.adv_ad.droid.bleAdvSetStartAdvertisingSet({ - "connectable": True, - "legacyMode": False, - "primaryPhy": "PHY_LE_1M", - "secondaryPhy": "PHY_LE_2M", - "interval": 320 - }, self.big_adv_data, None, None, None, 0, 0, adv_callback) - - self.scn_ad.droid.bleSetScanSettingsLegacy(False) - self.scn_ad.droid.bleSetScanSettingsPhy(ble_scan_settings_phys['1m']) - - filter_list, scan_settings, scan_callback = generate_ble_scan_objects( - self.scn_ad.droid) - - adv_device_name = self.adv_ad.droid.bluetoothGetLocalName() - self.scn_ad.droid.bleSetScanFilterDeviceName(adv_device_name) - self.scn_ad.droid.bleBuildScanFilter(filter_list) - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - self.active_scan_callback_list.append(scan_callback) - - try: - self.scn_ad.ed.pop_event( - scan_result.format(scan_callback), self.default_timeout) - except Empty: - self.log.error("Scan result not found") - self.adv_ad.droid.bleAdvSetStopAdvertisingSet(adv_callback) - return False - - self.adv_ad.droid.bleAdvSetStopAdvertisingSet(adv_callback) - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='236e9e5b-3853-4762-81ae-e88db03d74f3') - def test_legacy_scan_result_raw_length(self): - """Test that raw scan record data in legacy scan is 62 bytes long. - - This is required for compability with older apps that make this - assumption. - - Steps: - 1. Start legacy advertising set on dut1 - 2. Start scanning on dut0, scan filter set to advertiser's device name - 3. Try to find an event, expect found, verify scan recurd data length - 4. Stop advertising - - Expected Result: - Scan finds a legacy advertisement of proper size - - Returns: - Pass if True - Fail if False - - TAGS: LE Advertising Extension, BT5, LE, Advertising, Scanning - Priority: 1 - """ - adv_callback = self.adv_ad.droid.bleAdvSetGenCallback() - self.adv_ad.droid.bleAdvSetStartAdvertisingSet({ - "connectable": True, - "scannable": True, - "legacyMode": True, - "interval": 320 - }, {"includeDeviceName": True}, None, None, None, 0, 0, adv_callback) - - self.scn_ad.droid.bleSetScanSettingsLegacy(True) - self.scn_ad.droid.bleSetScanSettingsPhy(ble_scan_settings_phys['1m']) - - filter_list, scan_settings, scan_callback = generate_ble_scan_objects( - self.scn_ad.droid) - - adv_device_name = self.adv_ad.droid.bluetoothGetLocalName() - self.scn_ad.droid.bleSetScanFilterDeviceName(adv_device_name) - self.scn_ad.droid.bleBuildScanFilter(filter_list) - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - self.active_scan_callback_list.append(scan_callback) - - try: - evt = self.scn_ad.ed.pop_event( - scan_result.format(scan_callback), self.default_timeout) - rawData = evt['data']['Result']['scanRecord'] - asserts.assert_true(62 == len(rawData.split(",")), - "Raw data should be 62 bytes long.") - except Empty: - self.log.error("Scan result not found") - self.adv_ad.droid.bleAdvSetStopAdvertisingSet(adv_callback) - return False - - self.adv_ad.droid.bleAdvSetStopAdvertisingSet(adv_callback) - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='04632d8d-4303-476f-8f83-52c16be3713a') - def test_duration(self): - """Test scanning duration - - Tests BT5.0 scanning duration - - Steps: - 1. Start advertising set - 2. Start 5.0 scan - 3. Scan for advertisement event - - Expected Result: - Scan finds a legacy advertisement of proper size - - Returns: - Pass if True - Fail if False - - TAGS: BT5.0, LE, Advertising, Scanning - Priority: 1 - """ - adv_callback = self.adv_ad.droid.bleAdvSetGenCallback() - self.adv_ad.droid.bleAdvSetStartAdvertisingSet({ - "connectable": True, - "legacyMode": False, - "primaryPhy": "PHY_LE_1M", - "secondaryPhy": "PHY_LE_2M", - "interval": 320 - }, self.big_adv_data, None, None, None, 0, 0, adv_callback) - - self.scn_ad.droid.bleSetScanSettingsLegacy(False) - self.scn_ad.droid.bleSetScanSettingsPhy(ble_scan_settings_phys['1m']) - - filter_list, scan_settings, scan_callback = generate_ble_scan_objects( - self.scn_ad.droid) - - adv_device_name = self.adv_ad.droid.bluetoothGetLocalName() - self.scn_ad.droid.bleSetScanFilterDeviceName(adv_device_name) - self.scn_ad.droid.bleBuildScanFilter(filter_list) - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - self.active_scan_callback_list.append(scan_callback) - - try: - self.scn_ad.ed.pop_event( - scan_result.format(scan_callback), self.default_timeout) - except Empty: - self.log.error("Scan result not found") - self.adv_ad.droid.bleAdvSetStopAdvertisingSet(adv_callback) - return False - - self.adv_ad.droid.bleAdvSetStopAdvertisingSet(adv_callback) - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='a3704083-0f5c-4a46-b979-32ebc594d6ee') - def test_anonymous_advertising(self): - """Test anonymous advertising. - - Tests test verify that device is able to receive anonymous advertising - on 1M PHY when secondary is 2M PHY. - - Steps: - 1. Start anonymous advertising set on dut1 - 2. Start scanning on dut0, scan filter set to advertiser's device name - 3. Try to find an event, expect found - 4. Stop advertising - - Expected Result: - Scan finds a advertisement. - - Returns: - Pass if True - Fail if False - - TAGS: LE Advertising Extension, BT5, LE, Advertising, Scanning - Priority: 1 - """ - adv_callback = self.adv_ad.droid.bleAdvSetGenCallback() - self.adv_ad.droid.bleAdvSetStartAdvertisingSet({ - "connectable": False, - "anonymous": True, - "legacyMode": False, - "primaryPhy": "PHY_LE_1M", - "secondaryPhy": "PHY_LE_2M", - "interval": 320 - }, self.big_adv_data, None, None, None, 0, 0, adv_callback) - - self.scn_ad.droid.bleSetScanSettingsLegacy(False) - self.scn_ad.droid.bleSetScanSettingsPhy(ble_scan_settings_phys['1m']) - - filter_list, scan_settings, scan_callback = generate_ble_scan_objects( - self.scn_ad.droid) - - adv_device_name = self.adv_ad.droid.bluetoothGetLocalName() - self.scn_ad.droid.bleSetScanFilterDeviceName(adv_device_name) - self.scn_ad.droid.bleBuildScanFilter(filter_list) - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - self.active_scan_callback_list.append(scan_callback) - - try: - evt = self.scn_ad.ed.pop_event( - scan_result.format(scan_callback), self.default_timeout) - address = evt['data']['Result']['deviceInfo']['address'] - asserts.assert_true( - '00:00:00:00:00:00' == address, - "Anonymous address should be 00:00:00:00:00:00, but was " + - str(address)) - except Empty: - self.log.error("Scan result not found") - self.adv_ad.droid.bleAdvSetStopAdvertisingSet(adv_callback) - return False - - self.adv_ad.droid.bleAdvSetStopAdvertisingSet(adv_callback) - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='e3277355-eebf-4760-9502-e49a9289f6ab') - def test_get_own_address(self): - """Test obtaining own address for PTS. - - Test obtaining own address. - - Steps: - 1. Start advertising set dut1 - 2. Grab address - 3. Stop advertising - - Expected Result: - Callback with address is received. - - Returns: - Pass if True - Fail if False - - TAGS: LE Advertising Extension, BT5, LE, Advertising - Priority: 1 - """ - adv_callback = self.adv_ad.droid.bleAdvSetGenCallback() - self.adv_ad.droid.bleAdvSetStartAdvertisingSet({ - "connectable": False, - "anonymous": True, - "legacyMode": False, - "primaryPhy": "PHY_LE_1M", - "secondaryPhy": "PHY_LE_2M", - "interval": 320 - }, self.big_adv_data, None, None, None, 0, 0, adv_callback) - - set_id = -1 - - try: - evt = self.adv_ad.ed.pop_event( - advertising_set_started.format(adv_callback), - self.default_timeout) - self.log.info("data: " + str(evt['data'])) - set_id = evt['data']['setId'] - except Empty: - self.log.error("did not receive the set started event!") - self.adv_ad.droid.bleAdvSetStopAdvertisingSet(adv_callback) - return False - - self.adv_ad.droid.bleAdvSetGetOwnAddress(set_id) - - try: - evt = self.adv_ad.ed.pop_event( - advertising_set_on_own_address_read.format(set_id), - self.default_timeout) - address = evt['data']['address'] - self.log.info("Advertiser address is: " + str(address)) - except Empty: - self.log.error("onOwnAddressRead not received.") - self.adv_ad.droid.bleAdvSetStopAdvertisingSet(adv_callback) - return False - - self.adv_ad.droid.bleAdvSetStopAdvertisingSet(adv_callback) - return True diff --git a/acts/tests/google/ble/bt5/PhyTest.py b/acts/tests/google/ble/bt5/PhyTest.py deleted file mode 100644 index 0b1ecfade8..0000000000 --- a/acts/tests/google/ble/bt5/PhyTest.py +++ /dev/null @@ -1,248 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (C) 2017 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -""" -This test script exercises set PHY and read PHY procedures. -""" - -from queue import Empty - -from acts.test_decorators import test_tracker_info -from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest -from acts.test_utils.bt.GattConnectedBaseTest import GattConnectedBaseTest -from acts.test_utils.bt.bt_constants import gatt_connection_priority -from acts.test_utils.bt.bt_constants import gatt_event -from acts.test_utils.bt.bt_constants import gatt_phy -from acts import signals - -CONNECTION_PRIORITY_HIGH = gatt_connection_priority['high'] -PHY_LE_1M = gatt_phy['1m'] -PHY_LE_2M = gatt_phy['2m'] - - -def lfmt(txPhy, rxPhy): - return '(' + list(gatt_phy.keys())[list(gatt_phy.values()).index( - txPhy)] + ', ' + list(gatt_phy.keys())[list(gatt_phy.values()).index( - rxPhy)] + ')' - - -class PhyTest(GattConnectedBaseTest): - def setup_class(self): - super(PhyTest, self).setup_class() - if not self.cen_ad.droid.bluetoothIsLe2MPhySupported(): - raise signals.TestAbortClass( - "Central device does not support LE 2M PHY") - - if not self.per_ad.droid.bluetoothIsLe2MPhySupported(): - raise signals.TestAbortClass( - "Peripheral device does not support LE 2M PHY") - - # Some controllers auto-update PHY to 2M, and both client and server - # might receive PHY Update event right after connection, if the - # connection was established over 1M PHY. We will ignore this event, but - # must pop it from queue. - def pop_initial_phy_update(self): - try: - maybe_event = gatt_event['phy_update']['evt'].format( - self.gatt_callback) - self.cen_ad.ed.pop_event(maybe_event, 0) - except Empty: - pass - - try: - maybe_event = gatt_event['serv_phy_update']['evt'].format( - self.gatt_server_callback) - self.per_ad.ed.pop_event(maybe_event, 0) - except Empty: - pass - - # this helper method checks wether both client and server received PHY - # update event with proper txPhy and rxPhy - def ensure_both_updated_phy(self, clientTxPhy, clientRxPhy): - event = self._client_wait(gatt_event['phy_update']) - txPhy = event['data']['TxPhy'] - rxPhy = event['data']['RxPhy'] - self.log.info("\tClient PHY updated: " + lfmt(txPhy, rxPhy)) - self.assertEqual(0, event['data']['Status'], "Status should be 0") - self.assertEqual(clientTxPhy, event['data']['TxPhy']) - self.assertEqual(clientRxPhy, event['data']['RxPhy']) - - bt_device_id = 0 - event = self._server_wait(gatt_event['serv_phy_update']) - txPhy = event['data']['TxPhy'] - rxPhy = event['data']['RxPhy'] - self.log.info("\tServer PHY updated: " + lfmt(txPhy, rxPhy)) - self.assertEqual(0, event['data']['Status'], "Status should be 0") - self.assertEqual(clientRxPhy, event['data']['TxPhy']) - self.assertEqual(clientTxPhy, event['data']['RxPhy']) - - # read the client phy, return (txPhy, rxPhy) - def read_client_phy(self): - self.cen_ad.droid.gattClientReadPhy(self.bluetooth_gatt) - event = self._client_wait(gatt_event['phy_read']) - self.assertEqual(0, event['data']['Status'], "Status should be 0") - return (event['data']['TxPhy'], event['data']['RxPhy']) - - # read the server phy, return (txPhy, rxPhy) - def read_server_phy(self): - bt_device_id = 0 - self.per_ad.droid.gattServerReadPhy(self.gatt_server, bt_device_id) - event = self._server_wait(gatt_event['serv_phy_read']) - self.assertEqual(0, event['data']['Status'], "Status should be 0") - return (event['data']['TxPhy'], event['data']['RxPhy']) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='edb95ae1-97e5-4337-9a60-1e113aa43a4d') - def test_phy_read(self): - """Test LE read PHY. - - Test LE read PHY. - - Steps: - 1. Central, Peripheral : read PHY, make sure values are same. - 2. Central: update PHY. - 3. Ensure both Central and Peripheral received PHY update event. - 4. Central, Peripheral: read PHY, make sure values are same. - - Expected Result: - Verify that read PHY works properly. - - Returns: - Pass if True - Fail if False - - TAGS: LE, PHY - Priority: 0 - """ - self.cen_ad.droid.gattClientRequestConnectionPriority( - self.bluetooth_gatt, CONNECTION_PRIORITY_HIGH) - self.pop_initial_phy_update() - - # read phy from client and server, make sure they're same - cTxPhy, cRxPhy = self.read_client_phy() - sTxPhy, sRxPhy = self.read_server_phy() - self.assertEqual(cTxPhy, sTxPhy) - self.assertEqual(cRxPhy, sRxPhy) - - self.log.info("Initial connection PHY was: " + lfmt(cTxPhy, cRxPhy)) - - nextTxPhy = (cTxPhy == PHY_LE_1M) and PHY_LE_2M or PHY_LE_1M - nextRxPhy = (cRxPhy == PHY_LE_1M) and PHY_LE_2M or PHY_LE_1M - - # try to update PHY from Client - self.log.info("Will try to set PHY to: " + lfmt(nextTxPhy, nextRxPhy)) - self.cen_ad.droid.gattClientSetPreferredPhy(self.bluetooth_gatt, - nextTxPhy, nextRxPhy, 0) - self.ensure_both_updated_phy(nextTxPhy, nextRxPhy) - - # read phy on client and server, make sure values are same and equal - # the newly set value - cTxPhy, cRxPhy = self.read_client_phy() - sTxPhy, sRxPhy = self.read_server_phy() - self.assertEqual(cTxPhy, sTxPhy) - self.assertEqual(cRxPhy, sRxPhy) - - self.assertEqual(nextTxPhy, cTxPhy) - self.assertEqual(nextRxPhy, cRxPhy) - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='6b66af0a-35eb-42af-acd5-9634684f275d') - def test_phy_change_20_times(self): - """Test PHY update. - - Test LE PHY update. - - Steps: - 1. Central: read PHY. - 2. Central: update PHY to 1M, 2M, 1M... 20 times, each time ensuring - both client and server received PHY update event. - - Expected Result: - Verify that read update PHY worked properly each time. - - Returns: - Pass if True - Fail if False - - TAGS: LE, PHY - Priority: 0 - """ - self.cen_ad.droid.gattClientRequestConnectionPriority( - self.bluetooth_gatt, CONNECTION_PRIORITY_HIGH) - self.pop_initial_phy_update() - - txPhyB, rxPhyB = self.read_client_phy() - txPhyA = (txPhyB == PHY_LE_1M) and PHY_LE_2M or PHY_LE_1M - rxPhyA = (rxPhyB == PHY_LE_1M) and PHY_LE_2M or PHY_LE_1M - - self.log.info("Initial connection PHY was: " + lfmt(txPhyB, rxPhyB)) - - for i in range(20): - #swap values between iterations - txPhy = (i & 1) and txPhyB or txPhyA - rxPhy = (i & 1) and rxPhyB or rxPhyA - - self.log.info("Will try to set PHY to: " + lfmt(txPhy, rxPhy)) - self.cen_ad.droid.gattClientSetPreferredPhy(self.bluetooth_gatt, - txPhy, rxPhy, 0) - self.ensure_both_updated_phy(txPhy, rxPhy) - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='13f28de4-07f4-458c-a3e5-3ba95318616f') - def test_phy_change_asym(self): - """Test PHY update with asymetric rx and tx PHY. - - Test PHY update with asymetric rx and tx PHY. - - Steps: - 1. Central: read PHY. - 2. Central: update PHY to tx: 1M, rx: 2M, ensure both devices received - the asymetric update. - 3. Central: update PHY to tx: 2M, rx: 1M, ensure both devices received - the asymetric update. - - Expected Result: - Verify that read update PHY worked properly each time. - - Returns: - Pass if True - Fail if False - - TAGS: LE, PHY - Priority: 0 - """ - self.cen_ad.droid.gattClientRequestConnectionPriority( - self.bluetooth_gatt, CONNECTION_PRIORITY_HIGH) - self.pop_initial_phy_update() - - txPhy, rxPhy = self.read_client_phy() - - self.log.info("Initial connection PHY was: " + lfmt(txPhy, rxPhy)) - self.log.info("will try to set PHY to: PHY_LE_1M, PHY_LE_2M") - - #try to update PHY to tx 1M, rx 2M from Client - self.cen_ad.droid.gattClientSetPreferredPhy(self.bluetooth_gatt, - PHY_LE_1M, PHY_LE_2M, 0) - self.ensure_both_updated_phy(PHY_LE_1M, PHY_LE_2M) - - #try to update PHY to TX 2M, RX 1M from Client - self.log.info("will try to set PHY to: PHY_LE_2M, PHY_LE_1M") - self.cen_ad.droid.gattClientSetPreferredPhy(self.bluetooth_gatt, - PHY_LE_2M, PHY_LE_1M, 0) - self.ensure_both_updated_phy(PHY_LE_2M, PHY_LE_1M) - - return True diff --git a/acts/tests/google/ble/concurrency/ConcurrentBleAdvertisementDiscoveryTest.py b/acts/tests/google/ble/concurrency/ConcurrentBleAdvertisementDiscoveryTest.py deleted file mode 100644 index c38fc935de..0000000000 --- a/acts/tests/google/ble/concurrency/ConcurrentBleAdvertisementDiscoveryTest.py +++ /dev/null @@ -1,123 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -""" -Test script to test the integrity of LE scan results upon resetting the -Bluetooth stack. -""" - -import concurrent -import os -import time - -from queue import Empty -from acts.test_decorators import test_tracker_info -from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest -from acts.test_utils.bt.bt_constants import ble_advertise_settings_modes -from acts.test_utils.bt.bt_constants import ble_scan_settings_callback_types -from acts.test_utils.bt.bt_constants import ble_scan_settings_modes -from acts.test_utils.bt.bt_constants import adv_succ -from acts.test_utils.bt.bt_constants import scan_result -from acts.test_utils.bt.bt_test_utils import BtTestUtilsError -from acts.test_utils.bt.bt_test_utils import generate_ble_advertise_objects -from acts.test_utils.bt.bt_test_utils import generate_ble_scan_objects -from acts.test_utils.bt.bt_test_utils import get_advanced_droid_list -from acts.test_utils.bt.bt_test_utils import reset_bluetooth -from acts.test_utils.bt.bt_test_utils import setup_n_advertisements -from acts.test_utils.bt.bt_test_utils import take_btsnoop_logs -from acts.test_utils.bt.bt_test_utils import teardown_n_advertisements -from acts.test_utils.bt.bt_test_utils import scan_and_verify_n_advertisements - - -class ConcurrentBleAdvertisementDiscoveryTest(BluetoothBaseTest): - default_timeout = 10 - droid_list = [] - max_advertisements = -1 - advertise_callback_list = [] - - def setup_class(self): - super().setup_class() - self.scn_ad = self.android_devices[0] - self.adv_ad = self.android_devices[1] - self.droid_list = get_advanced_droid_list(self.android_devices) - self.max_advertisements = self.droid_list[1]['max_advertisements'] - - def setup_test(self): - super().setup_test() - self.log.info("Setting up advertisements") - reset_bluetooth(self.android_devices) - try: - self.advertise_callback_list = setup_n_advertisements( - self.adv_ad, self.max_advertisements) - except BtTestUtilsError: - return False - return True - - def teardown_test(self): - super(BluetoothBaseTest, self).teardown_test() - self.log.info("Tearing down advertisements") - teardown_n_advertisements(self.adv_ad, - len(self.advertise_callback_list), - self.advertise_callback_list) - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='e02d6ca6-4db3-4a1d-adaf-98db7c7c2c7a') - def test_max_advertisements_defaults(self): - """Test scan integrity after BT state is reset - - This test is to verify that LE devices are found - successfully after the Bluetooth stack is - reset. This is repeated multiple times in order - to verify that LE devices are not lost in scanning - when the stack is brought back up. - - Steps: - 1. Pre-Condition: Max advertisements are active - 2. With the DUT android device, scan for all advertisements - and verify that all expected advertisements are found. - 3. Reset Bluetooth on DUT. - 4. Repeat steps 2-3 for defined iterations - - Expected Result: - All expected advertisements should be found on all iterations. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Concurrency, Scanning - Priority: 2 - """ - filter_list = self.scn_ad.droid.bleGenFilterList() - self.scn_ad.droid.bleBuildScanFilter(filter_list) - self.scn_ad.droid.bleSetScanSettingsCallbackType( - ble_scan_settings_callback_types['all_matches']) - self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ - 'low_latency']) - iterations = 20 - for _ in range(iterations): - self.log.info("Verify all advertisements found") - try: - if not scan_and_verify_n_advertisements( - self.scn_ad, self.max_advertisements): - self.log.error("Failed to find all advertisements") - return False - except BtTestUtilsError: - return False - if not reset_bluetooth([self.scn_ad]): - self.log.error("Failed to reset Bluetooth state") - return False - return True diff --git a/acts/tests/google/ble/concurrency/ConcurrentBleAdvertisingTest.py b/acts/tests/google/ble/concurrency/ConcurrentBleAdvertisingTest.py deleted file mode 100644 index 09c6cd3a5e..0000000000 --- a/acts/tests/google/ble/concurrency/ConcurrentBleAdvertisingTest.py +++ /dev/null @@ -1,632 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -""" -Test script to exercises different ways Ble Advertisements can run in -concurrency. This test was designed to be run in a shield box. -""" - -import concurrent -import os -import time - -from queue import Empty -from acts.test_decorators import test_tracker_info -from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest -from acts.test_utils.bt.bt_test_utils import BtTestUtilsError -from acts.test_utils.bt.bt_constants import ble_advertise_settings_modes -from acts.test_utils.bt.bt_constants import ble_scan_settings_callback_types -from acts.test_utils.bt.bt_constants import ble_scan_settings_modes -from acts.test_utils.bt.bt_constants import adv_succ -from acts.test_utils.bt.bt_test_utils import generate_ble_advertise_objects -from acts.test_utils.bt.bt_test_utils import generate_ble_scan_objects -from acts.test_utils.bt.bt_test_utils import get_advanced_droid_list -from acts.test_utils.bt.bt_test_utils import reset_bluetooth -from acts.test_utils.bt.bt_test_utils import scan_and_verify_n_advertisements -from acts.test_utils.bt.bt_constants import scan_result -from acts.test_utils.bt.bt_test_utils import setup_n_advertisements -from acts.test_utils.bt.bt_test_utils import take_btsnoop_logs -from acts.test_utils.bt.bt_test_utils import teardown_n_advertisements - - -class ConcurrentBleAdvertisingTest(BluetoothBaseTest): - default_timeout = 10 - droid_list = [] - max_advertisements = -1 - - def setup_class(self): - super().setup_class() - self.scn_ad = self.android_devices[0] - self.adv_ad = self.android_devices[1] - self.droid_list = get_advanced_droid_list(self.android_devices) - self.max_advertisements = self.droid_list[1]['max_advertisements'] - - def setup_test(self): - super().setup_test() - return reset_bluetooth(self.android_devices) - - def _verify_n_advertisements(self, num_advertisements): - try: - advertise_callback_list = setup_n_advertisements( - self.adv_ad, num_advertisements) - except BtTestUtilsError: - return False - try: - scan_and_verify_n_advertisements(self.scn_ad, num_advertisements) - except BtTestUtilsError: - return False - teardown_n_advertisements(self.adv_ad, - len(advertise_callback_list), - advertise_callback_list) - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='abc03874-6d7a-4b5d-9f29-18731a102793') - def test_max_advertisements_defaults(self): - """Testing max advertisements. - - Test that a single device can have the max advertisements - concurrently advertising. - - Steps: - 1. Setup the scanning android device. - 2. Setup the advertiser android device. - 3. Start scanning on the max_advertisements as defined in the script. - 4. Verify that all advertisements are found. - - Expected Result: - All advertisements should start without errors. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Concurrency - Priority: 0 - """ - return self._verify_n_advertisements(self.max_advertisements) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='50ee137e-eb71-40ef-b72f-a5fd646190d2') - def test_max_advertisements_include_device_name_and_filter_device_name( - self): - """Testing max advertisement variant. - - Test that a single device can have the max advertisements - concurrently advertising. Include the device name as a part of the filter - and advertisement data. - - Steps: - 1. Setup the scanning android device. - 2. Setup the advertiser android device. - 3. Include device name in each advertisement. - 4. Include device name filter in the scanner. - 5. Start scanning on the max_advertisements as defined in the script. - 6. Verify that all advertisements are found. - - Expected Result: - All advertisements should start without errors. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Concurrency - Priority: 2 - """ - self.adv_ad.droid.bleSetAdvertiseDataIncludeDeviceName(True) - self.scn_ad.droid.bleSetScanFilterDeviceName( - self.adv_ad.droid.bluetoothGetLocalName()) - return self._verify_n_advertisements(self.max_advertisements) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='f7e9ba2b-6286-4510-a8a0-f1df831056c0') - def test_max_advertisements_exclude_device_name_and_filter_device_name( - self): - """Test max advertisement variant. - - Test that a single device can have the max advertisements concurrently - advertising. Include the device name as a part of the filter but not the - advertisement data. - - Steps: - 1. Setup the scanning android device. - 2. Setup the advertiser android device. - 3. Include device name filter in the scanner. - 4. Start scanning on the max_advertisements as defined in the script. - 5. Verify that no advertisements are found. - - Expected Result: - All advertisements should start without errors. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Concurrency - Priority: 2 - """ - self.adv_ad.droid.bleSetAdvertiseDataIncludeDeviceName(False) - self.scn_ad.droid.bleSetScanFilterDeviceName( - self.adv_ad.droid.bluetoothGetLocalName()) - return not self._verify_n_advertisements(self.max_advertisements) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='6ce102d7-61e1-4ca0-bcfb-767437b86c2b') - def test_max_advertisements_with_manufacturer_data(self): - """Test max advertisement variant. - - Test that a single device can have the max advertisements concurrently - advertising. Include the manufacturer data as a part of the filter and - advertisement data. - - Steps: - 1. Setup the scanning android device. - 2. Setup the advertiser android device. - 3. Include manufacturer data in each advertisement. - 4. Include manufacturer data filter in the scanner. - 5. Start scanning on the max_advertisements as defined in the script. - 6. Verify that all advertisements are found. - - Expected Result: - All advertisements should start without errors. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Concurrency - Priority: 2 - """ - self.scn_ad.droid.bleSetScanFilterManufacturerData(1, [1]) - self.adv_ad.droid.bleAddAdvertiseDataManufacturerId(1, [1]) - return self._verify_n_advertisements(self.max_advertisements) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='2fc7d5e8-1539-42a8-8681-ce0b8bfc0924') - def test_max_advertisements_with_manufacturer_data_mask(self): - """Test max advertisements variant. - - Test that a single device can have the max advertisements concurrently - advertising. Include the manufacturer data mask as a part of the filter - and advertisement data. - - Steps: - 1. Setup the scanning android device. - 2. Setup the advertiser android device. - 3. Include manufacturer data in each advertisement. - 4. Include manufacturer data mask filter in the scanner. - 5. Start scanning on the max_advertisements as defined in the script. - 6. Verify that all advertisements are found. - - Expected Result: - All advertisements should start without errors. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Concurrency - Priority: 2 - """ - self.scn_ad.droid.bleSetScanFilterManufacturerData(1, [1], [1]) - self.adv_ad.droid.bleAddAdvertiseDataManufacturerId(1, [1]) - return self._verify_n_advertisements(self.max_advertisements) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='9ef615ed-1705-44ae-ab5b-f7e8fb4bb770') - def test_max_advertisements_with_service_data(self): - """Test max advertisement variant. - - Test that a single device can have the max advertisements concurrently - advertising. Include the service data as a part of the filter and - advertisement data. - - Steps: - 1. Setup the scanning android device. - 2. Setup the advertiser android device. - 3. Include service data in each advertisement. - 4. Include service data filter in the scanner. - 5. Start scanning on the max_advertisements as defined in the script. - 6. Verify that all advertisements are found. - - Expected Result: - All advertisements should start without errors. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Concurrency - Priority: 2 - """ - test_result = True - filter_list = self.scn_ad.droid.bleGenFilterList() - self.scn_ad.droid.bleSetScanFilterServiceData( - "0000110A-0000-1000-8000-00805F9B34FB", [11, 17, 80]) - self.adv_ad.droid.bleAddAdvertiseDataServiceData( - "0000110A-0000-1000-8000-00805F9B34FB", [11, 17, 80]) - return self._verify_n_advertisements(self.max_advertisements) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='9ef615ed-1705-44ae-ab5b-f7e8fb4bb770') - def test_max_advertisements_with_manufacturer_data_mask_and_include_device_name( - self): - """Test max advertisement variant. - - Test that a single device can have the max advertisements concurrently - advertising. Include the device name and manufacturer data as a part of - the filter and advertisement data. - - Steps: - 1. Setup the scanning android device. - 2. Setup the advertiser android device. - 3. Include device name and manufacturer data in each advertisement. - 4. Include device name and manufacturer data filter in the scanner. - 5. Start scanning on the max_advertisements as defined in the script. - 6. Verify that all advertisements are found. - - Expected Result: - All advertisements should start without errors. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Concurrency - Priority: 2 - """ - self.adv_ad.droid.bleSetAdvertiseDataIncludeDeviceName(True) - self.scn_ad.droid.bleSetScanFilterDeviceName( - self.adv_ad.droid.bluetoothGetLocalName()) - self.scn_ad.droid.bleSetScanFilterManufacturerData(1, [1], [1]) - self.adv_ad.droid.bleAddAdvertiseDataManufacturerId(1, [1]) - return self._verify_n_advertisements(self.max_advertisements) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='c2ca85fb-6663-431d-aa30-5286a85dbbe0') - def test_max_advertisements_with_service_uuids(self): - """Test max advertisement variant. - - Test that a single device can have the max advertisements concurrently - advertising. Include the service uuid as a part of the filter and - advertisement data. - - Steps: - 1. Setup the scanning android device. - 2. Setup the advertiser android device. - 3. Include service uuid in each advertisement. - 4. Include service uuid filter in the scanner. - 5. Start scanning on the max_advertisements as defined in the script. - 6. Verify that all advertisements are found. - - Expected Result: - All advertisements should start without errors. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Concurrency - Priority: 1 - """ - self.scn_ad.droid.bleSetScanFilterServiceUuid( - "00000000-0000-1000-8000-00805f9b34fb") - self.adv_ad.droid.bleSetAdvertiseDataSetServiceUuids( - ["00000000-0000-1000-8000-00805f9b34fb"]) - return self._verify_n_advertisements(self.max_advertisements) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='756e026f-64d7-4a2f-935a-3790c0ac4503') - def test_max_advertisements_with_service_uuid_and_service_mask(self): - """Test max advertisements variant. - - Test that a single device can have the max advertisements concurrently - advertising. Include the service mask as a part of the filter and - advertisement data. - - Steps: - 1. Setup the scanning android device. - 2. Setup the advertiser android device. - 3. Include service uuid in each advertisement. - 4. Include service mask filter in the scanner. - 5. Start scanning on the max_advertisements as defined in the script. - 6. Verify that all advertisements are found. - - Expected Result: - All advertisements should start without errors. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Concurrency - Priority: 2 - """ - self.scn_ad.droid.bleSetScanFilterServiceUuid( - "00000000-0000-1000-8000-00805f9b34fb", - "00000000-0000-1000-8000-00805f9b34fb") - self.adv_ad.droid.bleSetAdvertiseDataSetServiceUuids( - ["00000000-0000-1000-8000-00805f9b34fb"]) - return self._verify_n_advertisements(self.max_advertisements) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='79c4b6cd-9f07-49a9-829f-69b29ea8d322') - def test_max_advertisements_plus_one(self): - """Test max advertisements plus one. - - Test that a single device can have the max advertisements concurrently - advertising but fail on starting the max advertisements plus one. - filter and advertisement data. - - Steps: - 1. Setup the scanning android device. - 2. Setup the advertiser android device. - 3. Start max_advertisements + 1. - - Expected Result: - The last advertisement should fail. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Concurrency - Priority: 0 - """ - return not self._verify_n_advertisements(self.max_advertisements + 1) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='0bd6e490-a501-4fe1-88e5-9b77970c0b95') - def test_start_two_advertisements_on_same_callback(self): - """Test invalid advertisement scenario. - - Test that a single device cannot have two advertisements start on the - same callback. - - Steps: - 1. Setup the scanning android device. - 2. Setup the advertiser android device. - 3. Call start ble advertising on the same callback. - - Expected Result: - The second call of start advertising on the same callback should fail. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Concurrency - Priority: 1 - """ - test_result = True - advertise_callback, advertise_data, advertise_settings = ( - generate_ble_advertise_objects(self.adv_ad.droid)) - self.adv_ad.droid.bleStartBleAdvertising( - advertise_callback, advertise_data, advertise_settings) - try: - self.adv_ad.ed.pop_event( - adv_succ.format(advertise_callback), self.default_timeout) - except Empty as error: - self.log.error("Test failed with Empty error: {}".format(error)) - return False - except concurrent.futures._base.TimeoutError as error: - self.log.debug( - "Test failed, filtering callback onSuccess never occurred: {}" - .format(error)) - try: - self.adv_ad.droid.bleStartBleAdvertising( - advertise_callback, advertise_data, advertise_settings) - self.adv_ad.ed.pop_event( - adv_succ.format(advertise_callback), self.default_timeout) - test_result = False - except Empty as error: - self.log.debug("Test passed with Empty error: {}".format(error)) - except concurrent.futures._base.TimeoutError as error: - self.log.debug( - "Test passed, filtering callback onSuccess never occurred: {}" - .format(error)) - - return test_result - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='12632b31-22b9-4121-80b6-1263b9d90909') - def test_toggle_advertiser_bt_state(self): - """Test forcing stopping advertisements. - - Test that a single device resets its callbacks when the bluetooth state is - reset. There should be no advertisements. - - Steps: - 1. Setup the scanning android device. - 2. Setup the advertiser android device. - 3. Call start ble advertising. - 4. Toggle bluetooth on and off. - 5. Scan for any advertisements. - - Expected Result: - No advertisements should be found after toggling Bluetooth on the - advertising device. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Concurrency - Priority: 2 - """ - test_result = True - self.adv_ad.droid.bleSetAdvertiseDataIncludeDeviceName(True) - advertise_callback, advertise_data, advertise_settings = ( - generate_ble_advertise_objects(self.adv_ad.droid)) - self.adv_ad.droid.bleStartBleAdvertising( - advertise_callback, advertise_data, advertise_settings) - try: - self.adv_ad.ed.pop_event( - adv_succ.format(advertise_callback), self.default_timeout) - except Empty as error: - self.log.error("Test failed with Empty error: {}".format(error)) - return False - except concurrent.futures._base.TimeoutError as error: - self.log.error( - "Test failed, filtering callback onSuccess never occurred: {}". - format(error)) - self.scn_ad.droid.bleSetScanSettingsScanMode( - ble_scan_settings_modes['low_latency']) - self.scn_ad.droid.bleSetScanFilterDeviceName( - self.adv_ad.droid.bluetoothGetLocalName()) - filter_list, scan_settings, scan_callback = generate_ble_scan_objects( - self.scn_ad.droid) - self.scn_ad.droid.bleBuildScanFilter(filter_list) - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - try: - self.scn_ad.ed.pop_event( - scan_result.format(scan_callback), self.default_timeout) - except Empty as error: - self.log.error("Test failed with: {}".format(error)) - return False - self.scn_ad.droid.bleStopBleScan(scan_callback) - test_result = reset_bluetooth([self.android_devices[1]]) - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - if not test_result: - return False - try: - expected_event = scan_result.format(scan_callback) - event = self.scn_ad.ed.pop_event(expected_event, - self.default_timeout) - self.log.error("Event {} not expected. Found: {}".format( - expected_event, event)) - return False - except Empty as error: - self.log.debug("Test passed with: {}".format(error)) - self.scn_ad.droid.bleStopBleScan(scan_callback) - self.adv_ad.droid.bleStopBleAdvertising(advertise_callback) - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='785c5c77-d5d4-4d0f-8b7b-3eb1f1646d2c') - def test_restart_advertise_callback_after_bt_toggle(self): - """Test starting an advertisement on a cleared out callback. - - Test that a single device resets its callbacks when the bluetooth state - is reset. - - Steps: - 1. Setup the scanning android device. - 2. Setup the advertiser android device. - 3. Call start ble advertising. - 4. Toggle bluetooth on and off. - 5. Call start ble advertising on the same callback. - - Expected Result: - Starting an advertisement on a callback id after toggling bluetooth - should fail. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Concurrency - Priority: 1 - """ - test_result = True - advertise_callback, advertise_data, advertise_settings = ( - generate_ble_advertise_objects(self.adv_ad.droid)) - self.adv_ad.droid.bleStartBleAdvertising( - advertise_callback, advertise_data, advertise_settings) - try: - self.adv_ad.ed.pop_event( - adv_succ.format(advertise_callback), self.default_timeout) - except Empty as error: - self.log.error("Test failed with Empty error: {}".format(error)) - test_result = False - except concurrent.futures._base.TimeoutError as error: - self.log.debug( - "Test failed, filtering callback onSuccess never occurred: {}". - format(error)) - test_result = reset_bluetooth([self.android_devices[1]]) - if not test_result: - return test_result - self.adv_ad.droid.bleStartBleAdvertising( - advertise_callback, advertise_data, advertise_settings) - try: - self.adv_ad.ed.pop_event( - adv_succ.format(advertise_callback), self.default_timeout) - except Empty as error: - self.log.error("Test failed with Empty error: {}".format(error)) - test_result = False - except concurrent.futures._base.TimeoutError as error: - self.log.debug( - "Test failed, filtering callback onSuccess never occurred: {}". - format(error)) - return test_result - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='dd5529b7-6774-4580-8b29-d84568c15442') - def test_timeout(self): - """Test starting advertiser with timeout. - - Test that when a timeout is used, the advertiser is cleaned properly, - and next one can be started. - - Steps: - 1. Setup the advertiser android device with 4 second timeout. - 2. Call start ble advertising. - 3. Wait 5 seconds, to make sure advertiser times out. - 4. Repeat steps 1-4 four times. - - Expected Result: - Starting the advertising should succeed each time. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Concurrency - Priority: 1 - """ - advertise_timeout_s = 4 - num_iterations = 4 - test_result = True - - for i in range(0, num_iterations): - advertise_callback, advertise_data, advertise_settings = ( - generate_ble_advertise_objects(self.adv_ad.droid)) - - self.adv_ad.droid.bleSetAdvertiseSettingsTimeout( - advertise_timeout_s * 1000) - - self.adv_ad.droid.bleStartBleAdvertising( - advertise_callback, advertise_data, advertise_settings) - try: - self.adv_ad.ed.pop_event( - adv_succ.format(advertise_callback), self.default_timeout) - except Empty as error: - self.log.error("Test failed with Empty error: {}".format( - error)) - test_result = False - except concurrent.futures._base.TimeoutError as error: - self.log.debug( - "Test failed, filtering callback onSuccess never occurred: {}". - format(error)) - - if not test_result: - return test_result - - time.sleep(advertise_timeout_s + 1) - - return test_result diff --git a/acts/tests/google/ble/concurrency/ConcurrentBleScanningTest.py b/acts/tests/google/ble/concurrency/ConcurrentBleScanningTest.py deleted file mode 100644 index 512aed8f16..0000000000 --- a/acts/tests/google/ble/concurrency/ConcurrentBleScanningTest.py +++ /dev/null @@ -1,352 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -""" -Test script to exercises Ble Scans can run in concurrency. -This test was designed to be run in a shield box. -""" - -import concurrent -import time - -from queue import Empty -from acts.test_decorators import test_tracker_info -from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest -from acts.test_utils.bt.bt_constants import ble_advertise_settings_modes -from acts.test_utils.bt.bt_constants import ble_scan_settings_callback_types -from acts.test_utils.bt.bt_constants import ble_scan_settings_modes -from acts.test_utils.bt.bt_constants import adv_succ -from acts.test_utils.bt.bt_test_utils import generate_ble_advertise_objects -from acts.test_utils.bt.bt_test_utils import reset_bluetooth -from acts.test_utils.bt.bt_constants import scan_failed -from acts.test_utils.bt.bt_constants import scan_result -from acts.test_utils.bt.bt_test_utils import take_btsnoop_logs - - -class ConcurrentBleScanningTest(BluetoothBaseTest): - default_timeout = 20 - max_concurrent_scans = 27 - - def setup_class(self): - super().setup_class() - self.scn_ad = self.android_devices[0] - self.adv_ad = self.android_devices[1] - - def on_fail(self, test_name, begin_time): - self.log.debug("Test {} failed. Gathering bugreport and btsnoop logs." - .format(test_name)) - take_btsnoop_logs(self.android_devices, self, test_name) - reset_bluetooth(self.android_devices) - - def setup_test(self): - return reset_bluetooth(self.android_devices) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='e7f68b9b-fb3f-48e9-a272-e41c2a32b4bd') - def test_max_concurrent_ble_scans(self): - """Test max LE scans. - - Test that a single device can have max scans concurrently scanning. - - Steps: - 1. Initialize scanner - 2. Initialize advertiser - 3. Start advertising on the device from step 2 - 4. Create max ble scan callbacks - 5. Start ble scan on each callback - 6. Verify that each callback triggers - 7. Stop all scans and advertisements - - Expected Result: - All scanning instances should start without errors and the advertisement - should be found on each scan instance. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning, Concurrency - Priority: 0 - """ - test_result = True - self.adv_ad.droid.bleSetAdvertiseDataIncludeDeviceName(True) - self.scn_ad.droid.bleSetScanSettingsCallbackType( - ble_scan_settings_callback_types['all_matches']) - self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ - 'low_latency']) - self.adv_ad.droid.bleSetAdvertiseSettingsAdvertiseMode( - ble_advertise_settings_modes['low_latency']) - advertise_callback, advertise_data, advertise_settings = ( - generate_ble_advertise_objects(self.adv_ad.droid)) - self.adv_ad.droid.bleSetAdvertiseSettingsIsConnectable(False) - self.adv_ad.droid.bleStartBleAdvertising( - advertise_callback, advertise_data, advertise_settings) - try: - self.adv_ad.ed.pop_event( - adv_succ.format(advertise_callback), self.default_timeout) - except Empty as error: - self.log.exception("Test failed with Empty error: {}".format( - error)) - test_result = False - except concurrent.futures._base.TimeoutError as error: - self.log.exception( - "Test failed callback onSuccess never occurred: " - "{}".format(error)) - test_result = False - if not test_result: - return test_result - filter_list = self.scn_ad.droid.bleGenFilterList() - self.scn_ad.droid.bleSetScanFilterDeviceName( - self.adv_ad.droid.bluetoothGetLocalName()) - self.scn_ad.droid.bleBuildScanFilter(filter_list) - scan_settings = self.scn_ad.droid.bleBuildScanSetting() - scan_callback_list = [] - for i in range(self.max_concurrent_scans): - self.log.debug("Concurrent Ble Scan iteration {}".format(i + 1)) - scan_callback = self.scn_ad.droid.bleGenScanCallback() - scan_callback_list.append(scan_callback) - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - try: - self.scn_ad.ed.pop_event( - scan_result.format(scan_callback), self.default_timeout) - self.log.info("Found scan event successfully. Iteration {} " - "successful.".format(i)) - except Exception: - self.log.info("Failed to find a scan result for callback {}" - .format(scan_callback)) - test_result = False - break - for callback in scan_callback_list: - self.scn_ad.droid.bleStopBleScan(callback) - self.adv_ad.droid.bleStopBleAdvertising(advertise_callback) - if not test_result: - return test_result - self.log.info("Waiting for scan callbacks to stop completely.") - # Wait for all scan callbacks to stop. There is no confirmation - # otherwise. - time.sleep(10) - return test_result - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='58b0c45e-1cbc-420a-9e89-901518ffe3d1') - def test_max_concurrent_ble_scans_then_discover_advertisement(self): - """Test max LE scans variant. - - Test that a single device can have max scans concurrently scanning. - - Steps: - 1. Initialize scanner - 2. Initialize advertiser - 3. Create max ble scan callbacks - 4. Start ble scan on each callback - 5. Start advertising on the device from step 2 - 6. Verify that each callback triggers - 7. Stop all scans and advertisements - - Expected Result: - All scanning instances should start without errors and the advertisement - should be found on each scan instance. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning, Concurrency - Priority: 1 - """ - self.adv_ad.droid.bleSetAdvertiseDataIncludeDeviceName(True) - self.scn_ad.droid.bleSetScanSettingsCallbackType( - ble_scan_settings_callback_types['all_matches']) - self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ - 'low_latency']) - self.adv_ad.droid.bleSetAdvertiseSettingsAdvertiseMode( - ble_advertise_settings_modes['low_latency']) - advertise_callback, advertise_data, advertise_settings = ( - generate_ble_advertise_objects(self.adv_ad.droid)) - filter_list = self.scn_ad.droid.bleGenFilterList() - self.scn_ad.droid.bleSetScanFilterDeviceName( - self.adv_ad.droid.bluetoothGetLocalName()) - self.scn_ad.droid.bleBuildScanFilter(filter_list) - scan_settings = self.scn_ad.droid.bleBuildScanSetting() - scan_callback_list = [] - for i in range(self.max_concurrent_scans): - self.log.debug("Concurrent Ble Scan iteration {}".format(i + 1)) - scan_callback = self.scn_ad.droid.bleGenScanCallback() - scan_callback_list.append(scan_callback) - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - self.adv_ad.droid.bleStartBleAdvertising( - advertise_callback, advertise_data, advertise_settings) - try: - self.adv_ad.ed.pop_event( - adv_succ.format(advertise_callback), self.default_timeout) - except Empty as error: - self.log.exception("Test failed with Empty error: {}".format( - error)) - return False - except concurrent.futures._base.TimeoutError as error: - self.log.exception("Test failed, filtering callback onSuccess " - "never occurred: {}".format(error)) - return False - i = 0 - for callback in scan_callback_list: - try: - self.scn_ad.ed.pop_event( - scan_result.format(callback), self.default_timeout) - self.log.info( - "Found scan event successfully. Iteration {} successful." - .format(i)) - except Exception: - self.log.info("Failed to find a scan result for callback {}" - .format(callback)) - return False - i += 1 - for callback in scan_callback_list: - self.scn_ad.droid.bleStopBleScan(callback) - self.adv_ad.droid.bleStopBleAdvertising(advertise_callback) - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='7a45e45c-faf3-4e89-abb7-a52f63e53208') - def test_max_concurrent_ble_scans_plus_one(self): - """Test mac LE scans variant. - - Test that a single device can have max scans concurrently scanning. - - Steps: - 1. Initialize scanner - 3. Create max ble scan callbacks plus one - 5. Start ble scan on each callback - 6. Verify that the n+1th scan fails. - 7. Stop all scans - - Expected Result: - The n+1th scan should fail to start. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning, Concurrency - Priority: 1 - """ - test_result = True - filter_list = self.scn_ad.droid.bleGenFilterList() - scan_settings = self.scn_ad.droid.bleBuildScanSetting() - scan_callback_list = [] - for i in range(self.max_concurrent_scans): - self.log.debug("Concurrent Ble Scan iteration {}".format(i + 1)) - scan_callback = self.scn_ad.droid.bleGenScanCallback() - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - scan_callback_list.append(scan_callback) - scan_callback = self.scn_ad.droid.bleGenScanCallback() - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - try: - self.scn_ad.ed.pop_event( - scan_failed.format(scan_callback), self.default_timeout) - self.log.info( - "Found scan event successfully. Iteration {} successful." - .format(self.max_concurrent_scans + 1)) - except Exception: - self.log.error("Failed to find a onScanFailed event for callback {}" - .format(scan_callback)) - test_result = False - for callback in scan_callback_list: - self.scn_ad.droid.bleStopBleScan(callback) - return test_result - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='5a91f612-69e5-490f-b9d0-50d58a3db736') - def test_max_concurrent_ble_scans_verify_scans_stop_independently(self): - """Test max LE scans variant. - - Test that a single device can have max scans concurrently scanning. - - Steps: - 1. Initialize scanner - 2. Initialize advertiser - 3. Create max ble scan callbacks - 4. Start ble scan on each callback - 5. Start advertising on the device from step 2 - 6. Verify that the first callback triggers - 7. Stop the scan and repeat steps 6 and 7 until all scans stopped - - Expected Result: - All scanning instances should start without errors and the advertisement - should be found on each scan instance. All scanning instances should - stop successfully. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning, Concurrency - Priority: 1 - """ - self.adv_ad.droid.bleSetAdvertiseDataIncludeDeviceName(True) - self.scn_ad.droid.bleSetScanSettingsCallbackType( - ble_scan_settings_callback_types['all_matches']) - self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ - 'low_latency']) - self.adv_ad.droid.bleSetAdvertiseSettingsAdvertiseMode( - ble_advertise_settings_modes['low_latency']) - advertise_callback, advertise_data, advertise_settings = ( - generate_ble_advertise_objects(self.adv_ad.droid)) - filter_list = self.scn_ad.droid.bleGenFilterList() - self.scn_ad.droid.bleSetScanFilterDeviceName( - self.adv_ad.droid.bluetoothGetLocalName()) - self.scn_ad.droid.bleBuildScanFilter(filter_list) - scan_settings = self.scn_ad.droid.bleBuildScanSetting() - scan_callback_list = [] - for i in range(self.max_concurrent_scans): - self.log.debug("Concurrent Ble Scan iteration {}".format(i + 1)) - scan_callback = self.scn_ad.droid.bleGenScanCallback() - scan_callback_list.append(scan_callback) - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - self.adv_ad.droid.bleStartBleAdvertising( - advertise_callback, advertise_data, advertise_settings) - try: - self.adv_ad.ed.pop_event( - adv_succ.format(advertise_callback), self.default_timeout) - except Empty as error: - self.log.exception("Test failed with Empty error: {}".format( - error)) - return False - except concurrent.futures._base.TimeoutError as error: - self.log.exception( - "Test failed, filtering callback onSuccess never" - " occurred: {}".format(error)) - return False - i = 0 - for callback in scan_callback_list: - expected_scan_event_name = scan_result.format(scan_callback) - try: - self.scn_ad.ed.pop_event(expected_scan_event_name, - self.default_timeout) - self.log.info( - "Found scan event successfully. Iteration {} successful.". - format(i)) - i += 1 - except Exception: - self.log.info("Failed to find a scan result for callback {}". - format(scan_callback)) - return False - self.scn_ad.droid.bleStopBleScan(callback) - self.adv_ad.droid.bleStopBleAdvertising(advertise_callback) - return True diff --git a/acts/tests/google/ble/concurrency/ConcurrentGattConnectTest.py b/acts/tests/google/ble/concurrency/ConcurrentGattConnectTest.py deleted file mode 100644 index ec5e09cae8..0000000000 --- a/acts/tests/google/ble/concurrency/ConcurrentGattConnectTest.py +++ /dev/null @@ -1,291 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (C) 2018 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -""" -Test script for concurrent Gatt connections. -Testbed assumes 6 Android devices. One will be the central and the rest -peripherals. -""" - -from queue import Empty -import concurrent.futures -import threading -import time -from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest -from acts.test_utils.bt.bt_constants import ble_scan_settings_modes -from acts.test_utils.bt.bt_constants import ble_advertise_settings_modes -from acts.test_utils.bt.bt_constants import bt_profile_constants -from acts.test_utils.bt.bt_constants import gatt_characteristic -from acts.test_utils.bt.bt_constants import gatt_characteristic_value_format -from acts.test_utils.bt.bt_constants import gatt_char_desc_uuids -from acts.test_utils.bt.bt_constants import gatt_descriptor -from acts.test_utils.bt.bt_constants import gatt_service_types -from acts.test_utils.bt.bt_constants import scan_result -from acts.test_utils.bt.bt_gatt_utils import run_continuous_write_descriptor -from acts.test_utils.bt.bt_gatt_utils import setup_gatt_connection -from acts.test_utils.bt.gatts_lib import GattServerLib -from acts.test_decorators import test_tracker_info - -service_uuid = '0000a00a-0000-1000-8000-00805f9b34fb' -characteristic_uuid = 'aa7edd5a-4d1d-4f0e-883a-d145616a1630' -descriptor_uuid = "00000003-0000-1000-8000-00805f9b34fb" - -gatt_server_read_descriptor_sample = { - 'services': [{ - 'uuid': - service_uuid, - 'type': - gatt_service_types['primary'], - 'characteristics': [{ - 'uuid': - characteristic_uuid, - 'properties': - gatt_characteristic['property_write'], - 'permissions': - gatt_characteristic['permission_write'], - 'instance_id': - 0x002a, - 'value_type': - gatt_characteristic_value_format['string'], - 'value': - 'Test Database', - 'descriptors': [{ - 'uuid': descriptor_uuid, - 'permissions': gatt_descriptor['permission_write'], - }] - }] - }] -} - - -class ConcurrentGattConnectTest(BluetoothBaseTest): - bt_default_timeout = 10 - max_connections = 5 - # List of tuples (android_device, advertise_callback) - advertise_callbacks = [] - # List of tuples (android_device, advertisement_name) - advertisement_names = [] - list_of_arguments_list = [] - - def setup_class(self): - super(BluetoothBaseTest, self).setup_class() - self.pri_dut = self.android_devices[0] - - - # Create 5 advertisements from different android devices - for i in range(1, self.max_connections + 1): - # Set device name - ad = self.android_devices[i] - name = "test_adv_{}".format(i) - self.advertisement_names.append((ad, name)) - ad.droid.bluetoothSetLocalName(name) - - # Setup and start advertisements - ad.droid.bleSetAdvertiseDataIncludeDeviceName(True) - ad.droid.bleSetAdvertiseSettingsAdvertiseMode( - ble_advertise_settings_modes['low_latency']) - advertise_data = ad.droid.bleBuildAdvertiseData() - advertise_settings = ad.droid.bleBuildAdvertiseSettings() - advertise_callback = ad.droid.bleGenBleAdvertiseCallback() - ad.droid.bleStartBleAdvertising(advertise_callback, advertise_data, - advertise_settings) - self.advertise_callbacks.append((ad, advertise_callback)) - - def obtain_address_list_from_scan(self): - """Returns the address list of all devices that match the scan filter. - - Returns: - A list if all devices are found; None is any devices are not found. - """ - # From central device, scan for all appropriate addresses by name. - filter_list = self.pri_dut.droid.bleGenFilterList() - self.pri_dut.droid.bleSetScanSettingsScanMode( - ble_scan_settings_modes['low_latency']) - scan_settings = self.pri_dut.droid.bleBuildScanSetting() - scan_callback = self.pri_dut.droid.bleGenScanCallback() - for android_device, name in self.advertisement_names: - self.pri_dut.droid.bleSetScanFilterDeviceName(name) - self.pri_dut.droid.bleBuildScanFilter(filter_list) - self.pri_dut.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - address_list = [] - devices_found = [] - # Set the scan time out to 20 sec to provide enough time to discover the - # devices in busy environment - scan_timeout = 20 - end_time = time.time() + scan_timeout - while time.time() < end_time and len(address_list) < len( - self.advertisement_names): - try: - event = self.pri_dut.ed.pop_event( - "BleScan{}onScanResults".format(scan_callback), - self.bt_default_timeout) - - adv_name = event['data']['Result']['deviceInfo']['name'] - mac_address = event['data']['Result']['deviceInfo']['address'] - # Look up the android device handle based on event name - device = [ - item for item in self.advertisement_names - if adv_name in item - ] - devices_found.append(device[0][0].serial) - if len(device) is not 0: - address_list_tuple = (device[0][0], mac_address) - else: - continue - result = [item for item in address_list if mac_address in item] - # if length of result is 0, it indicates that we have discovered - # new mac address. - if len(result) is 0: - self.log.info("Found new mac address: {}".format( - address_list_tuple[1])) - address_list.append(address_list_tuple) - except Empty as err: - self.log.error("Failed to find any scan results.") - return None - if len(address_list) < self.max_connections: - self.log.info("Only found these devices: {}".format(devices_found)) - self.log.error("Could not find all necessary advertisements.") - return None - return address_list - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='6638282c-69b5-4237-9f0d-18e131424a9f') - def test_concurrent_gatt_connections(self): - """Test max concurrent GATT connections - - Connect to all peripherals. - - Steps: - 1. Scan - 2. Save addresses - 3. Connect all addresses of the peripherals - - Expected Result: - All connections successful. - - Returns: - Pass if True - Fail if False - - TAGS: Bluetooth, GATT - Priority: 2 - """ - - address_list = self.obtain_address_list_from_scan() - if address_list is None: - return False - - # Connect to all addresses - for address_tuple in address_list: - address = address_tuple[1] - try: - autoconnect = False - bluetooth_gatt, gatt_callback = setup_gatt_connection( - self.pri_dut, address, autoconnect) - self.log.info("Successfully connected to {}".format(address)) - except Exception as err: - self.log.error( - "Failed to establish connection to {}".format(address)) - return False - if (len( - self.pri_dut.droid.bluetoothGetConnectedLeDevices( - bt_profile_constants['gatt_server'])) != - self.max_connections): - self.log.error("Did not reach max connection count.") - return False - - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='660bf05e-a8e5-45f3-b42b-b66b4ac0d85f') - def test_data_transfer_to_concurrent_gatt_connections(self): - """Test writing GATT descriptors concurrently to many peripherals. - - Connect to all peripherals and write gatt descriptors concurrently. - - - Steps: - 1. Scan the addresses by names - 2. Save mac addresses of the peripherals - 3. Connect all addresses of the peripherals and write gatt descriptors - - - Expected Result: - All connections and data transfers are successful. - - Returns: - Pass if True - Fail if False - - TAGS: Bluetooth, GATT - Priority: 2 - """ - - address_list = self.obtain_address_list_from_scan() - if address_list is None: - return False - - # Connect to all addresses - executor = concurrent.futures.ThreadPoolExecutor(max_workers=10) - - for address_tuple in address_list: - ad, address = address_tuple - - gatts = GattServerLib(log=self.log, dut=ad) - gatt_server, gatt_server_callback = gatts.setup_gatts_db( - database=gatt_server_read_descriptor_sample) - - try: - bluetooth_gatt, gatt_callback = setup_gatt_connection( - self.pri_dut, address, autoconnect=False) - self.log.info("Successfully connected to {}".format(address)) - - except Exception as err: - self.log.error( - "Failed to establish connection to {}".format(address)) - return False - - if self.pri_dut.droid.gattClientDiscoverServices(bluetooth_gatt): - event = self.pri_dut.ed.pop_event( - "GattConnect{}onServicesDiscovered".format(bluetooth_gatt), - self.bt_default_timeout) - discovered_services_index = event['data']['ServicesIndex'] - else: - self.log.info("Failed to discover services.") - return False - services_count = self.pri_dut.droid.gattClientGetDiscoveredServicesCount( - discovered_services_index) - - arguments_list = [ - self.pri_dut.droid, self.pri_dut.ed, ad.droid, ad.ed, - gatt_server, gatt_server_callback, bluetooth_gatt, - services_count, discovered_services_index, 100 - ] - self.list_of_arguments_list.append(arguments_list) - - for arguments_list in self.list_of_arguments_list: - executor.submit(run_continuous_write_descriptor, *arguments_list) - - executor.shutdown(wait=True) - - if (len( - self.pri_dut.droid.bluetoothGetConnectedLeDevices( - bt_profile_constants['gatt_server'])) != - self.max_connections): - self.log.error("Failed to write concurrently.") - return False - - return True diff --git a/acts/tests/google/ble/conn_oriented_chan/BleCoc2ConnTest.py b/acts/tests/google/ble/conn_oriented_chan/BleCoc2ConnTest.py deleted file mode 100644 index 353f507088..0000000000 --- a/acts/tests/google/ble/conn_oriented_chan/BleCoc2ConnTest.py +++ /dev/null @@ -1,510 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright 2017 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -""" -Test script to execute Bluetooth Connection-orient Channel (CoC) functionality for -2 connections test cases. This test was designed to be run in a shield box. -""" - -import threading -import time - -from acts import utils -from queue import Empty -from acts.test_decorators import test_tracker_info -from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest -from acts.test_utils.bt.bt_coc_test_utils import orchestrate_coc_connection -from acts.test_utils.bt.bt_coc_test_utils import do_multi_connection_throughput -from acts.test_utils.bt.bt_constants import default_le_data_length -from acts.test_utils.bt.bt_constants import default_bluetooth_socket_timeout_ms -from acts.test_utils.bt.bt_constants import l2cap_coc_header_size -from acts.test_utils.bt.bt_constants import l2cap_max_inactivity_delay_after_disconnect -from acts.test_utils.bt.bt_constants import le_connection_event_time_step_ms -from acts.test_utils.bt.bt_test_utils import clear_bonded_devices -from acts.test_utils.bt.bt_test_utils import kill_bluetooth_process -from acts.test_utils.bt.bt_test_utils import reset_bluetooth -from acts.test_utils.bt.bt_test_utils import setup_multiple_devices_for_bt_test -from acts.test_utils.bt.bt_test_utils import take_btsnoop_logs -from acts.test_utils.bt.bt_test_utils import write_read_verify_data -from acts.test_utils.bt.bt_test_utils import verify_server_and_client_connected - - -class BleCoc2ConnTest(BluetoothBaseTest): - def setup_class(self): - super().setup_class() - self.client_ad = self.android_devices[0] - # The client which is scanning will need location to be enabled in order to - # start scan and get scan results. - utils.set_location_service(self.client_ad, True) - self.server_ad = self.android_devices[1] - # Note that some tests required a third device. - if len(self.android_devices) > 2: - self.server2_ad = self.android_devices[2] - - return setup_multiple_devices_for_bt_test(self.android_devices) - - def teardown_test(self): - self.client_ad.droid.bluetoothSocketConnStop() - self.server_ad.droid.bluetoothSocketConnStop() - # Give sufficient time for the physical LE link to be disconnected. - time.sleep(l2cap_max_inactivity_delay_after_disconnect) - - # This utility function calculates the max and min connection event (ce) time. - # The formula is that the min/max ce time should be less than half the connection - # interval and must be multiples of the le_connection_event_time_step. - def _calc_min_max_ce_time(self, le_connection_interval): - conn_event_time_steps = int((le_connection_interval/2)/le_connection_event_time_step_ms) - conn_event_time_steps -= 1 - return (le_connection_event_time_step_ms * conn_event_time_steps) - - def _run_coc_connection_throughput_2_conn( - self, - is_secured, - buffer_size, - le_connection_interval=0, - le_tx_data_length=default_le_data_length, - min_ce_len=0, - max_ce_len=0): - - # The num_iterations is that number of repetitions of each - # set of buffers r/w. - # number_buffers is the total number of data buffers to transmit per - # set of buffers r/w. - # buffer_size is the number of bytes per L2CAP data buffer. - num_iterations = 10 - number_buffers = 100 - - # Make sure at least 3 phones are setup - if len(self.android_devices) <= 2: - self.log.info("test_coc_connection_throughput_2_conn: " - "Error: 3rd phone not configured in file") - return False - - self.log.info( - "_run_coc_connection_throughput_2_conn: is_secured={}, Interval={}, buffer_size={}, " - "le_tx_data_length={}, min_ce_len={}".format(is_secured, le_connection_interval, - buffer_size, le_tx_data_length, min_ce_len)) - status, client_conn_id1, server_conn_id1 = orchestrate_coc_connection( - self.client_ad, self.server_ad, True, is_secured, - le_connection_interval, le_tx_data_length, default_bluetooth_socket_timeout_ms, - min_ce_len, max_ce_len) - if not status: - return False - - status, client_conn_id2, server_conn_id2 = orchestrate_coc_connection( - self.client_ad, self.server2_ad, True, is_secured, - le_connection_interval, le_tx_data_length, default_bluetooth_socket_timeout_ms, - min_ce_len, max_ce_len) - if not status: - return False - - list_server_ad = [self.server_ad, self.server2_ad] - list_client_conn_id = [client_conn_id1, client_conn_id2] - data_rate = do_multi_connection_throughput( - self.client_ad, list_server_ad, list_client_conn_id, - num_iterations, number_buffers, buffer_size) - if data_rate <= 0: - return False - - self.log.info( - "test_coc_connection_throughput_2_conn: throughput=%d bytes per " - "sec", data_rate) - - self.client_ad.droid.bluetoothSocketConnStop(client_conn_id1) - self.client_ad.droid.bluetoothSocketConnStop(client_conn_id2) - self.server_ad.droid.bluetoothSocketConnStop(server_conn_id1) - self.server2_ad.droid.bluetoothSocketConnStop(server_conn_id2) - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='27226006-b725-4312-920e-6193cf0539d4') - def test_coc_insecured_connection_throughput_2_conn(self): - """Test LE CoC data throughput on two insecured connections - - Test Data Throughput of 2 L2CAP CoC insecured connections. - 3 phones are required. - - Steps: - 1. Get the mac address of the server device. - 2. Establish a L2CAP CoC connection from the client to the server#1 AD. - The connection is insecured. - 3. Verify that the L2CAP CoC connection is active from both the client - and server. - 4. Establish a L2CAP CoC connection from the client to the server#2 AD. - The connection is insecured. - 5. Verify that the L2CAP CoC connection is active from both the client - and server. - 6. Write data from the client to both server#1 and server#2. - 7. Verify data matches from client and server - - Expected Result: - L2CAP CoC connections are established and data written correctly to both servers. - - Returns: - Pass if True - Fail if False - - TAGS: BLE, CoC - Priority: 2 - """ - - # Note: A 117 octets buffer size would fix nicely to a 123 bytes Data Length - status = self._run_coc_connection_throughput_2_conn(False, 117) - return status - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='1a5fb032-8a27-42f1-933f-3e39311c09a6') - def test_coc_secured_connection_throughput_2_conn(self): - """Test LE CoC data throughput on two secured connections - - Test Data Throughput of 2 L2CAP CoC secured connections. - 3 phones are required. - - Steps: - 1. Get the mac address of the server device. - 2. Establish a L2CAP CoC connection from the client to the server#1 AD. - The connection is secured. - 3. Verify that the L2CAP CoC connection is active from both the client - and server. - 4. Establish a L2CAP CoC connection from the client to the server#2 AD. - The connection is secured. - 5. Verify that the L2CAP CoC connection is active from both the client - and server. - 6. Write data from the client to both server#1 and server#2. - 7. Verify data matches from client and server - - Expected Result: - L2CAP CoC connections are established and data written correctly to both servers. - - Returns: - Pass if True - Fail if False - - TAGS: BLE, CoC - Priority: 2 - """ - - # Note: A 117 octets buffer size would fix nicely to a 123 bytes Data Length - status = self._run_coc_connection_throughput_2_conn(True, 117) - return status - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='b198f8cc-26af-44bd-bb4d-7dc8f8645617') - def test_coc_connection_throughput_2_conn_NOSEC_10CI_60SIZE(self): - """Test LE CoC data throughput with 10msec CI and 60bytes buffer size. - - Test data throughput of 2 L2CAP CoC insecured connections with 20msec connection interval - and 60 bytes buffer size. 3 phones are required. - - Steps: - 1. Get the mac address of the server device. - 2. Establish a L2CAP CoC connection from the client to the server#1 AD. - The connection is insecured. - 3. Set the connection interval to 20 msec and buffer size to 60 bytes. - 4. Verify that the L2CAP CoC connection is active from both the client - and server. - 5. Establish a L2CAP CoC connection from the client to the server#2 AD. - The connection is insecured. - 6. Set the connection interval to 20 msec and buffer size to 60 bytes. - 7. Verify that the L2CAP CoC connection is active from both the client - and server. - 8. Write data from the client to both server#1 and server#2. - 9. Verify data matches from client and server - - Expected Result: - L2CAP CoC connections are established and data written correctly to both servers. - - Returns: - Pass if True - Fail if False - - TAGS: BLE, CoC - Priority: 1 - """ - - is_secured = False - le_connection_interval = 10 - buffer_size = 60 - le_tx_data_length = buffer_size + l2cap_coc_header_size - - status = self._run_coc_connection_throughput_2_conn( - is_secured, buffer_size, le_connection_interval, le_tx_data_length, - self._calc_min_max_ce_time(le_connection_interval), - self._calc_min_max_ce_time(le_connection_interval)) - return status - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='12dc2a6c-8283-4617-a911-42335dd693a8') - def test_coc_connection_throughput_2_conn_NOSEC_10CI_80SIZE(self): - """Test LE CoC data throughput with 10msec CI and 80bytes buffer size. - - Test data throughput of 2 L2CAP CoC insecured connections with 20msec connection interval - and 80 bytes buffer size. 3 phones are required. - - Steps: - 1. Get the mac address of the server device. - 2. Establish a L2CAP CoC connection from the client to the server#1 AD. - The connection is insecured. - 3. Set the connection interval to 20 msec and buffer size to 80 bytes. - 4. Verify that the L2CAP CoC connection is active from both the client - and server. - 5. Establish a L2CAP CoC connection from the client to the server#2 AD. - The connection is insecured. - 6. Set the connection interval to 20 msec and buffer size to 80 bytes. - 7. Verify that the L2CAP CoC connection is active from both the client - and server. - 8. Write data from the client to both server#1 and server#2. - 9. Verify data matches from client and server - - Expected Result: - L2CAP CoC connections are established and data written correctly to both servers. - - Returns: - Pass if True - Fail if False - - TAGS: BLE, CoC - Priority: 1 - """ - - is_secured = False - le_connection_interval = 10 - buffer_size = 80 - le_tx_data_length = buffer_size + l2cap_coc_header_size - status = self._run_coc_connection_throughput_2_conn( - is_secured, buffer_size, le_connection_interval, le_tx_data_length, - self._calc_min_max_ce_time(le_connection_interval), - self._calc_min_max_ce_time(le_connection_interval)) - return status - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='4730df05-3909-4adf-a365-7f0c3258c402') - def test_coc_connection_throughput_2_conn_NOSEC_10CI_120SIZE(self): - """Test LE CoC data throughput with 10msec CI and 120bytes buffer size. - - Test data throughput of 2 L2CAP CoC insecured connections with 20msec connection interval - and 120 bytes buffer size. 3 phones are required. - - Steps: - 1. Get the mac address of the server device. - 2. Establish a L2CAP CoC connection from the client to the server#1 AD. - The connection is insecured. - 3. Set the connection interval to 20 msec and buffer size to 120 bytes. - 4. Verify that the L2CAP CoC connection is active from both the client - and server. - 5. Establish a L2CAP CoC connection from the client to the server#2 AD. - The connection is insecured. - 6. Set the connection interval to 20 msec and buffer size to 120 bytes. - 7. Verify that the L2CAP CoC connection is active from both the client - and server. - 8. Write data from the client to both server#1 and server#2. - 9. Verify data matches from client and server - - Expected Result: - L2CAP CoC connections are established and data written correctly to both servers. - - Returns: - Pass if True - Fail if False - - TAGS: BLE, CoC - Priority: 1 - """ - - is_secured = False - le_connection_interval = 10 - buffer_size = 120 - le_tx_data_length = buffer_size + l2cap_coc_header_size - status = self._run_coc_connection_throughput_2_conn( - is_secured, buffer_size, le_connection_interval, le_tx_data_length, - self._calc_min_max_ce_time(le_connection_interval), - self._calc_min_max_ce_time(le_connection_interval)) - return status - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='471a8748-b0a5-4be5-9322-7c75e2b5d048') - def test_coc_connection_throughput_2_conn_NOSEC_15CI_120SIZE(self): - """Test LE CoC data throughput with 15msec CI and 120bytes buffer size. - - Test data throughput of 2 L2CAP CoC insecured connections with 15msec connection interval - and 120 bytes buffer size. 3 phones are required. - - Steps: - 1. Get the mac address of the server device. - 2. Establish a L2CAP CoC connection from the client to the server#1 AD. - The connection is insecured. - 3. Set the connection interval to 15 msec and buffer size to 120 bytes. - 4. Verify that the L2CAP CoC connection is active from both the client - and server. - 5. Establish a L2CAP CoC connection from the client to the server#2 AD. - The connection is insecured. - 6. Set the connection interval to 15 msec and buffer size to 120 bytes. - 7. Verify that the L2CAP CoC connection is active from both the client - and server. - 8. Write data from the client to both server#1 and server#2. - 9. Verify data matches from client and server - - Expected Result: - L2CAP CoC connections are established and data written correctly to both servers. - - Returns: - Pass if True - Fail if False - - TAGS: BLE, CoC - Priority: 1 - """ - - is_secured = False - le_connection_interval = 15 - buffer_size = 120 - le_tx_data_length = buffer_size + l2cap_coc_header_size - status = self._run_coc_connection_throughput_2_conn( - is_secured, buffer_size, le_connection_interval, le_tx_data_length, - self._calc_min_max_ce_time(le_connection_interval), - self._calc_min_max_ce_time(le_connection_interval)) - return status - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='053e59c2-f312-4bec-beaf-9e4efdce063a') - def test_coc_connection_throughput_2_conn_NOSEC_15CI_180SIZE(self): - """Test LE CoC data throughput with 15msec CI and 180bytes buffer size. - - Test data throughput of 2 L2CAP CoC insecured connections with 15msec connection interval - and 120 bytes buffer size. 3 phones are required. - - Steps: - 1. Get the mac address of the server device. - 2. Establish a L2CAP CoC connection from the client to the server#1 AD. - The connection is insecured. - 3. Set the connection interval to 15 msec and buffer size to 180 bytes. - 4. Verify that the L2CAP CoC connection is active from both the client - and server. - 5. Establish a L2CAP CoC connection from the client to the server#2 AD. - The connection is insecured. - 6. Set the connection interval to 15 msec and buffer size to 180 bytes. - 7. Verify that the L2CAP CoC connection is active from both the client - and server. - 8. Write data from the client to both server#1 and server#2. - 9. Verify data matches from client and server - - Expected Result: - L2CAP CoC connections are established and data written correctly to both servers. - - Returns: - Pass if True - Fail if False - - TAGS: BLE, CoC - Priority: 1 - """ - - is_secured = False - le_connection_interval = 15 - buffer_size = 180 - le_tx_data_length = buffer_size + l2cap_coc_header_size - status = self._run_coc_connection_throughput_2_conn( - is_secured, buffer_size, le_connection_interval, le_tx_data_length, - self._calc_min_max_ce_time(le_connection_interval), - self._calc_min_max_ce_time(le_connection_interval)) - return status - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='2b43caa6-76b3-48c5-b342-32ebb31ac52c') - def test_coc_connection_throughput_2_conn_NOSEC_20CI_240SIZE(self): - """Test LE CoC data throughput with 20msec CI and 240bytes buffer size. - - Test data throughput of 2 L2CAP CoC insecured connections with 20msec connection interval - and 240 bytes buffer size. 3 phones are required. - - Steps: - 1. Get the mac address of the server device. - 2. Establish a L2CAP CoC connection from the client to the server#1 AD. - The connection is insecured. - 3. Set the connection interval to 20 msec and buffer size to 240 bytes. - 4. Verify that the L2CAP CoC connection is active from both the client - and server. - 5. Establish a L2CAP CoC connection from the client to the server#2 AD. - The connection is insecured. - 6. Set the connection interval to 20 msec and buffer size to 240 bytes. - 7. Verify that the L2CAP CoC connection is active from both the client - and server. - 8. Write data from the client to both server#1 and server#2. - 9. Verify data matches from client and server - - Expected Result: - L2CAP CoC connections are established and data written correctly to both servers. - - Returns: - Pass if True - Fail if False - - TAGS: BLE, CoC - Priority: 1 - """ - - is_secured = False - le_connection_interval = 20 - buffer_size = 240 - le_tx_data_length = buffer_size + l2cap_coc_header_size - status = self._run_coc_connection_throughput_2_conn( - is_secured, buffer_size, le_connection_interval, le_tx_data_length, - self._calc_min_max_ce_time(le_connection_interval), - self._calc_min_max_ce_time(le_connection_interval)) - return status - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='f630df02-3fd6-4aa0-bc15-06837b705e97') - def test_coc_connection_throughput_2_conn_NOSEC_30CI_240SIZE(self): - """Test LE CoC data throughput with 30msec CI and 240bytes buffer size. - - Test data throughput of 2 L2CAP CoC insecured connections with 20msec connection interval - and 240 bytes buffer size. 3 phones are required. - - Steps: - 1. Get the mac address of the server device. - 2. Establish a L2CAP CoC connection from the client to the server#1 AD. - The connection is insecured. - 3. Set the connection interval to 30 msec and buffer size to 240 bytes. - 4. Verify that the L2CAP CoC connection is active from both the client - and server. - 5. Establish a L2CAP CoC connection from the client to the server#2 AD. - The connection is insecured. - 6. Set the connection interval to 30 msec and buffer size to 240 bytes. - 7. Verify that the L2CAP CoC connection is active from both the client - and server. - 8. Write data from the client to both server#1 and server#2. - 9. Verify data matches from client and server - - Expected Result: - L2CAP CoC connections are established and data written correctly to both servers. - - Returns: - Pass if True - Fail if False - - TAGS: BLE, CoC - Priority: 2 - """ - - is_secured = False - le_connection_interval = 30 - buffer_size = 240 - le_tx_data_length = buffer_size + l2cap_coc_header_size - status = self._run_coc_connection_throughput_2_conn( - is_secured, buffer_size, le_connection_interval, le_tx_data_length, - self._calc_min_max_ce_time(le_connection_interval), - self._calc_min_max_ce_time(le_connection_interval)) - return status diff --git a/acts/tests/google/ble/conn_oriented_chan/BleCocTest.py b/acts/tests/google/ble/conn_oriented_chan/BleCocTest.py deleted file mode 100644 index 166b848f26..0000000000 --- a/acts/tests/google/ble/conn_oriented_chan/BleCocTest.py +++ /dev/null @@ -1,587 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright 2017 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -""" -Test script to execute Bluetooth Connection-orient Channel (CoC) functionality -test cases. This test was designed to be run in a shield box. -""" - -import threading -import time - -from acts import utils -from queue import Empty -from acts.test_decorators import test_tracker_info -from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest -from acts.test_utils.bt.bt_coc_test_utils import orchestrate_coc_connection -from acts.test_utils.bt.bt_coc_test_utils import do_multi_connection_throughput -from acts.test_utils.bt.bt_constants import default_le_data_length -from acts.test_utils.bt.bt_constants import l2cap_coc_header_size -from acts.test_utils.bt.bt_constants import l2cap_max_inactivity_delay_after_disconnect -from acts.test_utils.bt.bt_test_utils import clear_bonded_devices -from acts.test_utils.bt.bt_test_utils import kill_bluetooth_process -from acts.test_utils.bt.bt_test_utils import reset_bluetooth -from acts.test_utils.bt.bt_test_utils import setup_multiple_devices_for_bt_test -from acts.test_utils.bt.bt_test_utils import take_btsnoop_logs -from acts.test_utils.bt.bt_test_utils import write_read_verify_data -from acts.test_utils.bt.bt_test_utils import verify_server_and_client_connected - - -class BleCocTest(BluetoothBaseTest): - message = ( - "Space: the final frontier. These are the voyages of " - "the starship Enterprise. Its continuing mission: to explore " - "strange new worlds, to seek out new life and new civilizations," - " to boldly go where no man has gone before.") - - def setup_class(self): - super().setup_class() - self.client_ad = self.android_devices[0] - self.server_ad = self.android_devices[1] - # Note that some tests required a third device. - if len(self.android_devices) > 2: - self.server2_ad = self.android_devices[2] - - # The client which is scanning will need location to be enabled in order to - # start scan and get scan results. - utils.set_location_service(self.client_ad, True) - return setup_multiple_devices_for_bt_test(self.android_devices) - - def teardown_test(self): - self.client_ad.droid.bluetoothSocketConnStop() - self.server_ad.droid.bluetoothSocketConnStop() - # Give sufficient time for the physical LE link to be disconnected. - time.sleep(l2cap_max_inactivity_delay_after_disconnect) - - def _run_coc_connection_throughput( - self, - is_secured, - buffer_size, - le_connection_interval=0, - le_tx_data_length=default_le_data_length): - - # The num_iterations is that number of repetitions of each - # set of buffers r/w. - # number_buffers is the total number of data buffers to transmit per - # set of buffers r/w. - # buffer_size is the number of bytes per L2CAP data buffer. - number_buffers = 100 - num_iterations = 10 - - self.log.info( - "_run_coc_connection_throughput: calling " - "orchestrate_coc_connection. is_secured={}, Connection Interval={}msec, " - "buffer_size={}bytes".format(is_secured, le_connection_interval, - buffer_size)) - status, client_conn_id, server_conn_id = orchestrate_coc_connection( - self.client_ad, self.server_ad, True, is_secured, - le_connection_interval, le_tx_data_length) - if not status: - return False - - list_server_ad = [self.server_ad] - list_client_conn_id = [client_conn_id] - data_rate = do_multi_connection_throughput( - self.client_ad, list_server_ad, list_client_conn_id, - num_iterations, number_buffers, buffer_size) - if data_rate <= 0: - return False - self.log.info( - "_run_coc_connection_throughput: throughput=%d bytes per sec", - data_rate) - - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='b6989966-c504-4934-bcd7-57fb4f7fde9c') - def test_coc_secured_connection(self): - """Test Bluetooth LE CoC secured connection - - Test LE CoC though establishing a basic connection with security. - - Steps: - 1. Get the mac address of the server device. - 2. Establish an LE CoC Secured connection from the client to the server AD. - 3. Verify that the LE CoC connection is active from both the client and - server. - Expected Result: - LE CoC connection is established then disconnected succcessfully. - - Returns: - Pass if True - Fail if False - - TAGS: BLE, CoC - Priority: 1 - """ - is_secured = True - self.log.info( - "_test_coc_secured_connection: calling orchestrate_coc_connection but " - "isBle=1 and securedConn={}".format(is_secured)) - status, client_conn_id, server_conn_id = orchestrate_coc_connection( - self.client_ad, self.server_ad, True, is_secured) - if not status: - return False - - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='6587792c-78fb-469f-9084-772c249f97de') - def test_coc_insecured_connection(self): - """Test Bluetooth LE CoC insecured connection - - Test LE CoC though establishing a basic connection with no security. - - Steps: - 1. Get the mac address of the server device. - 2. Establish an LE CoC Secured connection from the client to the server AD. - 3. Verify that the LE CoC connection is active from both the client and - server. - Expected Result: - LE CoC connection is established then disconnected succcessfully. - - Returns: - Pass if True - Fail if False - - TAGS: BLE, CoC - Priority: 1 - """ - is_secured = False - self.log.info( - "test_coc_insecured_connection: calling orchestrate_coc_connection but " - "isBle=1 and securedConn={}".format(is_secured)) - status, client_conn_id, server_conn_id = orchestrate_coc_connection( - self.client_ad, self.server_ad, True, is_secured) - if not status: - return False - - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='32a7b02e-f2b5-4193-b414-36c8815ac407') - def test_coc_secured_connection_write_ascii(self): - """Test LE CoC secured connection writing and reading ascii data - - Test LE CoC though establishing a secured connection and reading and writing ascii data. - - Steps: - 1. Get the mac address of the server device. - 2. Establish an LE CoC connection from the client to the server AD. The security of - connection is TRUE. - 3. Verify that the LE CoC connection is active from both the client and - server. - 4. Write data from the client and read received data from the server. - 5. Verify data matches from client and server - 6. Disconnect the LE CoC connection. - - Expected Result: - LE CoC connection is established then disconnected succcessfully. - - Returns: - Pass if True - Fail if False - - TAGS: BLE, CoC - Priority: 1 - """ - is_secured = True - self.log.info( - "test_coc_secured_connection_write_ascii: calling " - "orchestrate_coc_connection. is_secured={}".format(is_secured)) - status, client_conn_id, server_conn_id = orchestrate_coc_connection( - self.client_ad, self.server_ad, True, is_secured) - if not status: - return False - if not write_read_verify_data(self.client_ad, self.server_ad, - self.message, False): - return False - if not verify_server_and_client_connected(self.client_ad, - self.server_ad): - return False - - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='12537d27-79c9-40a0-8bdb-d023b0e36b58') - def test_coc_insecured_connection_write_ascii(self): - """Test LE CoC insecured connection writing and reading ascii data - - Test LE CoC though establishing a connection. - - Steps: - 1. Get the mac address of the server device. - 2. Establish an LE CoC connection from the client to the server AD. The security of - connection is FALSE. - 3. Verify that the LE CoC connection is active from both the client and - server. - 4. Write data from the client and read received data from the server. - 5. Verify data matches from client and server - 6. Disconnect the LE CoC connection. - - Expected Result: - LE CoC connection is established then disconnected succcessfully. - - Returns: - Pass if True - Fail if False - - TAGS: BLE, CoC - Priority: 1 - """ - is_secured = False - self.log.info( - "test_coc_secured_connection_write_ascii: calling " - "orchestrate_coc_connection. is_secured={}".format(is_secured)) - status, client_conn_id, server_conn_id = orchestrate_coc_connection( - self.client_ad, self.server_ad, True, is_secured) - if not status: - return False - if not write_read_verify_data(self.client_ad, self.server_ad, - self.message, False): - return False - if not verify_server_and_client_connected(self.client_ad, - self.server_ad): - return False - - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='214037f4-f0d1-47db-86a7-5230c71bdcac') - def test_coc_secured_connection_throughput(self): - """Test LE CoC writing and measured data throughput with security - - Test CoC thoughput by establishing a secured connection and sending data. - - Steps: - 1. Get the mac address of the server device. - 2. Establish a L2CAP CoC connection from the client to the server AD. - 3. Verify that the L2CAP CoC connection is active from both the client - and server. - 4. Write data from the client to server. - 5. Verify data matches from client and server - 6. Disconnect the L2CAP CoC connections. - - Expected Result: - CoC connection is established then disconnected succcessfully. - - Returns: - Pass if True - Fail if False - - TAGS: BLE, CoC - Priority: 1 - """ - - is_secured = True - # Note: A 117 octets buffer size would fix nicely to a 123 bytes Data Length - return self._run_coc_connection_throughput(is_secured, 117) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='6dc019bb-c3bf-4c98-978e-e2c5755058d7') - def test_coc_insecured_connection_throughput(self): - """Test LE CoC writing and measured data throughput without security. - - Test CoC thoughput by establishing an insecured connection and sending data. - - Steps: - 1. Get the mac address of the server device. - 2. Establish a L2CAP CoC connection from the client to the server AD. - 3. Verify that the L2CAP CoC connection is active from both the client - and server. - 4. Write data from the client to server. - 5. Verify data matches from client and server - 6. Disconnect the L2CAP CoC connections. - - Expected Result: - CoC connection is established then disconnected succcessfully. - - Returns: - Pass if True - Fail if False - - TAGS: BLE, CoC - Priority: 1 - """ - - is_secured = False - # Note: A 117 octets buffer size would fix nicely to a 123 bytes Data Length - return self._run_coc_connection_throughput(is_secured, 117) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='0af94805-1550-426c-bfdd-191b8b3a4c12') - def test_coc_connection_throughput_NOSEC_10CI_60SIZE(self): - """Test LE CoC data throughput with 10msec CI and 60bytes buffer size. - - Test CoC thoughput by establishing a connection and sending data with 10msec - Connection Interval and 60 bytes data buffer size. - - Steps: - 1. Get the mac address of the server device. - 2. Change the Connection Interval to 10msec. - 3. Change Payload Buffer Size to 60 bytes. - 4. Establish a L2CAP CoC connection from the client to the server AD. - 5. Verify that the L2CAP CoC connection is active from both the client - and server. - 6. Write data from the client to server. - 7. Verify data matches from client and server - 8. Disconnect the L2CAP CoC connections. - - Expected Result: - CoC connection is established, check transmitted data contents, then disconnected - succcessfully. - - Returns: - Pass if True - Fail if False - - TAGS: BLE, CoC - Priority: 2 - """ - - is_secured = False - le_connection_interval = 10 - buffer_size = 60 - le_tx_data_length = buffer_size + l2cap_coc_header_size - return self._run_coc_connection_throughput( - is_secured, buffer_size, le_connection_interval, le_tx_data_length) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='c32dac07-623a-4fdd-96c6-387a76afb2af') - def test_coc_connection_throughput_NOSEC_10CI_80SIZE(self): - """Test LE CoC data throughput with 10msec CI and 80bytes buffer size. - - Test CoC thoughput by establishing a connection and sending data with 10msec - Connection Interval and 80 bytes data buffer size. - - Steps: - 1. Get the mac address of the server device. - 2. Change the Connection Interval to 10msec. - 3. Change Payload Buffer Size to 80 bytes. - 4. Establish a L2CAP CoC connection from the client to the server AD. - 5. Verify that the L2CAP CoC connection is active from both the client - and server. - 6. Write data from the client to server. - 7. Verify data matches from client and server - 8. Disconnect the L2CAP CoC connections. - - Expected Result: - CoC connection is established, check transmitted data contents, then disconnected - succcessfully. - - Returns: - Pass if True - Fail if False - - TAGS: BLE, CoC - Priority: 2 - """ - - is_secured = False - le_connection_interval = 10 - buffer_size = 80 - le_tx_data_length = buffer_size + l2cap_coc_header_size - return self._run_coc_connection_throughput( - is_secured, buffer_size, le_connection_interval, le_tx_data_length) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='45d1b0c1-73b6-483f-ac6b-c3cec805da32') - def test_coc_connection_throughput_NOSEC_10CI_120SIZE(self): - """Test LE CoC data throughput with 10msec CI and 120bytes buffer size. - - Test CoC thoughput by establishing a connection and sending data with 10msec - Connection Interval and 120 bytes data buffer size. - - Steps: - 1. Get the mac address of the server device. - 2. Change the Connection Interval to 10msec. - 3. Change Payload Buffer Size to 120 bytes. - 4. Establish a L2CAP CoC connection from the client to the server AD. - 5. Verify that the L2CAP CoC connection is active from both the client - and server. - 6. Write data from the client to server. - 7. Verify data matches from client and server - 8. Disconnect the L2CAP CoC connections. - - Expected Result: - CoC connection is established, check transmitted data contents, then disconnected - succcessfully. - - Returns: - Pass if True - Fail if False - - TAGS: BLE, CoC - Priority: 2 - """ - - is_secured = False - le_connection_interval = 10 - buffer_size = 120 - le_tx_data_length = buffer_size + l2cap_coc_header_size - return self._run_coc_connection_throughput( - is_secured, buffer_size, le_connection_interval, le_tx_data_length) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='85f07f07-1017-42db-b38d-df0bf2fce804') - def test_coc_connection_throughput_NOSEC_15CI_120SIZE(self): - """Test LE CoC data throughput with 15msec CI and 120bytes buffer size. - - Test CoC thoughput by establishing a connection and sending data with 15msec - Connection Interval and 120 bytes data buffer size. - - Steps: - 1. Get the mac address of the server device. - 2. Change the Connection Interval to 15msec. - 3. Change Payload Buffer Size to 120 bytes. - 4. Establish a L2CAP CoC connection from the client to the server AD. - 5. Verify that the L2CAP CoC connection is active from both the client - and server. - 6. Write data from the client to server. - 7. Verify data matches from client and server - 8. Disconnect the L2CAP CoC connections. - - Expected Result: - CoC connection is established, check transmitted data contents, then disconnected - succcessfully. - - Returns: - Pass if True - Fail if False - - TAGS: BLE, CoC - Priority: 2 - """ - - is_secured = False - le_connection_interval = 15 - buffer_size = 120 - le_tx_data_length = buffer_size + l2cap_coc_header_size - return self._run_coc_connection_throughput( - is_secured, buffer_size, le_connection_interval, le_tx_data_length) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='4d3d4a06-7bbb-4a8c-9016-f326560cebb0') - def test_coc_connection_throughput_NOSEC_15CI_180SIZE(self): - """Test LE CoC data throughput with 15msec CI and 180bytes buffer size. - - Test CoC thoughput by establishing a connection and sending data with 15msec - Connection Interval and 180 bytes data buffer size. - - Steps: - 1. Get the mac address of the server device. - 2. Change the Connection Interval to 15msec. - 3. Change Payload Buffer Size to 180 bytes. - 4. Establish a L2CAP CoC connection from the client to the server AD. - 5. Verify that the L2CAP CoC connection is active from both the client - and server. - 6. Write data from the client to server. - 7. Verify data matches from client and server - 8. Disconnect the L2CAP CoC connections. - - Expected Result: - CoC connection is established, check transmitted data contents, then disconnected - succcessfully. - - Returns: - Pass if True - Fail if False - - TAGS: BLE, CoC - Priority: 2 - """ - - is_secured = False - le_connection_interval = 15 - buffer_size = 180 - le_tx_data_length = buffer_size + l2cap_coc_header_size - return self._run_coc_connection_throughput( - is_secured, buffer_size, le_connection_interval, le_tx_data_length) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='124d85ba-41e6-4ab7-a017-99a88db7524a') - def test_coc_connection_throughput_NOSEC_20CI_240SIZE(self): - """Test LE CoC data throughput with 20msec CI and 240bytes buffer size. - - Test CoC thoughput by establishing a connection and sending data with 20msec - Connection Interval and 240 bytes data buffer size. - - Steps: - 1. Get the mac address of the server device. - 2. Change the Connection Interval to 20msec. - 3. Change Payload Buffer Size to 240 bytes. - 4. Establish a L2CAP CoC connection from the client to the server AD. - 5. Verify that the L2CAP CoC connection is active from both the client - and server. - 6. Write data from the client to server. - 7. Verify data matches from client and server - 8. Disconnect the L2CAP CoC connections. - - Expected Result: - CoC connection is established, check transmitted data contents, then disconnected - succcessfully. - - Returns: - Pass if True - Fail if False - - TAGS: BLE, CoC - Priority: 2 - """ - - is_secured = False - le_connection_interval = 20 - buffer_size = 240 - le_tx_data_length = buffer_size + l2cap_coc_header_size - return self._run_coc_connection_throughput( - is_secured, buffer_size, le_connection_interval, le_tx_data_length) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='218932bc-ebb0-4c2b-96ad-220c600b50b1') - def test_coc_connection_throughput_NOSEC_30CI_240SIZE(self): - """Test LE CoC data throughput with 30msec CI and 240bytes buffer size. - - Test CoC thoughput by establishing a connection and sending data with 30msec - Connection Interval and 240 bytes data buffer size. - - Steps: - 1. Get the mac address of the server device. - 2. Change the Connection Interval to 30msec. - 3. Change Payload Buffer Size to 240 bytes. - 4. Establish a L2CAP CoC connection from the client to the server AD. - 5. Verify that the L2CAP CoC connection is active from both the client - and server. - 6. Write data from the client to server. - 7. Verify data matches from client and server - 8. Disconnect the L2CAP CoC connections. - - Expected Result: - CoC connection is established, check transmitted data contents, then disconnected - succcessfully. - - Returns: - Pass if True - Fail if False - - TAGS: BLE, CoC - Priority: 2 - """ - - is_secured = False - le_connection_interval = 30 - buffer_size = 240 - le_tx_data_length = buffer_size + l2cap_coc_header_size - return self._run_coc_connection_throughput( - is_secured, buffer_size, le_connection_interval, le_tx_data_length) diff --git a/acts/tests/google/ble/examples/BleExamplesTest.py b/acts/tests/google/ble/examples/BleExamplesTest.py deleted file mode 100644 index 1ced2db965..0000000000 --- a/acts/tests/google/ble/examples/BleExamplesTest.py +++ /dev/null @@ -1,143 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -""" -This script shows simple examples of how to get started with bluetooth low energy testing in acts. -""" - -import pprint - -from acts.controllers import android_device -from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest -from acts.test_utils.bt.bt_constants import adv_succ -from acts.test_utils.bt.bt_constants import scan_result -from acts.test_utils.bt.bt_test_utils import cleanup_scanners_and_advertisers -from acts.test_utils.bt.bt_test_utils import reset_bluetooth - - -class BleExamplesTest(BluetoothBaseTest): - default_timeout = 10 - active_scan_callback_list = [] - active_adv_callback_list = [] - scn_droid = None - adv_droid = None - - def setup_class(self): - super().setup_class() - self.scn_droid, self.scn_ed = (self.android_devices[0].droid, - self.android_devices[0].ed) - self.adv_droid, self.adv_ed = (self.android_devices[1].droid, - self.android_devices[1].ed) - - def teardown_test(self): - cleanup_scanners_and_advertisers( - self.android_devices[0], self.active_adv_callback_list, - self.android_devices[1], self.active_adv_callback_list) - self.active_adv_callback_list = [] - self.active_scan_callback_list = [] - - # An optional function. This overrides the default - # on_exception in base_test. If the test throws an - # unexpected exception, you can customise it. - def on_exception(self, test_name, begin_time): - self.log.debug("Test {} failed. Gathering bugreport and btsnoop logs". - format(test_name)) - android_devices.take_bug_reports(self.android_devices, test_name, - begin_time) - - @BluetoothBaseTest.bt_test_wrap - def test_bt_toggle(self): - """ - Test that simply toggle bluetooth - :return: - """ - return reset_bluetooth([self.android_devices[0]]) - - ''' - Start: Examples of BLE Scanning - ''' - - @BluetoothBaseTest.bt_test_wrap - def test_start_ble_scan(self): - """Test to demonstrate how to start an LE scan - - Test that shows the steps to start a new ble scan. - - Steps: - 1. Create a scan filter object. - 2. Create a scan setting object. - 3. Create a scan callback object. - 4. Start an LE scan using the objects created in steps 1-3. - 5. Find an advertisement with the scanner's event dispatcher. - - Expected Result: - A generic advertisement is found. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning - Priority: 4 - """ - filter_list = self.scn_droid.bleGenFilterList() - scan_settings = self.scn_droid.bleBuildScanSetting() - scan_callback = self.scn_droid.bleGenScanCallback() - self.scn_droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - self.active_scan_callback_list.append(scan_callback) - event_name = scan_result.format(scan_callback) - try: - event = self.scn_ed.pop_event(event_name, self.default_timeout) - self.log.info("Found scan result: {}".format( - pprint.pformat(event))) - except Exception: - self.log.info("Didn't find any scan results.") - return True - - ''' - End: Examples of BLE Scanning - ''' - - @BluetoothBaseTest.bt_test_wrap - def test_start_ble_advertise(self): - """Test to demonstrate how to start an LE advertisement - - Test that shows the steps to start a new ble scan. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising - Priority: 4 - """ - advertise_data = self.adv_droid.bleBuildAdvertiseData() - advertise_settings = self.adv_droid.bleBuildAdvertiseSettings() - advertise_callback = self.adv_droid.bleGenBleAdvertiseCallback() - self.adv_droid.bleStartBleAdvertising( - advertise_callback, advertise_data, advertise_settings) - self.adv_ed.pop_event(adv_succ.format(advertise_callback)) - return True diff --git a/acts/tests/google/ble/examples/GattServerExampleTest.py b/acts/tests/google/ble/examples/GattServerExampleTest.py deleted file mode 100644 index e1f6476017..0000000000 --- a/acts/tests/google/ble/examples/GattServerExampleTest.py +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (C) 2018 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. - -from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest -from acts.test_utils.bt.bt_constants import gatt_characteristic -from acts.test_utils.bt.bt_constants import gatt_descriptor -from acts.test_utils.bt.bt_constants import gatt_service_types -from acts.test_utils.bt.bt_constants import gatt_characteristic_value_format -from acts.test_utils.bt.bt_constants import gatt_char_desc_uuids -from acts.test_utils.bt.gatts_lib import GattServerLib - -service_uuid = '0000a00a-0000-1000-8000-00805f9b34fb' -characteristic_uuid = 'aa7edd5a-4d1d-4f0e-883a-d145616a1630' -descriptor_uuid = gatt_char_desc_uuids['client_char_cfg'] - -gatt_server_read_descriptor_sample = { - 'services': [{ - 'uuid': - service_uuid, - 'type': - gatt_service_types['primary'], - 'characteristics': [{ - 'uuid': - characteristic_uuid, - 'properties': - gatt_characteristic['property_read'], - 'permissions': - gatt_characteristic['permission_read'], - 'instance_id': - 0x002a, - 'value_type': - gatt_characteristic_value_format['string'], - 'value': - 'Test Database', - 'descriptors': [{ - 'uuid': descriptor_uuid, - 'permissions': gatt_descriptor['permission_read'], - }] - }] - }] -} - - -class GattServerExampleTest(BluetoothBaseTest): - def setup_class(self): - super().setup_class() - self.dut = self.android_devices[0] - - @BluetoothBaseTest.bt_test_wrap - def test_create_gatt_server_db_example(self): - gatts = GattServerLib(log=self.log, dut=self.dut) - gatts.setup_gatts_db(database=gatt_server_read_descriptor_sample) - self.log.info(gatts.list_all_uuids()) - return True diff --git a/acts/tests/google/ble/filtering/FilteringTest.py b/acts/tests/google/ble/filtering/FilteringTest.py deleted file mode 100644 index d1bdc399c9..0000000000 --- a/acts/tests/google/ble/filtering/FilteringTest.py +++ /dev/null @@ -1,12100 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. - -import itertools as it -import pprint -import time - -from queue import Empty -from acts.test_decorators import test_tracker_info -from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest -from acts.test_utils.bt.bt_constants import ble_advertise_settings_modes -from acts.test_utils.bt.bt_constants import ble_advertise_settings_tx_powers -from acts.test_utils.bt.bt_constants import java_integer -from acts.test_utils.bt.bt_constants import ble_scan_settings_modes -from acts.test_utils.bt.bt_constants import ble_scan_settings_modes -from acts.test_utils.bt.bt_constants import small_timeout -from acts.test_utils.bt.bt_constants import adv_fail -from acts.test_utils.bt.bt_constants import adv_succ -from acts.test_utils.bt.bt_test_utils import generate_ble_advertise_objects -from acts.test_utils.bt.bt_test_utils import reset_bluetooth -from acts.test_utils.bt.bt_constants import scan_result - - -class FilteringTest(BluetoothBaseTest): - default_timeout = 30 - default_callback = 1 - default_is_connectable = True - default_advertise_mode = 0 - default_tx_power_level = 2 - - #Data constant variants - manu_sepecific_data_small = [1] - manu_sepecific_data_small_2 = [1, 2] - manu_specific_data_small_3 = [127] - manu_sepecific_data_large = [14, 0, 54, 0, 0, 0, 0, 0] - manu_sepecific_data_mask_small = [1] - manu_specific_data_id_1 = 1 - manu_specific_data_id_2 = 2 - manu_specific_data_id_3 = 65535 - - service_data_small = [13] - service_data_small_2 = [127] - service_data_medium = [11, 14, 50] - service_data_large = [ - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 26, 17, 18, 19, 20, - 21, 22, 23, 24 - ] - - service_mask_1 = "00000000-0000-1000-8000-00805f9b34fb" - service_uuid_1 = "00000000-0000-1000-8000-00805f9b34fb" - service_uuid_2 = "FFFFFFFF-0000-1000-8000-00805f9b34fb" - service_uuid_3 = "3846D7A0-69C8-11E4-BA00-0002A5D5C51B" - - def setup_class(self): - super().setup_class() - self.scn_ad = self.android_devices[0] - self.adv_ad = self.android_devices[1] - self.log.info("Scanner device model: {}".format( - self.scn_ad.droid.getBuildModel())) - self.log.info("Advertiser device model: {}".format( - self.adv_ad.droid.getBuildModel())) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='be72fc18-e7e9-41cf-80b5-e31babd763f6') - def test_filter_combo_0(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='92e11460-1877-4dd1-998b-8f78354dd776') - def test_filter_combo_1(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': [1] - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='9cdb7ad3-9f1e-4cbc-ae3f-af27d9833ae3') - def test_filter_combo_2(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='ae06ece8-28ae-4c2f-a768-d0e1e60cc253') - def test_filter_combo_3(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='7a7c40fb-1398-4659-af46-ba01ca23ba7f') - def test_filter_combo_4(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': [1] - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='85cab0b7-4ba2-408c-b78b-c45d0cad1d1e') - def test_filter_combo_5(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='31e7a496-6626-4d73-8337-b250f7386ab6') - def test_filter_combo_6(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='465f5426-1157-4a6f-8c33-a266ee7439bc') - def test_filter_combo_7(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': [1] - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='77552584-74c7-4a1b-a98e-8863e91f4e74') - def test_filter_combo_8(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='fb2b5f08-53cd-400b-98a0-bbd96093e466') - def test_filter_combo_9(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='edacb609-9508-4394-9c94-9ed13a4205b5') - def test_filter_combo_10(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': [1] - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='73a86198-3213-43c5-b083-0a37089b8e44') - def test_filter_combo_11(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='9ca92075-d22b-4e82-9e7b-495060f3af45') - def test_filter_combo_12(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='a0689f97-c616-49a5-b690-00b6193ac822') - def test_filter_combo_13(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': [1] - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='dbdf3a68-c79a-43a6-89a7-5269a1fad9a5') - def test_filter_combo_14(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='93e45b16-dff0-4067-9c14-7adf32a0f484') - def test_filter_combo_15(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='dace8a1c-e71a-4668-9e8f-b1cb19071087') - def test_filter_combo_16(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': [1] - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='192528e2-4a67-4984-9c68-f9d716470d5b') - def test_filter_combo_17(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='2a9ffd92-f02d-45bc-81f5-f398e2572f14') - def test_filter_combo_18(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='ab98e5e5-ac35-4ebe-8b37-780b0ab56b82') - def test_filter_combo_19(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': [1] - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='0b4ca831-dbf6-44da-84b6-9425b7f50577') - def test_filter_combo_20(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='f615206a-16bf-4481-be31-7b2a28d8009b') - def test_filter_combo_21(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='e9a0e69e-bc5c-479e-a716-cbb88180e719') - def test_filter_combo_22(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': [1] - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='16c2949d-e7c8-4fa1-a781-3ced2c902c4c') - def test_filter_combo_23(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='ffd7a3a8-b9b5-4bf0-84c1-ed3823b8a52c') - def test_filter_combo_24(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='457b5dee-1034-4973-88c1-bde0a6ef700c') - def test_filter_combo_25(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': [1] - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='b848e90c-37ed-4ecb-8c49-601f3b66a4cc') - def test_filter_combo_26(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='c03df405-b7aa-42cf-b282-adf5c228e513') - def test_filter_combo_27(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='83de681d-89fb-45e1-b8e0-0488e43b3248') - def test_filter_combo_28(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': [1] - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='712bf6b2-0cdc-4782-b593-17a846fd1c65') - def test_filter_combo_29(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='725c37e5-046b-4234-a7eb-ad8836531a74') - def test_filter_combo_30(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='665344f9-c246-4b08-aff6-73f7ff35431b') - def test_filter_combo_31(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': [1] - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='6994ceff-fed8-42e4-a3cb-be6ed3a9a5c9') - def test_filter_combo_32(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='2fb756c0-8b72-403a-a769-d22d31376037') - def test_filter_combo_33(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='146203bb-04cc-4b3d-b372-66e1b8da3e08') - def test_filter_combo_34(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': [1] - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='1e123df5-db37-4e8d-ac1f-9399fe8487f9') - def test_filter_combo_35(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='886f0978-a2df-4005-810b-5e2cc0c2a5a4') - def test_filter_combo_36(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='94f61b07-e90a-42e3-b97b-07afc73755e6') - def test_filter_combo_37(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': [1] - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='1dbb67ed-2f9e-464d-8ba8-dd7ac668d765') - def test_filter_combo_38(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='3a3e5aa9-a5cc-4e99-aeb4-b32357186e1d') - def test_filter_combo_39(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='2c51245a-7be3-4dfb-87c5-7c4530ab5908') - def test_filter_combo_40(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': [1] - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='9d33bae5-0a5f-4d2c-96fc-fc1ec8107814') - def test_filter_combo_41(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='05b5ee9e-9a64-4bf8-91ab-a7762358d25e') - def test_filter_combo_42(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='589f4d3f-c644-4981-a0f8-cd9bcf4d5142') - def test_filter_combo_43(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': [1] - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='10ce4d36-081f-4353-a484-2c7988e7cda8') - def test_filter_combo_44(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='6f52f24d-adda-4e2d-b52e-1b24b978c343') - def test_filter_combo_45(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='5aacbec9-4a8b-4c76-9684-590a29f73854') - def test_filter_combo_46(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': [1] - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='e1fa3728-9acb-47e9-bea4-3ac886c68a22') - def test_filter_combo_47(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='9ce98edd-5f94-456c-8083-3dd37eefe086') - def test_filter_combo_48(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='cb93cdab-6443-4946-a7f6-9c34e0b21272') - def test_filter_combo_49(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': [1] - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='d9069a4d-8635-4b91-9a0f-31a64586a216') - def test_filter_combo_50(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='559f4f49-bd6a-4490-b8b3-da13ef57eb83') - def test_filter_combo_51(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='d769aa3c-c039-45f3-8ef7-f91ccbbcdfaf') - def test_filter_combo_52(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': [1] - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='4c6adf11-7c79-4a97-b507-cc8044d2c7c6') - def test_filter_combo_53(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='b99f7238-197b-4fb0-80a9-a51a20c00093') - def test_filter_combo_54(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='f1e3e036-b611-4325-81e2-114ad777d00e') - def test_filter_combo_55(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': [1] - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='9f786760-8a33-4076-b33e-38acc6689b5c') - def test_filter_combo_56(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='9e6466c3-ce73-471e-8b4a-dce1a1c9d046') - def test_filter_combo_57(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='b44f6d43-07cb-477d-bcc8-460cc2094475') - def test_filter_combo_58(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': [1] - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='38dcb64b-6564-4116-8abb-3a8e8ed530a9') - def test_filter_combo_59(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='b0918c1a-1291-482c-9ecb-2df085ec036f') - def test_filter_combo_60(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='6c317053-6fdc-45e1-9109-bd2726b2490f') - def test_filter_combo_61(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': [1] - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='af057157-3ef5-48af-918d-53ba6b2e8405') - def test_filter_combo_62(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='4693bb43-a4b6-4595-a75b-ff18c4be50c7') - def test_filter_combo_63(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='6e2037c1-5e99-4dc7-8950-5fd3df29fa08') - def test_filter_combo_64(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': [1] - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='a85acfbb-e6d2-42f4-b917-6b0bac26e457') - def test_filter_combo_65(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='d05f3aaa-833c-40a1-b3a0-c69756919218') - def test_filter_combo_66(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='1dd2b27b-f9fe-41e3-b884-3500d6bf9a38') - def test_filter_combo_67(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': [1] - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='e31e7d9d-878b-442e-9ae9-b07d5e903df3') - def test_filter_combo_68(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='05c05a71-27a4-4620-940b-ce3747d4e6c5') - def test_filter_combo_69(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='c4bb2251-1246-466b-a6bb-76ae13089101') - def test_filter_combo_70(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': [1] - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='b284008a-81be-42b6-8176-906a780f92a2') - def test_filter_combo_71(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='01bc025f-4696-4e80-a590-ec7b0eeea1a3') - def test_filter_combo_72(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='ef674d1e-f3b1-43fc-a037-718ffe650d12') - def test_filter_combo_73(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': [1] - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='cbc29a50-76fe-40b8-93fa-b274605660b2') - def test_filter_combo_74(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='0674b703-2571-4bcf-91f2-a34a323e179b') - def test_filter_combo_75(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='a65046b3-4aed-47f3-86cd-838155dfd309') - def test_filter_combo_76(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': [1] - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='a379dfdd-8924-4e62-95ac-14fe3ae358da') - def test_filter_combo_77(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='3ed6b73f-23fb-4ef2-8bd5-e59a34f362cd') - def test_filter_combo_78(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='9d3fc46a-07b7-48ad-9a31-fcdba259c670') - def test_filter_combo_79(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': [1] - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='9ba5e905-634f-485b-829c-1ef79fa5f116') - def test_filter_combo_80(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='b275ff76-eec5-467b-b12d-7440ff588cec') - def test_filter_combo_81(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='009ecb1c-2860-4a4e-867b-c712569ddfd1') - def test_filter_combo_82(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': [1] - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='61c7da36-6b19-49d2-9981-120bb0b76372') - def test_filter_combo_83(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='4c22688a-4d03-4145-aa2f-f989832f8086') - def test_filter_combo_84(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='cc159f43-5619-46fe-b8ad-209a446f10c0') - def test_filter_combo_85(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': [1] - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='9a81d52e-cd46-4e2b-9ac1-ecebcc04d788') - def test_filter_combo_86(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='938c404f-8dd8-46a5-afe4-f87559bb2c9d') - def test_filter_combo_87(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='4bc6a2db-e845-435d-8d8e-a990f4b1fcdc') - def test_filter_combo_88(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': [1] - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='e245fb6a-35fc-488f-ada6-393fe4a09134') - def test_filter_combo_89(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='4dd70ebf-ec85-4e95-a9f5-a10e1791293c') - def test_filter_combo_90(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='b0085042-0fd6-4ff3-af69-156f270953b1') - def test_filter_combo_91(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': [1] - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='6b9a539b-b6cc-46b1-a9a5-ef20808f5e74') - def test_filter_combo_92(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='1f18a94c-a72e-4912-a91a-0be96e708be4') - def test_filter_combo_93(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='9f2d3923-a932-40c8-b527-8baedcf3254c') - def test_filter_combo_94(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': [1] - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='edf61fa9-b51f-41fd-b3ca-0035ee7dbd65') - def test_filter_combo_95(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='8b8adcf5-adb9-4a48-8570-4e1d2e6b47c6') - def test_filter_combo_96(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='cc7857e0-5a5b-468f-bf5e-dc1478716715') - def test_filter_combo_97(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': [1] - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='b4c9e01f-944c-4d8e-9a3f-49efaa22887c') - def test_filter_combo_98(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='951e19cf-c138-4d8e-92e6-b42410b8114f') - def test_filter_combo_99(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='ad50f0c0-c19e-45b8-8fb2-95afe81f7620') - def test_filter_combo_100(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': [1] - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='a7fd36d6-77ec-453e-a67c-0c2fc78e572a') - def test_filter_combo_101(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='d661aafd-005d-4a31-88b0-a238e328b16d') - def test_filter_combo_102(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='7fe951d2-28c5-43a9-af79-c0fbf3a3388f') - def test_filter_combo_103(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': [1] - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='d802f38b-830f-4cd2-af2c-a44ba625a401') - def test_filter_combo_104(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='e1a30f67-1577-4cfb-9a0d-c07493a341b2') - def test_filter_combo_105(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='774a6bf9-cfd6-40ef-8b91-3576f23eb01b') - def test_filter_combo_106(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': [1] - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='b85d0c78-69bc-42e3-ac78-61ad8176a1d0') - def test_filter_combo_107(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='bd93c530-4ab0-4d9b-b202-ea6dd1c8a27d') - def test_filter_combo_108(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='4590bfbb-006f-46be-bd03-5afe8b81ac52') - def test_filter_combo_109(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': [1] - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='2626f60e-cb01-45a1-a23e-f1eaa85ac9ce') - def test_filter_combo_110(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='24cf16ac-10a6-4a02-9b72-84c280fa77a2') - def test_filter_combo_111(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='6242aadb-028b-4932-9024-8b6d2148c458') - def test_filter_combo_112(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': [1] - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='5918fef7-0578-4999-b331-d2948e62e720') - def test_filter_combo_113(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='63160fc2-306f-46a4-bf1f-b512642478c4') - def test_filter_combo_114(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='849749ae-e5f3-4029-be92-66a1353ba165') - def test_filter_combo_115(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': [1] - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='5f150448-94f6-4f0b-a8da-0c4a78541a4f') - def test_filter_combo_116(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='39af4eca-990a-4b3b-bcf2-1a840e8a9308') - def test_filter_combo_117(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='a59cb1fa-eb7d-4161-84a9-cda157b6b8c5') - def test_filter_combo_118(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': [1] - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='cfaf02e5-76e4-4593-849c-b63de4907638') - def test_filter_combo_119(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='9eb40c09-89ea-44e9-8514-e58cdce91779') - def test_filter_combo_120(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='e2d2a8d5-0554-49cc-9cc9-66e97378d260') - def test_filter_combo_121(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': [1] - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='cb72c86a-a7c6-4bf9-9eec-53f7d190a9f1') - def test_filter_combo_122(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='cb75e56e-a029-478d-8031-8de12f5fbebf') - def test_filter_combo_123(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='277a98c4-4b1f-428d-8c10-8697a3fe1f0f') - def test_filter_combo_124(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': [1] - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='2d884bf2-c678-429c-8aee-3be78b3176ff') - def test_filter_combo_125(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='e6b5fcff-8a6e-4eb7-9070-74caf9e18349') - def test_filter_combo_126(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='682ffa88-2d13-4d21-878e-c2a8a510cf71') - def test_filter_combo_127(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': [1] - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='a27d8f58-7523-404a-bf99-744afdb52aba') - def test_filter_combo_128(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='f2c77cf7-dc52-471d-b66d-54e72f7f7ea0') - def test_filter_combo_129(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='3e21ad66-88fc-48ee-a698-6c475f478a86') - def test_filter_combo_130(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': [1] - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='af046c81-524e-4016-b6a8-459538f320c2') - def test_filter_combo_131(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='f3aad5f8-6214-4c67-9a84-2da7171fb111') - def test_filter_combo_132(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='16ab8d79-15ca-4ab3-b004-834edb4da37b') - def test_filter_combo_133(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': [1] - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='cb37c6a3-496f-49a6-b02a-552b8260205e') - def test_filter_combo_134(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': True, - 'include_device_name': False, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='9e3ad4d0-4fab-4d85-9543-5e2c2fea79ec') - def test_filter_combo_135(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='37f93abf-237e-4917-91a6-afa2629b5f98') - def test_filter_combo_136(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': [1] - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='1131c908-ddf2-4cdd-b1a2-9b73990e72c3') - def test_filter_combo_137(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='1b283fa0-485b-4f45-a353-36f9cdd6c123') - def test_filter_combo_138(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='e4bdc84e-413c-4a2b-9049-f5b04e32b5b7') - def test_filter_combo_139(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': [1] - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='8791e036-3f30-4a44-b3a8-23371da893a6') - def test_filter_combo_140(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='27201535-9537-4e11-a1d7-1b1f5f01e213') - def test_filter_combo_141(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='e40e7b8f-44f0-4f87-8206-fea14d0fef52') - def test_filter_combo_142(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': [1] - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='0f369e78-c5ae-4cbc-8511-597cdc38b1ae') - def test_filter_combo_143(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='174418c1-6938-4319-9d8b-361df3fc28f3') - def test_filter_combo_144(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='6bc94d17-b532-413b-86fc-185c194b430c') - def test_filter_combo_145(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': [1] - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='3c47822e-5e74-4270-bcb4-72e3995bd5c5') - def test_filter_combo_146(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='19515def-b28d-4ef7-bae7-c4f64940879a') - def test_filter_combo_147(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='a45abd7c-24ca-400c-b2d5-233431b07522') - def test_filter_combo_148(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': [1] - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='4492a245-c91f-4df1-a55b-57541ce410c8') - def test_filter_combo_149(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='e4c485af-66a0-413b-b70e-3396e130fffb') - def test_filter_combo_150(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='31369cd6-feb7-47f3-9022-2d619c961ba7') - def test_filter_combo_151(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': [1] - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='5cf0da7f-a515-4f67-bae4-956d86275423') - def test_filter_combo_152(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='a78293f0-aee5-40d1-9c97-3fdda3ddd43e') - def test_filter_combo_153(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='3fd7d0cb-6d98-4ca8-9a14-8ca23b6dae07') - def test_filter_combo_154(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': [1] - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='19434f33-5bc5-427f-b332-36f85c997fe3') - def test_filter_combo_155(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='4195c9e1-b87c-4fa1-8039-ec0f2652e216') - def test_filter_combo_156(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='0536e50e-f33c-4772-b078-4f95231c3de6') - def test_filter_combo_157(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': [1] - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='116dcfef-caae-496f-abfa-0863f2968f6f') - def test_filter_combo_158(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='00f37533-9ca5-4c58-adb3-d3d709c7b215') - def test_filter_combo_159(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='d86e57da-29b5-445e-bf75-3e2843b9b739') - def test_filter_combo_160(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': [1] - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='792736ce-8f43-4d21-b9b9-30d3bfd66b6a') - def test_filter_combo_161(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': False, - 'include_device_name': False, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='ec387a8a-e7b2-4df7-9580-b09362c3dc4d') - def test_filter_combo_162(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='93a8f3b0-0fb0-47bd-88fb-6dc847ac14e4') - def test_filter_combo_163(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': [1] - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='283356e9-58ac-4edc-bf08-0bc9c7313053') - def test_filter_combo_164(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='ab4f0d84-58fd-4a2a-b3ed-128231f3e22f') - def test_filter_combo_165(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='02bbbdd0-3c57-41c5-ab32-28185f33802c') - def test_filter_combo_166(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': [1] - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='f6c67a80-bede-4186-b7a1-09756b4c1a68') - def test_filter_combo_167(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='4fc73f9c-4826-4ff2-bba0-bc64cc469f3a') - def test_filter_combo_168(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='58a6fafc-bbc5-466b-a586-310d9dfc14c1') - def test_filter_combo_169(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': [1] - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='38de3927-212c-4948-bd46-cca1d09ead90') - def test_filter_combo_170(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='b03a34cf-c3e1-4954-9cb6-b5f1a59e94e9') - def test_filter_combo_171(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='455ead9d-1e50-46e4-907c-c5b9bbbdcc9c') - def test_filter_combo_172(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': [1] - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='a7320afc-affb-4fa5-877d-7eb8bd1f8558') - def test_filter_combo_173(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='163c5c85-bef7-4da6-8e8a-89b0656b71d0') - def test_filter_combo_174(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='31147187-c5a9-4c2e-8be6-b79ff71cdaf3') - def test_filter_combo_175(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': [1] - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='783b5756-ca16-4a17-b1f0-8a16ddc009c4') - def test_filter_combo_176(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='924a107b-fe1c-4b9d-b29b-47c3b2df1de3') - def test_filter_combo_177(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='096a6596-fd8c-4d8c-88c6-45903047fe2c') - def test_filter_combo_178(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': [1] - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='e37b2083-a9d0-4337-aa11-d9205c15f456') - def test_filter_combo_179(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='3de8087b-7f25-4cda-8f07-fa9326524deb') - def test_filter_combo_180(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='f218bf14-0a6e-4c5f-b151-3ac9719ca1a2') - def test_filter_combo_181(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': [1] - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='1a13171d-b9a9-4b42-8cec-5c5841c4f3a5') - def test_filter_combo_182(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='53311ac1-239f-4033-aaa6-084523916fc6') - def test_filter_combo_183(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='f8bb89b2-2dae-4d41-9d19-6c9af0fe6da8') - def test_filter_combo_184(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': [1] - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='4747ab09-8d62-4866-80e6-c9b8e4cf5061') - def test_filter_combo_185(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='be6db894-57dd-452a-8f08-3ce462ac9417') - def test_filter_combo_186(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='2070329b-b7c8-4958-af9c-2e1044b71564') - def test_filter_combo_187(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': [1] - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='1a428d9e-46fd-4bd2-a12c-25c89ead74b1') - def test_filter_combo_188(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': True, - 'include_device_name': True, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='f07220c2-c0a9-471a-871d-a87931feb278') - def test_filter_combo_189(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='b3af8fb0-cd93-4ab0-b8f3-4111969c7cbb') - def test_filter_combo_190(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': [1] - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='b630cc10-4cda-487d-ab84-599963c172d7') - def test_filter_combo_191(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='9cdbe1df-e3e1-45e4-b816-96b8a6efb90f') - def test_filter_combo_192(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='10cd2757-a182-419f-9512-8b536539a134') - def test_filter_combo_193(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': [1] - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='5c7af5b2-8a2c-4c2d-911f-dad8216d849f') - def test_filter_combo_194(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='0acb37c7-0ece-4f5b-9294-014dd7fcb3ed') - def test_filter_combo_195(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='14f07972-6403-49be-8eed-ce7294e33d32') - def test_filter_combo_196(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': [1] - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='f2db7e80-d3ea-4beb-8e09-24ae33904716') - def test_filter_combo_197(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='30c1303f-956f-4b2d-af6a-3570aa4567fd') - def test_filter_combo_198(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='8e210748-f842-4fa1-ac40-2bfd291f08a1') - def test_filter_combo_199(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': [1] - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='756c687d-8183-4bc9-90dc-4e46a5579fca') - def test_filter_combo_200(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='8f904946-a9c7-4f7a-af96-0d22c5592709') - def test_filter_combo_201(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='abdfce9f-3529-435b-8fdc-9dd7bf0fc01c') - def test_filter_combo_202(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': [1] - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='71289aa2-f74d-44b7-ad18-515a3c438a15') - def test_filter_combo_203(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='223db6ca-7190-4f3f-89cc-92dcc2dcd109') - def test_filter_combo_204(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='8a61a11e-fc25-4e28-928d-e2be2d95af63') - def test_filter_combo_205(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': [1] - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='8c62bc17-6998-4ec8-923b-e29fe1693ae3') - def test_filter_combo_206(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': [1, 2], - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='85f168fa-a868-4940-aef1-de063a497083') - def test_filter_combo_207(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='7697ca45-fc34-4f8c-9b61-58cc7d4f3321') - def test_filter_combo_208(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': [1] - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='f5221c06-c006-4363-ab9c-90b9d8c31b43') - def test_filter_combo_209(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='b7119a2d-6269-408c-ae69-39ebad1e4192') - def test_filter_combo_210(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='2025037f-433b-4167-a0c9-3265a53fe6ba') - def test_filter_combo_211(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': [1] - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='ecf2c84b-88b0-48d9-8a4f-3660f039cd97') - def test_filter_combo_212(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_2, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='844a6bcb-cd5a-4023-9af7-cab68ed2e847') - def test_filter_combo_213(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': self.service_data_medium - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='b7e5ff94-93e0-45c9-a160-33628f5fcf9e') - def test_filter_combo_214(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': [1] - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='b9781df2-59e4-44ba-9a98-1d35670a6f63') - def test_filter_combo_215(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_3, - 'service_data_uuid': self.service_uuid_1, - 'manufacturer_specific_data': self.manu_specific_data_small_3, - 'include_tx_power_level': False, - 'include_device_name': True, - 'service_data': self.service_data_small_2 - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='4ad156f8-8d80-4635-b6d8-7bca07d8a899') - def test_filter_combo_216(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['high'], - 'is_connectable': True, - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['balanced'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='5b68c344-bfd1-44cb-9add-c81122d6b04f') - def test_filter_combo_217(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['low'], - 'is_connectable': True, - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['balanced'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='355ca57c-998c-4e7e-b0d2-66854b5192bb') - def test_filter_combo_218(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['ultra_low'], - 'is_connectable': True, - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['balanced'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='a9ec0f76-6b8f-42e0-8310-07c02de49d9d') - def test_filter_combo_219(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['medium'], - 'is_connectable': True, - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['balanced'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='73f448ff-e9f6-4608-80ba-92131485234f') - def test_filter_combo_220(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['high'], - 'is_connectable': True, - 'scan_mode': ble_scan_settings_modes['opportunistic'], - 'mode': ble_advertise_settings_modes['balanced'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='55ec509d-8cdd-4ab5-8e57-2ccadd5f8c0d') - def test_filter_combo_221(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['low'], - 'is_connectable': True, - 'scan_mode': ble_scan_settings_modes['opportunistic'], - 'mode': ble_advertise_settings_modes['balanced'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='1f6835fd-b33b-4be3-b133-b77f6c9872c8') - def test_filter_combo_222(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['ultra_low'], - 'is_connectable': True, - 'scan_mode': ble_scan_settings_modes['opportunistic'], - 'mode': ble_advertise_settings_modes['balanced'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='62d483c0-7d08-4b7c-9b1f-3b0324006554') - def test_filter_combo_223(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['medium'], - 'is_connectable': True, - 'scan_mode': ble_scan_settings_modes['opportunistic'], - 'mode': ble_advertise_settings_modes['balanced'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='01bcb867-3f39-4aef-baf5-50b439768b43') - def test_filter_combo_224(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['high'], - 'is_connectable': True, - 'scan_mode': ble_scan_settings_modes['balanced'], - 'mode': ble_advertise_settings_modes['balanced'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='faab6211-4408-4272-93d9-7b09b8c3b8cd') - def test_filter_combo_225(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['low'], - 'is_connectable': True, - 'scan_mode': ble_scan_settings_modes['balanced'], - 'mode': ble_advertise_settings_modes['balanced'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='a0f9ad8d-c00a-4420-9205-eeb081bf2b35') - def test_filter_combo_226(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['ultra_low'], - 'is_connectable': True, - 'scan_mode': ble_scan_settings_modes['balanced'], - 'mode': ble_advertise_settings_modes['balanced'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='7a2e8186-e8b0-4956-b8bc-fb2ba91b8f67') - def test_filter_combo_227(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['medium'], - 'is_connectable': True, - 'scan_mode': ble_scan_settings_modes['balanced'], - 'mode': ble_advertise_settings_modes['balanced'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='414b5464-b135-453b-acf3-aebc728d0366') - def test_filter_combo_228(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['high'], - 'is_connectable': True, - 'scan_mode': ble_scan_settings_modes['low_power'], - 'mode': ble_advertise_settings_modes['balanced'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='580e3ff8-4648-402e-a531-ddb85bbf4c89') - def test_filter_combo_229(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['low'], - 'is_connectable': True, - 'scan_mode': ble_scan_settings_modes['low_power'], - 'mode': ble_advertise_settings_modes['balanced'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='7fe0c829-94b5-4e88-aa92-47159c1eb232') - def test_filter_combo_230(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['ultra_low'], - 'is_connectable': True, - 'scan_mode': ble_scan_settings_modes['low_power'], - 'mode': ble_advertise_settings_modes['balanced'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='93c1747d-4b76-4faf-9efc-4ca40e751f08') - def test_filter_combo_231(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['medium'], - 'is_connectable': True, - 'scan_mode': ble_scan_settings_modes['low_power'], - 'mode': ble_advertise_settings_modes['balanced'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='96f7e662-6f74-407a-b1d8-e29ac3405ff4') - def test_filter_combo_232(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['high'], - 'is_connectable': True, - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='cde6415b-1138-4913-ab4f-542d4057542d') - def test_filter_combo_233(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['low'], - 'is_connectable': True, - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='4ca75288-0af8-462b-9146-022b9f915b1f') - def test_filter_combo_234(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['ultra_low'], - 'is_connectable': True, - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='4db5dae2-f974-4208-9c01-84ca050f8fc3') - def test_filter_combo_235(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['medium'], - 'is_connectable': True, - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='c9f7abf0-b333-4500-9fd0-e4678574cf18') - def test_filter_combo_236(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['high'], - 'is_connectable': True, - 'scan_mode': ble_scan_settings_modes['opportunistic'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='b8176ca4-478c-49c6-a638-4f53d7d2720c') - def test_filter_combo_237(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['low'], - 'is_connectable': True, - 'scan_mode': ble_scan_settings_modes['opportunistic'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='7e84c371-f28e-4995-86a9-bb99a4a29d0c') - def test_filter_combo_238(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['ultra_low'], - 'is_connectable': True, - 'scan_mode': ble_scan_settings_modes['opportunistic'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='3b8eb500-6885-4273-9c53-f7930896e895') - def test_filter_combo_239(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['medium'], - 'is_connectable': True, - 'scan_mode': ble_scan_settings_modes['opportunistic'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='f80ef69f-d71c-4c94-893d-363cf5a658f6') - def test_filter_combo_240(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['high'], - 'is_connectable': True, - 'scan_mode': ble_scan_settings_modes['balanced'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='dca1ab9d-7923-4917-8a82-1917dbad4923') - def test_filter_combo_241(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['low'], - 'is_connectable': True, - 'scan_mode': ble_scan_settings_modes['balanced'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='36faab09-d874-4f24-b7ea-8985d60dc4c3') - def test_filter_combo_242(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['ultra_low'], - 'is_connectable': True, - 'scan_mode': ble_scan_settings_modes['balanced'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='c94b7e3b-064c-4885-a4aa-899e83d0e754') - def test_filter_combo_243(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['medium'], - 'is_connectable': True, - 'scan_mode': ble_scan_settings_modes['balanced'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='f6680820-8843-47e4-b4fb-0ee1b76d51f8') - def test_filter_combo_244(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['high'], - 'is_connectable': True, - 'scan_mode': ble_scan_settings_modes['low_power'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='4b1bf9a9-7761-435a-8c6c-511b20312c04') - def test_filter_combo_245(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['low'], - 'is_connectable': True, - 'scan_mode': ble_scan_settings_modes['low_power'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='5c5b0147-cacd-46f0-a6b7-ff8b37cf985b') - def test_filter_combo_246(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['ultra_low'], - 'is_connectable': True, - 'scan_mode': ble_scan_settings_modes['low_power'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='c31e26f2-2e82-40bc-a9a5-5ae059b702d8') - def test_filter_combo_247(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['medium'], - 'is_connectable': True, - 'scan_mode': ble_scan_settings_modes['low_power'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='5a1a4438-6bb3-4acc-85ab-b48432c340db') - def test_filter_combo_248(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['high'], - 'is_connectable': False, - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['balanced'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='0dd54bff-d170-441f-81ae-bc11f7c8491b') - def test_filter_combo_249(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['low'], - 'is_connectable': False, - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['balanced'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='98d878cf-1548-4e79-9527-8741e5b523d0') - def test_filter_combo_250(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['ultra_low'], - 'is_connectable': False, - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['balanced'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='ec0c9a9b-3df3-4cba-84fc-9a17a11b1be7') - def test_filter_combo_251(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['medium'], - 'is_connectable': False, - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['balanced'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='eabddddc-29c7-4804-93a8-c259957538ae') - def test_filter_combo_252(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['high'], - 'is_connectable': False, - 'scan_mode': ble_scan_settings_modes['opportunistic'], - 'mode': ble_advertise_settings_modes['balanced'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='ee0abe8f-254e-4802-b808-4aa8e0306203') - def test_filter_combo_253(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['low'], - 'is_connectable': False, - 'scan_mode': ble_scan_settings_modes['opportunistic'], - 'mode': ble_advertise_settings_modes['balanced'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='9482cda2-a6f5-4dff-8809-6dfabaaf9f71') - def test_filter_combo_254(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['ultra_low'], - 'is_connectable': False, - 'scan_mode': ble_scan_settings_modes['opportunistic'], - 'mode': ble_advertise_settings_modes['balanced'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='279f54ee-975b-4edc-a6c8-f018e45846c3') - def test_filter_combo_255(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['medium'], - 'is_connectable': False, - 'scan_mode': ble_scan_settings_modes['opportunistic'], - 'mode': ble_advertise_settings_modes['balanced'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='a3508588-ca01-4063-ae7e-c845ac4a595b') - def test_filter_combo_256(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['high'], - 'is_connectable': False, - 'scan_mode': ble_scan_settings_modes['balanced'], - 'mode': ble_advertise_settings_modes['balanced'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='8bde1746-dec8-4b17-93ba-90448addcb13') - def test_filter_combo_257(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['low'], - 'is_connectable': False, - 'scan_mode': ble_scan_settings_modes['balanced'], - 'mode': ble_advertise_settings_modes['balanced'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='9ae7e798-0981-4501-9302-54553c76a54c') - def test_filter_combo_258(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['ultra_low'], - 'is_connectable': False, - 'scan_mode': ble_scan_settings_modes['balanced'], - 'mode': ble_advertise_settings_modes['balanced'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='28e1efdc-1c5f-44d8-8650-02720db32048') - def test_filter_combo_259(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['medium'], - 'is_connectable': False, - 'scan_mode': ble_scan_settings_modes['balanced'], - 'mode': ble_advertise_settings_modes['balanced'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='a309d9d0-bf5e-4878-b6bb-89d3c388d5b2') - def test_filter_combo_260(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['high'], - 'is_connectable': False, - 'scan_mode': ble_scan_settings_modes['low_power'], - 'mode': ble_advertise_settings_modes['balanced'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='b0db2d76-8039-4257-bed0-e5e154a5874f') - def test_filter_combo_261(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['low'], - 'is_connectable': False, - 'scan_mode': ble_scan_settings_modes['low_power'], - 'mode': ble_advertise_settings_modes['balanced'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='06ecd167-4dbc-4a8c-9c1c-2daea87f7a51') - def test_filter_combo_262(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['ultra_low'], - 'is_connectable': False, - 'scan_mode': ble_scan_settings_modes['low_power'], - 'mode': ble_advertise_settings_modes['balanced'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='12f6c002-8627-4477-8e5a-6d7b5335ed60') - def test_filter_combo_263(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['medium'], - 'is_connectable': False, - 'scan_mode': ble_scan_settings_modes['low_power'], - 'mode': ble_advertise_settings_modes['balanced'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='ccd43a09-cb39-4d84-8ffc-99ad8449783b') - def test_filter_combo_264(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['high'], - 'is_connectable': False, - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='f9d9abad-e543-4996-b369-09fddd9c4965') - def test_filter_combo_265(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['low'], - 'is_connectable': False, - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='2a14e619-23a6-4a49-acd6-e712b026d75b') - def test_filter_combo_266(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['ultra_low'], - 'is_connectable': False, - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='2ed25b96-54fd-4a81-b8d1-732b959aff8d') - def test_filter_combo_267(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['medium'], - 'is_connectable': False, - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='0ef9198b-78ac-4fa6-afe2-cc87007c2c0d') - def test_filter_combo_268(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['high'], - 'is_connectable': False, - 'scan_mode': ble_scan_settings_modes['opportunistic'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='43d97df2-07d7-4c45-bb83-908746e60923') - def test_filter_combo_269(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['low'], - 'is_connectable': False, - 'scan_mode': ble_scan_settings_modes['opportunistic'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='55262e57-7b47-45a3-8926-18cea480c2b2') - def test_filter_combo_270(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['ultra_low'], - 'is_connectable': False, - 'scan_mode': ble_scan_settings_modes['opportunistic'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='5ece141d-43ad-448c-900c-500666cb0e1c') - def test_filter_combo_271(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['medium'], - 'is_connectable': False, - 'scan_mode': ble_scan_settings_modes['opportunistic'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='66d3c0de-7e3b-4108-9ab0-3e101c6a14cd') - def test_filter_combo_272(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['high'], - 'is_connectable': False, - 'scan_mode': ble_scan_settings_modes['balanced'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='9703d50a-8b23-4d42-8ed3-9b0704dac9d2') - def test_filter_combo_273(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['low'], - 'is_connectable': False, - 'scan_mode': ble_scan_settings_modes['balanced'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='a5739a21-0e1b-4ba7-b259-acb7b38a8e09') - def test_filter_combo_274(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['ultra_low'], - 'is_connectable': False, - 'scan_mode': ble_scan_settings_modes['balanced'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='c399011c-54c0-47a1-9e05-a52c2190f89d') - def test_filter_combo_275(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['medium'], - 'is_connectable': False, - 'scan_mode': ble_scan_settings_modes['balanced'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='7854fdcc-5771-463a-91da-5b394484b065') - def test_filter_combo_276(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['high'], - 'is_connectable': False, - 'scan_mode': ble_scan_settings_modes['low_power'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='fa0fe141-c99f-4228-b249-96232194e740') - def test_filter_combo_277(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['low'], - 'is_connectable': False, - 'scan_mode': ble_scan_settings_modes['low_power'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='d2143fe1-bbec-429a-8241-19f39361b490') - def test_filter_combo_278(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['ultra_low'], - 'is_connectable': False, - 'scan_mode': ble_scan_settings_modes['low_power'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='21d025ef-2f89-49fd-bb31-2130dbe83c5c') - def test_filter_combo_279(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_tx_powers['medium'], - 'is_connectable': False, - 'scan_mode': ble_scan_settings_modes['low_power'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='19c5f91d-e10a-43af-8727-c66ee43187f2') - def test_filter_combo_280(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_tx_power_level': True} - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='7bda5df3-2644-46ca-b6de-e3d5557395cf') - def test_filter_combo_281(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'filter_device_address': True} - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='a80f6a40-9a60-4d68-b5e1-66d6e157cdd8') - def test_filter_combo_282(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='503bfb94-cfb8-4194-b451-23f19aff7b8e') - def test_filter_combo_283(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'manufacturer_specific_data': self.manu_sepecific_data_large - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='9bae0612-559b-460f-9723-fac896974835') - def test_filter_combo_284(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'manufacturer_specific_data_mask': [1] - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='f1ad0e3a-17cd-4e06-a395-7e5dde2268b4') - def test_filter_combo_285(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'service_data_uuid': '0000110A-0000-1000-8000-00805F9B34FB', - 'service_data': self.service_data_large - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='84f29360-9219-4f39-8ead-b43779c65504') - def test_filter_combo_286(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'service_data_uuid': '0000110B-0000-1000-8000-00805F9B34FB', - 'service_data': [13] - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='caece017-8379-46a3-913b-a21d3057e096') - def test_filter_combo_287(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'service_data_uuid': '0000110C-0000-1000-8000-00805F9B34FB', - 'service_data': [11, 14, 50] - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='37d63f4e-ed0c-4003-8044-f7032238a449') - def test_filter_combo_288(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'service_data_uuid': '0000110D-0000-1000-8000-00805F9B34FB', - 'service_data': [16, 22, 11] - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='7a57c0d7-1b8d-44e7-b407-7a6c58095058') - def test_filter_combo_289(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'service_data_uuid': '0000110E-0000-1000-8000-00805F9B34FB', - 'service_data': [2, 9, 54] - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='38f80b83-2aba-40f4-9238-7e108acea1e4') - def test_filter_combo_290(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'service_data_uuid': '0000110F-0000-1000-8000-00805F9B34FB', - 'service_data': [69, 11, 50] - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='adec5d6d-c1f2-46d0-8b05-2c46c02435a6') - def test_filter_combo_291(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'service_data_uuid': '00001101-0000-1000-8000-00805F9B34FB', - 'service_data': [12, 11, 21] - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='cd3cbc57-80a6-43d8-8042-9f163beda73a') - def test_filter_combo_292(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'service_data_uuid': '00001102-0000-1000-8000-00805F9B34FB', - 'service_data': [12, 12, 44] - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='35d9ab80-1ceb-4b45-ae9e-304c413f9273') - def test_filter_combo_293(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'service_data_uuid': '00001103-0000-1000-8000-00805F9B34FB', - 'service_data': [4, 54, 1] - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='07cecc9f-6e72-407e-a11d-c982f92c1834') - def test_filter_combo_294(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'service_data_uuid': '00001104-0000-1000-8000-00805F9B34FB', - 'service_data': [33, 22, 44] - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='8c0de318-4c57-47c3-8068-d1b0fde7f448') - def test_filter_combo_295(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'service_uuid': '00000000-0000-1000-8000-00805f9b34fb', - 'service_mask': '00000000-0000-1000-8000-00805f9b34fb' - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='8fbd96a9-5844-4714-8f63-5b92432d23d1') - def test_filter_combo_296(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'service_uuid': 'FFFFFFFF-0000-1000-8000-00805f9b34fb', - 'service_mask': '00000000-0000-1000-8000-00805f9b34fb' - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='d127b973-46ca-4a9f-a1e1-5cda6affaa53') - def test_filter_combo_297(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'service_uuid': '3846D7A0-69C8-11E4-BA00-0002A5D5C51B', - 'service_mask': '00000000-0000-1000-8000-00805f9b34fb' - } - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='efaad273-f953-43ca-b4f6-f9eba10d3ba5') - def test_filter_combo_298(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='373ba3e8-01e8-4c26-ad7f-7b7ba69d1a70') - def test_filter_combo_299(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_tx_power_level': True} - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='e1848bba-b9a6-473b-bceb-101b14b4ccc1') - def test_filter_combo_300(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'filter_device_address': True} - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='3a6068a5-0dd1-4503-b25a-79bc0f4a7006') - def test_filter_combo_301(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='c54e14e7-c5f6-4c16-9900-2b8ac9ee96a5') - def test_filter_combo_302(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'manufacturer_specific_data': self.manu_sepecific_data_large - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='bb188de9-8c63-4eba-96ab-b8577001412d') - def test_filter_combo_303(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'manufacturer_specific_data_id': self.manu_specific_data_id_1, - 'manufacturer_specific_data': self.manu_sepecific_data_small, - 'manufacturer_specific_data_mask': [1] - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='4e42416b-fe86-41e7-99cd-3ea0ab61a027') - def test_filter_combo_304(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'service_data_uuid': '0000110A-0000-1000-8000-00805F9B34FB', - 'service_data': self.service_data_large - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='a519609b-cd95-4017-adac-86954153669e') - def test_filter_combo_305(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'service_data_uuid': '0000110B-0000-1000-8000-00805F9B34FB', - 'service_data': [13] - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='ad1f5bdd-b532-482c-8f62-cc6804f0f8a2') - def test_filter_combo_306(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'service_data_uuid': '0000110C-0000-1000-8000-00805F9B34FB', - 'service_data': [11, 14, 50] - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='a44af1a3-f5ac-419b-a11b-a72734b57fa7') - def test_filter_combo_307(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'service_data_uuid': '0000110D-0000-1000-8000-00805F9B34FB', - 'service_data': [16, 22, 11] - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='1b2b17e7-5a1a-4795-974d-3a239c7fccc8') - def test_filter_combo_308(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'service_data_uuid': '0000110E-0000-1000-8000-00805F9B34FB', - 'service_data': [2, 9, 54] - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='9e9944cc-a85c-4077-9129-ca348a6c0286') - def test_filter_combo_309(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'service_data_uuid': '0000110F-0000-1000-8000-00805F9B34FB', - 'service_data': [69, 11, 50] - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='e0bb52ea-ac8f-4951-bd00-5322d0e72fd2') - def test_filter_combo_310(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'service_data_uuid': '00001101-0000-1000-8000-00805F9B34FB', - 'service_data': [12, 11, 21] - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='719d258d-6556-47b6-92d6-224c691b5dfd') - def test_filter_combo_311(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'service_data_uuid': '00001102-0000-1000-8000-00805F9B34FB', - 'service_data': [12, 12, 44] - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='1ab27561-6e2d-4da8-b2b1-dc4bd2c42f97') - def test_filter_combo_312(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'service_data_uuid': '00001103-0000-1000-8000-00805F9B34FB', - 'service_data': [4, 54, 1] - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='5b460a48-f6d6-469c-9553-11817171dacb') - def test_filter_combo_313(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'service_data_uuid': '00001104-0000-1000-8000-00805F9B34FB', - 'service_data': [33, 22, 44] - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='e0439501-b72d-43ac-a51f-c44b4d0c86d9') - def test_filter_combo_314(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'service_uuid': '00000000-0000-1000-8000-00805f9b34fb', - 'service_mask': '00000000-0000-1000-8000-00805f9b34fb' - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='3a7f4527-2a77-4172-8402-78d90fbc5a8a') - def test_filter_combo_315(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'service_uuid': 'FFFFFFFF-0000-1000-8000-00805f9b34fb', - 'service_mask': '00000000-0000-1000-8000-00805f9b34fb' - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='c6661021-33ad-4628-99f0-1a3b4b4a8263') - def test_filter_combo_316(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = { - 'service_uuid': '3846D7A0-69C8-11E4-BA00-0002A5D5C51B', - 'service_mask': '00000000-0000-1000-8000-00805f9b34fb' - } - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='3a633941-1716-4bf6-a8d7-8a4ad0be24aa') - def test_filter_combo_317(self): - """Test a combination scan filter and advertisement - - Test that an advertisement is found and matches corresponding - settings. - - Steps: - 1. Create a advertise data object - 2. Create a advertise settings object. - 3. Create a advertise callback object. - 4. Start an LE advertising using the objects created in steps 1-3. - 5. Find the onSuccess advertisement event. - - Expected Result: - Advertisement is successfully advertising. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - filters = {'include_device_name': True} - settings_in_effect = { - 'scan_mode': ble_scan_settings_modes['low_latency'], - 'mode': ble_advertise_settings_modes['low_latency'] - } - return self._magic((filters, settings_in_effect)) - - def _blescan_verify_onscanresult_event(self, event, filters): - test_result = True - self.log.debug("Verifying onScanResult event: {}".format(event)) - callback_type = event['data']['CallbackType'] - if 'callback_type' in filters.keys(): - if filters['callback_type'] != callback_type: - self.log.error("Expected callback type: {}, Found callback " - "type: {}".format(filters['callback_type'], - callback_type)) - test_result = False - elif self.default_callback != callback_type: - self.log.error("Expected callback type: {}, Found callback type: " - "{}".format(self.default_callback, callback_type)) - test_result = False - if 'include_device_name' in filters.keys() and filters[ - 'include_device_name'] is not False: - if event['data']['Result']['deviceName'] != filters[ - 'include_device_name']: - self.log.error( - "Expected device name: {}, Found device name: {}" - .format(filters['include_device_name'], event['data'][ - 'Result']['deviceName'])) - - test_result = False - elif 'deviceName' in event['data']['Result'].keys(): - self.log.error( - "Device name was found when it wasn't meant to be included.") - test_result = False - if ('include_tx_power_level' in filters.keys() and - filters['include_tx_power_level'] is not False): - if not event['data']['Result']['txPowerLevel']: - self.log.error( - "Expected to find tx power level in event but found none.") - test_result = False - if not event['data']['Result']['rssi']: - self.log.error("Expected rssi in the advertisement, found none.") - test_result = False - if not event['data']['Result']['timestampNanos']: - self.log.error("Expected rssi in the advertisement, found none.") - test_result = False - return test_result - - def _bleadvertise_verify_onsuccess(self, event, settings_in_effect): - self.log.debug("Verifying {} event".format(adv_succ)) - test_result = True - if 'is_connectable' in settings_in_effect.keys(): - if (event['data']['SettingsInEffect']['isConnectable'] != - settings_in_effect['is_connectable']): - self.log.error("Expected is connectable value: {}, Actual is " - "connectable value:".format(settings_in_effect[ - 'is_connectable'], event['data'][ - 'SettingsInEffect']['isConnectable'])) - test_result = False - elif (event['data']['SettingsInEffect']['isConnectable'] != - self.default_is_connectable): - self.log.error( - "Default value for isConnectable did not match what was found.") - test_result = False - if 'mode' in settings_in_effect.keys(): - if (event['data']['SettingsInEffect']['mode'] != - settings_in_effect['mode']): - self.log.error("Expected mode value: {}, Actual mode value: {}" - .format(settings_in_effect['mode'], event[ - 'data']['SettingsInEffect']['mode'])) - test_result = False - elif (event['data']['SettingsInEffect']['mode'] != - self.default_advertise_mode): - self.log.error( - "Default value for filtering mode did not match what was " - "found.") - test_result = False - if 'tx_power_level' in settings_in_effect.keys(): - if (event['data']['SettingsInEffect']['txPowerLevel'] == - java_integer['min']): - self.log.error("Expected tx power level was not meant to be: " - "{}".format(java_integer['min'])) - test_result = False - elif (event['data']['SettingsInEffect']['txPowerLevel'] != - self.default_tx_power_level): - self.log.error( - "Default value for tx power level did not match what" - " was found.") - test_result = False - return test_result - - def _magic(self, params): - (filters, settings_in_effect) = params - test_result = True - - self.log.debug("Settings in effect: {}".format( - pprint.pformat(settings_in_effect))) - self.log.debug("Filters:".format(pprint.pformat(filters))) - if 'is_connectable' in settings_in_effect.keys(): - self.log.debug("Setting advertisement is_connectable to {}".format( - settings_in_effect['is_connectable'])) - self.adv_ad.droid.bleSetAdvertiseSettingsIsConnectable( - settings_in_effect['is_connectable']) - if 'mode' in settings_in_effect.keys(): - self.log.debug("Setting advertisement mode to {}" - .format(settings_in_effect['mode'])) - self.adv_ad.droid.bleSetAdvertiseSettingsAdvertiseMode( - settings_in_effect['mode']) - if 'tx_power_level' in settings_in_effect.keys(): - self.log.debug("Setting advertisement tx_power_level to {}".format( - settings_in_effect['tx_power_level'])) - self.adv_ad.droid.bleSetAdvertiseSettingsTxPowerLevel( - settings_in_effect['tx_power_level']) - filter_list = self.scn_ad.droid.bleGenFilterList() - if ('include_device_name' in filters.keys() and - filters['include_device_name'] is not False): - - self.log.debug("Setting advertisement include_device_name to {}" - .format(filters['include_device_name'])) - self.adv_ad.droid.bleSetAdvertiseDataIncludeDeviceName(True) - filters['include_device_name'] = ( - self.adv_ad.droid.bluetoothGetLocalName()) - self.log.debug("Setting scanner include_device_name to {}".format( - filters['include_device_name'])) - self.scn_ad.droid.bleSetScanFilterDeviceName(filters[ - 'include_device_name']) - else: - self.log.debug( - "Setting advertisement include_device_name to False") - self.adv_ad.droid.bleSetAdvertiseDataIncludeDeviceName(False) - if ('include_tx_power_level' in filters.keys() and - filters['include_tx_power_level'] is not False): - self.log.debug( - "Setting advertisement include_tx_power_level to True") - self.adv_ad.droid.bleSetAdvertiseDataIncludeTxPowerLevel(True) - if 'manufacturer_specific_data_id' in filters.keys(): - if 'manufacturer_specific_data_mask' in filters.keys(): - self.adv_ad.droid.bleAddAdvertiseDataManufacturerId( - filters['manufacturer_specific_data_id'], - filters['manufacturer_specific_data']) - self.scn_ad.droid.bleSetScanFilterManufacturerData( - filters['manufacturer_specific_data_id'], - filters['manufacturer_specific_data'], - filters['manufacturer_specific_data_mask']) - else: - self.adv_ad.droid.bleAddAdvertiseDataManufacturerId( - filters['manufacturer_specific_data_id'], - filters['manufacturer_specific_data']) - self.scn_ad.droid.bleSetScanFilterManufacturerData( - filters['manufacturer_specific_data_id'], - filters['manufacturer_specific_data']) - if 'service_data' in filters.keys(): - self.adv_ad.droid.bleAddAdvertiseDataServiceData( - filters['service_data_uuid'], filters['service_data']) - self.scn_ad.droid.bleSetScanFilterServiceData( - filters['service_data_uuid'], filters['service_data']) - if 'manufacturer_specific_data_list' in filters.keys(): - for pair in filters['manufacturer_specific_data_list']: - (manu_id, manu_data) = pair - self.adv_ad.droid.bleAddAdvertiseDataManufacturerId(manu_id, - manu_data) - if 'service_mask' in filters.keys(): - self.scn_ad.droid.bleSetScanFilterServiceUuid( - filters['service_uuid'].upper(), filters['service_mask']) - self.adv_ad.droid.bleSetAdvertiseDataSetServiceUuids( - [filters['service_uuid'].upper()]) - elif 'service_uuid' in filters.keys(): - self.scn_ad.droid.bleSetScanFilterServiceUuid(filters[ - 'service_uuid']) - self.adv_ad.droid.bleSetAdvertiseDataSetServiceUuids( - [filters['service_uuid']]) - self.scn_ad.droid.bleBuildScanFilter(filter_list) - advertise_callback, advertise_data, advertise_settings = ( - generate_ble_advertise_objects(self.adv_ad.droid)) - if ('scan_mode' in settings_in_effect and - settings_in_effect['scan_mode'] != - ble_scan_settings_modes['opportunistic']): - self.scn_ad.droid.bleSetScanSettingsScanMode(settings_in_effect[ - 'scan_mode']) - else: - self.scn_ad.droid.bleSetScanSettingsScanMode( - ble_scan_settings_modes['low_latency']) - scan_settings = self.scn_ad.droid.bleBuildScanSetting() - scan_callback = self.scn_ad.droid.bleGenScanCallback() - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - opportunistic = False - scan_settings2, scan_callback2 = None, None - if ('scan_mode' in settings_in_effect and - settings_in_effect['scan_mode'] == - ble_scan_settings_modes['opportunistic']): - opportunistic = True - scan_settings2 = self.scn_ad.droid.bleBuildScanSetting() - scan_callback2 = self.scn_ad.droid.bleGenScanCallback() - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings2, - scan_callback2) - self.scn_ad.droid.bleSetScanSettingsScanMode( - ble_scan_settings_modes['opportunistic']) - self.adv_ad.droid.bleStartBleAdvertising( - advertise_callback, advertise_data, advertise_settings) - regex = "(" + adv_succ.format( - advertise_callback) + "|" + adv_fail.format( - advertise_callback) + ")" - self.log.debug(regex) - try: - event = self.adv_ad.ed.pop_events(regex, self.default_timeout, - small_timeout) - except Empty: - self.adv_ad.log.error("Failed to get success or failed event.") - return False - if event[0]["name"] == adv_succ.format(advertise_callback): - if not self._bleadvertise_verify_onsuccess(event[0], - settings_in_effect): - return False - else: - self.adv_ad.log.info("Advertisement started successfully.") - else: - self.adv_ad.log.error("Failed to start advertisement: {}".format( - event[0]["data"]["Error"])) - expected_scan_event_name = scan_result.format(scan_callback) - try: - event = self.scn_ad.ed.pop_event(expected_scan_event_name, - self.default_timeout) - except Empty: - self.log.error("Scan event not found: {}".format( - expected_scan_event_name)) - return False - if not self._blescan_verify_onscanresult_event(event, filters): - return False - if opportunistic: - expected_scan_event_name = scan_result.format(scan_callback2) - try: - event = self.scn_ad.ed.pop_event(expected_scan_event_name, - self.default_timeout) - except Empty: - self.log.error("Opportunistic scan event not found: {}".format( - expected_scan_event_name)) - return False - if not self._blescan_verify_onscanresult_event(event, filters): - return False - self.scn_ad.droid.bleStopBleScan(scan_callback2) - self.adv_ad.droid.bleStopBleAdvertising(advertise_callback) - self.scn_ad.droid.bleStopBleScan(scan_callback) - return test_result diff --git a/acts/tests/google/ble/filtering/UniqueFilteringTest.py b/acts/tests/google/ble/filtering/UniqueFilteringTest.py deleted file mode 100644 index c2e837c567..0000000000 --- a/acts/tests/google/ble/filtering/UniqueFilteringTest.py +++ /dev/null @@ -1,650 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -""" -This test script exercises different filters and outcomes not exercised in -FilteringTest. -""" - -import concurrent -import json -import pprint -import time - -from queue import Empty -from acts.test_decorators import test_tracker_info -from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest -from acts.test_utils.bt.bt_constants import ble_advertise_settings_modes -from acts.test_utils.bt.bt_constants import ble_scan_settings_modes -from acts.test_utils.bt.bt_test_utils import generate_ble_advertise_objects -from acts.test_utils.bt.bt_test_utils import generate_ble_scan_objects -from acts.test_utils.bt.bt_constants import adv_succ -from acts.test_utils.bt.bt_constants import batch_scan_result -from acts.test_utils.bt.bt_constants import scan_result - - -class UniqueFilteringTest(BluetoothBaseTest): - default_timeout = 10 - - def setup_class(self): - super().setup_class() - self.scn_ad = self.android_devices[0] - self.adv_ad = self.android_devices[1] - - def blescan_verify_onfailure_event_handler(self, event): - self.log.debug("Verifying onFailure event") - self.log.debug(pprint.pformat(event)) - return event - - def blescan_verify_onscanresult_event_handler(self, - event, - expected_callbacktype=None, - system_time_nanos=None): - test_result = True - self.log.debug("Verifying onScanResult event") - self.log.debug(pprint.pformat(event)) - callbacktype = event['data']['CallbackType'] - if callbacktype != expected_callbacktype: - self.log.debug( - "Expected callback type: {}, Found callback type: {}".format( - expected_callbacktype, callbacktype)) - test_result = False - return test_result - - def blescan_get_mac_address_event_handler(self, event): - return event['data']['Result']['deviceInfo']['address'] - - def blescan_verify_onbatchscanresult_event_handler( - self, event, system_time_nanos=None, report_delay_nanos=None): - test_result = True - self.log.debug("Verifying onBatchScanResult event") - self.log.debug(pprint.pformat(event)) - for result in event['data']['Results']: - timestamp_nanos = result['timestampNanos'] - length_of_time = timestamp_nanos - system_time_nanos - self.log.debug("Difference in time in between scan start and " - "onBatchScanResult: {}".format(length_of_time)) - buffer = 1000000000 # 1 second - if length_of_time > (report_delay_nanos + buffer): - self.log.debug( - "Difference was greater than the allowable difference.") - test_result = False - return test_result - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='c3764358-cd65-451c-9a2d-4bfb6cf98f48') - def test_scan_flush_pending_scan_results(self): - """Test LE scan api flush pending results. - - Test that flush pending scan results doesn't affect onScanResults from - triggering. - - Steps: - 1. Setup the scanning android device. - 2. Setup the advertiser android devices. - 3. Trigger bluetoothFlushPendingScanResults on the scanning droid. - 4. Verify that only one onScanResults callback was triggered. - - Expected Result: - After flushing pending scan results, make sure only one onScanResult - callback was triggered. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 1 - """ - test_result = True - self.adv_ad.droid.bleSetAdvertiseDataIncludeDeviceName(True) - self.adv_ad.droid.bleSetAdvertiseSettingsAdvertiseMode( - ble_advertise_settings_modes['low_latency']) - filter_list, scan_settings, scan_callback = generate_ble_scan_objects( - self.scn_ad.droid) - expected_event_name = scan_result.format(scan_callback) - advertise_callback, advertise_data, advertise_settings = ( - generate_ble_advertise_objects(self.adv_ad.droid)) - self.adv_ad.droid.bleStartBleAdvertising( - advertise_callback, advertise_data, advertise_settings) - self.scn_ad.droid.bleSetScanFilterDeviceName( - self.adv_ad.droid.bluetoothGetLocalName()) - self.scn_ad.droid.bleBuildScanFilter(filter_list) - - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - self.scn_ad.droid.bleFlushPendingScanResults(scan_callback) - worker = self.scn_ad.ed.handle_event( - self.blescan_verify_onscanresult_event_handler, - expected_event_name, ([1]), self.default_timeout) - try: - self.log.debug(worker.result(self.default_timeout)) - except Empty as error: - test_result = False - self.log.error("Test failed with Empty error: {}".format(error)) - except concurrent.futures._base.TimeoutError as error: - test_result = False - self.log.error("Test failed with TimeoutError: {}".format(error)) - self.scn_ad.droid.bleStopBleScan(scan_callback) - self.adv_ad.droid.bleStopBleAdvertising(advertise_callback) - return test_result - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='4b358654-db69-4b51-98ec-7599aee2db10') - def test_scan_trigger_on_batch_scan_results(self): - """Test triggering batch scan results. - - Test that triggers onBatchScanResults and verifies the time to trigger - within one second leeway. - - Steps: - 1. Setup the scanning android device with report delay seconds set to - 5000. - 2. Setup the advertiser android devices. - 3. Verify that only one onBatchScanResult callback was triggered. - 4. Compare the system time that the scan was started with the elapsed - time that is in the callback. - - Expected Result: - The scan event dispatcher should find an onBatchScanResult event. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning, Batch Scanning - Priority: 2 - """ - test_result = True - self.scn_ad.droid.bleSetScanSettingsReportDelayMillis(5000) - filter_list, scan_settings, scan_callback = generate_ble_scan_objects( - self.scn_ad.droid) - expected_event_name = batch_scan_result.format(scan_callback) - self.adv_ad.droid.bleSetAdvertiseDataIncludeDeviceName(True) - self.adv_ad.droid.bleSetAdvertiseDataIncludeTxPowerLevel(True) - advertise_callback, advertise_data, advertise_settings = ( - generate_ble_advertise_objects(self.adv_ad.droid)) - self.adv_ad.droid.bleStartBleAdvertising( - advertise_callback, advertise_data, advertise_settings) - self.scn_ad.droid.bleSetScanFilterDeviceName( - self.adv_ad.droid.bluetoothGetLocalName()) - self.scn_ad.droid.bleBuildScanFilter(filter_list) - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - system_time_nanos = self.scn_ad.droid.getSystemElapsedRealtimeNanos() - self.log.debug("Current system time: {}".format(system_time_nanos)) - worker = self.scn_ad.ed.handle_event( - self.blescan_verify_onbatchscanresult_event_handler, - expected_event_name, ([system_time_nanos, 5000000000]), - self.default_timeout) - try: - self.log.debug(worker.result(self.default_timeout)) - except Empty as error: - test_result = False - self.log.debug("Test failed with: {}".format(error)) - except concurrent.futures._base.TimeoutError as error: - test_result = False - self.log.debug("Test failed with: {}".format(error)) - self.scn_ad.droid.bleStopBleScan(scan_callback) - self.adv_ad.droid.bleStopBleAdvertising(advertise_callback) - return test_result - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='94dbe8b2-9e7f-4da4-973e-5162b84a7ce0') - def test_scan_flush_results_without_on_batch_scan_results_triggered(self): - """Test that doesn't expect a batch scan result. - - Test flush pending scan results with a report delay seconds set to 0. - No onBatchScanResults callback should be triggered. - - Steps: - 1. Setup the scanning android device with report delay seconds set to 0 - (or just use default). - 2. Setup the advertiser android devices. - - Expected Result: - Verify that no onBatchScanResults were triggered. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning, Batch Scanning - Priority: 2 - """ - test_result = True - filter_list, scan_settings, scan_callback = generate_ble_scan_objects( - self.scn_ad.droid) - expected_event_name = batch_scan_result.format(scan_callback) - self.adv_ad.droid.bleSetAdvertiseDataIncludeDeviceName(True) - advertise_callback, advertise_data, advertise_settings = ( - generate_ble_advertise_objects(self.adv_ad.droid)) - self.adv_ad.droid.bleStartBleAdvertising( - advertise_callback, advertise_data, advertise_settings) - self.scn_ad.droid.bleSetScanFilterDeviceName( - self.adv_ad.droid.bluetoothGetLocalName()) - self.scn_ad.droid.bleBuildScanFilter(filter_list) - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - worker = self.scn_ad.ed.handle_event( - self.blescan_verify_onbatchscanresult_event_handler, - expected_event_name, ([]), self.default_timeout) - self.scn_ad.droid.bleFlushPendingScanResults(scan_callback) - try: - event_info = self.scn_ad.ed.pop_event(expected_event_name, 10) - self.log.debug( - "Unexpectedly found an advertiser: {}".format(event_info)) - test_result = False - except Empty: - self.log.debug("No {} events were found as expected.".format( - batch_scan_result)) - self.scn_ad.droid.bleStopBleScan(scan_callback) - self.adv_ad.droid.bleStopBleAdvertising(advertise_callback) - return test_result - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='5856882e-3d82-4a6f-b110-389086b0ac41') - def test_scan_non_existent_name_filter(self): - """Test non-existent name filter. - - Test scan filter on non-existent device name. - - Steps: - 1. Setup the scanning android device with scan filter for device name - set to an unexpected value. - 2. Setup the advertiser android devices. - 3. Verify that no onScanResults were triggered. - - Expected Result: - No advertisements were found. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - test_result = True - filter_name = "{}_probably_wont_find".format( - self.adv_ad.droid.bluetoothGetLocalName()) - self.adv_ad.droid.bleSetAdvertiseDataIncludeDeviceName(True) - self.scn_ad.droid.bleSetScanFilterDeviceName(filter_name) - filter_list, scan_settings, scan_callback = generate_ble_scan_objects( - self.scn_ad.droid) - self.scn_ad.droid.bleBuildScanFilter(filter_list) - expected_event_name = scan_result.format(scan_callback) - self.adv_ad.droid.bleSetAdvertiseDataIncludeDeviceName(True) - self.adv_ad.droid.bleSetAdvertiseDataIncludeTxPowerLevel(True) - advertise_callback, advertise_data, advertise_settings = ( - generate_ble_advertise_objects(self.adv_ad.droid)) - self.adv_ad.droid.bleStartBleAdvertising( - advertise_callback, advertise_data, advertise_settings) - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - try: - event_info = self.scn_ad.ed.pop_event(expected_event_name, - self.default_timeout) - self.log.error( - "Unexpectedly found an advertiser: {}".format(event_info)) - test_result = False - except Empty: - self.log.debug("No events were found as expected.") - self.scn_ad.droid.bleStopBleScan(scan_callback) - self.adv_ad.droid.bleStopBleAdvertising(advertise_callback) - return test_result - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='0a54c50b-d4ef-4d8c-8328-775781aab2c7') - def test_scan_advertisement_with_device_service_uuid_filter_expect_no_events( - self): - """Test scan filtering against an advertisement with no data. - - Test that exercises a service uuid filter on the scanner but no server - uuid added to the advertisement. - - Steps: - 1. Setup the scanning android device with scan filter including a - service uuid and mask. - 2. Setup the advertiser android devices. - 3. Verify that no onScanResults were triggered. - - Expected Result: - Verify no advertisements found. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 1 - """ - test_result = True - service_uuid = "00000000-0000-1000-8000-00805F9B34FB" - service_mask = "00000000-0000-1000-8000-00805F9B34FA" - self.scn_ad.droid.bleSetScanFilterServiceUuid(service_uuid, - service_mask) - self.adv_ad.droid.bleSetAdvertiseSettingsAdvertiseMode( - ble_advertise_settings_modes['low_latency']) - filter_list, scan_settings, scan_callback = generate_ble_scan_objects( - self.scn_ad.droid) - expected_event_name = scan_result.format(scan_callback) - self.adv_ad.droid.bleSetAdvertiseDataIncludeDeviceName(True) - self.adv_ad.droid.bleSetAdvertiseDataIncludeTxPowerLevel(True) - advertise_callback, advertise_data, advertise_settings = ( - generate_ble_advertise_objects(self.adv_ad.droid)) - self.adv_ad.droid.bleStartBleAdvertising( - advertise_callback, advertise_data, advertise_settings) - self.scn_ad.droid.bleSetScanFilterDeviceName( - self.adv_ad.droid.bluetoothGetLocalName()) - self.scn_ad.droid.bleBuildScanFilter(filter_list) - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - worker = self.scn_ad.ed.handle_event( - self.blescan_verify_onscanresult_event_handler, - expected_event_name, ([1]), self.default_timeout) - try: - event_info = self.scn_ad.ed.pop_event(expected_event_name, - self.default_timeout) - self.log.error( - "Unexpectedly found an advertiser: {}".format(event_info)) - test_result = False - except Empty as error: - self.log.debug("No events were found as expected.") - self.scn_ad.droid.bleStopBleScan(scan_callback) - self.adv_ad.droid.bleStopBleAdvertising(advertise_callback) - return test_result - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='aefbc70c-ea46-4a63-a627-6fcceb72ac9e') - def test_scan_filtering_multiple_advertisements_manufacturer_data(self): - """Test scan filtering against multiple varying advertisements. - - Test scan filtering against multiple varying advertisements. The first - advertisement will have partial manufacturer data that matches the - the full manufacturer data in the second advertisement. - - Steps: - 1. Setup up an advertisement with manufacturer data [1,2,3]. - 2. Setup a second advertisement with manufacturer data - [1,2,3,4,5,6,7,8]. - 3. Start advertising on each advertisement. - 4. Create a scan filter that includes manufacturer data [1,2,3]. - - Expected Result: - TBD. Right now Shamu finds only the first advertisement with - manufacturer data [1,2,3]. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 2 - """ - test_result = True - self.adv_ad.droid.bleSetAdvertiseSettingsAdvertiseMode( - ble_advertise_settings_modes['low_latency']) - self.adv_ad.droid.bleAddAdvertiseDataManufacturerId(117, [1, 2, 3]) - advertise_callback, advertise_data, advertise_settings = ( - generate_ble_advertise_objects(self.adv_ad.droid)) - self.adv_ad.droid.bleSetAdvertiseSettingsAdvertiseMode( - ble_advertise_settings_modes['low_latency']) - self.adv_ad.droid.bleAddAdvertiseDataManufacturerId( - 117, [1, 2, 3, 4, 5, 6, 7, 8]) - advertise_callback1, advertise_data1, advertise_settings1 = ( - generate_ble_advertise_objects(self.adv_ad.droid)) - self.adv_ad.droid.bleStartBleAdvertising( - advertise_callback, advertise_data, advertise_settings) - self.adv_ad.droid.bleStartBleAdvertising( - advertise_callback1, advertise_data1, advertise_settings1) - - filter_list = self.scn_ad.droid.bleGenFilterList() - self.scn_ad.droid.bleSetScanSettingsScanMode( - ble_scan_settings_modes['low_latency']) - scan_settings = self.scn_ad.droid.bleBuildScanSetting() - scan_callback = self.scn_ad.droid.bleGenScanCallback() - self.scn_ad.droid.bleSetScanFilterManufacturerData( - 117, [1, 2, 3], [127, 127, 127]) - self.scn_ad.droid.bleBuildScanFilter(filter_list) - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - return test_result - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='cdbeeb8e-895e-4d11-9e42-7b89ff6917ce') - def test_scan_filter_device_address(self): - """Test scan filtering of a device address. - - This test will have to create two scanning instances. The first will - have no filters and will find the generic advertisement's mac address. - The second will have a filter of the found mac address. - - Steps: - 1. Start a generic advertisement. - 2. Start a generic scanner. - 3. Find the advertisement and extract the mac address. - 4. Stop the first scanner. - 5. Create a new scanner with scan filter with a mac address filter of - what was found in step 3. - 6. Start the scanner. - - Expected Result: - Verify that the advertisement was found in the second scan instance. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 1 - """ - test_result = True - self.scn_ad.droid.bleSetScanSettingsScanMode( - ble_scan_settings_modes['low_latency']) - filter_list, scan_settings, scan_callback = generate_ble_scan_objects( - self.scn_ad.droid) - expected_event_name = scan_result.format(scan_callback) - self.adv_ad.droid.bleSetAdvertiseSettingsAdvertiseMode( - ble_advertise_settings_modes['low_latency']) - self.adv_ad.droid.bleSetAdvertiseDataIncludeDeviceName(True) - advertise_callback, advertise_data, advertise_settings = ( - generate_ble_advertise_objects(self.adv_ad.droid)) - self.adv_ad.droid.bleStartBleAdvertising( - advertise_callback, advertise_data, advertise_settings) - self.scn_ad.droid.bleSetScanFilterDeviceName( - self.adv_ad.droid.bluetoothGetLocalName()) - self.scn_ad.droid.bleBuildScanFilter(filter_list) - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - try: - event_info = self.scn_ad.ed.pop_event(expected_event_name, - self.default_timeout) - except Empty as error: - self.log.error("Could not find initial advertisement.") - return False - mac_address = event_info['data']['Result']['deviceInfo']['address'] - self.log.info( - "Filter advertisement with address {}".format(mac_address)) - self.scn_ad.droid.bleStopBleScan(scan_callback) - self.scn_ad.droid.bleSetScanSettingsScanMode( - ble_scan_settings_modes['low_latency']) - self.scn_ad.droid.bleSetScanFilterDeviceAddress(mac_address) - filter_list2, scan_settings2, scan_callback2 = ( - generate_ble_scan_objects(self.scn_ad.droid)) - - self.scn_ad.droid.bleBuildScanFilter(filter_list2) - self.scn_ad.droid.bleStartBleScan(filter_list2, scan_settings2, - scan_callback2) - expected_event_name = scan_result.format(scan_callback2) - found_event = self.scn_ad.ed.pop_event(expected_event_name, - self.default_timeout) - if (found_event['data']['Result']['deviceInfo']['address'] != - mac_address): - test_result = False - self.scn_ad.droid.bleStopBleScan(scan_callback2) - self.adv_ad.droid.bleStopBleAdvertising(advertise_callback) - return test_result - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='a4921d7b-cdd5-4d52-834c-f4bb85a9e2e8') - def test_filter_simulated_ibeacon(self): - """Test scan filtering of a simulated ibeacon. - - This test will setup one Android device as an ibeacon and - a second Android device will be used to test filtering of - the manufacturer data for 60 seconds. - - Steps: - 1. Start an advertisement with manufacturer id set to 0x004c - 2. Start a generic scanner. - 3. Find the advertisement and extract the mac address. - 4. Stop the first scanner. - 5. Create a new scanner with scan filter with a mac address filter of - what was found in step 3. - 6. Start the scanner. - - Expected Result: - Verify that the advertisement was found in the second scan instance. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 1 - """ - manufacturer_id = 0x4c - self.adv_ad.droid.bleAddAdvertiseDataManufacturerId( - manufacturer_id, [0x01]) - self.adv_ad.droid.bleSetAdvertiseSettingsAdvertiseMode( - ble_advertise_settings_modes['low_latency']) - advertise_callback, advertise_data, advertise_settings = ( - generate_ble_advertise_objects(self.adv_ad.droid)) - self.adv_ad.droid.bleStartBleAdvertising( - advertise_callback, advertise_data, advertise_settings) - expected_event = adv_succ.format(advertise_callback) - try: - self.adv_ad.ed.pop_event(expected_event) - except Empty: - self.log.info("Failed to start advertisement.") - return False - - self.scn_ad.droid.bleSetScanSettingsScanMode( - ble_scan_settings_modes['low_latency']) - self.scn_ad.droid.bleSetScanFilterManufacturerData( - manufacturer_id, [0x01]) - filter_list = self.scn_ad.droid.bleGenFilterList() - scan_settings = self.scn_ad.droid.bleBuildScanSetting() - scan_filter = self.scn_ad.droid.bleBuildScanFilter(filter_list) - scan_callback = self.scn_ad.droid.bleGenScanCallback() - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - # continuously scan for 60 seconds - scan_time = 60 - end_time = time.time() + scan_time - expected_event_name = scan_result.format(scan_callback) - event = None - while time.time() < end_time: - try: - event = self.scn_ad.ed.pop_event(expected_event_name, - self.default_timeout) - found_manufacturer_id = json.loads( - event['data']['Result']['manufacturerIdList']) - if found_manufacturer_id[0] != manufacturer_id: - self.log.error( - "Manufacturer id mismatch. Found {}, Expected {}". - format(found_manufacturer_id, manufacturer_id)) - return False - except Empty: - self.log.error("Unable to find ibeacon advertisement.") - return False - self.scn_ad.droid.bleStopBleScan(scan_callback) - self.adv_ad.droid.bleStopBleAdvertising(advertise_callback) - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='a70a276d-7990-4754-8899-792b586ecce6') - def test_filter_manufacturer_id_bounds(self): - """Test scan filtering of lower and upper bounds of allowed manu data - - This test will setup one Android device as an advertiser and the - second as the scanner and test the upper and lower bounds of - manufacturer data filtering - - Steps: - 1. Start an advertisement with manufacturer id set to 0x004c - 2. Start a generic scanner. - 3. Find the advertisement and extract the mac address. - 4. Stop the first scanner. - 5. Create a new scanner with scan filter with a mac address filter of - what was found in step 3. - 6. Start the scanner. - - Expected Result: - Verify that the advertisement was found in the second scan instance. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning - Priority: 1 - """ - manufacturer_id_list = [0, 1, 65534, 65535] - for manufacturer_id in manufacturer_id_list: - self.adv_ad.droid.bleAddAdvertiseDataManufacturerId( - manufacturer_id, [0x01]) - self.adv_ad.droid.bleSetAdvertiseSettingsAdvertiseMode( - ble_advertise_settings_modes['low_latency']) - advertise_callback, advertise_data, advertise_settings = ( - generate_ble_advertise_objects(self.adv_ad.droid)) - self.adv_ad.droid.bleStartBleAdvertising( - advertise_callback, advertise_data, advertise_settings) - expected_event = adv_succ.format(advertise_callback) - try: - self.adv_ad.ed.pop_event(expected_event) - except Empty: - self.log.info("Failed to start advertisement.") - return False - - self.scn_ad.droid.bleSetScanSettingsScanMode( - ble_scan_settings_modes['low_latency']) - self.scn_ad.droid.bleSetScanFilterManufacturerData( - manufacturer_id, [0x01]) - filter_list = self.scn_ad.droid.bleGenFilterList() - scan_settings = self.scn_ad.droid.bleBuildScanSetting() - scan_filter = self.scn_ad.droid.bleBuildScanFilter(filter_list) - scan_callback = self.scn_ad.droid.bleGenScanCallback() - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - expected_event_name = scan_result.format(scan_callback) - event = None - try: - event = self.scn_ad.ed.pop_event(expected_event_name, - self.default_timeout) - except Empty: - self.log.error("Unable to find beacon advertisement.") - return False - found_manufacturer_id = json.loads( - event['data']['Result']['manufacturerIdList']) - if found_manufacturer_id[0] != manufacturer_id: - self.log.error( - "Manufacturer id mismatch. Found {}, Expected {}".format( - found_manufacturer_id, manufacturer_id)) - return False - self.scn_ad.droid.bleStopBleScan(scan_callback) - self.adv_ad.droid.bleStopBleAdvertising(advertise_callback) - return True diff --git a/acts/tests/google/ble/gatt/GattConnectTest.py b/acts/tests/google/ble/gatt/GattConnectTest.py deleted file mode 100644 index 52f3601cd0..0000000000 --- a/acts/tests/google/ble/gatt/GattConnectTest.py +++ /dev/null @@ -1,1184 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -""" -This test script exercises different GATT connection tests. -""" - -import pprint -from queue import Empty -import time - -from acts.test_decorators import test_tracker_info -from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest -from acts.test_utils.bt.bt_constants import ble_advertise_settings_modes -from acts.test_utils.bt.bt_constants import ble_scan_settings_modes -from acts.test_utils.bt.bt_constants import ble_scan_settings_match_nums -from acts.test_utils.bt.bt_constants import bt_profile_constants -from acts.test_utils.bt.bt_constants import gatt_characteristic -from acts.test_utils.bt.bt_constants import gatt_descriptor -from acts.test_utils.bt.bt_constants import gatt_service_types -from acts.test_utils.bt.bt_constants import gatt_cb_err -from acts.test_utils.bt.bt_constants import gatt_cb_strings -from acts.test_utils.bt.bt_constants import gatt_connection_state -from acts.test_utils.bt.bt_constants import gatt_mtu_size -from acts.test_utils.bt.bt_constants import gatt_phy_mask -from acts.test_utils.bt.bt_constants import gatt_transport -from acts.test_utils.bt.bt_constants import scan_result -from acts.test_utils.bt.bt_gatt_utils import GattTestUtilsError -from acts.test_utils.bt.bt_gatt_utils import disconnect_gatt_connection -from acts.test_utils.bt.bt_gatt_utils import wait_for_gatt_disconnect_event -from acts.test_utils.bt.bt_gatt_utils import close_gatt_client -from acts.test_utils.bt.bt_gatt_utils import log_gatt_server_uuids -from acts.test_utils.bt.bt_gatt_utils import orchestrate_gatt_connection -from acts.test_utils.bt.bt_gatt_utils import setup_gatt_connection -from acts.test_utils.bt.bt_gatt_utils import setup_multiple_services -from acts.test_utils.bt.bt_test_utils import get_mac_address_of_generic_advertisement -from acts.test_utils.bt.bt_test_utils import clear_bonded_devices - -PHYSICAL_DISCONNECT_TIMEOUT = 5 - - -class GattConnectTest(BluetoothBaseTest): - adv_instances = [] - bluetooth_gatt_list = [] - gatt_server_list = [] - default_timeout = 10 - default_discovery_timeout = 3 - - def setup_class(self): - super().setup_class() - self.cen_ad = self.android_devices[0] - self.per_ad = self.android_devices[1] - - def setup_test(self): - super(BluetoothBaseTest, self).setup_test() - bluetooth_gatt_list = [] - self.gatt_server_list = [] - self.adv_instances = [] - # Ensure there is ample time for a physical disconnect in between - # testcases. - self.log.info( - "Waiting for {} seconds for physical GATT disconnections".format( - PHYSICAL_DISCONNECT_TIMEOUT)) - time.sleep(PHYSICAL_DISCONNECT_TIMEOUT) - - def teardown_test(self): - for bluetooth_gatt in self.bluetooth_gatt_list: - self.cen_ad.droid.gattClientClose(bluetooth_gatt) - for gatt_server in self.gatt_server_list: - self.per_ad.droid.gattServerClose(gatt_server) - for adv in self.adv_instances: - self.per_ad.droid.bleStopBleAdvertising(adv) - return True - - def _orchestrate_gatt_disconnection(self, bluetooth_gatt, gatt_callback): - self.log.info("Disconnecting from peripheral device.") - try: - disconnect_gatt_connection(self.cen_ad, bluetooth_gatt, - gatt_callback) - close_gatt_client(self.cen_ad, bluetooth_gatt) - if bluetooth_gatt in self.bluetooth_gatt_list: - self.bluetooth_gatt_list.remove(bluetooth_gatt) - except GattTestUtilsError as err: - self.log.error(err) - return False - return True - - def _find_service_added_event(self, gatt_server_cb, uuid): - expected_event = gatt_cb_strings['serv_added'].format(gatt_server_cb) - try: - event = self.per_ad.ed.pop_event(expected_event, - self.default_timeout) - except Empty: - self.log.error( - gatt_cb_strings['serv_added_err'].format(expected_event)) - return False - if event['data']['serviceUuid'].lower() != uuid.lower(): - self.log.error("Uuid mismatch. Found: {}, Expected {}.".format( - event['data']['serviceUuid'], uuid)) - return False - return True - - def _verify_mtu_changed_on_client_and_server( - self, expected_mtu, gatt_callback, gatt_server_callback): - expected_event = gatt_cb_strings['mtu_changed'].format(gatt_callback) - try: - mtu_event = self.cen_ad.ed.pop_event(expected_event, - self.default_timeout) - mtu_size_found = mtu_event['data']['MTU'] - if mtu_size_found != expected_mtu: - self.log.error("MTU size found: {}, expected: {}".format( - mtu_size_found, expected_mtu)) - return False - except Empty: - self.log.error( - gatt_cb_err['mtu_changed_err'].format(expected_event)) - return False - - expected_event = gatt_cb_strings['mtu_serv_changed'].format( - gatt_server_callback) - try: - mtu_event = self.per_ad.ed.pop_event(expected_event, - self.default_timeout) - mtu_size_found = mtu_event['data']['MTU'] - if mtu_size_found != expected_mtu: - self.log.error("MTU size found: {}, expected: {}".format( - mtu_size_found, expected_mtu)) - return False - except Empty: - self.log.error( - gatt_cb_err['mtu_serv_changed_err'].format(expected_event)) - return False - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='8a3530a3-c8bb-466b-9710-99e694c38618') - def test_gatt_connect(self): - """Test GATT connection over LE. - - Test establishing a gatt connection between a GATT server and GATT - client. - - Steps: - 1. Start a generic advertisement. - 2. Start a generic scanner. - 3. Find the advertisement and extract the mac address. - 4. Stop the first scanner. - 5. Create a GATT connection between the scanner and advertiser. - 6. Disconnect the GATT connection. - - Expected Result: - Verify that a connection was established and then disconnected - successfully. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning, GATT - Priority: 0 - """ - gatt_server_cb = self.per_ad.droid.gattServerCreateGattServerCallback() - gatt_server = self.per_ad.droid.gattServerOpenGattServer( - gatt_server_cb) - self.gatt_server_list.append(gatt_server) - try: - bluetooth_gatt, gatt_callback, adv_callback = ( - orchestrate_gatt_connection(self.cen_ad, self.per_ad)) - self.bluetooth_gatt_list.append(bluetooth_gatt) - except GattTestUtilsError as err: - self.log.error(err) - return False - self.adv_instances.append(adv_callback) - return self._orchestrate_gatt_disconnection(bluetooth_gatt, - gatt_callback) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='a839b505-03ac-4783-be7e-1d43129a1948') - def test_gatt_connect_stop_advertising(self): - """Test GATT connection over LE then stop advertising - - A test case that verifies the GATT connection doesn't - disconnect when LE advertisement is stopped. - - Steps: - 1. Start a generic advertisement. - 2. Start a generic scanner. - 3. Find the advertisement and extract the mac address. - 4. Stop the first scanner. - 5. Create a GATT connection between the scanner and advertiser. - 6. Stop the advertiser. - 7. Verify no connection state changed happened. - 8. Disconnect the GATT connection. - - Expected Result: - Verify that a connection was established and not disconnected - when advertisement stops. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning, GATT - Priority: 0 - """ - gatt_server_cb = self.per_ad.droid.gattServerCreateGattServerCallback() - gatt_server = self.per_ad.droid.gattServerOpenGattServer( - gatt_server_cb) - self.gatt_server_list.append(gatt_server) - try: - bluetooth_gatt, gatt_callback, adv_callback = ( - orchestrate_gatt_connection(self.cen_ad, self.per_ad)) - self.bluetooth_gatt_list.append(bluetooth_gatt) - except GattTestUtilsError as err: - self.log.error(err) - return False - self.per_ad.droid.bleStopBleAdvertising(adv_callback) - try: - event = self.cen_ad.ed.pop_event( - gatt_cb_strings['gatt_conn_change'].format( - gatt_callback, self.default_timeout)) - self.log.error( - "Connection event found when not expected: {}".format(event)) - return False - except Empty: - self.log.info("No connection state change as expected") - try: - self._orchestrate_gatt_disconnection(bluetooth_gatt, gatt_callback) - except Exception as err: - self.log.info("Failed to orchestrate disconnect: {}".format(err)) - return False - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='b82f91a8-54bb-4779-a117-73dc7fdb28cc') - def test_gatt_connect_autoconnect(self): - """Test GATT connection over LE. - - Test re-establishing a gatt connection using autoconnect - set to True in order to test connection whitelist. - - Steps: - 1. Start a generic advertisement. - 2. Start a generic scanner. - 3. Find the advertisement and extract the mac address. - 4. Stop the first scanner. - 5. Create a GATT connection between the scanner and advertiser. - 6. Disconnect the GATT connection. - 7. Create a GATT connection with autoconnect set to True - 8. Disconnect the GATT connection. - - Expected Result: - Verify that a connection was re-established and then disconnected - successfully. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning, GATT - Priority: 0 - """ - gatt_server_cb = self.per_ad.droid.gattServerCreateGattServerCallback() - gatt_server = self.per_ad.droid.gattServerOpenGattServer( - gatt_server_cb) - self.gatt_server_list.append(gatt_server) - autoconnect = False - mac_address, adv_callback, scan_callback = ( - get_mac_address_of_generic_advertisement(self.cen_ad, self.per_ad)) - self.adv_instances.append(adv_callback) - try: - bluetooth_gatt, gatt_callback = setup_gatt_connection( - self.cen_ad, mac_address, autoconnect) - self.cen_ad.droid.bleStopBleScan(scan_callback) - self.bluetooth_gatt_list.append(bluetooth_gatt) - except GattTestUtilsError as err: - self.log.error(err) - return False - try: - disconnect_gatt_connection(self.cen_ad, bluetooth_gatt, - gatt_callback) - close_gatt_client(self.cen_ad, bluetooth_gatt) - if bluetooth_gatt in self.bluetooth_gatt_list: - self.bluetooth_gatt_list.remove(bluetooth_gatt) - except GattTestUtilsError as err: - self.log.error(err) - return False - autoconnect = True - bluetooth_gatt = self.cen_ad.droid.gattClientConnectGatt( - gatt_callback, mac_address, autoconnect, gatt_transport['auto'], - False, gatt_phy_mask['1m_mask']) - self.bluetooth_gatt_list.append(bluetooth_gatt) - expected_event = gatt_cb_strings['gatt_conn_change'].format( - gatt_callback) - try: - event = self.cen_ad.ed.pop_event(expected_event, - self.default_timeout) - except Empty: - self.log.error( - gatt_cb_err['gatt_conn_changed_err'].format(expected_event)) - test_result = False - return self._orchestrate_gatt_disconnection(bluetooth_gatt, - gatt_callback) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='e506fa50-7cd9-4bd8-938a-6b85dcfe6bc6') - def test_gatt_connect_opportunistic(self): - """Test opportunistic GATT connection over LE. - - Test establishing a gatt connection between a GATT server and GATT - client in opportunistic mode. - - Steps: - 1. Start a generic advertisement. - 2. Start a generic scanner. - 3. Find the advertisement and extract the mac address. - 4. Stop the first scanner. - 5. Create GATT connection 1 between the scanner and advertiser normally - 6. Create GATT connection 2 between the scanner and advertiser using - opportunistic mode - 7. Disconnect GATT connection 1 - - Expected Result: - Verify GATT connection 2 automatically disconnects when GATT connection - 1 disconnect - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning, GATT - Priority: 0 - """ - gatt_server_cb = self.per_ad.droid.gattServerCreateGattServerCallback() - gatt_server = self.per_ad.droid.gattServerOpenGattServer( - gatt_server_cb) - self.gatt_server_list.append(gatt_server) - mac_address, adv_callback, scan_callback = ( - get_mac_address_of_generic_advertisement(self.cen_ad, self.per_ad)) - # Make GATT connection 1 - try: - bluetooth_gatt_1, gatt_callback_1 = setup_gatt_connection( - self.cen_ad, - mac_address, - False, - transport=gatt_transport['auto'], - opportunistic=False) - self.cen_ad.droid.bleStopBleScan(scan_callback) - self.adv_instances.append(adv_callback) - self.bluetooth_gatt_list.append(bluetooth_gatt_1) - except GattTestUtilsError as err: - self.log.error(err) - return False - # Make GATT connection 2 - try: - bluetooth_gatt_2, gatt_callback_2 = setup_gatt_connection( - self.cen_ad, - mac_address, - False, - transport=gatt_transport['auto'], - opportunistic=True) - self.bluetooth_gatt_list.append(bluetooth_gatt_2) - except GattTestUtilsError as err: - self.log.error(err) - return False - # Disconnect GATT connection 1 - try: - disconnect_gatt_connection(self.cen_ad, bluetooth_gatt_1, - gatt_callback_1) - close_gatt_client(self.cen_ad, bluetooth_gatt_1) - if bluetooth_gatt_1 in self.bluetooth_gatt_list: - self.bluetooth_gatt_list.remove(bluetooth_gatt_1) - except GattTestUtilsError as err: - self.log.error(err) - return False - # Confirm that GATT connection 2 also disconnects - wait_for_gatt_disconnect_event(self.cen_ad, gatt_callback_2) - close_gatt_client(self.cen_ad, bluetooth_gatt_2) - if bluetooth_gatt_2 in self.bluetooth_gatt_list: - self.bluetooth_gatt_list.remove(bluetooth_gatt_2) - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='1e01838e-c4de-4720-9adf-9e0419378226') - def test_gatt_request_min_mtu(self): - """Test GATT connection over LE and exercise MTU sizes. - - Test establishing a gatt connection between a GATT server and GATT - client. Request an MTU size that matches the correct minimum size. - - Steps: - 1. Start a generic advertisement. - 2. Start a generic scanner. - 3. Find the advertisement and extract the mac address. - 4. Stop the first scanner. - 5. Create a GATT connection between the scanner and advertiser. - 6. From the scanner (client) request MTU size change to the - minimum value. - 7. Find the MTU changed event on the client. - 8. Disconnect the GATT connection. - - Expected Result: - Verify that a connection was established and the MTU value found - matches the expected MTU value. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning, GATT, MTU - Priority: 0 - """ - gatt_server_cb = self.per_ad.droid.gattServerCreateGattServerCallback() - gatt_server = self.per_ad.droid.gattServerOpenGattServer( - gatt_server_cb) - self.gatt_server_list.append(gatt_server) - try: - bluetooth_gatt, gatt_callback, adv_callback = ( - orchestrate_gatt_connection(self.cen_ad, self.per_ad)) - self.bluetooth_gatt_list.append(bluetooth_gatt) - except GattTestUtilsError as err: - self.log.error(err) - return False - self.adv_instances.append(adv_callback) - expected_mtu = gatt_mtu_size['min'] - self.cen_ad.droid.gattClientRequestMtu(bluetooth_gatt, expected_mtu) - if not self._verify_mtu_changed_on_client_and_server( - expected_mtu, gatt_callback, gatt_server_cb): - return False - return self._orchestrate_gatt_disconnection(bluetooth_gatt, - gatt_callback) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='c1fa3a2d-fb47-47db-bdd1-458928cd6a5f') - def test_gatt_request_max_mtu(self): - """Test GATT connection over LE and exercise MTU sizes. - - Test establishing a gatt connection between a GATT server and GATT - client. Request an MTU size that matches the correct maximum size. - - Steps: - 1. Start a generic advertisement. - 2. Start a generic scanner. - 3. Find the advertisement and extract the mac address. - 4. Stop the first scanner. - 5. Create a GATT connection between the scanner and advertiser. - 6. From the scanner (client) request MTU size change to the - maximum value. - 7. Find the MTU changed event on the client. - 8. Disconnect the GATT connection. - - Expected Result: - Verify that a connection was established and the MTU value found - matches the expected MTU value. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning, GATT, MTU - Priority: 0 - """ - gatt_server_cb = self.per_ad.droid.gattServerCreateGattServerCallback() - gatt_server = self.per_ad.droid.gattServerOpenGattServer( - gatt_server_cb) - self.gatt_server_list.append(gatt_server) - try: - bluetooth_gatt, gatt_callback, adv_callback = ( - orchestrate_gatt_connection(self.cen_ad, self.per_ad)) - self.bluetooth_gatt_list.append(bluetooth_gatt) - except GattTestUtilsError as err: - self.log.error(err) - return False - self.adv_instances.append(adv_callback) - expected_mtu = gatt_mtu_size['max'] - self.cen_ad.droid.gattClientRequestMtu(bluetooth_gatt, expected_mtu) - if not self._verify_mtu_changed_on_client_and_server( - expected_mtu, gatt_callback, gatt_server_cb): - return False - return self._orchestrate_gatt_disconnection(bluetooth_gatt, - gatt_callback) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='4416d483-dec3-46cb-8038-4d82620f873a') - def test_gatt_request_out_of_bounds_mtu(self): - """Test GATT connection over LE and exercise an out of bound MTU size. - - Test establishing a gatt connection between a GATT server and GATT - client. Request an MTU size that is the MIN value minus 1. - - Steps: - 1. Start a generic advertisement. - 2. Start a generic scanner. - 3. Find the advertisement and extract the mac address. - 4. Stop the first scanner. - 5. Create a GATT connection between the scanner and advertiser. - 6. From the scanner (client) request MTU size change to the - minimum value minus one. - 7. Find the MTU changed event on the client. - 8. Disconnect the GATT connection. - - Expected Result: - Verify that an MTU changed event was not discovered and that - it didn't cause an exception when requesting an out of bounds - MTU. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning, GATT, MTU - Priority: 0 - """ - gatt_server_cb = self.per_ad.droid.gattServerCreateGattServerCallback() - gatt_server = self.per_ad.droid.gattServerOpenGattServer( - gatt_server_cb) - self.gatt_server_list.append(gatt_server) - try: - bluetooth_gatt, gatt_callback, adv_callback = ( - orchestrate_gatt_connection(self.cen_ad, self.per_ad)) - self.bluetooth_gatt_list.append(bluetooth_gatt) - except GattTestUtilsError as err: - self.log.error(err) - return False - self.adv_instances.append(adv_callback) - unexpected_mtu = gatt_mtu_size['min'] - 1 - self.cen_ad.droid.gattClientRequestMtu(bluetooth_gatt, unexpected_mtu) - if self._verify_mtu_changed_on_client_and_server( - unexpected_mtu, gatt_callback, gatt_server_cb): - return False - return self._orchestrate_gatt_disconnection(bluetooth_gatt, - gatt_callback) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='31ffb9ca-cc75-43fb-9802-c19f1c5856b6') - def test_gatt_connect_trigger_on_read_rssi(self): - """Test GATT connection over LE read RSSI. - - Test establishing a gatt connection between a GATT server and GATT - client then read the RSSI. - - Steps: - 1. Start a generic advertisement. - 2. Start a generic scanner. - 3. Find the advertisement and extract the mac address. - 4. Stop the first scanner. - 5. Create a GATT connection between the scanner and advertiser. - 6. From the scanner, request to read the RSSI of the advertiser. - 7. Disconnect the GATT connection. - - Expected Result: - Verify that a connection was established and then disconnected - successfully. Verify that the RSSI was ready correctly. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning, GATT, RSSI - Priority: 1 - """ - gatt_server_cb = self.per_ad.droid.gattServerCreateGattServerCallback() - gatt_server = self.per_ad.droid.gattServerOpenGattServer( - gatt_server_cb) - self.gatt_server_list.append(gatt_server) - try: - bluetooth_gatt, gatt_callback, adv_callback = ( - orchestrate_gatt_connection(self.cen_ad, self.per_ad)) - self.bluetooth_gatt_list.append(bluetooth_gatt) - except GattTestUtilsError as err: - self.log.error(err) - return False - self.adv_instances.append(adv_callback) - expected_event = gatt_cb_strings['rd_remote_rssi'].format( - gatt_callback) - if self.cen_ad.droid.gattClientReadRSSI(bluetooth_gatt): - try: - self.cen_ad.ed.pop_event(expected_event, self.default_timeout) - except Empty: - self.log.error( - gatt_cb_err['rd_remote_rssi_err'].format(expected_event)) - return self._orchestrate_gatt_disconnection(bluetooth_gatt, - gatt_callback) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='dee9ef28-b872-428a-821b-cc62f27ba936') - def test_gatt_connect_trigger_on_services_discovered(self): - """Test GATT connection and discover services of peripheral. - - Test establishing a gatt connection between a GATT server and GATT - client the discover all services from the connected device. - - Steps: - 1. Start a generic advertisement. - 2. Start a generic scanner. - 3. Find the advertisement and extract the mac address. - 4. Stop the first scanner. - 5. Create a GATT connection between the scanner and advertiser. - 6. From the scanner (central device), discover services. - 7. Disconnect the GATT connection. - - Expected Result: - Verify that a connection was established and then disconnected - successfully. Verify that the service were discovered. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning, GATT, Services - Priority: 1 - """ - gatt_server_cb = self.per_ad.droid.gattServerCreateGattServerCallback() - gatt_server = self.per_ad.droid.gattServerOpenGattServer( - gatt_server_cb) - self.gatt_server_list.append(gatt_server) - try: - bluetooth_gatt, gatt_callback, adv_callback = ( - orchestrate_gatt_connection(self.cen_ad, self.per_ad)) - self.bluetooth_gatt_list.append(bluetooth_gatt) - except GattTestUtilsError as err: - self.log.error(err) - return False - self.adv_instances.append(adv_callback) - if self.cen_ad.droid.gattClientDiscoverServices(bluetooth_gatt): - expected_event = gatt_cb_strings['gatt_serv_disc'].format( - gatt_callback) - try: - event = self.cen_ad.ed.pop_event(expected_event, - self.default_timeout) - except Empty: - self.log.error( - gatt_cb_err['gatt_serv_disc'].format(expected_event)) - return False - return self._orchestrate_gatt_disconnection(bluetooth_gatt, - gatt_callback) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='01883bdd-0cf8-48fb-bf15-467bbd4f065b') - def test_gatt_connect_trigger_on_services_discovered_iterate_attributes( - self): - """Test GATT connection and iterate peripherals attributes. - - Test establishing a gatt connection between a GATT server and GATT - client and iterate over all the characteristics and descriptors of the - discovered services. - - Steps: - 1. Start a generic advertisement. - 2. Start a generic scanner. - 3. Find the advertisement and extract the mac address. - 4. Stop the first scanner. - 5. Create a GATT connection between the scanner and advertiser. - 6. From the scanner (central device), discover services. - 7. Iterate over all the characteristics and descriptors of the - discovered features. - 8. Disconnect the GATT connection. - - Expected Result: - Verify that a connection was established and then disconnected - successfully. Verify that the services, characteristics, and descriptors - were discovered. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning, GATT, Services - Characteristics, Descriptors - Priority: 1 - """ - gatt_server_cb = self.per_ad.droid.gattServerCreateGattServerCallback() - gatt_server = self.per_ad.droid.gattServerOpenGattServer( - gatt_server_cb) - self.gatt_server_list.append(gatt_server) - try: - bluetooth_gatt, gatt_callback, adv_callback = ( - orchestrate_gatt_connection(self.cen_ad, self.per_ad)) - self.bluetooth_gatt_list.append(bluetooth_gatt) - except GattTestUtilsError as err: - self.log.error(err) - return False - self.adv_instances.append(adv_callback) - if self.cen_ad.droid.gattClientDiscoverServices(bluetooth_gatt): - expected_event = gatt_cb_strings['gatt_serv_disc'].format( - gatt_callback) - try: - event = self.cen_ad.ed.pop_event(expected_event, - self.default_timeout) - discovered_services_index = event['data']['ServicesIndex'] - except Empty: - self.log.error( - gatt_cb_err['gatt_serv_disc'].format(expected_event)) - return False - log_gatt_server_uuids(self.cen_ad, discovered_services_index) - return self._orchestrate_gatt_disconnection(bluetooth_gatt, - gatt_callback) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='d4277bee-da99-4f48-8a4d-f81b5389da18') - def test_gatt_connect_with_service_uuid_variations(self): - """Test GATT connection with multiple service uuids. - - Test establishing a gatt connection between a GATT server and GATT - client with multiple service uuid variations. - - Steps: - 1. Start a generic advertisement. - 2. Start a generic scanner. - 3. Find the advertisement and extract the mac address. - 4. Stop the first scanner. - 5. Create a GATT connection between the scanner and advertiser. - 6. From the scanner (central device), discover services. - 7. Verify that all the service uuid variations are found. - 8. Disconnect the GATT connection. - - Expected Result: - Verify that a connection was established and then disconnected - successfully. Verify that the service uuid variations are found. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning, GATT, Services - Priority: 2 - """ - try: - gatt_server_cb, gatt_server = setup_multiple_services(self.per_ad) - self.gatt_server_list.append(gatt_server) - except GattTestUtilsError as err: - self.log.error(err) - return False - try: - bluetooth_gatt, gatt_callback, adv_callback = ( - orchestrate_gatt_connection(self.cen_ad, self.per_ad)) - self.bluetooth_gatt_list.append(bluetooth_gatt) - except GattTestUtilsError as err: - self.log.error(err) - return False - self.adv_instances.append(adv_callback) - if self.cen_ad.droid.gattClientDiscoverServices(bluetooth_gatt): - expected_event = gatt_cb_strings['gatt_serv_disc'].format( - gatt_callback) - try: - event = self.cen_ad.ed.pop_event(expected_event, - self.default_timeout) - except Empty: - self.log.error( - gatt_cb_err['gatt_serv_disc'].format(expected_event)) - return False - discovered_services_index = event['data']['ServicesIndex'] - log_gatt_server_uuids(self.cen_ad, discovered_services_index) - - return self._orchestrate_gatt_disconnection(bluetooth_gatt, - gatt_callback) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='7d3442c5-f71f-44ae-bd35-f2569f01b3b8') - def test_gatt_connect_in_quick_succession(self): - """Test GATT connections multiple times. - - Test establishing a gatt connection between a GATT server and GATT - client with multiple iterations. - - Steps: - 1. Start a generic advertisement. - 2. Start a generic scanner. - 3. Find the advertisement and extract the mac address. - 4. Stop the first scanner. - 5. Create a GATT connection between the scanner and advertiser. - 6. Disconnect the GATT connection. - 7. Repeat steps 5 and 6 twenty times. - - Expected Result: - Verify that a connection was established and then disconnected - successfully twenty times. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning, GATT, Stress - Priority: 1 - """ - gatt_server_cb = self.per_ad.droid.gattServerCreateGattServerCallback() - gatt_server = self.per_ad.droid.gattServerOpenGattServer( - gatt_server_cb) - self.gatt_server_list.append(gatt_server) - mac_address, adv_callback, scan_callback = get_mac_address_of_generic_advertisement( - self.cen_ad, self.per_ad) - autoconnect = False - for i in range(1000): - self.log.info("Starting connection iteration {}".format(i + 1)) - try: - bluetooth_gatt, gatt_callback = setup_gatt_connection( - self.cen_ad, mac_address, autoconnect) - self.cen_ad.droid.bleStopBleScan(scan_callback) - except GattTestUtilsError as err: - self.log.error(err) - return False - test_result = self._orchestrate_gatt_disconnection( - bluetooth_gatt, gatt_callback) - if not test_result: - self.log.info("Failed to disconnect from peripheral device.") - return False - self.adv_instances.append(adv_callback) - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='148469d9-7ab0-4c08-b2e9-7e49e88da1fc') - def test_gatt_connect_mitm_attack(self): - """Test GATT connection with permission write encrypted mitm. - - Test establishing a gatt connection between a GATT server and GATT - client while the GATT server's characteristic includes the property - write value and the permission write encrypted mitm value. This will - prompt LE pairing and then the devices will create a bond. - - Steps: - 1. Create a GATT server and server callback on the peripheral device. - 2. Create a unique service and characteristic uuid on the peripheral. - 3. Create a characteristic on the peripheral with these properties: - gatt_characteristic['property_write'], - gatt_characteristic['permission_write_encrypted_mitm'] - 4. Create a GATT service on the peripheral. - 5. Add the characteristic to the GATT service. - 6. Create a GATT connection between your central and peripheral device. - 7. From the central device, discover the peripheral's services. - 8. Iterate the services found until you find the unique characteristic - created in step 3. - 9. Once found, write a random but valid value to the characteristic. - 10. Start pairing helpers on both devices immediately after attempting - to write to the characteristic. - 11. Within 10 seconds of writing the characteristic, there should be - a prompt to bond the device from the peripheral. The helpers will - handle the UI interaction automatically. (see - BluetoothConnectionFacade.java bluetoothStartPairingHelper). - 12. Verify that the two devices are bonded. - - Expected Result: - Verify that a connection was established and the devices are bonded. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning, GATT, Characteristic, MITM - Priority: 1 - """ - gatt_server_cb = self.per_ad.droid.gattServerCreateGattServerCallback() - gatt_server = self.per_ad.droid.gattServerOpenGattServer( - gatt_server_cb) - self.gatt_server_list.append(gatt_server) - service_uuid = "3846D7A0-69C8-11E4-BA00-0002A5D5C51B" - test_uuid = "aa7edd5a-4d1d-4f0e-883a-d145616a1630" - bonded = False - characteristic = self.per_ad.droid.gattServerCreateBluetoothGattCharacteristic( - test_uuid, gatt_characteristic['property_write'], - gatt_characteristic['permission_write_encrypted_mitm']) - gatt_service = self.per_ad.droid.gattServerCreateService( - service_uuid, gatt_service_types['primary']) - self.per_ad.droid.gattServerAddCharacteristicToService( - gatt_service, characteristic) - self.per_ad.droid.gattServerAddService(gatt_server, gatt_service) - result = self._find_service_added_event(gatt_server_cb, service_uuid) - if not result: - return False - bluetooth_gatt, gatt_callback, adv_callback = ( - orchestrate_gatt_connection(self.cen_ad, self.per_ad)) - self.bluetooth_gatt_list.append(bluetooth_gatt) - self.adv_instances.append(adv_callback) - if self.cen_ad.droid.gattClientDiscoverServices(bluetooth_gatt): - expected_event = gatt_cb_strings['gatt_serv_disc'].format( - gatt_callback) - try: - event = self.cen_ad.ed.pop_event(expected_event, - self.default_timeout) - except Empty: - self.log.error( - gatt_cb_err['gatt_serv_disc'].format(expected_event)) - return False - discovered_services_index = event['data']['ServicesIndex'] - else: - self.log.info("Failed to discover services.") - return False - test_value = [1, 2, 3, 4, 5, 6, 7] - services_count = self.cen_ad.droid.gattClientGetDiscoveredServicesCount( - discovered_services_index) - for i in range(services_count): - characteristic_uuids = ( - self.cen_ad.droid.gattClientGetDiscoveredCharacteristicUuids( - discovered_services_index, i)) - for characteristic_uuid in characteristic_uuids: - if characteristic_uuid == test_uuid: - self.cen_ad.droid.bluetoothStartPairingHelper() - self.per_ad.droid.bluetoothStartPairingHelper() - self.cen_ad.droid.gattClientCharacteristicSetValue( - bluetooth_gatt, discovered_services_index, i, - characteristic_uuid, test_value) - self.cen_ad.droid.gattClientWriteCharacteristic( - bluetooth_gatt, discovered_services_index, i, - characteristic_uuid) - start_time = time.time() + self.default_timeout - target_name = self.per_ad.droid.bluetoothGetLocalName() - while time.time() < start_time and bonded == False: - bonded_devices = \ - self.cen_ad.droid.bluetoothGetBondedDevices() - for device in bonded_devices: - if ('name' in device.keys() - and device['name'] == target_name): - bonded = True - break - bonded = False - target_name = self.cen_ad.droid.bluetoothGetLocalName() - while time.time() < start_time and bonded == False: - bonded_devices = \ - self.per_ad.droid.bluetoothGetBondedDevices() - for device in bonded_devices: - if ('name' in device.keys() - and device['name'] == target_name): - bonded = True - break - - # Dual mode devices will establish connection over the classic transport, - # in order to establish bond over both transports, and do SDP. Starting - # disconnection before all this is finished is not safe, might lead to - # race conditions, i.e. bond over classic tranport shows up after LE - # bond is already removed. - time.sleep(4) - - for ad in [self.cen_ad, self.per_ad]: - if not clear_bonded_devices(ad): - return False - - # Necessary sleep time for entries to update unbonded state - time.sleep(2) - - for ad in [self.cen_ad, self.per_ad]: - bonded_devices = ad.droid.bluetoothGetBondedDevices() - if len(bonded_devices) > 0: - self.log.error( - "Failed to unbond devices: {}".format(bonded_devices)) - return False - return self._orchestrate_gatt_disconnection(bluetooth_gatt, - gatt_callback) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='cc3fc361-7bf1-4ee2-9e46-4a27c88ce6a8') - def test_gatt_connect_get_connected_devices(self): - """Test GATT connections show up in getConnectedDevices - - Test establishing a gatt connection between a GATT server and GATT - client. Verify that active connections show up using - BluetoothManager.getConnectedDevices API. - - Steps: - 1. Start a generic advertisement. - 2. Start a generic scanner. - 3. Find the advertisement and extract the mac address. - 4. Stop the first scanner. - 5. Create a GATT connection between the scanner and advertiser. - 7. Verify the GATT Client has an open connection to the GATT Server. - 8. Verify the GATT Server has an open connection to the GATT Client. - 9. Disconnect the GATT connection. - - Expected Result: - Verify that a connection was established, connected devices are found - on both the central and peripheral devices, and then disconnected - successfully. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Scanning, GATT - Priority: 2 - """ - gatt_server_cb = self.per_ad.droid.gattServerCreateGattServerCallback() - gatt_server = self.per_ad.droid.gattServerOpenGattServer( - gatt_server_cb) - self.gatt_server_list.append(gatt_server) - try: - bluetooth_gatt, gatt_callback, adv_callback = ( - orchestrate_gatt_connection(self.cen_ad, self.per_ad)) - self.bluetooth_gatt_list.append(bluetooth_gatt) - except GattTestUtilsError as err: - self.log.error(err) - return False - conn_cen_devices = self.cen_ad.droid.bluetoothGetConnectedLeDevices( - bt_profile_constants['gatt']) - conn_per_devices = self.per_ad.droid.bluetoothGetConnectedLeDevices( - bt_profile_constants['gatt_server']) - target_name = self.per_ad.droid.bluetoothGetLocalName() - error_message = ("Connected device {} not found in list of connected " - "devices {}") - if not any(d['name'] == target_name for d in conn_cen_devices): - self.log.error(error_message.format(target_name, conn_cen_devices)) - return False - # For the GATT server only check the size of the list since - # it may or may not include the device name. - target_name = self.cen_ad.droid.bluetoothGetLocalName() - if not conn_per_devices: - self.log.error(error_message.format(target_name, conn_per_devices)) - return False - self.adv_instances.append(adv_callback) - return self._orchestrate_gatt_disconnection(bluetooth_gatt, - gatt_callback) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='a0a37ca6-9fa8-4d35-9fdb-0e25b4b8a363') - def test_gatt_connect_second_adv_after_canceling_first_adv(self): - """Test GATT connection to peripherals second advertising address. - - The the ability of cancelling GATT connections and trying to reconnect - to the same device via a different address. - - Steps: - 1. A starts advertising - 2. B starts scanning and finds A's mac address - 3. Stop advertisement from step 1. Start a new advertisement on A and - find the new new mac address, B knows of both old and new address. - 4. B1 sends connect request to old address of A - 5. B1 cancel connect attempt after 10 seconds - 6. B1 sends connect request to new address of A - 7. Verify B1 establish connection to A in less than 10 seconds - - Expected Result: - Verify that a connection was established only on the second - advertisement's mac address. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Scanning, GATT - Priority: 3 - """ - autoconnect = False - transport = gatt_transport['auto'] - opportunistic = False - # Setup a basic Gatt server on the peripheral - gatt_server_cb = self.per_ad.droid.gattServerCreateGattServerCallback() - gatt_server = self.per_ad.droid.gattServerOpenGattServer( - gatt_server_cb) - - # Set advertisement settings to include local name in advertisement - # and set the advertising mode to low_latency. - self.per_ad.droid.bleSetAdvertiseSettingsIsConnectable(True) - self.per_ad.droid.bleSetAdvertiseDataIncludeDeviceName(True) - self.per_ad.droid.bleSetAdvertiseSettingsAdvertiseMode( - ble_advertise_settings_modes['low_latency']) - - # Setup necessary advertisement objects. - advertise_data = self.per_ad.droid.bleBuildAdvertiseData() - advertise_settings = self.per_ad.droid.bleBuildAdvertiseSettings() - advertise_callback = self.per_ad.droid.bleGenBleAdvertiseCallback() - - # Step 1: Start advertisement - self.per_ad.droid.bleStartBleAdvertising( - advertise_callback, advertise_data, advertise_settings) - - # Setup scan settings for low_latency scanning and to include the local name - # of the advertisement started in step 1. - filter_list = self.cen_ad.droid.bleGenFilterList() - self.cen_ad.droid.bleSetScanSettingsNumOfMatches( - ble_scan_settings_match_nums['one']) - self.cen_ad.droid.bleSetScanFilterDeviceName( - self.per_ad.droid.bluetoothGetLocalName()) - self.cen_ad.droid.bleBuildScanFilter(filter_list) - self.cen_ad.droid.bleSetScanSettingsScanMode( - ble_scan_settings_modes['low_latency']) - - # Setup necessary scan objects. - scan_settings = self.cen_ad.droid.bleBuildScanSetting() - scan_callback = self.cen_ad.droid.bleGenScanCallback() - - # Step 2: Start scanning on central Android device and find peripheral - # address. - self.cen_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - expected_event_name = scan_result.format(scan_callback) - try: - mac_address_pre_restart = self.cen_ad.ed.pop_event( - expected_event_name, self.default_timeout)['data']['Result'][ - 'deviceInfo']['address'] - self.log.info( - "Peripheral advertisement found with mac address: {}".format( - mac_address_pre_restart)) - except Empty: - self.log.info("Peripheral advertisement not found") - test_result = False - - # Step 3: Restart peripheral advertising such that a new mac address is - # created. - self.per_ad.droid.bleStopBleAdvertising(advertise_callback) - self.per_ad.droid.bleStartBleAdvertising( - advertise_callback, advertise_data, advertise_settings) - - mac_address_post_restart = mac_address_pre_restart - - while True: - try: - mac_address_post_restart = self.cen_ad.ed.pop_event( - expected_event_name, self.default_timeout)['data']['Result'][ - 'deviceInfo']['address'] - self.log.info( - "Peripheral advertisement found with mac address: {}".format( - mac_address_post_restart)) - except Empty: - self.log.info("Peripheral advertisement not found") - test_result = False - - if mac_address_pre_restart != mac_address_post_restart: - break - - self.cen_ad.droid.bleStopBleScan(scan_callback) - - # Steps 4: Try to connect to the first mac address - gatt_callback = self.cen_ad.droid.gattCreateGattCallback() - self.log.info( - "Gatt Connect to mac address {}.".format(mac_address_pre_restart)) - bluetooth_gatt = self.cen_ad.droid.gattClientConnectGatt( - gatt_callback, mac_address_pre_restart, autoconnect, transport, - opportunistic, gatt_phy_mask['1m_mask']) - self.bluetooth_gatt_list.append(bluetooth_gatt) - expected_event = gatt_cb_strings['gatt_conn_change'].format( - gatt_callback) - try: - event = self.cen_ad.ed.pop_event(expected_event, - self.default_timeout) - self.log.error( - "Connection callback updated unexpectedly: {}".format(event)) - return False - except Empty: - self.log.info("No connection update as expected.") - - # Step 5: Cancel connection request. - self.cen_ad.droid.gattClientDisconnect(bluetooth_gatt) - close_gatt_client(self.cen_ad, bluetooth_gatt) - if bluetooth_gatt in self.bluetooth_gatt_list: - self.bluetooth_gatt_list.remove(bluetooth_gatt) - - # Step 6: Connect to second mac address. - gatt_callback = self.cen_ad.droid.gattCreateGattCallback() - self.log.info( - "Gatt Connect to mac address {}.".format(mac_address_post_restart)) - bluetooth_gatt = self.cen_ad.droid.gattClientConnectGatt( - gatt_callback, mac_address_post_restart, autoconnect, transport, - opportunistic, gatt_phy_mask['1m_mask']) - self.bluetooth_gatt_list.append(bluetooth_gatt) - expected_event = gatt_cb_strings['gatt_conn_change'].format( - gatt_callback) - - # Step 7: Verify connection was setup successfully. - try: - event = self.cen_ad.ed.pop_event(expected_event, - self.default_timeout) - self.log.info( - "Connection callback updated successfully: {}".format(event)) - if event['data']['State'] != gatt_connection_state['connected']: - self.log.error( - "Could not establish a connection to the peripheral.") - return False - except Empty: - self.log.error("No connection update was found.") - return False - - self.per_ad.droid.bleStopBleAdvertising(advertise_callback) - - return self._orchestrate_gatt_disconnection(bluetooth_gatt, - gatt_callback) diff --git a/acts/tests/google/ble/gatt/GattNotifyTest.py b/acts/tests/google/ble/gatt/GattNotifyTest.py deleted file mode 100644 index 7d62d65349..0000000000 --- a/acts/tests/google/ble/gatt/GattNotifyTest.py +++ /dev/null @@ -1,97 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -""" -This test script exercises GATT notify/indicate procedures. -""" - -from acts.test_decorators import test_tracker_info -from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest -from acts.test_utils.bt.GattConnectedBaseTest import GattConnectedBaseTest -from acts.test_utils.bt.bt_constants import gatt_characteristic -from acts.test_utils.bt.bt_constants import gatt_descriptor -from acts.test_utils.bt.bt_constants import gatt_event -from acts.test_utils.bt.bt_constants import gatt_cb_strings -from acts.test_utils.bt.bt_constants import gatt_char_desc_uuids -from math import ceil - - -class GattNotifyTest(GattConnectedBaseTest): - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='e0ba60af-c1f2-4516-a5d5-89e2def0c757') - def test_notify_char(self): - """Test notify characteristic value. - - Test GATT notify characteristic value. - - Steps: - 1. Central: write CCC - register for notifications. - 2. Peripheral: receive CCC modification. - 3. Peripheral: send characteristic notification. - 4. Central: receive notification, verify it's conent matches what was - sent - - Expected Result: - Verify that notification registration and delivery works. - - Returns: - Pass if True - Fail if False - - TAGS: LE, GATT, Characteristic - Priority: 0 - """ - #write CCC descriptor to enable notifications - self.cen_ad.droid.gattClientDescriptorSetValue( - self.bluetooth_gatt, self.discovered_services_index, - self.test_service_index, self.NOTIFIABLE_CHAR_UUID, - gatt_char_desc_uuids['client_char_cfg'], - gatt_descriptor['enable_notification_value']) - - self.cen_ad.droid.gattClientWriteDescriptor( - self.bluetooth_gatt, self.discovered_services_index, - self.test_service_index, self.NOTIFIABLE_CHAR_UUID, - gatt_char_desc_uuids['client_char_cfg']) - - #enable notifications in app - self.cen_ad.droid.gattClientSetCharacteristicNotification( - self.bluetooth_gatt, self.discovered_services_index, - self.test_service_index, self.NOTIFIABLE_CHAR_UUID, True) - - event = self._server_wait(gatt_event['desc_write_req']) - - request_id = event['data']['requestId'] - bt_device_id = 0 - status = 0 - #confirm notification registration was successful - self.per_ad.droid.gattServerSendResponse( - self.gatt_server, bt_device_id, request_id, status, 0, []) - #wait for client to get response - event = self._client_wait(gatt_event['desc_write']) - - #set notified value - notified_value = [1, 5, 9, 7, 5, 3, 6, 4, 8, 2] - self.per_ad.droid.gattServerCharacteristicSetValue( - self.notifiable_char_index, notified_value) - - #send notification - self.per_ad.droid.gattServerNotifyCharacteristicChanged( - self.gatt_server, bt_device_id, self.notifiable_char_index, False) - - #wait for client to receive the notification - event = self._client_wait(gatt_event['char_change']) - self.assertEqual(notified_value, event["data"]["CharacteristicValue"]) - - return True diff --git a/acts/tests/google/ble/gatt/GattReadTest.py b/acts/tests/google/ble/gatt/GattReadTest.py deleted file mode 100644 index e880757586..0000000000 --- a/acts/tests/google/ble/gatt/GattReadTest.py +++ /dev/null @@ -1,198 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -""" -This test script exercises different GATT read procedures. -""" - -from acts.test_decorators import test_tracker_info -from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest -from acts.test_utils.bt.GattConnectedBaseTest import GattConnectedBaseTest -from acts.test_utils.bt.bt_constants import gatt_characteristic -from acts.test_utils.bt.bt_constants import gatt_descriptor -from acts.test_utils.bt.bt_constants import gatt_event -from acts.test_utils.bt.bt_constants import gatt_cb_strings -from math import ceil - - -class GattReadTest(GattConnectedBaseTest): - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='ed8523f4-0eb8-4d14-b558-d3c28902f8bb') - def test_read_char(self): - """Test read characteristic value. - - Test GATT read characteristic value. - - Steps: - 1. Central: send read request. - 2. Peripheral: receive read request . - 3. Peripheral: send read response with status 0 (success), and - characteristic value. - 4. Central: receive read response, verify it's conent matches what was - sent - - Expected Result: - Verify that read request/response is properly delivered. - - Returns: - Pass if True - Fail if False - - TAGS: LE, GATT, Characteristic - Priority: 0 - """ - self.cen_ad.droid.gattClientReadCharacteristic( - self.bluetooth_gatt, self.discovered_services_index, - self.test_service_index, self.READABLE_CHAR_UUID) - - event = self._server_wait(gatt_event['char_read_req']) - - request_id = event['data']['requestId'] - self.assertEqual(0, event['data']['offset'], "offset should be 0") - - bt_device_id = 0 - status = 0 - char_value = [1, 2, 3, 4, 5, 6, 7, 20] - offset = 0 - self.per_ad.droid.gattServerSendResponse(self.gatt_server, - bt_device_id, request_id, - status, offset, char_value) - - event = self._client_wait(gatt_event['char_read']) - self.assertEqual(status, event["data"]["Status"], - "Write status should be 0") - self.assertEqual(char_value, event["data"]["CharacteristicValue"], - "Read value shall be equal to value sent from server") - - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='5916a78d-3db8-4df2-9b96-b25e99096e0d') - def test_read_long_char(self): - """Test read long characteristic value. - - Test GATT read long characteristic value. - - Steps: - 1. Central: send read request. - 2. Peripheral: receive read request . - 3. Peripheral: send read response with status 0 (success), and - characteristic content. - 5. Central: stack receives read response that was full, so stack sends - read blob request with increased offset. - 6. Peripheral: receive read blob request, send read blob response with - next piece of characteristic value. - 7. Central: stack receives read blob response, so stack sends read blob - request with increased offset. No Java callbacks are called here - 8. Repeat steps 6 and 7 until whole characteristic is read. - 9. Central: verify onCharacteristicRead callback is called with whole - characteristic content. - - Expected Result: - Verify that read request/response is properly delivered, and that read - blob reqest/response is properly sent internally by the stack. - - Returns: - Pass if True - Fail if False - - TAGS: LE, GATT, Characteristic - Priority: 0 - """ - char_value = [] - for i in range(512): - char_value.append(i % 256) - - self.cen_ad.droid.gattClientReadCharacteristic( - self.bluetooth_gatt, self.discovered_services_index, - self.test_service_index, self.READABLE_CHAR_UUID) - - # characteristic value is divided into packets, each contains MTU-1 - # bytes. Compute number of packets we expect to receive. - num_packets = ceil((len(char_value) + 1) / (self.mtu - 1)) - - for i in range(num_packets): - startOffset = i * (self.mtu - 1) - - event = self._server_wait(gatt_event['char_read_req']) - - request_id = event['data']['requestId'] - self.assertEqual(startOffset, event['data']['offset'], - "offset should be 0") - - bt_device_id = 0 - status = 0 - offset = 0 - self.per_ad.droid.gattServerSendResponse( - self.gatt_server, bt_device_id, request_id, status, offset, - char_value[startOffset:startOffset + self.mtu - 1]) - - event = self._client_wait(gatt_event['char_read']) - - self.assertEqual(status, event["data"]["Status"], - "Write status should be 0") - self.assertEqual(char_value, event["data"]["CharacteristicValue"], - "Read value shall be equal to value sent from server") - - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='12498522-cac5-478b-a0cd-faa542832fa8') - def test_read_using_char_uuid(self): - """Test read using characteristic UUID. - - Test GATT read value using characteristic UUID. - - Steps: - 1. Central: send read by UUID request. - 2. Peripheral: receive read request . - 3. Peripheral: send read response with status 0 (success), and - characteristic value. - 4. Central: receive read response, verify it's conent matches what was - sent - - Expected Result: - Verify that read request/response is properly delivered. - - Returns: - Pass if True - Fail if False - - TAGS: LE, GATT, Characteristic - Priority: 0 - """ - self.cen_ad.droid.gattClientReadUsingCharacteristicUuid( - self.bluetooth_gatt, self.READABLE_CHAR_UUID, 0x0001, 0xFFFF) - - event = self._server_wait(gatt_event['char_read_req']) - - request_id = event['data']['requestId'] - self.assertEqual(0, event['data']['offset'], "offset should be 0") - - bt_device_id = 0 - status = 0 - char_value = [1, 2, 3, 4, 5, 6, 7, 20] - offset = 0 - self.per_ad.droid.gattServerSendResponse(self.gatt_server, - bt_device_id, request_id, - status, offset, char_value) - - event = self._client_wait(gatt_event['char_read']) - self.assertEqual(status, event["data"]["Status"], - "Write status should be 0") - self.assertEqual(char_value, event["data"]["CharacteristicValue"], - "Read value shall be equal to value sent from server") - - return True diff --git a/acts/tests/google/ble/gatt/GattToolTest.py b/acts/tests/google/ble/gatt/GattToolTest.py deleted file mode 100644 index 8e7a9f0182..0000000000 --- a/acts/tests/google/ble/gatt/GattToolTest.py +++ /dev/null @@ -1,445 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -""" -This test script is for partial automation of LE devices - -This script requires these custom parameters in the config file: - -"ble_mac_address" -"service_uuid" -"notifiable_char_uuid" -""" - -import pprint -from queue import Empty -import time - -from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest -from acts.test_utils.bt.bt_constants import ble_scan_settings_modes -from acts.test_utils.bt.bt_constants import gatt_cb_err -from acts.test_utils.bt.bt_constants import gatt_cb_strings -from acts.test_utils.bt.bt_constants import gatt_descriptor -from acts.test_utils.bt.bt_constants import gatt_transport -from acts.test_utils.bt.bt_constants import scan_result -from acts.test_utils.bt.bt_gatt_utils import GattTestUtilsError -from acts.test_utils.bt.bt_gatt_utils import disconnect_gatt_connection -from acts.test_utils.bt.bt_test_utils import generate_ble_scan_objects -from acts.test_utils.bt.bt_gatt_utils import setup_gatt_connection -from acts.test_utils.bt.bt_gatt_utils import log_gatt_server_uuids -from acts.test_utils.bt.bt_test_utils import reset_bluetooth - - -class GattToolTest(BluetoothBaseTest): - AUTOCONNECT = False - DEFAULT_TIMEOUT = 10 - PAIRING_TIMEOUT = 20 - adv_instances = [] - timer_list = [] - - def setup_class(self): - super().setup_class() - # Central role Android device - self.cen_ad = self.android_devices[0] - self.ble_mac_address = self.user_params['ble_mac_address'] - self.SERVICE_UUID = self.user_params['service_uuid'] - self.NOTIFIABLE_CHAR_UUID = self.user_params['notifiable_char_uuid'] - # CCC == Client Characteristic Configuration - self.CCC_DESC_UUID = "00002902-0000-1000-8000-00805f9b34fb" - - def setup_test(self): - super(BluetoothBaseTest, self).setup_test() - if not self._is_peripheral_advertising(): - input("Press enter when peripheral is advertising...") - return True - - def teardown_test(self): - super(BluetoothBaseTest, self).teardown_test() - self.log_stats() - self.timer_list = [] - return True - - def _pair_with_peripheral(self): - self.cen_ad.droid.bluetoothDiscoverAndBond(self.ble_mac_address) - end_time = time.time() + self.PAIRING_TIMEOUT - self.log.info("Verifying devices are bonded") - while time.time() < end_time: - bonded_devices = self.cen_ad.droid.bluetoothGetBondedDevices() - if self.ble_mac_address in {d['address'] for d in bonded_devices}: - self.log.info("Successfully bonded to device") - return True - return False - - def _is_peripheral_advertising(self): - self.cen_ad.droid.bleSetScanFilterDeviceAddress(self.ble_mac_address) - self.cen_ad.droid.bleSetScanSettingsScanMode( - ble_scan_settings_modes['low_latency']) - filter_list, scan_settings, scan_callback = generate_ble_scan_objects( - self.cen_ad.droid) - self.cen_ad.droid.bleBuildScanFilter(filter_list) - - self.cen_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - expected_event_name = scan_result.format(scan_callback) - test_result = True - try: - self.cen_ad.ed.pop_event(expected_event_name, self.DEFAULT_TIMEOUT) - self.log.info( - "Peripheral found with event: {}".format(expected_event_name)) - except Empty: - self.log.info("Peripheral not advertising or not found: {}".format( - self.ble_mac_address)) - test_result = False - self.cen_ad.droid.bleStopBleScan(scan_callback) - return test_result - - def _unbond_device(self): - self.cen_ad.droid.bluetoothUnbond(self.ble_mac_address) - time.sleep(2) #Grace timeout for unbonding to finish - bonded_devices = self.cen_ad.droid.bluetoothGetBondedDevices() - if bonded_devices: - self.log.error( - "Failed to unbond device... found: {}".format(bonded_devices)) - return False - return True - - @BluetoothBaseTest.bt_test_wrap - def test_gatt_connect_without_scanning(self): - """Test the round trip speed of connecting to a peripheral - - This test will prompt the user to press "Enter" when the - peripheral is in a connecable advertisement state. Once - the user presses enter, this script will measure the amount - of time it takes to establish a GATT connection to the - peripheral. The test will then disconnect - - Steps: - 1. Wait for user input to confirm peripheral is advertising. - 2. Start timer - 3. Perform GATT connection to peripheral - 4. Upon successful connection, stop timer - 5. Disconnect from peripheral - - Expected Result: - Device should be connected successfully - - Returns: - Pass if True - Fail if False - - TAGS: LE, GATT - Priority: 1 - """ - self.AUTOCONNECT = False - start_time = self._get_time_in_milliseconds() - try: - bluetooth_gatt, gatt_callback = (setup_gatt_connection( - self.cen_ad, self.ble_mac_address, self.AUTOCONNECT, - gatt_transport['le'])) - except GattTestUtilsError as err: - self.log.error(err) - return False - end_time = self._get_time_in_milliseconds() - self.log.info("Total time (ms): {}".format(end_time - start_time)) - try: - disconnect_gatt_connection(self.cen_ad, bluetooth_gatt, - gatt_callback) - self.cen_ad.droid.gattClientClose(bluetooth_gatt) - except GattTestUtilsError as err: - self.log.error(err) - return False - self.cen_ad.droid.gattClientClose(bluetooth_gatt) - - @BluetoothBaseTest.bt_test_wrap - def test_gatt_connect_stress(self): - """Test the round trip speed of connecting to a peripheral many times - - This test will prompt the user to press "Enter" when the - peripheral is in a connecable advertisement state. Once - the user presses enter, this script will measure the amount - of time it takes to establish a GATT connection to the - peripheral. The test will then disconnect. It will attempt to - repeat this process multiple times. - - Steps: - 1. Wait for user input to confirm peripheral is advertising. - 2. Start timer - 3. Perform GATT connection to peripheral - 4. Upon successful connection, stop timer - 5. Disconnect from peripheral - 6. Repeat steps 2-5 1000 times. - - Expected Result: - Test should measure 1000 iterations of connect/disconnect cycles. - - Returns: - Pass if True - Fail if False - - TAGS: LE, GATT - Priority: 2 - """ - filter_list, scan_settings, scan_callback = generate_ble_scan_objects( - self.cen_ad.droid) - self.cen_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - self.AUTOCONNECT = False - iterations = 1000 - n = 0 - while n < iterations: - self.start_timer() - try: - bluetooth_gatt, gatt_callback = (setup_gatt_connection( - self.cen_ad, self.ble_mac_address, self.AUTOCONNECT, - gatt_transport['le'])) - except GattTestUtilsError as err: - self.log.error(err) - return False - self.log.info("Total time (ms): {}".format(self.end_timer())) - try: - disconnect_gatt_connection(self.cen_ad, bluetooth_gatt, - gatt_callback) - self.cen_ad.droid.gattClientClose(bluetooth_gatt) - except GattTestUtilsError as err: - self.log.error(err) - return False - n += 1 - return True - - @BluetoothBaseTest.bt_test_wrap - def test_gatt_connect_iterate_uuids(self): - """Test the discovery of uuids of a peripheral - - This test will prompt the user to press "Enter" when the - peripheral is in a connecable advertisement state. Once - the user presses enter, this script connects an Android device - to the periphal and attempt to discover all services, - characteristics, and descriptors. - - Steps: - 1. Wait for user input to confirm peripheral is advertising. - 2. Perform GATT connection to peripheral - 3. Upon successful connection, iterate through all services, - characteristics, and descriptors. - 5. Disconnect from peripheral - - Expected Result: - Device services, characteristics, and descriptors should all - be read. - - Returns: - Pass if True - Fail if False - - TAGS: LE, GATT - Priority: 2 - """ - try: - bluetooth_gatt, gatt_callback = (setup_gatt_connection( - self.cen_ad, self.ble_mac_address, self.AUTOCONNECT, - gatt_transport['le'])) - except GattTestUtilsError as err: - self.log.error(err) - return False - if self.cen_ad.droid.gattClientDiscoverServices(bluetooth_gatt): - expected_event = gatt_cb_strings['gatt_serv_disc'].format( - gatt_callback) - try: - event = self.cen_ad.ed.pop_event(expected_event, - self.DEFAULT_TIMEOUT) - discovered_services_index = event['data']['ServicesIndex'] - except Empty: - self.log.error( - gatt_cb_err['gatt_serv_disc'].format(expected_event)) - return False - log_gatt_server_uuids(self.cen_ad, discovered_services_index) - try: - disconnect_gatt_connection(self.cen_ad, bluetooth_gatt, - gatt_callback) - self.cen_ad.droid.gattClientClose(bluetooth_gatt) - except GattTestUtilsError as err: - self.log.error(err) - return False - self.cen_ad.droid.gattClientClose(bluetooth_gatt) - return True - - @BluetoothBaseTest.bt_test_wrap - def test_pairing(self): - """Test pairing to a GATT mac address - - This test will prompt the user to press "Enter" when the - peripheral is in a connecable advertisement state. Once - the user presses enter, this script will bond the Android device - to the peripheral. - - Steps: - 1. Wait for user input to confirm peripheral is advertising. - 2. Perform Bluetooth pairing to GATT mac address - 3. Upon successful bonding. - 4. Unbond from device - - Expected Result: - Device services, characteristics, and descriptors should all - be read. - - Returns: - Pass if True - Fail if False - - TAGS: LE, GATT - Priority: 1 - """ - if not self._pair_with_peripheral(): - return False - self.cen_ad.droid.bluetoothUnbond(self.ble_mac_address) - return self._unbond_device() - - @BluetoothBaseTest.bt_test_wrap - def test_pairing_stress(self): - """Test the round trip speed of pairing to a peripheral many times - - This test will prompt the user to press "Enter" when the - peripheral is in a connecable advertisement state. Once - the user presses enter, this script will measure the amount - of time it takes to establish a pairing with a BLE device. - - Steps: - 1. Wait for user input to confirm peripheral is advertising. - 2. Start timer - 3. Perform Bluetooth pairing to GATT mac address - 4. Upon successful bonding, stop timer. - 5. Unbond from device - 6. Repeat steps 2-5 100 times. - - Expected Result: - Test should measure 100 iterations of bonding. - - Returns: - Pass if True - Fail if False - - TAGS: LE, GATT - Priority: 3 - """ - iterations = 100 - for _ in range(iterations): - start_time = self.start_timer() - if not self._pair_with_peripheral(): - return False - self.log.info("Total time (ms): {}".format(self.end_timer())) - if not self._unbond_device(): - return False - return True - - @BluetoothBaseTest.bt_test_wrap - def test_gatt_notification_longev(self): - """Test GATT characterisitic notifications for long periods of time - - This test will prompt the user to press "Enter" when the - peripheral is in a connecable advertisement state. Once - the user presses enter, this script aims to set characteristic - notification to true on the config file's SERVICE_UUID, - NOTIFIABLE_CHAR_UUID, and CCC_DESC_UUID. This test assumes - the peripheral will constantly write data to a notifiable - characteristic. - - Steps: - 1. Wait for user input to confirm peripheral is advertising. - 2. Perform Bluetooth pairing to GATT mac address - 3. Perform a GATT connection to the periheral - 4. Get the discovered service uuid that matches the user's input - in the config file - 4. Write to the CCC descriptor to enable notifications - 5. Enable notifications on the user's input Characteristic UUID - 6. Continuously wait for Characteristic Changed events which - equate to recieving notifications for 15 minutes. - - Expected Result: - There should be no disconnects and we should constantly receive - Characteristic Changed information. Values should vary upon user - interaction with the peripheral. - - Returns: - Pass if True - Fail if False - - TAGS: LE, GATT - Priority: 1 - """ - #pair devices - if not self._pair_with_peripheral(): - return False - try: - bluetooth_gatt, gatt_callback = (setup_gatt_connection( - self.cen_ad, self.ble_mac_address, self.AUTOCONNECT, - gatt_transport['le'])) - except GattTestUtilsError as err: - self.log.error(err) - return False - if self.cen_ad.droid.gattClientDiscoverServices(bluetooth_gatt): - expected_event = gatt_cb_strings['gatt_serv_disc'].format( - gatt_callback) - try: - event = self.cen_ad.ed.pop_event(expected_event, - self.DEFAULT_TIMEOUT) - discovered_services_index = event['data']['ServicesIndex'] - except Empty: - self.log.error( - gatt_cb_err['gatt_serv_disc'].format(expected_event)) - return False - # TODO: in setup save service_cound and discovered_services_index - # programatically - services_count = self.cen_ad.droid.gattClientGetDiscoveredServicesCount( - discovered_services_index) - test_service_index = None - for i in range(services_count): - disc_service_uuid = ( - self.cen_ad.droid.gattClientGetDiscoveredServiceUuid( - discovered_services_index, i)) - if disc_service_uuid == self.SERVICE_UUID: - test_service_index = i - break - if not test_service_index: - self.log.error("Service not found.") - return False - - self.cen_ad.droid.gattClientDescriptorSetValue( - bluetooth_gatt, discovered_services_index, test_service_index, - self.NOTIFIABLE_CHAR_UUID, self.CCC_DESC_UUID, - gatt_descriptor['enable_notification_value']) - - self.cen_ad.droid.gattClientWriteDescriptor( - bluetooth_gatt, discovered_services_index, test_service_index, - self.NOTIFIABLE_CHAR_UUID, self.CCC_DESC_UUID) - - self.cen_ad.droid.gattClientSetCharacteristicNotification( - bluetooth_gatt, discovered_services_index, test_service_index, - self.NOTIFIABLE_CHAR_UUID, True) - - # set 15 minute notification test time - notification_test_time = 900 - end_time = time.time() + notification_test_time - expected_event = gatt_cb_strings['char_change'].format(gatt_callback) - while time.time() < end_time: - try: - event = self.cen_ad.ed.pop_event(expected_event, - self.DEFAULT_TIMEOUT) - self.log.info(event) - except Empty as err: - print(err) - self.log.error( - gatt_cb_err['char_change_err'].format(expected_event)) - return False - return True diff --git a/acts/tests/google/ble/gatt/GattWriteTest.py b/acts/tests/google/ble/gatt/GattWriteTest.py deleted file mode 100644 index d245e9e36e..0000000000 --- a/acts/tests/google/ble/gatt/GattWriteTest.py +++ /dev/null @@ -1,572 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -""" -This test script exercises different GATT write procedures. -""" - -from acts.test_decorators import test_tracker_info -from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest -from acts.test_utils.bt.GattConnectedBaseTest import GattConnectedBaseTest -from acts.test_utils.bt.bt_constants import gatt_characteristic -from acts.test_utils.bt.bt_constants import gatt_descriptor -from acts.test_utils.bt.bt_constants import gatt_event -from acts.test_utils.bt.bt_constants import gatt_cb_strings -from acts.test_utils.bt.bt_constants import gatt_connection_priority -from acts.test_utils.bt.bt_constants import gatt_characteristic_attr_length -from acts.test_utils.bt.bt_constants import gatt_mtu_size -from acts.test_utils.bt.bt_gatt_utils import setup_gatt_mtu - - -class GattWriteTest(GattConnectedBaseTest): - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='513f4cef-489e-4bb6-96cc-c298c589225c') - def test_write_char(self): - """Test write characteristic value - - Test write characteristic value using Write Request - - 1. Central: write WRITABLE_CHAR_UUID characteristic with char_value - using write request. - 2. Peripheral: receive the written data. - 3. Peripheral: send response with status 0 (success). - 4. Central: make sure write callback is called. - - Expected Result: - Verify that write request/response is properly delivered. - - Returns: - Pass if True - Fail if False - - TAGS: LE, GATT, Characteristic - Priority: 0 - """ - char_value = [1, 2, 3, 4, 5, 6, 7] - self.cen_ad.droid.gattClientCharacteristicSetValue( - self.bluetooth_gatt, self.discovered_services_index, - self.test_service_index, self.WRITABLE_CHAR_UUID, char_value) - - self.cen_ad.droid.gattClientCharacteristicSetWriteType( - self.bluetooth_gatt, self.discovered_services_index, - self.test_service_index, self.WRITABLE_CHAR_UUID, - gatt_characteristic['write_type_default']) - - self.cen_ad.droid.gattClientWriteCharacteristic( - self.bluetooth_gatt, self.discovered_services_index, - self.test_service_index, self.WRITABLE_CHAR_UUID) - - event = self._server_wait(gatt_event['char_write_req']) - - request_id = event['data']['requestId'] - self.assertEqual(True, event['data']['responseNeeded'], - "Should need response") - self.assertEqual(char_value, event['data']['value']) - self.assertEqual(0, event['data']['offset']) - - bt_device_id = 0 - status = 0 - #both offset and return value don't matter, just the status - offset = 0 - self.per_ad.droid.gattServerGetConnectedDevices(self.gatt_server) - self.per_ad.droid.gattServerSendResponse( - self.gatt_server, bt_device_id, request_id, status, offset, []) - - event = self._client_wait(gatt_event['char_write']) - self.assertEqual(status, event["data"]["Status"], - "Write status should be 0") - # Write response doesn't carry any data expcept status - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='329dbef8-1b54-47e2-a388-b33ef9384464') - def test_write_descr(self): - """Test write descriptor value - - Test write descriptor value - - 1. Central: write WRITABLE_DESC_UUID descriptor with desc_value. - 2. Peripheral: receive the written data. - 3. Peripheral: send response with status 0 (success). - 4. Central: make sure write callback is called. - - Expected Result: - Verify that write request/response is properly delivered. - - Returns: - Pass if True - Fail if False - - TAGS: LE, GATT, Descriptor - Priority: 0 - """ - desc_value = [1, 2, 3, 4, 5, 6, 7] - self.cen_ad.droid.gattClientDescriptorSetValue( - self.bluetooth_gatt, self.discovered_services_index, - self.test_service_index, self.WRITABLE_CHAR_UUID, - self.WRITABLE_DESC_UUID, desc_value) - - self.cen_ad.droid.gattClientWriteDescriptor( - self.bluetooth_gatt, self.discovered_services_index, - self.test_service_index, self.WRITABLE_CHAR_UUID, - self.WRITABLE_DESC_UUID) - - event = self._server_wait(gatt_event['desc_write_req']) - - request_id = event['data']['requestId'] - self.assertEqual(True, event['data']['responseNeeded'], - "Should need response") - self.assertEqual(desc_value, event['data']['value']) - self.assertEqual(0, event['data']['offset']) - - bt_device_id = 0 - status = 0 - #both offset and return value don't matter, just the status - offset = 0 - self.per_ad.droid.gattServerGetConnectedDevices(self.gatt_server) - self.per_ad.droid.gattServerSendResponse( - self.gatt_server, bt_device_id, request_id, status, offset, []) - - event = self._client_wait(gatt_event['desc_write']) - self.assertEqual(status, event["data"]["Status"], - "Write status should be 0") - # Write response doesn't carry any data except status - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='85757307-5bb1-43e5-9331-f1d7bdcbd6a0') - def test_write_char_no_resp(self): - """Test write characteristic value - - Test write characteristic value using Write Command - - 1. Central: write WRITABLE_CHAR_UUID characteristic with char_value - using write command. - 2. Central: make sure write callback is called. - 3. Peripheral: receive the written data. - - Expected Result: - Verify that write command is properly delivered. - - Returns: - Pass if True - Fail if False - - TAGS: LE, GATT, Characteristic - Priority: 0 - """ - char_value = [1, 2, 3, 4, 5, 6, 7] - self.cen_ad.droid.gattClientCharacteristicSetValue( - self.bluetooth_gatt, self.discovered_services_index, - self.test_service_index, self.WRITABLE_CHAR_UUID, char_value) - - self.cen_ad.droid.gattClientCharacteristicSetWriteType( - self.bluetooth_gatt, self.discovered_services_index, - self.test_service_index, self.WRITABLE_CHAR_UUID, - gatt_characteristic['write_type_no_response']) - - self.cen_ad.droid.gattClientWriteCharacteristic( - self.bluetooth_gatt, self.discovered_services_index, - self.test_service_index, self.WRITABLE_CHAR_UUID) - - event = self._client_wait(gatt_event['char_write']) - if event["data"]["Status"] != 0: - self.log.error("Write status should be 0") - return False - - event = self._server_wait(gatt_event['char_write_req']) - - request_id = event['data']['requestId'] - self.assertEqual(False, event['data']['responseNeeded'], - "Should not need response") - self.assertEqual(0, event['data']['offset']) - self.assertEqual(char_value, event['data']['value']) - - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='0bf0182a-c315-4160-81be-9ce09f93608b') - def test_write_characteristic_long_no_resp(self): - """Test write characteristic value - - Test write characteristic value using Write Command - - 1. Central: write WRITABLE_CHAR_UUID characteristic with char_value - using write command. - 2. Central: make sure write callback is called. - 3. Peripheral: receive the written data. Check it was properly trimmed. - - Expected Result: - Verify that write command is properly trimmed and delivered. - - Returns: - Pass if True - Fail if False - - TAGS: LE, GATT, Characteristic - Priority: 0 - """ - char_value = [] - for i in range(512): - char_value.append(i % 256) - - self.cen_ad.droid.gattClientCharacteristicSetValue( - self.bluetooth_gatt, self.discovered_services_index, - self.test_service_index, self.WRITABLE_CHAR_UUID, char_value) - - self.cen_ad.droid.gattClientCharacteristicSetWriteType( - self.bluetooth_gatt, self.discovered_services_index, - self.test_service_index, self.WRITABLE_CHAR_UUID, - gatt_characteristic['write_type_no_response']) - - self.cen_ad.droid.gattClientWriteCharacteristic( - self.bluetooth_gatt, self.discovered_services_index, - self.test_service_index, self.WRITABLE_CHAR_UUID) - - event = self._server_wait(gatt_event['char_write_req']) - - request_id = event['data']['requestId'] - self.assertEqual(False, event['data']['responseNeeded']) - - # value shall be trimmed to MTU-3 - trimmed_value = char_value[0:self.mtu - 3] - self.assertEqual( - trimmed_value, event['data']['value'], - "Received value should be sent value trimmed to MTU-3") - - event = self._client_wait(gatt_event['char_write']) - if event["data"]["Status"] != 0: - self.log.error("Write status should be 0") - return False - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='b80f1b5a-a223-441e-a6ed-d3c284c83cc7') - def test_write_characteristic_value_longer_than_mtu_request(self): - """Test writing characteristic value longer than what mtu limts - - Test establishing a gatt connection between a GATT Peripheral and GATT - Client. Request mtu size equal to the max MTU. - The max number of bytes can be sent within a characteristic is - (MTU - gatt_characteristic_attr_length['attr_2']) since - the gatt_characteristic_attr_length['attr_2'] (3 bytes) are - used for its attribute of the command code and its handle. - Then reduce mtu by 1 and re-send the same characteristic. - Make sure the characteristic value received by the remote side is - also reduced properly. - - Steps: - 1. Create a GATT connection between the scanner(Client) and - advertiser(Peripheral). - 2. Client: request new mtu size change to max MTU. - 3. Client: write a characteristic with char_value of max MTU bytes. - 4. Peripheral: receive the written data. Check it was properly - truncated to (max MTU - gatt_characteristic_attr_length['attr_2']). - 5. Client: request mtu size change to (max MTU - 1). - 6. Client: write the same characteristic again. - 7. Peripheral: receive the written data. Check it was properly - truncated to (max MTU - 1 - gatt_characteristic_attr_length['attr_2']) - 8. Client: return mtu size. - - Expected Result: - Verify that data received by the Peripheral side is properly truncated - when mtu is set. - - Returns: - Pass if True - Fail if False - - TAGS: LE, GATT, Characteristic, MTU - Priority: 2 - """ - self.mtu = gatt_mtu_size['max'] - self.log.info("Set mtu to max MTU: {}".format(self.mtu)) - # set new MTU to the middle point of min and max of MTU - if not setup_gatt_mtu(self.cen_ad, self.bluetooth_gatt, - self.gatt_callback, self.mtu): - return False - - # create a characteristic with max MTU (217) bytes - char_value = [] - for i in range(gatt_mtu_size['max']): - char_value.append(i) - - self.cen_ad.droid.gattClientCharacteristicSetValue( - self.bluetooth_gatt, self.discovered_services_index, - self.test_service_index, self.WRITABLE_CHAR_UUID, char_value) - - self.cen_ad.droid.gattClientCharacteristicSetWriteType( - self.bluetooth_gatt, self.discovered_services_index, - self.test_service_index, self.WRITABLE_CHAR_UUID, - gatt_characteristic['write_type_no_response']) - - # write data to the characteristic of the Peripheral - self.cen_ad.droid.gattClientWriteCharacteristic( - self.bluetooth_gatt, self.discovered_services_index, - self.test_service_index, self.WRITABLE_CHAR_UUID) - - event = self._server_wait(gatt_event['char_write_req']) - self.log.info("Received value with mtu = max MTU: {}".format(event[ - 'data']['value'])) - - # check the data received by Peripheral shall be truncated to - # (mtu - gatt_characteristic_attr_length['attr_2']) bytes - data_length = self.mtu - gatt_characteristic_attr_length['attr_2'] - expected_value = char_value[:data_length] - self.assertEqual( - expected_value, event['data']['value'], - "Received value should have {} bytes".format(data_length)) - - # set the mtu to max MTU-1 - self.mtu = gatt_mtu_size['max'] - 1 - self.log.info("Set mtu to max MTU - 1 : {}".format(self.mtu)) - data_length = self.mtu - gatt_characteristic_attr_length['attr_2'] - if not setup_gatt_mtu(self.cen_ad, self.bluetooth_gatt, - self.gatt_callback, self.mtu): - return False - - # write the same characteric to Peripheral again - self.cen_ad.droid.gattClientWriteCharacteristic( - self.bluetooth_gatt, self.discovered_services_index, - self.test_service_index, self.WRITABLE_CHAR_UUID) - - event = self._server_wait(gatt_event['char_write_req']) - self.log.info("Data received when mtu = max MTU - 1: {}".format(event[ - 'data']['value'])) - - # check the data received by Peripheral shall be truncated to - # (mtu - gatt_characteristic_attr_length['attr_2']) bytes - # when mtu is reduced - expected_value = char_value[:data_length] - self.assertEqual( - expected_value, event['data']['value'], - "Received value should have {} bytes".format(data_length)) - - # return the mtu to default - self.mtu = gatt_mtu_size['min'] - self.log.info("Set mtu to min : {}".format(self.mtu)) - if not setup_gatt_mtu(self.cen_ad, self.bluetooth_gatt, - self.gatt_callback, self.mtu): - return False - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='319eee6d-22d9-4498-bb15-21d0018e45e6') - def test_write_characteristic_stress(self): - """Stress test write characteristic value - - Test write characteristic value using Write Request - - 1. Central: write WRITABLE_CHAR_UUID characteristic with char_value - using write request. - 2. Peripheral: receive the written data. - 3. Peripheral: send response with status 0 (success). - 4. Central: make sure write callback is called. - 5. Repeat steps 1-4 100 times. - - Expected Result: - Verify that write request/response is properly delivered. - - Returns: - Pass if True - Fail if False - - TAGS: LE, GATT, Characteristic - Priority: 0 - """ - self.cen_ad.droid.gattClientRequestConnectionPriority( - self.bluetooth_gatt, gatt_connection_priority['high']) - - bt_device_id = 0 - - self.cen_ad.droid.gattClientCharacteristicSetWriteType( - self.bluetooth_gatt, self.discovered_services_index, - self.test_service_index, self.WRITABLE_CHAR_UUID, - gatt_characteristic['write_type_default']) - - for i in range(100): - - char_value = [] - for j in range(i, i + self.mtu - 3): - char_value.append(j % 256) - - self.cen_ad.droid.gattClientCharacteristicSetValue( - self.bluetooth_gatt, self.discovered_services_index, - self.test_service_index, self.WRITABLE_CHAR_UUID, char_value) - - self.cen_ad.droid.gattClientWriteCharacteristic( - self.bluetooth_gatt, self.discovered_services_index, - self.test_service_index, self.WRITABLE_CHAR_UUID) - - event = self._server_wait(gatt_event['char_write_req']) - - self.log.info("{} event found: {}".format(gatt_cb_strings[ - 'char_write_req'].format(self.gatt_server_callback), event[ - 'data']['value'])) - request_id = event['data']['requestId'] - found_value = event['data']['value'] - if found_value != char_value: - self.log.info("Values didn't match. Found: {}, " - "Expected: {}".format(found_value, char_value)) - return False - - # only status is sent - status = 0 - offset = 0 - char_value_return = [] - self.per_ad.droid.gattServerSendResponse( - self.gatt_server, bt_device_id, request_id, status, offset, - char_value_return) - - event = self._client_wait(gatt_event['char_write']) - if event["data"]["Status"] != status: - self.log.error("Write status should be 0") - return False - - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='b19d42dc-58ba-4b20-b6c1-6628e7d21de4') - def test_write_descriptor_stress(self): - """Stress test write descriptor value - - Stress test write descriptor value - - 1. Central: write WRITABLE_DESC_UUID descriptor with desc_value. - 2. Peripheral: receive the written data. - 3. Peripheral: send response with status 0 (success). - 4. Central: make sure write callback is called. - 5. Repeat 1-4 100 times - - Expected Result: - Verify that write request/response is properly delivered. - - Returns: - Pass if True - Fail if False - - TAGS: LE, GATT, Descriptor - Priority: 0 - """ - self.cen_ad.droid.gattClientRequestConnectionPriority( - self.bluetooth_gatt, gatt_connection_priority['high']) - - for i in range(100): - - desc_value = [] - for j in range(i, i + self.mtu - 3): - desc_value.append(j % 256) - - self.cen_ad.droid.gattClientDescriptorSetValue( - self.bluetooth_gatt, self.discovered_services_index, - self.test_service_index, self.WRITABLE_CHAR_UUID, - self.WRITABLE_DESC_UUID, desc_value) - - self.cen_ad.droid.gattClientWriteDescriptor( - self.bluetooth_gatt, self.discovered_services_index, - self.test_service_index, self.WRITABLE_CHAR_UUID, - self.WRITABLE_DESC_UUID) - - event = self._server_wait(gatt_event['desc_write_req']) - - self.log.info("{} event found: {}".format(gatt_cb_strings[ - 'char_write_req'].format(self.gatt_server_callback), event[ - 'data']['value'])) - - request_id = event['data']['requestId'] - self.assertEqual(True, event['data']['responseNeeded'], - "Should need response") - self.assertEqual(desc_value, event['data']['value']) - self.assertEqual(0, event['data']['offset']) - - bt_device_id = 0 - status = 0 - #both offset and return value don't matter, just the status - offset = 0 - self.per_ad.droid.gattServerGetConnectedDevices(self.gatt_server) - self.per_ad.droid.gattServerSendResponse( - self.gatt_server, bt_device_id, request_id, status, offset, []) - - event = self._client_wait(gatt_event['desc_write']) - self.assertEqual(status, event["data"]["Status"], - "Write status should be 0") - # Write response doesn't carry any data except status - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='74c147eb-2702-4cd8-be1f-efff3e9eaa6c') - def test_write_characteristic_no_resp_stress(self): - """Stress test write characteristic value - - Stress test write characteristic value using Write Command - - 1. Central: write WRITABLE_CHAR_UUID characteristic with char_value - using write command. - 2. Central: make sure write callback is called. - 3. Peripheral: receive the written data. - 4. Repeat steps 1-3 100 times. - - Expected Result: - Verify that write command is properly delivered. - - Returns: - Pass if True - Fail if False - - TAGS: LE, GATT, Characteristic - Priority: 0 - """ - self.cen_ad.droid.gattClientRequestConnectionPriority( - self.bluetooth_gatt, gatt_connection_priority['high']) - - bt_device_id = 0 - - self.cen_ad.droid.gattClientCharacteristicSetWriteType( - self.bluetooth_gatt, self.discovered_services_index, - self.test_service_index, self.WRITABLE_CHAR_UUID, - gatt_characteristic['write_type_no_response']) - - for i in range(100): - char_value = [] - for j in range(i, i + self.mtu - 3): - char_value.append(j % 256) - - self.cen_ad.droid.gattClientCharacteristicSetValue( - self.bluetooth_gatt, self.discovered_services_index, - self.test_service_index, self.WRITABLE_CHAR_UUID, char_value) - - self.cen_ad.droid.gattClientWriteCharacteristic( - self.bluetooth_gatt, self.discovered_services_index, - self.test_service_index, self.WRITABLE_CHAR_UUID) - - # client shall not wait for server, get complete event right away - event = self._client_wait(gatt_event['char_write']) - if event["data"]["Status"] != 0: - self.log.error("Write status should be 0") - return False - - event = self._server_wait(gatt_event['char_write_req']) - - self.log.info("{} event found: {}".format(gatt_cb_strings[ - 'char_write_req'].format(self.gatt_server_callback), event[ - 'data']['value'])) - request_id = event['data']['requestId'] - found_value = event['data']['value'] - if found_value != char_value: - self.log.info("Values didn't match. Found: {}, " - "Expected: {}".format(found_value, char_value)) - return False - - return True diff --git a/acts/tests/google/ble/scan/BleBackgroundScanTest.py b/acts/tests/google/ble/scan/BleBackgroundScanTest.py deleted file mode 100644 index 68396023b4..0000000000 --- a/acts/tests/google/ble/scan/BleBackgroundScanTest.py +++ /dev/null @@ -1,277 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -""" -This test script exercises background scan test scenarios. -""" - -from queue import Empty - -from acts import utils -from acts.test_decorators import test_tracker_info -from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest -from acts.test_utils.bt.bt_test_utils import bluetooth_off -from acts.test_utils.bt.bt_test_utils import bluetooth_on -from acts.test_utils.bt.bt_test_utils import cleanup_scanners_and_advertisers -from acts.test_utils.bt.bt_test_utils import enable_bluetooth -from acts.test_utils.bt.bt_test_utils import generate_ble_advertise_objects -from acts.test_utils.bt.bt_test_utils import generate_ble_scan_objects -from acts.test_utils.bt.bt_constants import bluetooth_le_off -from acts.test_utils.bt.bt_constants import bluetooth_le_on -from acts.test_utils.bt.bt_constants import bt_adapter_states -from acts.test_utils.bt.bt_constants import ble_scan_settings_modes -from acts.test_utils.bt.bt_constants import scan_result - -import time - - -class BleBackgroundScanTest(BluetoothBaseTest): - default_timeout = 10 - report_delay = 2000 - scan_callbacks = [] - adv_callbacks = [] - active_scan_callback_list = [] - active_adv_callback_list = [] - - def setup_class(self): - super(BluetoothBaseTest, self).setup_class() - self.scn_ad = self.android_devices[0] - self.adv_ad = self.android_devices[1] - - utils.set_location_service(self.scn_ad, True) - utils.set_location_service(self.adv_ad, True) - return True - - def setup_test(self): - # Always start tests with Bluetooth enabled and BLE disabled. - enable_bluetooth(self.scn_ad.droid, self.scn_ad.ed) - self.scn_ad.droid.bluetoothDisableBLE() - for a in self.android_devices: - a.ed.clear_all_events() - return True - - def teardown_test(self): - cleanup_scanners_and_advertisers( - self.scn_ad, self.active_adv_callback_list, self.adv_ad, - self.active_adv_callback_list) - self.active_adv_callback_list = [] - self.active_scan_callback_list = [] - - def _setup_generic_advertisement(self): - self.adv_ad.droid.bleSetAdvertiseDataIncludeDeviceName(True) - adv_callback, adv_data, adv_settings = generate_ble_advertise_objects( - self.adv_ad.droid) - self.adv_ad.droid.bleStartBleAdvertising(adv_callback, adv_data, - adv_settings) - self.active_adv_callback_list.append(adv_callback) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='4d13c3a8-1805-44ef-a92a-e385540767f1') - def test_background_scan(self): - """Test generic background scan. - - Tests LE background scan. The goal is to find scan results even though - Bluetooth is turned off. - - Steps: - 1. Setup an advertisement on dut1 - 2. Enable LE on the Bluetooth Adapter on dut0 - 3. Toggle BT off on dut1 - 4. Start a LE scan on dut0 - 5. Find the advertisement from dut1 - - Expected Result: - Find a advertisement from the scan instance. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Scanning, Background Scanning - Priority: 0 - """ - self.scn_ad.droid.bluetoothEnableBLE() - self._setup_generic_advertisement() - self.scn_ad.droid.bleSetScanSettingsScanMode( - ble_scan_settings_modes['low_latency']) - filter_list, scan_settings, scan_callback = generate_ble_scan_objects( - self.scn_ad.droid) - self.scn_ad.droid.bleSetScanFilterDeviceName( - self.adv_ad.droid.bluetoothGetLocalName()) - self.scn_ad.droid.bleBuildScanFilter(filter_list) - self.scn_ad.droid.bluetoothToggleState(False) - try: - self.scn_ad.ed.pop_event(bluetooth_off, self.default_timeout) - except Empty: - self.log.error("Bluetooth Off event not found. Expected {}".format( - bluetooth_off)) - return False - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - expected_event = scan_result.format(scan_callback) - try: - self.scn_ad.ed.pop_event(expected_event, self.default_timeout) - except Empty: - self.log.error("Scan Result event not found. Expected {}".format( - expected_event)) - return False - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='9c4577f8-5e06-4034-b977-285956734974') - def test_background_scan_ble_disabled(self): - """Test background LE scanning with LE disabled. - - Tests LE background scan. The goal is to find scan results even though - Bluetooth is turned off. - - Steps: - 1. Setup an advertisement on dut1 - 2. Enable LE on the Bluetooth Adapter on dut0 - 3. Toggle BT off on dut1 - 4. Start a LE scan on dut0 - 5. Find the advertisement from dut1 - - Expected Result: - Find a advertisement from the scan instance. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Scanning, Background Scanning - Priority: 0 - """ - self._setup_generic_advertisement() - self.scn_ad.droid.bluetoothEnableBLE() - self.scn_ad.droid.bleSetScanSettingsScanMode( - ble_scan_settings_modes['low_latency']) - filter_list, scan_settings, scan_callback = generate_ble_scan_objects( - self.scn_ad.droid) - self.scn_ad.droid.bleSetScanFilterDeviceName( - self.adv_ad.droid.bluetoothGetLocalName()) - self.scn_ad.droid.bleBuildScanFilter(filter_list) - self.scn_ad.droid.bluetoothToggleState(False) - try: - self.scn_ad.ed.pop_event(bluetooth_off, self.default_timeout) - except Empty: - self.log.info(self.scn_ad.droid.bluetoothCheckState()) - self.log.error("Bluetooth Off event not found. Expected {}".format( - bluetooth_off)) - return False - try: - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - expected_event = scan_result.format(scan_callback) - try: - self.scn_ad.ed.pop_event(expected_event, self.default_timeout) - except Empty: - self.log.error( - "Scan Result event not found. Expected {}".format( - expected_event)) - return False - except Exception: - self.log.info( - "Was not able to start a background scan as expected.") - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='0bdd1764-3dc6-4a82-b041-76e48ed0f424') - def test_airplane_mode_disables_ble(self): - """Try to start LE mode in Airplane Mode. - - This test will enable airplane mode, then attempt to start LE scanning - mode. This should result in bluetooth still being turned off, LE - not enabled. - - Steps: - 1. Start LE only mode. - 2. Bluetooth should be in LE ONLY mode - 2. Turn on airplane mode. - 3. Bluetooth should be OFF - 4. Try to start LE only mode. - 5. Bluetooth should stay in OFF mode (LE only start should fail) - 6. Turn off airplane mode. - 7. Bluetooth should be OFF. - - Expected Result: - No unexpected bluetooth state changes. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Airplane - Priority: 1 - """ - ble_state_error_msg = "Bluetooth LE State not OK {}. Expected {} got {}" - # Enable BLE always available (effectively enabling BT in location) - self.scn_ad.shell.enable_ble_scanning() - self.scn_ad.droid.bluetoothEnableBLE() - self.scn_ad.droid.bluetoothToggleState(False) - try: - self.scn_ad.ed.pop_event(bluetooth_off, self.default_timeout) - except Empty: - self.log.error("Bluetooth Off event not found. Expected {}".format( - bluetooth_off)) - self.log.info(self.scn_ad.droid.bluetoothCheckState()) - return False - - # Sleep because LE turns off after the bluetooth off event fires - time.sleep(self.default_timeout) - state = self.scn_ad.droid.bluetoothGetLeState() - if state != bt_adapter_states['ble_on']: - self.log.error( - ble_state_error_msg.format("after BT Disable", - bt_adapter_states['ble_on'], state)) - return False - - self.scn_ad.droid.bluetoothListenForBleStateChange() - self.scn_ad.droid.connectivityToggleAirplaneMode(True) - try: - self.scn_ad.ed.pop_event(bluetooth_le_off, self.default_timeout) - except Empty: - self.log.error( - "Bluetooth LE Off event not found. Expected {}".format( - bluetooth_le_off)) - return False - state = self.scn_ad.droid.bluetoothGetLeState() - if state != bt_adapter_states['off']: - self.log.error( - ble_state_error_msg.format("after Airplane Mode ON", - bt_adapter_states['off'], state)) - return False - result = self.scn_ad.droid.bluetoothEnableBLE() - if result: - self.log.error( - "Bluetooth Enable command succeded when it should have failed (in airplane mode)" - ) - return False - state = self.scn_ad.droid.bluetoothGetLeState() - if state != bt_adapter_states['off']: - self.log.error( - "Bluetooth LE State not OK after attempted enable. Expected {} got {}". - format(bt_adapter_states['off'], state)) - return False - self.scn_ad.droid.connectivityToggleAirplaneMode(False) - # Sleep to let Airplane Mode disable propogate through the system - time.sleep(self.default_timeout) - state = self.scn_ad.droid.bluetoothGetLeState() - if state != bt_adapter_states['off']: - self.log.error( - ble_state_error_msg.format("after Airplane Mode OFF", - bt_adapter_states['off'], state)) - return False - return True diff --git a/acts/tests/google/ble/scan/BleOnLostOnFoundTest.py b/acts/tests/google/ble/scan/BleOnLostOnFoundTest.py deleted file mode 100644 index 01f7976db4..0000000000 --- a/acts/tests/google/ble/scan/BleOnLostOnFoundTest.py +++ /dev/null @@ -1,292 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -""" -This test script exercises different onLost/onFound scenarios. -""" - -from queue import Empty -from acts import utils -from acts.test_decorators import test_tracker_info -from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest -from acts.test_utils.bt.bt_constants import ble_advertise_settings_modes -from acts.test_utils.bt.bt_constants import ble_scan_settings_callback_types -from acts.test_utils.bt.BleEnum import ScanSettingsMatchMode -from acts.test_utils.bt.BleEnum import ScanSettingsMatchNum -from acts.test_utils.bt.bt_constants import ble_scan_settings_modes -from acts.test_utils.bt.bt_constants import ble_scan_settings_match_modes -from acts.test_utils.bt.bt_constants import ble_scan_settings_match_nums -from acts.test_utils.bt.bt_constants import adv_succ -from acts.test_utils.bt.bt_test_utils import cleanup_scanners_and_advertisers -from acts.test_utils.bt.bt_test_utils import reset_bluetooth -from acts.test_utils.bt.bt_constants import scan_result - - -class BleOnLostOnFoundTest(BluetoothBaseTest): - default_timeout = 10 - active_scan_callback_list = [] - active_adv_callback_list = [] - - def setup_class(self): - super(BluetoothBaseTest, self).setup_class() - self.scn_ad = self.android_devices[0] - self.adv_ad = self.android_devices[1] - - utils.set_location_service(self.scn_ad, True) - utils.set_location_service(self.adv_ad, True) - return True - - def teardown_test(self): - cleanup_scanners_and_advertisers( - self.scn_ad, self.active_adv_callback_list, self.adv_ad, - self.active_adv_callback_list) - self.active_adv_callback_list = [] - self.active_scan_callback_list = [] - - def on_exception(self, test_name, begin_time): - reset_bluetooth(self.android_devices) - - def _start_generic_advertisement_include_device_name(self): - self.adv_ad.droid.bleSetAdvertiseDataIncludeDeviceName(True) - self.adv_ad.droid.bleSetAdvertiseSettingsAdvertiseMode( - ble_advertise_settings_modes['low_latency']) - advertise_data = self.adv_ad.droid.bleBuildAdvertiseData() - advertise_settings = self.adv_ad.droid.bleBuildAdvertiseSettings() - advertise_callback = self.adv_ad.droid.bleGenBleAdvertiseCallback() - self.adv_ad.droid.bleStartBleAdvertising( - advertise_callback, advertise_data, advertise_settings) - self.adv_ad.ed.pop_event( - adv_succ.format(advertise_callback), self.default_timeout) - self.active_adv_callback_list.append(advertise_callback) - return advertise_callback - - def _verify_no_events_found(self, event_name): - try: - self.scn_ad.ed.pop_event(event_name, self.default_timeout) - self.log.error("Found an event when none was expected.") - return False - except Empty: - self.log.info("No scan result found as expected.") - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='9bd7fd09-71c9-4623-90f0-9a895eb37409') - def test_onlost_onfound_defaults(self): - """Test generic onlost/onfound defaults. - - Tests basic onFound/onLost functionality. - - Steps: - 1. Setup dut0 scanner and start scan with this setup: - Scan Mode: SCAN_MODE_LOW_LATENCY - Callback Type: CALLBACK_TYPE_FOUND_AND_LOST - Match Mode: AGGRESSIVE - Num of Matches: MATCH_NUM_ONE_ADVERTISEMENT - Filter: Device name of dut1 - 2. Start an advertisement on dut1, include device name - 3. Find an onFound event - 4. Stop the advertisement on dut1 - 5. Find an onLost event - - Expected Result: - Find an onLost and an onFound event successfully. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Scanning, onLost, onFound - Priority: 0 - """ - filter_list = self.scn_ad.droid.bleGenFilterList() - self.scn_ad.droid.bleSetScanFilterDeviceName( - self.adv_ad.droid.bluetoothGetLocalName()) - self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ - 'low_latency']) - self.scn_ad.droid.bleSetScanSettingsCallbackType( - ble_scan_settings_callback_types['found_and_lost']) - self.scn_ad.droid.bleSetScanSettingsMatchMode( - ble_scan_settings_match_modes['aggresive']) - self.scn_ad.droid.bleSetScanSettingsNumOfMatches( - ble_scan_settings_match_nums['one']) - scan_settings = self.scn_ad.droid.bleBuildScanSetting() - scan_callback = self.scn_ad.droid.bleGenScanCallback() - self.scn_ad.droid.bleBuildScanFilter(filter_list) - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - self.active_scan_callback_list.append(scan_callback) - adv_callback = self._start_generic_advertisement_include_device_name() - event = self.scn_ad.ed.pop_event( - scan_result.format(scan_callback), self.default_timeout * 3) - found_callback_type = event['data']['CallbackType'] - if event['data']['CallbackType'] != ble_scan_settings_callback_types[ - 'first_match']: - self.log.info( - "Found Callbacreset_bluetoothkType:{}, Expected CallbackType:{}". - format(found_callback_type, ble_scan_settings_callback_types[ - 'first_match'])) - return False - self.adv_ad.droid.bleStopBleAdvertising(adv_callback) - event = self.scn_ad.ed.pop_event( - scan_result.format(scan_callback), self.default_timeout * 4) - found_callback_type = event['data']['CallbackType'] - if found_callback_type != ble_scan_settings_callback_types[ - 'match_lost']: - self.log.info( - "Found CallbackType:{}, Expected CallbackType:{}".format( - found_callback_type, ble_scan_settings_callback_types[ - 'match_lost'])) - return False - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='10b48dc9-0c2a-46a3-8890-5cde3004a996') - def test_onlost_onfound_match_mode_sticky(self): - """Test generic onlost/onfound in sticky mode. - - Tests basic onFound/onLost functionality. - - Steps: - 1. Setup dut0 scanner and start scan with this setup: - Scan Mode: SCAN_MODE_LOW_LATENCY - Callback Type: CALLBACK_TYPE_FOUND_AND_LOST - Match Mode: STICKY - Num of Matches: MATCH_NUM_ONE_ADVERTISEMENT - Filter: Device name of dut1 - 2. Start an advertisement on dut1, include device name - 3. Find an onFound event - 4. Stop the advertisement on dut1 - 5. Find an onLost event - - Expected Result: - Find an onLost and an onFound event successfully. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Scanning, onLost, onFound - Priority: 1 - """ - filter_list = self.scn_ad.droid.bleGenFilterList() - self.scn_ad.droid.bleSetScanFilterDeviceName( - self.adv_ad.droid.bluetoothGetLocalName()) - self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ - 'low_latency']) - self.scn_ad.droid.bleSetScanSettingsCallbackType( - ble_scan_settings_callback_types['found_and_lost']) - self.scn_ad.droid.bleSetScanSettingsMatchMode( - ble_scan_settings_match_modes['sticky']) - self.scn_ad.droid.bleSetScanSettingsNumOfMatches( - ble_scan_settings_match_nums['one']) - scan_settings = self.scn_ad.droid.bleBuildScanSetting() - scan_callback = self.scn_ad.droid.bleGenScanCallback() - self.scn_ad.droid.bleBuildScanFilter(filter_list) - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - self.active_scan_callback_list.append(scan_callback) - adv_callback = self._start_generic_advertisement_include_device_name() - event = self.scn_ad.ed.pop_event( - scan_result.format(scan_callback), self.default_timeout * 3) - found_callback_type = event['data']['CallbackType'] - if event['data']['CallbackType'] != ble_scan_settings_callback_types[ - 'first_match']: - self.log.info( - "Found CallbackType:{}, Expected CallbackType:{}".format( - found_callback_type, ble_scan_settings_callback_types[ - 'first_match'])) - return False - self.adv_ad.droid.bleStopBleAdvertising(adv_callback) - event = self.scn_ad.ed.pop_event( - scan_result.format(scan_callback), self.default_timeout * 4) - found_callback_type = event['data']['CallbackType'] - if found_callback_type != ble_scan_settings_callback_types[ - 'match_lost']: - self.log.info( - "Found CallbackType:{}, Expected CallbackType:{}".format( - found_callback_type, ble_scan_settings_callback_types[ - 'match_lost'])) - return False - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='4fefed82-7800-41be-8272-aac076640fed') - def test_onlost_onfound_match_num_few(self): - """Test generic onlost/onfound num few. - - Tests basic onFound/onLost functionality. - - Steps: - 1. Setup dut0 scanner and start scan with this setup: - Scan Mode: SCAN_MODE_LOW_LATENCY - Callback Type: CALLBACK_TYPE_FOUND_AND_LOST - Match Mode: AGGRESSIVE - Num of Matches: MATCH_NUM_FEW_ADVERTISEMENT - Filter: Device name of dut1 - 2. Start an advertisement on dut1, include device name - 3. Find an onFound event - 4. Stop the advertisement on dut1 - 5. Find an onLost event - - Expected Result: - Find an onLost and an onFound event successfully. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Scanning, onLost, onFound - Priority: 1 - """ - filter_list = self.scn_ad.droid.bleGenFilterList() - self.scn_ad.droid.bleSetScanFilterDeviceName( - self.adv_ad.droid.bluetoothGetLocalName()) - self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ - 'low_latency']) - self.scn_ad.droid.bleSetScanSettingsCallbackType( - ble_scan_settings_callback_types['found_and_lost']) - self.scn_ad.droid.bleSetScanSettingsMatchMode( - ble_scan_settings_match_modes['aggresive']) - self.scn_ad.droid.bleSetScanSettingsNumOfMatches( - ble_scan_settings_match_nums['few']) - scan_settings = self.scn_ad.droid.bleBuildScanSetting() - scan_callback = self.scn_ad.droid.bleGenScanCallback() - self.scn_ad.droid.bleBuildScanFilter(filter_list) - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - self.active_scan_callback_list.append(scan_callback) - adv_callback = self._start_generic_advertisement_include_device_name() - event = self.scn_ad.ed.pop_event( - scan_result.format(scan_callback), self.default_timeout * 3) - found_callback_type = event['data']['CallbackType'] - if event['data']['CallbackType'] != ble_scan_settings_callback_types[ - 'first_match']: - self.log.info( - "Found CallbackType:{}, Expected CallbackType:{}".format( - found_callback_type, ble_scan_settings_callback_types[ - 'first_match'])) - return False - self.adv_ad.droid.bleStopBleAdvertising(adv_callback) - event = self.scn_ad.ed.pop_event( - scan_result.format(scan_callback), self.default_timeout * 4) - found_callback_type = event['data']['CallbackType'] - if found_callback_type != ble_scan_settings_callback_types[ - 'match_lost']: - self.log.info( - "Found CallbackType:{}, Expected CallbackType:{}".format( - found_callback_type, ble_scan_settings_callback_types[ - 'match_lost'])) - return False - return True diff --git a/acts/tests/google/ble/scan/BleOpportunisticScanTest.py b/acts/tests/google/ble/scan/BleOpportunisticScanTest.py deleted file mode 100644 index 9e591281b1..0000000000 --- a/acts/tests/google/ble/scan/BleOpportunisticScanTest.py +++ /dev/null @@ -1,702 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -""" -This test script exercises different opportunistic scan scenarios. -It is expected that the second AndroidDevice is able to advertise. - -This test script was designed with this setup in mind: -Shield box one: Android Device, Android Device -""" - -from queue import Empty - -from acts import utils -from acts.test_decorators import test_tracker_info -from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest -from acts.test_utils.bt.bt_constants import ble_scan_settings_modes -from acts.test_utils.bt.bt_constants import ble_scan_settings_modes -from acts.test_utils.bt.bt_constants import batch_scan_result -from acts.test_utils.bt.bt_test_utils import cleanup_scanners_and_advertisers -from acts.test_utils.bt.bt_test_utils import generate_ble_advertise_objects -from acts.test_utils.bt.bt_test_utils import generate_ble_scan_objects -from acts.test_utils.bt.bt_test_utils import reset_bluetooth -from acts.test_utils.bt.bt_constants import scan_result - - -class BleOpportunisticScanTest(BluetoothBaseTest): - default_timeout = 10 - max_scan_instances = 25 - report_delay = 2000 - scan_callbacks = [] - adv_callbacks = [] - active_scan_callback_list = [] - active_adv_callback_list = [] - - def setup_class(self): - super(BluetoothBaseTest, self).setup_class() - self.scn_ad = self.android_devices[0] - self.adv_ad = self.android_devices[1] - - utils.set_location_service(self.scn_ad, True) - utils.set_location_service(self.adv_ad, True) - return True - - def teardown_test(self): - cleanup_scanners_and_advertisers( - self.scn_ad, self.active_scan_callback_list, self.adv_ad, - self.active_adv_callback_list) - self.active_adv_callback_list = [] - self.active_scan_callback_list = [] - - def on_exception(self, test_name, begin_time): - reset_bluetooth(self.android_devices) - - def _setup_generic_advertisement(self): - adv_callback, adv_data, adv_settings = generate_ble_advertise_objects( - self.adv_ad.droid) - self.adv_ad.droid.bleStartBleAdvertising(adv_callback, adv_data, - adv_settings) - self.active_adv_callback_list.append(adv_callback) - - def _verify_no_events_found(self, event_name): - try: - event = self.scn_ad.ed.pop_event(event_name, self.default_timeout) - self.log.error("Found an event when none was expected: {}".format( - event)) - return False - except Empty: - self.log.info("No scan result found as expected.") - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='6bccfbea-3734-4504-8ea9-3511ad17a3e0') - def test_scan_result_no_advertisement(self): - """Test opportunistic scan with no advertisement. - - Tests opportunistic scan where there are no advertisements. This should - not find any onScanResults. - - Steps: - 1. Initialize scanner with scan mode set to opportunistic mode. - 2. Start scanning on dut 0 - 3. Pop onScanResults event on the scanner - - Expected Result: - Find no advertisements with the opportunistic scan instance. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Scanning, Opportunistic Scan - Priority: 1 - """ - self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ - 'opportunistic']) - filter_list, scan_settings, scan_callback = generate_ble_scan_objects( - self.scn_ad.droid) - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - self.active_scan_callback_list.append(scan_callback) - if not self._verify_no_events_found(scan_result.format(scan_callback)): - return False - self.scn_ad.droid.bleStopBleScan(scan_callback) - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='8430bc57-925c-4b70-a62e-cd34df264ca1') - def test_batch_scan_result_no_advertisement(self): - """Test batch opportunistic scan without an advertisement. - - Tests opportunistic scan where there are no advertisements. This should - not find any onBatchScanResult. - - Steps: - 1. Initialize scanner with scan mode set to opportunistic mode. - 2. Set report delay seconds such that onBatchScanResult events are - expected - 2. Start scanning on dut 0 - 3. Pop onBatchScanResult event on the scanner - - Expected Result: - Find no advertisements with the opportunistic scan instance. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Scanning, Opportunistic Scan, Batch Scanning - Priority: 1 - """ - self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ - 'opportunistic']) - self.scn_ad.droid.bleSetScanSettingsReportDelayMillis( - self.report_delay) - filter_list, scan_settings, scan_callback = generate_ble_scan_objects( - self.scn_ad.droid) - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - self.active_scan_callback_list.append(scan_callback) - if not self._verify_no_events_found( - batch_scan_result.format(scan_callback)): - return False - self.scn_ad.droid.bleStopBleScan(scan_callback) - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='4613cb67-0f54-494e-8a56-2e8ce56fad41') - def test_scan_result(self): - """Test opportunistic scan with an advertisement. - - Tests opportunistic scan where it will only report scan results when - other registered scanners find results. - - Steps: - 1. Initialize advertiser and start advertisement on dut1 - 2. Initialize scanner with scan mode set to opportunistic mode on dut0 - and start scanning - 3. Try to find an event, expect none. - 4. Start a second scanner on dut0, with any other mode set - 5. Pop onScanResults event on the second scanner - 6. Pop onScanResults event on the first scanner - - Expected Result: - Scan result is found on the opportunistic scan instance. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Scanning, Opportunistic Scan - Priority: 1 - """ - self._setup_generic_advertisement() - self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ - 'opportunistic']) - filter_list, scan_settings, scan_callback = generate_ble_scan_objects( - self.scn_ad.droid) - - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - self.active_scan_callback_list.append(scan_callback) - if not self._verify_no_events_found(scan_result.format(scan_callback)): - return False - self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ - 'low_latency']) - filter_list2, scan_settings2, scan_callback2 = ( - generate_ble_scan_objects(self.scn_ad.droid)) - self.scn_ad.droid.bleStartBleScan(filter_list2, scan_settings2, - scan_callback2) - self.active_scan_callback_list.append(scan_callback2) - try: - self.scn_ad.ed.pop_event( - scan_result.format(scan_callback2), self.default_timeout) - except Empty: - self.log.error("Non-Opportunistic scan found no scan results.") - return False - try: - self.scn_ad.ed.pop_event( - scan_result.format(scan_callback), self.default_timeout) - except Empty: - self.log.error("Opportunistic scan found no scan results.") - return False - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='5b46fefc-70ef-48a0-acf4-35077cd72202') - def test_batch_scan_result(self): - """Test batch opportunistic scan with advertisement. - - Tests opportunistic scan where it will only report scan results when - other registered scanners find results. Set the report delay millis such - that an onBatchScanResult is expected. - - Steps: - 1. Initialize advertiser and start advertisement on dut1 - 2. Initialize scanner with scan mode set to opportunistic mode and - set scan settings report delay seconds such that a batch scan is - expected - 3. Start scanning on dut 0 - 4. Try to find an event, expect none. - 5. Start a second scanner on dut0, with any other mode set and set scan - settings report delay millis such that an onBatchScanResult is expected - 6. Pop onBatchScanResult event on the second scanner - 7. Pop onBatchScanResult event on the first scanner - - Expected Result: - Find a batch scan result on both opportunistic scan instances. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Scanning, Opportunistic Scan, Batch Scanning - Priority: 1 - """ - self._setup_generic_advertisement() - self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ - 'opportunistic']) - self.scn_ad.droid.bleSetScanSettingsReportDelayMillis( - self.report_delay) - filter_list, scan_settings, scan_callback = generate_ble_scan_objects( - self.scn_ad.droid) - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - self.active_scan_callback_list.append(scan_callback) - if not self._verify_no_events_found( - batch_scan_result.format(scan_callback)): - return False - self.scn_ad.droid.bleSetScanSettingsReportDelayMillis( - self.report_delay) - self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ - 'low_latency']) - filter_list2, scan_settings2, scan_callback2 = generate_ble_scan_objects( - self.scn_ad.droid) - self.scn_ad.droid.bleStartBleScan(filter_list2, scan_settings2, - scan_callback2) - self.active_scan_callback_list.append(scan_callback2) - try: - self.scn_ad.ed.pop_event( - batch_scan_result.format(scan_callback2), self.default_timeout) - except Empty: - self.log.error("Non-Opportunistic scan found no scan results.") - return False - try: - self.scn_ad.ed.pop_event( - batch_scan_result.format(scan_callback), self.default_timeout) - except Empty: - self.log.error("Opportunistic scan found no scan results.") - return False - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='fd85d95e-dc8c-48c1-8d8a-83c3475755ff') - def test_batch_scan_result_not_expected(self): - """Test opportunistic batch scan without expecting an event. - - Tests opportunistic scan where it will only report scan results when - other registered scanners find results. Set the report delay millis such - that a batch scan is not expected. - - Steps: - 1. Initialize advertiser and start advertisement on dut1 - 2. Initialize scanner with scan mode set to opportunistic mode and - set scan settings report delay seconds such that a batch scan is - expected. - 3. Start scanning on dut 0 - 4. Try to find an event, expect none. - 5. Start a second scanner on dut0, with any other mode set and set scan - settings report delay millis to 0 such that an onBatchScanResult is not - expected. - 6. Pop onScanResults event on the second scanner - 7. Pop onBatchScanResult event on the first scanner - - Expected Result: - Batch scan result is not expected on opportunistic scan instance. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Scanning, Opportunistic Scan, Batch Scanning - Priority: 1 - """ - self._setup_generic_advertisement() - self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ - 'opportunistic']) - self.scn_ad.droid.bleSetScanSettingsReportDelayMillis( - self.report_delay) - filter_list, scan_settings, scan_callback = generate_ble_scan_objects( - self.scn_ad.droid) - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - self.active_scan_callback_list.append(scan_callback) - if not self._verify_no_events_found( - batch_scan_result.format(scan_callback)): - - return False - self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ - 'low_latency']) - filter_list2, scan_settings2, scan_callback2 = ( - generate_ble_scan_objects(self.scn_ad.droid)) - self.scn_ad.droid.bleStartBleScan(filter_list2, scan_settings2, - scan_callback2) - self.active_scan_callback_list.append(scan_callback2) - try: - self.scn_ad.ed.pop_event( - scan_result.format(scan_callback2), self.default_timeout) - except Empty: - self.log.error("Non-Opportunistic scan found no scan results.") - return False - return self._verify_no_events_found( - batch_scan_result.format(scan_callback)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='6138592e-8fd5-444f-9a7c-25cd9695644a') - def test_scan_result_not_expected(self): - """Test opportunistic scan without expecting an event. - - Tests opportunistic scan where it will only report batch scan results - when other registered scanners find results. - - Steps: - 1. Initialize advertiser and start advertisement on dut1 - 2. Initialize scanner with scan mode set to opportunistic mode. - 3. Start scanning on dut 0 - 4. Try to find an event, expect none. - 5. Start a second scanner on dut0, with any other mode set and set scan - settings - report delay millis such that an onBatchScanResult is expected - 6. Pop onBatchScanResult event on the second scanner - 7. Pop onScanResults event on the first scanner - - Expected Result: - Scan result is not expected on opportunistic scan instance. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Scanning, Opportunistic Scan - Priority: 1 - """ - self._setup_generic_advertisement() - self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ - 'opportunistic']) - filter_list, scan_settings, scan_callback = generate_ble_scan_objects( - self.scn_ad.droid) - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - self.active_scan_callback_list.append(scan_callback) - if not self._verify_no_events_found(scan_result.format(scan_callback)): - return False - self.scn_ad.droid.bleSetScanSettingsReportDelayMillis( - self.report_delay) - self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ - 'low_latency']) - filter_list2, scan_settings2, scan_callback2 = ( - generate_ble_scan_objects(self.scn_ad.droid)) - self.scn_ad.droid.bleStartBleScan(filter_list2, scan_settings2, - scan_callback2) - self.active_scan_callback_list.append(scan_callback2) - try: - self.scn_ad.ed.pop_event( - batch_scan_result.format(scan_callback2), self.default_timeout) - except Empty: - self.log.error("Non-Opportunistic scan found no scan results.") - return False - return self._verify_no_events_found(scan_result.format(scan_callback)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='f7aba3d9-d3f7-4b2f-976e-441772705613') - def test_max_opportunistic_scan_instances(self): - """Test max number of opportunistic scan instances. - - Tests max instances of opportunistic scans. Each instances should - find an onScanResults event. - - Steps: - 1. Initialize advertiser and start advertisement on dut1 - 2. Set scan settings to opportunistic scan on dut0 scan instance - 3. Start scan scan from step 2 - 4. Repeat step two and three until there are max_scan_instances-1 scan - instances - 5. Start a regular ble scan on dut0 with the last available scan - instance - 6. Pop onScanResults event on all scan instances - - Expected Result: - Each opportunistic scan instance finds a advertisement. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Scanning, Opportunistic Scan - Priority: 1 - """ - self._setup_generic_advertisement() - for _ in range(self.max_scan_instances - 1): - self.scn_ad.droid.bleSetScanSettingsScanMode( - ble_scan_settings_modes['opportunistic']) - filter_list, scan_settings, scan_callback = generate_ble_scan_objects( - self.scn_ad.droid) - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - self.active_scan_callback_list.append(scan_callback) - - self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ - 'low_latency']) - filter_list2, scan_settings2, scan_callback2 = ( - generate_ble_scan_objects(self.scn_ad.droid)) - self.scn_ad.droid.bleStartBleScan(filter_list2, scan_settings2, - scan_callback2) - self.active_scan_callback_list.append(scan_callback2) - - for callback in self.active_scan_callback_list: - try: - self.scn_ad.ed.pop_event( - scan_result.format(callback), self.default_timeout) - except Empty: - self.log.error("No scan results found for callback {}".format( - callback)) - return False - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='cf971f08-4d92-4046-bba6-b86a75aa773c') - def test_max_opportunistic_batch_scan_instances(self): - """Test max opportunistic batch scan instances. - - Tests max instances of opportunistic batch scans. Each instances should - find an onBatchScanResult event. - - Steps: - 1. Initialize advertiser and start advertisement on dut1 - 2. Set scan settings to opportunistic scan on dut0 scan instance and - set report delay seconds such that an onBatchScanResult is expected - 3. Start scan scan from step 2 - 4. Repeat step two and three until there are max_scan_instances-1 scan - instances - 5. Start a regular ble scan on dut0 with the last available scan - instance - 6. Pop onBatchScanResult event on all scan instances - - Expected Result: - Each opportunistic scan instance finds an advertisement. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Scanning, Opportunistic Scan, Batch Scanning - Priority: 1 - """ - self._setup_generic_advertisement() - for _ in range(self.max_scan_instances - 1): - self.scn_ad.droid.bleSetScanSettingsScanMode( - ble_scan_settings_modes['opportunistic']) - self.scn_ad.droid.bleSetScanSettingsReportDelayMillis( - self.report_delay) - filter_list, scan_settings, scan_callback = generate_ble_scan_objects( - self.scn_ad.droid) - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - self.active_scan_callback_list.append(scan_callback) - - self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ - 'low_latency']) - self.scn_ad.droid.bleSetScanSettingsReportDelayMillis( - self.report_delay) - filter_list2, scan_settings2, scan_callback2 = ( - generate_ble_scan_objects(self.scn_ad.droid)) - self.scn_ad.droid.bleStartBleScan(filter_list2, scan_settings2, - scan_callback2) - self.active_scan_callback_list.append(scan_callback2) - - for callback in self.active_scan_callback_list: - try: - self.scn_ad.ed.pop_event( - batch_scan_result.format(callback), self.default_timeout) - except Empty: - self.log.error("No scan results found for callback {}".format( - callback)) - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='965d84ef-11a7-418a-97e9-2a441c6de776') - def test_discover_opportunistic_scan_result_off_secondary_scan_filter( - self): - """Test opportunistic scan result from secondary scan filter. - - Tests opportunistic scan where the filtered scan instance does not find - an advertisement and the scan instance with scan mode set to - opportunistic scan will also not find an advertisement. - - Steps: - 1. Initialize advertiser and start advertisement on dut1 (make sure the - advertisement is not advertising the device name) - 2. Set scan settings to opportunistic scan on dut0 scan instance - 3. Start scan scan from step 2 - 4. Try to find an event, expect none - 5. Start a second scanner on dut0, with any other mode set and set the - scan filter device name to "opp_test" - 6. Pop onScanResults from the second scanner - 7. Expect no events - 8. Pop onScanResults from the first scanner - 9. Expect no events - - Expected Result: - Opportunistic scan instance finds an advertisement. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Scanning, Opportunistic Scan - Priority: 1 - """ - self._setup_generic_advertisement() - self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ - 'opportunistic']) - filter_list, scan_settings, scan_callback = generate_ble_scan_objects( - self.scn_ad.droid) - - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - self.active_scan_callback_list.append(scan_callback) - if not self._verify_no_events_found(scan_result.format(scan_callback)): - return False - self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ - 'low_latency']) - self.scn_ad.droid.bleSetScanFilterDeviceName("opp_test") - filter_list2, scan_settings2, scan_callback2 = ( - generate_ble_scan_objects(self.scn_ad.droid)) - self.scn_ad.droid.bleBuildScanFilter(filter_list2) - self.scn_ad.droid.bleStartBleScan(filter_list2, scan_settings2, - scan_callback2) - self.active_scan_callback_list.append(scan_callback2) - if not self._verify_no_events_found( - scan_result.format(scan_callback2)): - return False - if not self._verify_no_events_found(scan_result.format(scan_callback)): - return False - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='13b0a83f-e96e-4d64-84ef-66351ec5054c') - def test_negative_opportunistic_scan_filter_result_off_secondary_scan_result( - self): - """Test opportunistic scan not found scenario. - - Tests opportunistic scan where the secondary scan instance does find an - advertisement but the scan instance with scan mode set to opportunistic - scan does not find an advertisement due to mismatched scan filters. - - Steps: - 1. Initialize advertiser and start advertisement on dut1 (make sure the - advertisement is not advertising the device name) - 2. Set scan settings to opportunistic scan on dut0 scan instance and set - the scan filter device name to "opp_test" - 3. Start scan scan from step 2 - 4. Try to find an event, expect none - 5. Start a second scanner on dut0, with any other mode set - 6. Pop onScanResults from the second scanner - 7. Pop onScanResults from the first scanner - 8. Expect no events - - Expected Result: - Opportunistic scan instance doesn't find any advertisements. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Scanning, Opportunistic Scan - Priority: 1 - """ - self._setup_generic_advertisement() - self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ - 'opportunistic']) - self.scn_ad.droid.bleSetScanFilterDeviceName("opp_test") - filter_list, scan_settings, scan_callback = generate_ble_scan_objects( - self.scn_ad.droid) - self.scn_ad.droid.bleBuildScanFilter(filter_list) - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - self.active_scan_callback_list.append(scan_callback) - if not self._verify_no_events_found(scan_result.format(scan_callback)): - return False - self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ - 'low_latency']) - filter_list2, scan_settings2, scan_callback2 = ( - generate_ble_scan_objects(self.scn_ad.droid)) - self.scn_ad.droid.bleStartBleScan(filter_list2, scan_settings2, - scan_callback2) - self.active_scan_callback_list.append(scan_callback2) - try: - self.scn_ad.ed.pop_event( - scan_result.format(scan_callback2), self.default_timeout) - except Empty: - self.log.error("Non-Opportunistic scan found no scan results.") - return False - return self._verify_no_events_found(scan_result.format(scan_callback)) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='087f60b2-f6a1-4919-b4c5-cdf3debcfeff') - def test_opportunistic_scan_filter_result_off_secondary_scan_result(self): - """Test opportunistic scan from a secondary scan result. - - Tests opportunistic scan where the scan filters are the same between the - first scan instance with opportunistic scan set and the second instance - with any other mode set. - - Steps: - 1. Initialize advertiser and start advertisement on dut1 - 2. On dut0, set the scan settings mode to opportunistic scan and set - the scan filter device name to the advertiser's device name - 3. Start scan scan from step 2 - 4. Try to find an event, expect none - 5. Start a second scanner on dut0, with any other mode set and set the - scan filter device name to the advertiser's device name - 6. Pop onScanResults from the second scanner - 7. Pop onScanResults from the first scanner - - Expected Result: - Opportunistic scan instance finds a advertisement. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Scanning, Opportunistic Scan - Priority: 1 - """ - self.adv_ad.droid.bleSetAdvertiseDataIncludeDeviceName(True) - self._setup_generic_advertisement() - adv_device_name = self.adv_ad.droid.bluetoothGetLocalName() - self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ - 'opportunistic']) - self.scn_ad.droid.bleSetScanFilterDeviceName(adv_device_name) - filter_list, scan_settings, scan_callback = generate_ble_scan_objects( - self.scn_ad.droid) - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - self.active_scan_callback_list.append(scan_callback) - if not self._verify_no_events_found(scan_result.format(scan_callback)): - return False - self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ - 'low_latency']) - filter_list2, scan_settings2, scan_callback2 = ( - generate_ble_scan_objects(self.scn_ad.droid)) - self.scn_ad.droid.bleSetScanFilterDeviceName(adv_device_name) - self.scn_ad.droid.bleBuildScanFilter(filter_list2) - self.scn_ad.droid.bleStartBleScan(filter_list2, scan_settings2, - scan_callback2) - self.active_scan_callback_list.append(scan_callback2) - try: - self.scn_ad.ed.pop_event( - scan_result.format(scan_callback2), self.default_timeout) - except Empty: - self.log.error("Opportunistic scan found no scan results.") - return False - try: - self.scn_ad.ed.pop_event( - scan_result.format(scan_callback), self.default_timeout) - except Empty: - self.log.error("Non-Opportunistic scan found no scan results.") - return False - return True diff --git a/acts/tests/google/ble/scan/BleScanScreenStateTest.py b/acts/tests/google/ble/scan/BleScanScreenStateTest.py deleted file mode 100644 index 07ae898fbf..0000000000 --- a/acts/tests/google/ble/scan/BleScanScreenStateTest.py +++ /dev/null @@ -1,559 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (C) 2017 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -""" -This test script exercises different scan filters with different screen states. -""" - -import concurrent -import json -import pprint -import time - -from queue import Empty -from acts import utils -from acts.test_decorators import test_tracker_info -from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest -from acts.test_utils.bt.bt_constants import adv_succ -from acts.test_utils.bt.bt_constants import ble_advertise_settings_modes -from acts.test_utils.bt.bt_constants import ble_scan_settings_modes -from acts.test_utils.bt.bt_constants import bt_default_timeout -from acts.test_utils.bt.bt_constants import scan_result -from acts.test_utils.bt.bt_test_utils import generate_ble_advertise_objects -from acts.test_utils.bt.bt_test_utils import generate_ble_scan_objects -from acts.test_utils.bt.bt_test_utils import reset_bluetooth - - -class BleScanScreenStateTest(BluetoothBaseTest): - advertise_callback = -1 - max_concurrent_scans = 27 - scan_callback = -1 - shorter_scan_timeout = 4 - - def setup_class(self): - super(BluetoothBaseTest, self).setup_class() - self.scn_ad = self.android_devices[0] - self.adv_ad = self.android_devices[1] - - utils.set_location_service(self.scn_ad, True) - utils.set_location_service(self.adv_ad, True) - return True - - def _setup_generic_advertisement(self): - self.adv_ad.droid.bleSetAdvertiseSettingsAdvertiseMode( - ble_advertise_settings_modes['low_latency']) - self.advertise_callback, advertise_data, advertise_settings = ( - generate_ble_advertise_objects(self.adv_ad.droid)) - self.adv_ad.droid.bleStartBleAdvertising( - self.advertise_callback, advertise_data, advertise_settings) - try: - self.adv_ad.ed.pop_event(adv_succ.format(self.advertise_callback)) - except Empty: - self.log.error("Failed to start advertisement.") - return False - return True - - def _setup_scan_with_no_filters(self): - filter_list, scan_settings, self.scan_callback = \ - generate_ble_scan_objects(self.scn_ad.droid) - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - self.scan_callback) - - def _scan_found_results(self): - try: - self.scn_ad.ed.pop_event( - scan_result.format(self.scan_callback), bt_default_timeout) - self.log.info("Found an advertisement.") - except Empty: - self.log.info("Did not find an advertisement.") - return False - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='9b695819-e5a8-48b3-87a0-f90422998bf9') - def test_scan_no_filters_screen_on(self): - """Test LE scanning is successful with no filters and screen on. - - Test LE scanning is successful with no filters and screen on. Scan - results should be found. - - Steps: - 1. Setup advertisement - 2. Turn on screen - 3. Start scanner without filters - 4. Verify scan results are found - 5. Teardown advertisement and scanner - - Expected Result: - Scan results should be found. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning, Screen - Priority: 2 - """ - # Step 1 - if not self._setup_generic_advertisement(): - return False - - # Step 2 - self.scn_ad.droid.wakeUpNow() - - # Step 3 - self._setup_scan_with_no_filters() - - # Step 4 - if not self._scan_found_results(): - return False - - # Step 5 - self.adv_ad.droid.bleStopBleAdvertising(self.advertise_callback) - self.scn_ad.droid.bleStopBleScan(self.scan_callback) - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='38fb6959-f07b-4501-814b-81a498e3efc4') - def test_scan_no_filters_screen_off(self): - """Test LE scanning is successful with no filters and screen off. - - Test LE scanning is successful with no filters and screen off. No scan - results should be found. - - Steps: - 1. Setup advertisement - 2. Turn off screen - 3. Start scanner without filters - 4. Verify no scan results are found - 5. Teardown advertisement and scanner - - Expected Result: - No scan results should be found. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning, Screen - Priority: 1 - """ - # Step 1 - if not self._setup_generic_advertisement(): - return False - - # Step 2 - self.scn_ad.droid.goToSleepNow() - # Give the device time to go to sleep - time.sleep(2) - - # Step 3 - self._setup_scan_with_no_filters() - - # Step 4 - if self._scan_found_results(): - return False - - # Step 5 - self.adv_ad.droid.bleStopBleAdvertising(self.advertise_callback) - self.scn_ad.droid.bleStopBleScan(self.scan_callback) - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='7186ef2f-096a-462e-afde-b0e3d4ecdd83') - def test_scan_filters_works_with_screen_off(self): - """Test LE scanning is successful with filters and screen off. - - Test LE scanning is successful with no filters and screen off. No scan - results should be found. - - Steps: - 1. Setup advertisement - 2. Turn off screen - 3. Start scanner with filters - 4. Verify scan results are found - 5. Teardown advertisement and scanner - - Expected Result: - Scan results should be found. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning, Screen - Priority: 1 - """ - # Step 1 - adv_device_name = self.adv_ad.droid.bluetoothGetLocalName() - print(adv_device_name) - self.adv_ad.droid.bleSetAdvertiseDataIncludeDeviceName(True) - if not self._setup_generic_advertisement(): - return False - - # Step 2 - self.scn_ad.droid.goToSleepNow() - - # Step 3 - self.scn_ad.droid.bleSetScanFilterDeviceName(adv_device_name) - filter_list, scan_settings, self.scan_callback = generate_ble_scan_objects( - self.scn_ad.droid) - self.scn_ad.droid.bleBuildScanFilter(filter_list) - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - self.scan_callback) - - # Step 4 - if not self._scan_found_results(): - return False - - # Step 5 - self.adv_ad.droid.bleStopBleAdvertising(self.advertise_callback) - self.scn_ad.droid.bleStopBleScan(self.scan_callback) - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='02cd6dca-149e-439b-8427-a2edc7864265') - def test_scan_no_filters_screen_off_then_turn_on(self): - """Test start LE scan with no filters while screen is off then turn on. - - Test that a scan without filters will not return results while the - screen is off but will return results when the screen turns on. - - Steps: - 1. Setup advertisement - 2. Turn off screen - 3. Start scanner without filters - 4. Verify no scan results are found - 5. Turn screen on - 6. Verify scan results are found - 7. Teardown advertisement and scanner - - Expected Result: - Scan results should only come in when the screen is on. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning, Screen - Priority: 2 - """ - # Step 1 - if not self._setup_generic_advertisement(): - return False - - # Step 2 - self.scn_ad.droid.goToSleepNow() - # Give the device time to go to sleep - time.sleep(2) - - # Step 3 - self._setup_scan_with_no_filters() - - # Step 4 - if self._scan_found_results(): - return False - - # Step 5 - self.scn_ad.droid.wakeUpNow() - - # Step 6 - if not self._scan_found_results(): - return False - - # Step 7 - self.adv_ad.droid.bleStopBleAdvertising(self.advertise_callback) - self.scn_ad.droid.bleStopBleScan(self.scan_callback) - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='eb9fc373-f5e8-4a55-9750-02b7a11893d1') - def test_scan_no_filters_screen_on_then_turn_off(self): - """Test start LE scan with no filters while screen is on then turn off. - - Test that a scan without filters will not return results while the - screen is off but will return results when the screen turns on. - - Steps: - 1. Setup advertisement - 2. Turn off screen - 3. Start scanner without filters - 4. Verify no scan results are found - 5. Turn screen on - 6. Verify scan results are found - 7. Teardown advertisement and scanner - - Expected Result: - Scan results should only come in when the screen is on. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning, Screen - Priority: 2 - """ - # Step 1 - if not self._setup_generic_advertisement(): - return False - - # Step 2 - self.scn_ad.droid.wakeUpNow() - - # Step 3 - self._setup_scan_with_no_filters() - - # Step 4 - if not self._scan_found_results(): - return False - - # Step 5 - self.scn_ad.droid.goToSleepNow() - # Give the device time to go to sleep - time.sleep(2) - self.scn_ad.ed.clear_all_events() - - # Step 6 - if self._scan_found_results(): - return False - - # Step 7 - self.adv_ad.droid.bleStopBleAdvertising(self.advertise_callback) - self.scn_ad.droid.bleStopBleScan(self.scan_callback) - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='41d90e11-b0a8-4eed-bff1-c19678920762') - def test_scan_no_filters_screen_toggling(self): - """Test start LE scan with no filters and test screen toggling. - - Test that a scan without filters will not return results while the - screen is off and return results while the screen is on. - - Steps: - 1. Setup advertisement - 2. Turn off screen - 3. Start scanner without filters - 4. Verify no scan results are found - 5. Turn screen on - 6. Verify scan results are found - 7. Repeat steps 1-6 10 times - 7. Teardown advertisement and scanner - - Expected Result: - Scan results should only come in when the screen is on. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning, Screen - Priority: 3 - """ - iterations = 10 - # Step 1 - if not self._setup_generic_advertisement(): - return False - - for i in range(iterations): - self.log.info("Starting iteration {}".format(i + 1)) - # Step 2 - self.scn_ad.droid.goToSleepNow() - # Give the device time to go to sleep - time.sleep(2) - self.scn_ad.ed.clear_all_events() - - # Step 3 - self._setup_scan_with_no_filters() - - # Step 4 - if self._scan_found_results(): - return False - - # Step 5 - self.scn_ad.droid.wakeUpNow() - - # Step 6 - if not self._scan_found_results(): - return False - - # Step 7 - self.adv_ad.droid.bleStopBleAdvertising(self.advertise_callback) - self.scn_ad.droid.bleStopBleScan(self.scan_callback) - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='7a2fe7ef-b15f-4e93-a2f0-40e2f7d9cbcb') - def test_opportunistic_scan_no_filters_screen_off_then_on(self): - """Test opportunistic scanning does not find results with screen off. - - Test LE scanning is successful with no filters and screen off. No scan - results should be found. - - Steps: - 1. Setup advertisement - 2. Turn off screen - 3. Start opportunistic scan without filters - 4. Start scan without filters - 5. Verify no scan results are found on either scan instance - 6. Wake up phone - 7. Verify scan results on each scan instance - 8. Teardown advertisement and scanner - - Expected Result: - No scan results should be found. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning, Screen - Priority: 1 - """ - # Step 1 - if not self._setup_generic_advertisement(): - return False - - # Step 2 - self.scn_ad.droid.goToSleepNow() - # Give the device time to go to sleep - time.sleep(2) - - # Step 3 - self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ - 'opportunistic']) - filter_list, scan_settings, scan_callback = generate_ble_scan_objects( - self.scn_ad.droid) - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - - # Step 4 - filter_list2, scan_settings2, scan_callback2 = generate_ble_scan_objects( - self.scn_ad.droid) - self.scn_ad.droid.bleStartBleScan(filter_list2, scan_settings2, - scan_callback2) - - # Step 5 - try: - self.scn_ad.ed.pop_event( - scan_result.format(scan_callback), self.shorter_scan_timeout) - self.log.error("Found an advertisement on opportunistic scan.") - return False - except Empty: - self.log.info("Did not find an advertisement.") - try: - self.scn_ad.ed.pop_event( - scan_result.format(scan_callback2), self.shorter_scan_timeout) - self.log.error("Found an advertisement on scan instance.") - return False - except Empty: - self.log.info("Did not find an advertisement.") - - # Step 6 - self.scn_ad.droid.wakeUpNow() - - # Step 7 - try: - self.scn_ad.ed.pop_event( - scan_result.format(scan_callback), self.shorter_scan_timeout) - self.log.info("Found an advertisement on opportunistic scan.") - except Empty: - self.log.error( - "Did not find an advertisement on opportunistic scan.") - return False - try: - self.scn_ad.ed.pop_event( - scan_result.format(scan_callback2), self.shorter_scan_timeout) - self.log.info("Found an advertisement on scan instance.") - except Empty: - self.log.info("Did not find an advertisement.") - return False - - # Step 8 - self.adv_ad.droid.bleStopBleAdvertising(self.advertise_callback) - self.scn_ad.droid.bleStopBleScan(scan_callback) - self.scn_ad.droid.bleStopBleScan(scan_callback2) - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='406f1a2e-160f-4fb2-8a87-6403996df36e') - def test_max_scan_no_filters_screen_off_then_turn_on(self): - """Test start max scans with no filters while screen is off then turn on - - Test that max LE scan without filters will not return results while the - screen is off but will return results when the screen turns on. - - Steps: - 1. Setup advertisement - 2. Turn off screen - 3. Start scanner without filters and verify no scan results - 4. Turn screen on - 5. Verify scan results are found on each scan callback - 6. Teardown advertisement and all scanner - - Expected Result: - Scan results should only come in when the screen is on. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Filtering, Scanning, Screen - Priority: 2 - """ - # Step 1 - if not self._setup_generic_advertisement(): - return False - - # Step 2 - self.scn_ad.droid.goToSleepNow() - # Give the device time to go to sleep - time.sleep(2) - - # Step 3 - scan_callback_list = [] - for _ in range(self.max_concurrent_scans): - filter_list, scan_settings, scan_callback = \ - generate_ble_scan_objects(self.scn_ad.droid) - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - scan_callback_list.append(scan_callback) - try: - self.scn_ad.ed.pop_event( - scan_result.format(self.scan_callback), - self.shorter_scan_timeout) - self.log.info("Found an advertisement.") - return False - except Empty: - self.log.info("Did not find an advertisement.") - - # Step 4 - self.scn_ad.droid.wakeUpNow() - - # Step 5 - for callback in scan_callback_list: - try: - self.scn_ad.ed.pop_event( - scan_result.format(callback), self.shorter_scan_timeout) - self.log.info("Found an advertisement.") - except Empty: - self.log.info("Did not find an advertisement.") - return False - - # Step 7 - self.adv_ad.droid.bleStopBleAdvertising(self.advertise_callback) - for callback in scan_callback_list: - self.scn_ad.droid.bleStopBleScan(callback) - return True diff --git a/acts/tests/google/ble/system_tests/BleStressTest.py b/acts/tests/google/ble/system_tests/BleStressTest.py deleted file mode 100644 index afbb67a1cd..0000000000 --- a/acts/tests/google/ble/system_tests/BleStressTest.py +++ /dev/null @@ -1,355 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -""" -Basic LE Stress tests. -""" - -import concurrent -import pprint -import time - -from queue import Empty -from acts.test_decorators import test_tracker_info -from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest -from acts.test_utils.bt.bt_test_utils import BtTestUtilsError -from acts.test_utils.bt.bt_test_utils import clear_bonded_devices -from acts.test_utils.bt.bt_test_utils import generate_ble_advertise_objects -from acts.test_utils.bt.bt_test_utils import generate_ble_scan_objects -from acts.test_utils.bt.bt_test_utils import get_advanced_droid_list -from acts.test_utils.bt.bt_test_utils import get_mac_address_of_generic_advertisement -from acts.test_utils.bt.bt_test_utils import reset_bluetooth -from acts.test_utils.bt.bt_constants import scan_result - - -class BleStressTest(BluetoothBaseTest): - default_timeout = 10 - PAIRING_TIMEOUT = 20 - droid_list = [] - - def setup_class(self): - super().setup_class() - self.droid_list = get_advanced_droid_list(self.android_devices) - self.scn_ad = self.android_devices[0] - self.adv_ad = self.android_devices[1] - - def teardown_test(self): - super().teardown_test() - self.log_stats() - - def bleadvertise_verify_onsuccess_handler(self, event): - test_result = True - self.log.debug("Verifying onSuccess event") - self.log.debug(pprint.pformat(event)) - return test_result - - def _verify_successful_bond(self, target_address): - end_time = time.time() + self.PAIRING_TIMEOUT - self.log.info("Verifying devices are bonded") - while time.time() < end_time: - bonded_devices = self.scn_ad.droid.bluetoothGetBondedDevices() - if target_address in {d['address'] for d in bonded_devices}: - self.log.info("Successfully bonded to device") - return True - return False - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='22f98085-6ed8-4ad8-b62d-b8d1eae20b89') - def test_loop_scanning_1000(self): - """Stress start/stop scan instances. - - This test will start and stop scan instances as fast as possible. This - will guarantee that the scan instances are properly being cleaned up - when the scan is stopped. - - Steps: - 1. Start a scan instance. - 2. Stop the scan instance. - 3. Repeat steps 1-2 1000 times. - - Expected Result: - Neither starting or stopping scan instances causes any failures. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning, Stress - Priority: 1 - """ - test_result = True - for _ in range(1000): - filter_list, scan_settings, scan_callback = generate_ble_scan_objects( - self.scn_ad.droid) - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - self.scn_ad.droid.bleStopBleScan(scan_callback) - return test_result - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='6caa84c2-50ac-46f2-a5e5-f942fd2cd6f6') - def test_loop_scanning_100_verify_no_hci_timeout(self): - """Stress start/stop scan instances variant. - - This test will start and stop scan instances with a one second timeout - in between each iteration. This testcase was added because the specific - timing combination caused hci timeouts. - - Steps: - 1. Start a scan instance. - 2. Stop the scan instance. - 3. Sleep for 1 second. - 4. Repeat steps 1-3 100 times. - - Expected Result: - Neither starting or stopping scan instances causes any failures. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning, Stress - Priority: 1 - """ - for _ in range(self.droid_list[1]['max_advertisements']): - adv_callback, adv_data, adv_settings = generate_ble_advertise_objects( - self.adv_ad.droid) - self.adv_ad.droid.bleStartBleAdvertising(adv_callback, adv_data, - adv_settings) - for _ in range(100): - filter_list, scan_settings, scan_callback = generate_ble_scan_objects( - self.scn_ad.droid) - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - self.log.info( - self.scn_ad.ed.pop_event(scan_result.format(scan_callback))) - self.scn_ad.droid.bleStopBleScan(scan_callback) - time.sleep(1) - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='5e9e4c8d-b72e-4767-81e5-f907c1834430') - def test_loop_advertising_100(self): - """Stress start/stop advertising instances. - - This test will start and stop advertising instances as fast as possible. - - Steps: - 1. Start a advertising instance. - 2. Find that an onSuccess callback is triggered. - 3. Stop the advertising instance. - 4. Repeat steps 1-3 100 times. - - Expected Result: - Neither starting or stopping advertising instances causes any failures. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Stress - Priority: 1 - """ - test_result = True - for _ in range(100): - advertise_callback, advertise_data, advertise_settings = generate_ble_advertise_objects( - self.adv_ad.droid) - self.adv_ad.droid.bleStartBleAdvertising( - advertise_callback, advertise_data, advertise_settings) - expected_advertise_event_name = "".join( - ["BleAdvertise", - str(advertise_callback), "onSuccess"]) - worker = self.adv_ad.ed.handle_event( - self.bleadvertise_verify_onsuccess_handler, - expected_advertise_event_name, ([]), self.default_timeout) - try: - self.log.debug(worker.result(self.default_timeout)) - except Empty as error: - self.log.debug(" ".join( - ["Test failed with Empty error:", - str(error)])) - test_result = False - except concurrent.futures._base.TimeoutError as error: - self.log.debug(" ".join([ - "Test failed, filtering callback onSuccess never occurred:", - str(error) - ])) - test_result = False - self.adv_ad.droid.bleStopBleAdvertising(advertise_callback) - return test_result - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='11a2f51b-7178-4c32-bb5c-7eddd100a50f') - def test_restart_advertise_callback_after_bt_toggle(self): - """Test to reuse an advertise callback. - - This will verify if advertising objects can be reused after a bluetooth - toggle. - - Steps: - 1. Start a advertising instance. - 2. Find that an onSuccess callback is triggered. - 3. Stop the advertising instance. - 4. Toggle bluetooth off and on. - 5. Start an advertising instance on the same objects used in step 1. - 6. Find that an onSuccess callback is triggered. - - Expected Result: - Advertisement should start successfully. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Stress - Priority: 1 - """ - test_result = True - advertise_callback, advertise_data, advertise_settings = generate_ble_advertise_objects( - self.adv_ad.droid) - self.adv_ad.droid.bleStartBleAdvertising( - advertise_callback, advertise_data, advertise_settings) - expected_advertise_event_name = "".join( - ["BleAdvertise", - str(advertise_callback), "onSuccess"]) - worker = self.adv_ad.ed.handle_event( - self.bleadvertise_verify_onsuccess_handler, - expected_advertise_event_name, ([]), self.default_timeout) - try: - self.log.debug(worker.result(self.default_timeout)) - except Empty as error: - self.log.debug(" ".join( - ["Test failed with Empty error:", - str(error)])) - test_result = False - except concurrent.futures._base.TimeoutError as error: - self.log.debug(" ".join([ - "Test failed, filtering callback onSuccess never occurred:", - str(error) - ])) - test_result = reset_bluetooth([self.scn_ad]) - if not test_result: - return test_result - time.sleep(5) - self.adv_ad.droid.bleStartBleAdvertising( - advertise_callback, advertise_data, advertise_settings) - worker = self.adv_ad.ed.handle_event( - self.bleadvertise_verify_onsuccess_handler, - expected_advertise_event_name, ([]), self.default_timeout) - try: - self.log.debug(worker.result(self.default_timeout)) - except Empty as error: - self.log.debug(" ".join( - ["Test failed with Empty error:", - str(error)])) - test_result = False - except concurrent.futures._base.TimeoutError as error: - self.log.debug(" ".join([ - "Test failed, filtering callback onSuccess never occurred:", - str(error) - ])) - return test_result - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='88f3c068-41be-41df-920c-c0ecaae1a619') - def test_restart_scan_callback_after_bt_toggle(self): - """Test to reuse an scan callback. - - This will verify if scan objects can be reused after a bluetooth - toggle. - - Steps: - 1. Start a scanning instance. - 3. Stop the scanning instance. - 4. Toggle bluetooth off and on. - 5. Start an scanning instance on the same objects used in step 1. - - Expected Result: - Scanner should start successfully. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning, Stress - Priority: 1 - """ - test_result = True - filter_list, scan_settings, scan_callback = generate_ble_scan_objects( - self.scn_ad.droid) - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - reset_bluetooth([self.scn_ad]) - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - - return test_result - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='ce8adfc0-384f-4751-9438-13a76cada8da') - def test_le_pairing(self): - """Test LE pairing transport stress - - This will test LE pairing between two android devices. - - Steps: - 1. Start an LE advertisement on secondary device. - 2. Find address from primary device. - 3. Discover and bond to LE address. - 4. Stop LE advertisement on secondary device. - 5. Repeat steps 1-4 100 times - - Expected Result: - LE pairing should pass 100 times. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning, Stress, Pairing - Priority: 1 - """ - iterations = 100 - for i in range(iterations): - try: - target_address, adv_callback, scan_callback = get_mac_address_of_generic_advertisement( - self.scn_ad, self.adv_ad) - except BtTestUtilsError as err: - self.log.error(err) - return False - self.log.info("Begin interation {}/{}".format(i + 1, iterations)) - self.scn_ad.droid.bluetoothStartPairingHelper() - self.adv_ad.droid.bluetoothStartPairingHelper() - start_time = self.start_timer() - self.scn_ad.droid.bluetoothDiscoverAndBond(target_address) - if not self._verify_successful_bond(target_address): - self.log.error("Failed to bond devices.") - return False - self.log.info("Total time (ms): {}".format(self.end_timer())) - if not self._verify_successful_bond(self.adv_ad.droid.bluetoothGetLocalAddress()): - self.log.error("Failed to bond BREDR devices.") - return False - if not self.scn_ad.droid.bluetoothUnbond(target_address): - self.log.error("Failed to unbond device from scanner.") - return False - time.sleep(2) - if not self.adv_ad.droid.bluetoothUnbond(self.scn_ad.droid.bluetoothGetLocalAddress()): - self.log.error("Failed to unbond device from advertiser.") - return False - self.adv_ad.droid.bleStopBleAdvertising(adv_callback) - self.scn_ad.droid.bleStopBleScan(scan_callback) - # Magic sleep to let unbonding finish - time.sleep(2) - return True diff --git a/acts/tests/google/ble/system_tests/GattLongevityTest.py b/acts/tests/google/ble/system_tests/GattLongevityTest.py deleted file mode 100644 index bb13646625..0000000000 --- a/acts/tests/google/ble/system_tests/GattLongevityTest.py +++ /dev/null @@ -1,102 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -""" -This test script for GATT longevity tests. -""" - -from acts.test_decorators import test_tracker_info -from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest -from acts.test_utils.bt.GattConnectedBaseTest import GattConnectedBaseTest -from acts.test_utils.bt.bt_constants import gatt_characteristic -from acts.test_utils.bt.bt_constants import gatt_descriptor -from acts.test_utils.bt.bt_constants import gatt_event -from acts.test_utils.bt.bt_constants import gatt_cb_strings -from acts.test_utils.bt.bt_constants import gatt_connection_priority -from acts.test_utils.bt.bt_constants import gatt_characteristic_attr_length -from acts.test_utils.bt.GattEnum import MtuSize -from acts.test_utils.bt.bt_gatt_utils import setup_gatt_mtu - - -class GattLongevityTest(GattConnectedBaseTest): - longevity_iterations = 1100000 - - @test_tracker_info(uuid='d7d378f4-89d8-4330-bb80-0054b92020bb') - def test_write_characteristic_no_resp_longevity(self): - """Longevity test write characteristic value - - Longevity test to write characteristic value for - self.longevity_iteration times. This is to test the - integrity of written data and the robustness of central - and peripheral mode of the Android devices under test. - - 1. Central: write WRITABLE_CHAR_UUID characteristic with char_value - using write command. - 2. Central: make sure write callback is called. - 3. Peripheral: receive the written data. - 4. Verify data written matches data received. - 5. Repeat steps 1-4 self.longevity_iterations times. - - Expected Result: - Verify that write command is properly delivered. - - Returns: - Pass if True - Fail if False - - TAGS: LE, GATT, Characteristic, Longevity - Priority: 0 - """ - self.cen_ad.droid.gattClientRequestConnectionPriority( - self.bluetooth_gatt, gatt_connection_priority['high']) - - self.cen_ad.droid.gattClientCharacteristicSetWriteType( - self.bluetooth_gatt, self.discovered_services_index, - self.test_service_index, self.WRITABLE_CHAR_UUID, - gatt_characteristic['write_type_no_response']) - - for i in range(self.longevity_iterations): - self.log.debug("Iteration {} started.".format(i + 1)) - char_value = [] - for j in range(i, i + self.mtu - 3): - char_value.append(j % 256) - - self.cen_ad.droid.gattClientCharacteristicSetValue( - self.bluetooth_gatt, self.discovered_services_index, - self.test_service_index, self.WRITABLE_CHAR_UUID, char_value) - - self.cen_ad.droid.gattClientWriteCharacteristic( - self.bluetooth_gatt, self.discovered_services_index, - self.test_service_index, self.WRITABLE_CHAR_UUID) - - # client shall not wait for server, get complete event right away - event = self._client_wait(gatt_event['char_write']) - if event["data"]["Status"] != 0: - self.log.error("Write status should be 0") - return False - - event = self._server_wait(gatt_event['char_write_req']) - - self.log.info("{} event found: {}".format(gatt_cb_strings[ - 'char_write_req'].format(self.gatt_server_callback), event[ - 'data']['value'])) - request_id = event['data']['requestId'] - found_value = event['data']['value'] - if found_value != char_value: - self.log.info("Values didn't match. Found: {}, " - "Expected: {}".format(found_value, char_value)) - return False - - return True diff --git a/acts/tests/google/experimental/BluetoothLatencyTest.py b/acts/tests/google/experimental/BluetoothLatencyTest.py deleted file mode 100644 index ea6ed4a24d..0000000000 --- a/acts/tests/google/experimental/BluetoothLatencyTest.py +++ /dev/null @@ -1,141 +0,0 @@ -#/usr/bin/env python3 -# -# Copyright (C) 2018 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. - -import random -import statistics -import string -import time -from acts import asserts -from acts.base_test import BaseTestClass -from acts.signals import TestPass -from acts.test_decorators import test_tracker_info -from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest -from acts.test_utils.bt.bt_test_utils import orchestrate_rfcomm_connection -from acts.test_utils.bt.bt_test_utils import setup_multiple_devices_for_bt_test -from acts.test_utils.bt.bt_test_utils import verify_server_and_client_connected -from acts.test_utils.bt.bt_test_utils import write_read_verify_data -from acts.test_utils.bt.loggers.bluetooth_metric_logger import BluetoothMetricLogger -from acts.test_utils.bt.loggers.protos import bluetooth_metric_pb2 as proto_module -from acts.utils import set_location_service - - -class BluetoothLatencyTest(BaseTestClass): - """Connects two Android phones and tests the RFCOMM latency. - - Attributes: - client_device: An Android device object that will be sending data - server_device: An Android device object that will be receiving data - bt_logger: The proxy logger instance for each test case - data_transfer_type: Data transfer protocol used for the test - """ - - def setup_class(self): - super().setup_class() - - # Sanity check of the devices under test - # TODO(b/119051823): Investigate using a config validator to replace this. - if len(self.android_devices) < 2: - raise ValueError( - 'Not enough android phones detected (need at least two)') - - # Data will be sent from the client_device to the server_device - self.client_device = self.android_devices[0] - self.server_device = self.android_devices[1] - self.bt_logger = BluetoothMetricLogger.for_test_case() - self.data_transfer_type = proto_module.BluetoothDataTestResult.RFCOMM - self.log.info('Successfully found required devices.') - - def setup_test(self): - setup_multiple_devices_for_bt_test(self.android_devices) - self._connect_rfcomm() - - def teardown_test(self): - if verify_server_and_client_connected( - self.client_device, self.server_device, log=False): - self.client_device.droid.bluetoothSocketConnStop() - self.server_device.droid.bluetoothSocketConnStop() - - def _connect_rfcomm(self): - """Establishes an RFCOMM connection between two phones. - - Connects the client device to the server device given the hardware - address of the server device. - """ - - set_location_service(self.client_device, True) - set_location_service(self.server_device, True) - server_address = self.server_device.droid.bluetoothGetLocalAddress() - self.log.info('Pairing and connecting devices') - asserts.assert_true(self.client_device.droid - .bluetoothDiscoverAndBond(server_address), - 'Failed to pair and connect devices') - - # Create RFCOMM connection - asserts.assert_true(orchestrate_rfcomm_connection - (self.client_device, self.server_device), - 'Failed to establish RFCOMM connection') - - def _measure_latency(self): - """Measures the latency of data transfer over RFCOMM. - - Sends data from the client device that is read by the server device. - Calculates the latency of the transfer. - - Returns: - The latency of the transfer milliseconds. - """ - - # Generates a random message to transfer - message = (''.join(random.choice(string.ascii_letters + string.digits) - for _ in range(6))) - - start_time = time.perf_counter() - write_read_successful = write_read_verify_data(self.client_device, - self.server_device, - message, - False) - end_time = time.perf_counter() - asserts.assert_true(write_read_successful, - 'Failed to send/receive message') - return (end_time - start_time) * 1000 - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='7748295d-204e-4ad0-adf5-7591380b940a') - def test_bluetooth_latency(self): - """Tests the latency for a data transfer over RFCOMM""" - - metrics = {} - latency_list = [] - - for _ in range(300): - latency_list.append(self._measure_latency()) - - metrics['data_transfer_protocol'] = self.data_transfer_type - metrics['data_latency_min_millis'] = int(min(latency_list)) - metrics['data_latency_max_millis'] = int(max(latency_list)) - metrics['data_latency_avg_millis'] = int(statistics.mean(latency_list)) - self.log.info('Latency: {}'.format(metrics)) - - proto = self.bt_logger.get_results(metrics, - self.__class__.__name__, - self.server_device, - self.client_device) - - asserts.assert_true(metrics['data_latency_min_millis'] > 0, - 'Minimum latency must be greater than 0!', - extras=proto) - - raise TestPass('Latency test completed successfully', extras=proto) diff --git a/acts/tests/google/experimental/BluetoothPairAndConnectTest.py b/acts/tests/google/experimental/BluetoothPairAndConnectTest.py deleted file mode 100644 index 2402fb5444..0000000000 --- a/acts/tests/google/experimental/BluetoothPairAndConnectTest.py +++ /dev/null @@ -1,192 +0,0 @@ -#/usr/bin/env python3 -# -# Copyright (C) 2018 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -"""Bluetooth 1st time force pair and connect test implementation.""" -# Quick way to get the Apollo serial number: -# python3.5 -c "from acts.controllers.buds_lib.apollo_lib import get_devices; [print(d['serial_number']) for d in get_devices()]" - -import statistics -import time - -from acts import logger -from acts.base_test import BaseTestClass -from acts.controllers.buds_lib.test_actions.bt_utils import BTUtils -from acts.controllers.buds_lib.test_actions.bt_utils import BTUtilsError -from acts.controllers.buds_lib.test_actions.apollo_acts import ApolloTestActions -from acts.signals import TestFailure -from acts.signals import TestPass -from acts.test_decorators import test_tracker_info -from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest -from acts.test_utils.bt.bt_test_utils import factory_reset_bluetooth -from acts.test_utils.bt.bt_test_utils import enable_bluetooth -from acts.test_utils.bt.bt_test_utils import setup_multiple_devices_for_bt_test -from acts.test_utils.bt.loggers.bluetooth_metric_logger import BluetoothMetricLogger -from acts.utils import set_location_service - - -# The number of pairing and connection attempts -PAIR_CONNECT_ATTEMPTS = 200 - - -class BluetoothPairConnectError(TestFailure): - pass - - -class BluetoothPairAndConnectTest(BaseTestClass): - """Pairs and connects a phone and an Apollo buds device. - - Attributes: - phone: An Android phone object - apollo: An Apollo earbuds object - apollo_act: An Apollo test action object - dut_bt_addr: The Bluetooth address of the Apollo earbuds - bt_utils: BTUtils test action object - """ - - def setup_class(self): - super().setup_class() - # Sanity check of the devices under test - # TODO(b/119051823): Investigate using a config validator to replace this. - if not self.android_devices: - raise ValueError( - 'Cannot find android phone (need at least one).') - self.phone = self.android_devices[0] - - if not self.buds_devices: - raise ValueError( - 'Cannot find apollo device (need at least one).') - self.apollo = self.buds_devices[0] - self.log.info('Successfully found needed devices.') - - # Staging the test, create result object, etc. - self.apollo_act = ApolloTestActions(self.apollo, self.log) - self.dut_bt_addr = self.apollo.bluetooth_address - self.bt_utils = BTUtils() - self.bt_logger = BluetoothMetricLogger.for_test_case() - - def setup_test(self): - setup_multiple_devices_for_bt_test(self.android_devices) - # Make sure Bluetooth is on - enable_bluetooth(self.phone.droid, self.phone.ed) - set_location_service(self.phone, True) - self.apollo_act.factory_reset() - self.log.info('===== START BLUETOOTH PAIR AND CONNECT TEST =====') - - def teardown_test(self): - self.log.info('Teardown test, shutting down all services...') - self.apollo_act.factory_reset() - self.apollo.close() - - def _get_device_pair_and_connect_times(self): - """Gets the pair and connect times of the phone and buds device. - - Pairs the phone with the buds device. Gets the pair and connect times. - Unpairs the devices. - - Returns: - pair_time: The time it takes to pair the devices in ms. - connection_time: The time it takes to connect the devices for the - first time after pairing. - - Raises: - BluetoothPairConnectError - """ - - try: - pair_time = self.bt_utils.bt_pair(self.phone, self.apollo) - except BTUtilsError: - raise BluetoothPairConnectError('Failed to pair devices') - - pair_time *= 1000 - connection_start_time = time.perf_counter() - if not self.apollo_act.wait_for_bluetooth_a2dp_hfp(30): - raise BluetoothPairConnectError('Failed to connect devices') - connection_end_time = time.perf_counter() - connection_time = (connection_end_time - - connection_start_time) * 1000 - - return pair_time, connection_time - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='c914fd08-350d-465a-96cf-970d40e71060') - def test_bluetooth_connect(self): - # Store metrics - metrics = {} - pair_connect_success = 0 - pair_connect_failures = [] - pair_times = [] - connect_times = [] - first_connection_failure = None - - for attempt in range(PAIR_CONNECT_ATTEMPTS): - self.log.info('Pair and connection attempt {}'.format(attempt + 1)) - pair_connect_timestamp = time.strftime(logger.log_line_time_format, - time.localtime()) - try: - pair_time, connect_time = (self. - _get_device_pair_and_connect_times()) - except BluetoothPairConnectError as err: - self.log.error(err) - failure_data = {'timestamp': pair_connect_timestamp, - 'error': str(err), - 'pair_and_connect_attempt': attempt + 1} - pair_connect_failures.append(failure_data) - if not first_connection_failure: - first_connection_failure = err - else: - connect_times.append(connect_time) - pair_times.append(pair_time) - pair_connect_success += 1 - - factory_reset_bluetooth([self.phone]) - self.log.info('Factory resetting Apollo device...') - self.apollo_act.factory_reset() - - # Buffer between pair and connect attempts - time.sleep(3) - - metrics['pair_attempt_count'] = PAIR_CONNECT_ATTEMPTS - metrics['pair_successful_count'] = pair_connect_success - metrics['pair_failed_count'] = (PAIR_CONNECT_ATTEMPTS - - pair_connect_success) - - if len(pair_times) > 0: - metrics['pair_max_time_millis'] = int(max(pair_times)) - metrics['pair_min_time_millis'] = int(min(pair_times)) - metrics['pair_avg_time_millis'] = int(statistics.mean(pair_times)) - - if len(connect_times) > 0: - metrics['first_connection_max_time_millis'] = int( - max(connect_times)) - metrics['first_connection_min_time_millis'] = int( - min(connect_times)) - metrics['first_connection_avg_time_millis'] = int( - (statistics.mean(connect_times))) - - if pair_connect_failures: - metrics['pair_conn_failure_info'] = pair_connect_failures - - proto = self.bt_logger.get_results(metrics, - self.__class__.__name__, - self.phone, - self.apollo) - - self.log.info('Metrics: {}'.format(metrics)) - - if PAIR_CONNECT_ATTEMPTS != pair_connect_success: - raise TestFailure(str(first_connection_failure), extras=proto) - else: - raise TestPass('Bluetooth pair and connect test passed', - extras=proto) diff --git a/acts/tests/google/experimental/BluetoothReconnectTest.py b/acts/tests/google/experimental/BluetoothReconnectTest.py deleted file mode 100644 index 5339e517eb..0000000000 --- a/acts/tests/google/experimental/BluetoothReconnectTest.py +++ /dev/null @@ -1,182 +0,0 @@ -#/usr/bin/env python3 -# -# Copyright (C) 2018 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -"""Bluetooth disconnect and reconnect verification.""" -# Quick way to get the Apollo serial number: -# python3.5 -c "from acts.controllers.buds_lib.apollo_lib import get_devices; [print(d['serial_number']) for d in get_devices()]" - -import statistics -import time -from acts import asserts -from acts.base_test import BaseTestClass -from acts.controllers.buds_lib.test_actions.apollo_acts import ApolloTestActions -from acts.signals import TestFailure -from acts.signals import TestPass -from acts.test_decorators import test_tracker_info -from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest -from acts.test_utils.bt.bt_test_utils import enable_bluetooth -from acts.test_utils.bt.bt_test_utils import setup_multiple_devices_for_bt_test -from acts.test_utils.bt.loggers.bluetooth_metric_logger import BluetoothMetricLogger -from acts.utils import set_location_service - -# The number of reconnections to be attempted during the test -RECONNECTION_ATTEMPTS = 200 - - -class BluetoothReconnectError(TestFailure): - pass - - -class BluetoothReconnectTest(BaseTestClass): - """Connects a phone to Apollo earbuds to test Bluetooth reconnection. - - Attributes: - phone: An Android phone object - apollo: An Apollo earbuds object - apollo_act: An Apollo test action object - dut_bt_addr: The Bluetooth address of the Apollo earbuds - """ - - def setup_class(self): - super().setup_class() - # sanity check of the dut devices. - # TODO(b/119051823): Investigate using a config validator to replace this. - if not self.android_devices: - raise ValueError( - 'Cannot find android phone (need at least one).') - self.phone = self.android_devices[0] - - if not self.buds_devices: - raise ValueError( - 'Cannot find apollo device (need at least one).') - self.apollo = self.buds_devices[0] - self.log.info('Successfully found needed devices.') - - # Staging the test, create result object, etc. - self.apollo_act = ApolloTestActions(self.apollo, self.log) - self.dut_bt_addr = self.apollo.bluetooth_address - self.bt_logger = BluetoothMetricLogger.for_test_case() - - def setup_test(self): - setup_multiple_devices_for_bt_test(self.android_devices) - # Make sure Bluetooth is on - enable_bluetooth(self.phone.droid, self.phone.ed) - set_location_service(self.phone, True) - self.apollo_act.factory_reset() - - # Initial pairing and connection of devices - self.phone.droid.bluetoothDiscoverAndBond(self.dut_bt_addr) - paired_and_connected = self.apollo_act.wait_for_bluetooth_a2dp_hfp() - asserts.assert_true(paired_and_connected, - 'Failed to pair and connect devices') - time.sleep(20) - self.log.info('===== START BLUETOOTH RECONNECT TEST =====') - - def teardown_test(self): - self.log.info('Teardown test, shutting down all services...') - self.apollo_act.factory_reset() - self.apollo.close() - - def _reconnect_bluetooth_from_phone(self): - """Reconnects Bluetooth from the phone. - - Disables and then re-enables Bluetooth from the phone when Bluetooth - disconnection has been verified. Measures the reconnection time. - - Returns: - The time it takes to connect Bluetooth in milliseconds. - - Raises: - BluetoothReconnectError - """ - - # Disconnect Bluetooth from the phone side - self.log.info('Disconnecting Bluetooth from phone') - self.phone.droid.bluetoothDisconnectConnected(self.dut_bt_addr) - if not self.apollo_act.wait_for_bluetooth_disconnection(): - raise BluetoothReconnectError('Failed to disconnect Bluetooth') - self.log.info('Bluetooth disconnected successfully') - - # Buffer between disconnect and reconnect - time.sleep(3) - - # Reconnect Bluetooth from the phone side - self.log.info('Connecting Bluetooth from phone') - start_time = time.perf_counter() - self.phone.droid.bluetoothConnectBonded(self.dut_bt_addr) - self.log.info('Bluetooth connected successfully') - if not self.apollo_act.wait_for_bluetooth_a2dp_hfp(): - raise BluetoothReconnectError('Failed to connect Bluetooth') - end_time = time.perf_counter() - return (end_time - start_time) * 1000 - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='da921903-92d0-471d-ae01-456058cc1297') - def test_bluetooth_reconnect(self): - """Reconnects Bluetooth between a phone and Apollo device a specified - number of times and reports connection time statistics.""" - - # Store metrics - metrics = {} - connection_success = 0 - connection_times = [] - reconnection_failures = [] - first_connection_failure = None - - for attempt in range(RECONNECTION_ATTEMPTS): - self.log.info("Reconnection attempt {}".format(attempt + 1)) - reconnect_timestamp = time.strftime('%Y-%m-%d %H:%M:%S', - time.localtime()) - try: - connection_time = self._reconnect_bluetooth_from_phone() - except BluetoothReconnectError as err: - self.log.error(err) - failure_data = {'timestamp': reconnect_timestamp, - 'error': str(err), - 'reconnect_attempt': attempt + 1} - reconnection_failures.append(failure_data) - if not first_connection_failure: - first_connection_failure = err - else: - connection_times.append(connection_time) - connection_success += 1 - - # Buffer between reconnection attempts - time.sleep(3) - - metrics['connection_attempt_count'] = RECONNECTION_ATTEMPTS - metrics['connection_successful_count'] = connection_success - metrics['connection_failed_count'] = (RECONNECTION_ATTEMPTS - - connection_success) - if len(connection_times) > 0: - metrics['connection_max_time_millis'] = int(max(connection_times)) - metrics['connection_min_time_millis'] = int(min(connection_times)) - metrics['connection_avg_time_millis'] = int(statistics.mean( - connection_times)) - - if reconnection_failures: - metrics['connection_failure_info'] = reconnection_failures - - proto = self.bt_logger.get_results(metrics, - self.__class__.__name__, - self.phone, - self.apollo) - - self.log.info('Metrics: {}'.format(metrics)) - - if RECONNECTION_ATTEMPTS != connection_success: - raise TestFailure(str(first_connection_failure), extras=proto) - else: - raise TestPass('Bluetooth reconnect test passed', extras=proto) diff --git a/acts/tests/google/experimental/BluetoothThroughputTest.py b/acts/tests/google/experimental/BluetoothThroughputTest.py deleted file mode 100644 index 1f53172d8e..0000000000 --- a/acts/tests/google/experimental/BluetoothThroughputTest.py +++ /dev/null @@ -1,234 +0,0 @@ -#/usr/bin/env python3 -# -# Copyright (C) 2018 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. - -import statistics -from acts import asserts -from acts.base_test import BaseTestClass -from acts.signals import TestPass -from acts.test_decorators import test_tracker_info -from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest -from acts.test_utils.bt.bt_test_utils import orchestrate_rfcomm_connection -from acts.test_utils.bt.bt_test_utils import setup_multiple_devices_for_bt_test -from acts.test_utils.bt.bt_test_utils import verify_server_and_client_connected -from acts.test_utils.bt.loggers.bluetooth_metric_logger import BluetoothMetricLogger -from acts.test_utils.bt.loggers.protos import bluetooth_metric_pb2 as proto_module -from acts.utils import set_location_service - - -class BluetoothThroughputTest(BaseTestClass): - """Connects two Android phones and tests the throughput between them. - - Attributes: - client_device: An Android device object that will be sending data - server_device: An Android device object that will be receiving data - bt_logger: The proxy logger instance for each test case - data_transfer_type: Data transfer protocol used for the test - """ - - def setup_class(self): - super().setup_class() - - # Sanity check of the devices under test - # TODO(b/119051823): Investigate using a config validator to replace this. - if len(self.android_devices) < 2: - raise ValueError( - 'Not enough android phones detected (need at least two)') - - # Data will be sent from the client_device to the server_device - self.client_device = self.android_devices[0] - self.server_device = self.android_devices[1] - self.bt_logger = BluetoothMetricLogger.for_test_case() - self.data_transfer_type = proto_module.BluetoothDataTestResult.RFCOMM - self.log.info('Successfully found required devices.') - - def setup_test(self): - setup_multiple_devices_for_bt_test(self.android_devices) - self._connect_rfcomm() - - def teardown_test(self): - if verify_server_and_client_connected( - self.client_device, self.server_device, log=False): - self.client_device.droid.bluetoothSocketConnStop() - self.server_device.droid.bluetoothSocketConnStop() - - def _connect_rfcomm(self): - """Establishes an RFCOMM connection between two phones. - - Connects the client device to the server device given the hardware - address of the server device. - """ - - set_location_service(self.client_device, True) - set_location_service(self.server_device, True) - server_address = self.server_device.droid.bluetoothGetLocalAddress() - self.log.info('Pairing and connecting devices') - asserts.assert_true(self.client_device.droid - .bluetoothDiscoverAndBond(server_address), - 'Failed to pair and connect devices') - - # Create RFCOMM connection - asserts.assert_true(orchestrate_rfcomm_connection - (self.client_device, self.server_device), - 'Failed to establish RFCOMM connection') - - def _measure_throughput(self, num_of_buffers, buffer_size): - """Measures the throughput of a data transfer. - - Sends data from the client device that is read by the server device. - Calculates the throughput for the transfer. - - Args: - num_of_buffers: An integer value designating the number of buffers - to be sent. - buffer_size: An integer value designating the size of each buffer, - in bytes. - - Returns: - The throughput of the transfer in bytes per second. - """ - - # TODO(b/119638242): Need to fix throughput send/receive methods - (self.client_device.droid - .bluetoothConnectionThroughputSend(num_of_buffers, buffer_size)) - - throughput = (self.server_device.droid - .bluetoothConnectionThroughputRead(num_of_buffers, - buffer_size)) - return throughput - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='23afba5b-5801-42c2-8d7a-41510e91a605') - def test_bluetooth_throughput_large_buffer(self): - """Tests the throughput over a series of data transfers with large - buffer size. - """ - - metrics = {} - throughput_list = [] - - for transfer in range(300): - throughput = self._measure_throughput(1, 300) - self.log.info('Throughput: {} bytes-per-sec'.format(throughput)) - throughput_list.append(throughput) - - metrics['data_transfer_protocol'] = self.data_transfer_type - metrics['data_packet_size'] = 300 - metrics['data_throughput_min_bytes_per_second'] = int( - min(throughput_list)) - metrics['data_throughput_max_bytes_per_second'] = int( - max(throughput_list)) - metrics['data_throughput_avg_bytes_per_second'] = int(statistics.mean( - throughput_list)) - - proto = self.bt_logger.get_results(metrics, - self.__class__.__name__, - self.server_device, - self.client_device) - - asserts.assert_true(metrics['data_throughput_min_bytes_per_second'] > 0, - 'Minimum throughput must be greater than 0!', - extras=proto) - raise TestPass('Throughput test (large buffer) completed successfully', - extras=proto) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='5472fe33-891e-4fa1-ba84-78fc6f6a2327') - def test_bluetooth_throughput_medium_buffer(self): - """Tests the throughput over a series of data transfers with medium - buffer size. - """ - - metrics = {} - throughput_list = [] - - for transfer in range(300): - throughput = self._measure_throughput(1, 100) - self.log.info('Throughput: {} bytes-per-sec'.format(throughput)) - throughput_list.append(throughput) - - metrics['data_transfer_protocol'] = self.data_transfer_type - metrics['data_packet_size'] = 100 - metrics['data_throughput_min_bytes_per_second'] = int( - min(throughput_list)) - metrics['data_throughput_max_bytes_per_second'] = int( - max(throughput_list)) - metrics['data_throughput_avg_bytes_per_second'] = int(statistics.mean( - throughput_list)) - - proto = self.bt_logger.get_results(metrics, - self.__class__.__name__, - self.server_device, - self.client_device) - - asserts.assert_true(metrics['data_throughput_min_bytes_per_second'] > 0, - 'Minimum throughput must be greater than 0!', - extras=proto) - raise TestPass('Throughput test (medium buffer) completed successfully', - extras=proto) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='97589280-cefa-4ae4-b3fd-94ec9c1f4104') - def test_bluetooth_throughput_small_buffer(self): - """Tests the throughput over a series of data transfers with small - buffer size. - """ - - metrics = {} - throughput_list = [] - - for transfer in range(300): - throughput = self._measure_throughput(1, 10) - self.log.info('Throughput: {} bytes-per-sec'.format(throughput)) - throughput_list.append(throughput) - - metrics['data_transfer_protocol'] = self.data_transfer_type - metrics['data_packet_size'] = 10 - metrics['data_throughput_min_bytes_per_second'] = int( - min(throughput_list)) - metrics['data_throughput_max_bytes_per_second'] = int( - max(throughput_list)) - metrics['data_throughput_avg_bytes_per_second'] = int(statistics.mean( - throughput_list)) - - proto = self.bt_logger.get_results(metrics, - self.__class__.__name__, - self.server_device, - self.client_device) - - asserts.assert_true(metrics['data_throughput_min_bytes_per_second'] > 0, - 'Minimum throughput must be greater than 0!', - extras=proto) - raise TestPass('Throughput test (small buffer) completed successfully', - extras=proto) - - @BluetoothBaseTest.bt_test_wrap - def test_maximum_buffer_size(self): - """Calculates the maximum allowed buffer size for one packet.""" - - current_buffer_size = 1 - while True: - self.log.info('Trying buffer size {}'.format(current_buffer_size)) - try: - throughput = self._measure_throughput(1, current_buffer_size) - except Exception: - buffer_msg = ('Max buffer size: {} bytes'. - format(current_buffer_size - 1)) - throughput_msg = ('Max throughput: {} bytes-per-second'. - format(throughput)) - self.log.info(buffer_msg) - self.log.info(throughput_msg) - return True - current_buffer_size += 1 diff --git a/acts/tests/google/fugu/AndroidFuguRemotePairingTest.py b/acts/tests/google/fugu/AndroidFuguRemotePairingTest.py deleted file mode 100644 index a41f9fce79..0000000000 --- a/acts/tests/google/fugu/AndroidFuguRemotePairingTest.py +++ /dev/null @@ -1,81 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (C) 2017 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -""" -Test script to test pairing of an Android Device to a Fugu Remote -""" -import time - -from acts.controllers.relay_lib.relay import SynchronizeRelays -from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest - -class AndroidFuguRemotePairingTest(BluetoothBaseTest): - def setup_class(self): - super().setup_class() - self.dut = self.android_devices[0] - self.fugu_remote = self.relay_devices[0] - - def setup_test(self): - super(BluetoothBaseTest, self).setup_test() - self.fugu_remote.setup() - return True - - def teardown_test(self): - super(BluetoothBaseTest, self).teardown_test() - self.fugu_remote.clean_up() - return True - - @BluetoothBaseTest.bt_test_wrap - def test_pairing(self): - """Test pairing between a fugu device and a remote controller. - - Test the remote controller can be paired to fugu. - - Steps: - 1. Find the MAC address of remote controller from relay config file. - 2. Start the device paring process. - 3. Enable remote controller in pairing mode. - 4. Verify the remote is paired. - - Expected Result: - Remote controller is paired. - - Returns: - Pass if True - Fail if False - - TAGS: fugu - Priority: 1 - """ - - self.dut.droid.bluetoothStartPairingHelper(False) - self.fugu_remote.enter_pairing_mode() - self.dut.droid.bluetoothDiscoverAndBond(self.fugu_remote.mac_address) - - end_time = time.time() + 20 - self.dut.log.info("Verifying devices are bonded") - while time.time() < end_time: - bonded_devices = self.dut.droid.bluetoothGetBondedDevices() - - for d in bonded_devices: - if d['address'] == self.fugu_remote.mac_address: - self.dut.log.info("Successfully bonded to device.") - self.log.info("Fugu Bonded devices:\n{}".format( - bonded_devices)) - return True - # Timed out trying to bond. - self.dut.log.info("Failed to bond devices.") - - return False diff --git a/acts/tests/google/fugu/fugu_pairing_test.json b/acts/tests/google/fugu/fugu_pairing_test.json deleted file mode 100644 index 59f45e35af..0000000000 --- a/acts/tests/google/fugu/fugu_pairing_test.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "_description": "Test configuration for Fugu pairing the remote controller", - "logpath": "/tmp/logs", - "testpaths": ["."], - "no_bug_report_on_fail": "True", - - "testbed": [ - { - "_description": "A testbed for RelayDevices", - "name": "7A18F48B", - "AndroidDevice": ["7A18F48B"], - "RelayDevice": "tests/google/fugu/relay.json" - }, - { - "_description": "A testbed for RelayDevices", - "name": "164FE498", - "AndroidDevice": ["164FE498"], - "RelayDevice": "tests/google/fugu/relay.json" - }, - { - "_description": "A testbed for RelayDevices", - "name": "B8B20856", - "AndroidDevice": ["B8B20856"], - "RelayDevice": "tests/google/fugu/relay.json" - }, - { - "_description": "A testbed for RelayDevices", - "name": "121A69F0", - "AndroidDevice": ["121A69F0"], - "RelayDevice": "tests/google/fugu/relay.json" - }, - { - "_description": "A testbed for RelayDevices", - "name": "BBDAC5ED", - "AndroidDevice": ["BBDAC5ED"], - "RelayDevice": "tests/google/fugu/relay.json" - } - ] -} diff --git a/acts/tests/google/fugu/relay.json b/acts/tests/google/fugu/relay.json deleted file mode 100644 index c3ab9db3d1..0000000000 --- a/acts/tests/google/fugu/relay.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "boards": [ - { - "type": "SainSmartBoard", - "name": "ss0", - "base_url": "http://192.168.1.4/30000/" - } - ], - "devices": [ - { - "type": "FuguRemote", - "name": "Fugu0", - "mac_address" : "AC:9E:17:53:AC:3A", - "relays": { - "Play": "ss0/1", - "Home": "ss0/2", - "Back": "ss0/3" - } - } - ] -} diff --git a/acts/tests/google/native/NativeTest.py b/acts/tests/google/native/NativeTest.py deleted file mode 100644 index 90ebceb28c..0000000000 --- a/acts/tests/google/native/NativeTest.py +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. - -import time -from acts.base_test import BaseTestClass -from acts.test_utils.bt.native_bt_test_utils import setup_native_bluetooth -from acts.test_utils.bt.bt_test_utils import generate_id_by_size - -class NativeTest(BaseTestClass): - tests = None - - def __init__(self, controllers): - BaseTestClass.__init__(self, controllers) - self.tests = ( - "test_bool_return_true", - "test_bool_return_false", - "test_null_return", - "test_string_empty_return", - "test_max_param_size", - ) - - def setup_class(self): - super().setup_class() - self.droid = self.native_android_devices[0].droid - - def test_bool_return_true(self): - return self.droid.TestBoolTrueReturn() - - def test_bool_return_false(self): - return not self.droid.TestBoolFalseReturn() - - def test_null_return(self): - return not self.droid.TestNullReturn() - - def test_string_empty_return(self): - return self.droid.TestStringEmptyReturn() == "" - - def test_max_param_size(self): - json_buffer_size = 64 - max_sl4n_buffer_size = 4096 - test_string = "x" * (max_sl4n_buffer_size - json_buffer_size) - return test_string == self.droid.TestStringMaxReturn(test_string) - - def test_specific_param_naming(self): - a = [{"string_test":"test", "int_test":1}] - return self.droid.TestSpecificParamNaming(a) - diff --git a/acts/tests/google/native/bt/BtNativeTest.py b/acts/tests/google/native/bt/BtNativeTest.py deleted file mode 100644 index 55674bcb42..0000000000 --- a/acts/tests/google/native/bt/BtNativeTest.py +++ /dev/null @@ -1,63 +0,0 @@ -from acts.base_test import BaseTestClass -from acts.controllers import native_android_device -from acts.test_utils.bt.native_bt_test_utils import setup_native_bluetooth -from acts.test_utils.bt.bt_test_utils import generate_id_by_size - - -class BtNativeTest(BaseTestClass): - tests = None - - def __init__(self, controllers): - BaseTestClass.__init__(self, controllers) - self.tests = ( - "test_binder_get_name", - "test_binder_get_name_invalid_parameter", - "test_binder_set_name_get_name", - "test_binder_get_address", ) - - def setup_class(self): - setup_native_bluetooth(self.native_android_devices) - self.droid = self.native_android_devices[0].droid - if len(self.native_android_devices) > 1: - self.droid1 = self.native_android_devices[1].droid - self.tests = self.tests + ("test_two_devices_set_get_name", ) - - def test_binder_get_name(self): - result = self.droid.BtBinderGetName() - self.log.info("Bluetooth device name: {}".format(result)) - return True - - def test_binder_get_name_invalid_parameter(self): - try: - self.droid.BtBinderGetName("unexpected_parameter") - return False - except Exception: - return True - - def test_binder_set_name_get_name(self): - test_name = generate_id_by_size(4) - result = self.droid.BtBinderSetName(test_name) - if not result: - return False - name = self.droid.BtBinderGetName() - if test_name != name: - return False - return True - - def test_binder_get_address(self): - result = self.droid.BtBinderGetAddress() - self.log.info("Found BT address: {}".format(result)) - if not result: - return False - return True - - def test_two_devices_set_get_name(self): - test_name = generate_id_by_size(4) - for n in self.native_android_devices: - d = n.droid - d.BtBinderSetName(test_name) - name = d.BtBinderGetName() - if name != test_name: - return False - return True - diff --git a/acts/tests/google/nfc/NfcBasicFunctionalityTest.py b/acts/tests/google/nfc/NfcBasicFunctionalityTest.py deleted file mode 100644 index 5d531d1931..0000000000 --- a/acts/tests/google/nfc/NfcBasicFunctionalityTest.py +++ /dev/null @@ -1,111 +0,0 @@ -#!/usr/bin/env python3.4 -# -# Copyright 2017 - The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import time - -from acts.base_test import BaseTestClass -from acts.test_decorators import test_tracker_info - - -class NfcBasicFunctionalityTest(BaseTestClass): - nfc_on_event = "NfcStateOn" - nfc_off_event = "NfcStateOff" - timeout = 5 - - def setup_class(self): - self.dut = self.android_devices[0] - self._ensure_nfc_enabled(self.dut) - self.dut.droid.nfcStartTrackingStateChange() - self.dut.adb.shell("setprop nfc.app_log_level 255") - self.dut.adb.shell("setprop nfc.enable_protocol_log 255") - self.dut.adb.shell("setprop nfc.nxp_log_level_global 5") - self.dut.adb.shell("setprop nfc.nxp_log_level_extns 5") - self.dut.adb.shell("setprop nfc.nxp_log_level_hal 5") - self.dut.adb.shell("setprop nfc.nxp_log_level_nci 5") - self.dut.adb.shell("setprop nfc.nxp_log_level_tml 5") - self.dut.adb.shell("setprop nfc.nxp_log_level_dnld 5") - self._ensure_nfc_disabled(self.dut) - return True - - def _ensure_nfc_enabled(self, dut): - end_time = time.time() + 10 - while end_time > time.time(): - try: - dut.ed.pop_event(self.nfc_on_event, self.timeout) - self.log.info("Event {} found".format(self.nfc_on_event)) - return True - except Exception as err: - self.log.debug( - "Event {} not yet found".format(self.nfc_on_event)) - return False - - def _ensure_nfc_disabled(self, dut): - end_time = time.time() + 10 - while end_time > time.time(): - try: - dut.ed.pop_event(self.nfc_off_event, self.timeout) - self.log.info("Event {} found".format(self.nfc_off_event)) - return True - except Exception as err: - self.log.debug( - "Event {} not yet found".format(self.nfc_off_event)) - return False - - def setup_test(self): - # Every test starts with the assumption that NFC is enabled - if not self.dut.droid.nfcIsEnabled(): - self.dut.droid.nfcEnable() - else: - return True - if not self._ensure_nfc_enabled(self.dut): - self.log.error("Failed to toggle NFC on") - return False - return True - - def on_fail(self, test_name, begin_time): - self.dut.take_bug_report(test_name, begin_time) - - @test_tracker_info(uuid='d57fcdd8-c56c-4ab0-81fb-e2218b100de9') - def test_nfc_toggle_state_100_iterations(self): - """Test toggling NFC state 100 times. - - Verify that NFC toggling works. Test assums NFC is on. - - Steps: - 1. Toggle NFC off - 2. Toggle NFC on - 3. Repeat steps 1-2 100 times. - - Expected Result: - RFCOMM connection is established then disconnected succcessfully. - - Returns: - Pass if True - Fail if False - - TAGS: NFC - Priority: 1 - """ - iterations = 100 - for i in range(iterations): - self.log.info("Starting iteration {}".format(i + 1)) - self.dut.droid.nfcDisable() - if not self._ensure_nfc_disabled(self.dut): - return False - self.dut.droid.nfcEnable() - if not self._ensure_nfc_enabled(self.dut): - return False - return True diff --git a/acts/tests/google/usb/UsbTetheringFunctionsTest.py b/acts/tests/google/usb/UsbTetheringFunctionsTest.py deleted file mode 100644 index 3f0393ba01..0000000000 --- a/acts/tests/google/usb/UsbTetheringFunctionsTest.py +++ /dev/null @@ -1,419 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright 2019 - The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import re -import time -from queue import Empty - -from acts import utils -from acts import base_test -from acts.libs.proc import job -from acts import signals -from acts.test_decorators import test_tracker_info -from acts.test_utils.wifi import wifi_test_utils as wutils -from acts.test_utils.tel import tel_test_utils as tutils -from acts.test_utils.tel import tel_defines -from acts.test_utils.tel.anritsu_utils import wait_for_sms_sent_success -from acts.test_utils.tel.tel_defines import EventMmsSentSuccess - -# Time it takes for the usb tethering IP to -# show up in ifconfig and function waiting. -DEFAULT_SETTLE_TIME = 5 -WifiEnums = wutils.WifiEnums -USB_CHARGE_MODE = 'svc usb setFunctions' -USB_TETHERING_MODE = 'svc usb setFunctions rndis' -USB_MTP_MODE = 'svc usb setFunctions mtp' -DEVICE_IP_ADDRESS = 'ip address' - - -class UsbTetheringFunctionsTest(base_test.BaseTestClass): - """Tests for usb tethering throughput test. - - Test Bed Requirement: - * One Android device. - * Wi-Fi networks visible to the device. - * Sim card with data call. - """ - - def setup_class(self): - self.dut = self.android_devices[0] - req_params = ['wifi_network', 'receiver_number', 'ping_count'] - self.unpack_userparams(req_param_names=req_params) - - self.ssid_map = {} - for network in self.wifi_network: - SSID = network['SSID'].replace('-', '_') - self.ssid_map[SSID] = network - self.dut.droid.setMobileDataEnabled() - if not tutils.verify_internet_connection( - self.dut.log, self.dut, retries=3): - tutils.abort_all_tests(self.dut.log, 'Internet connection Failed.') - - def setup_test(self): - self.dut.droid.wakeLockAcquireBright() - self.dut.droid.wakeUpNow() - self.dut.unlock_screen() - - def teardown_test(self): - wutils.wifi_toggle_state(self.dut, False) - self.dut.droid.wakeLockRelease() - self.dut.droid.goToSleepNow() - self.dut.droid.setMobileDataEnabled() - self.dut.droid.connectivityStopTethering(tel_defines.TETHERING_WIFI) - self.dut.stop_services() - # Set usb function back to charge mode. - self.dut.adb.shell(USB_CHARGE_MODE) - self.dut.adb.wait_for_device() - self.dut.start_services() - - def teardown_class(self): - wutils.reset_wifi(self.dut) - - def on_fail(self, test_name, begin_time): - self.dut.take_bug_report(test_name, begin_time) - self.dut.cat_adb_log(test_name, begin_time) - - def enable_usb_tethering(self, attempts=3): - """Stop SL4A service and enable usb tethering. - - Logic steps are - 1. Stop SL4A service. - 2. Enable usb tethering. - 3. Restart SL4A service. - 4. Check usb tethering enabled. - 5. Attempt if fail to enable usb tethering. - - Args: - attempts: number of times for enable usb tethering. - - Raises: - TestFailure when unable to find rndis string. - """ - for i in range(attempts): - self.dut.stop_services() - self.dut.adb.shell(USB_TETHERING_MODE, ignore_status=True) - self.dut.adb.wait_for_device() - self.dut.start_services() - if 'rndis' in self.dut.adb.shell(DEVICE_IP_ADDRESS): - self.log.info('Usb tethering is enabled.') - return - else: - self.log.info('Enable usb tethering - attempt %d' % (i + 1)) - raise signals.TestFailure('Unable to enable USB tethering.') - - def connect_to_wifi_network(self, network): - """Connection logic for wifi network. - - Args: - network: Dictionary with network info. - """ - SSID = network[WifiEnums.SSID_KEY] - self.dut.ed.clear_all_events() - wutils.start_wifi_connection_scan(self.dut) - scan_results = self.dut.droid.wifiGetScanResults() - wutils.assert_network_in_list({WifiEnums.SSID_KEY: SSID}, scan_results) - wutils.wifi_connect(self.dut, network, num_of_tries=3) - - def enable_wifi_hotspot(self): - """Enable wifi hotspot.""" - sap_config = wutils.create_softap_config() - wutils.start_wifi_tethering(self.dut, - sap_config[wutils.WifiEnums.SSID_KEY], - sap_config[wutils.WifiEnums.PWD_KEY], - wutils.WifiEnums.WIFI_CONFIG_APBAND_2G) - - def get_rndis_interface(self): - """Check rndis interface after usb tethering enable. - - Returns: - Usb tethering interface from Android device. - - Raises: - TestFailure when unable to find correct usb tethering interface. - """ - time.sleep(DEFAULT_SETTLE_TIME) - check_usb_tethering = job.run('ifconfig').stdout - # A regex that stores the tethering interface in group 1. - tethered_interface_regex = r'^(enp.*?):.*?broadcast 192.168.42.255' - match = re.search(tethered_interface_regex, check_usb_tethering, - re.DOTALL + re.MULTILINE) - if match: - return match.group(1) - else: - raise signals.TestFailure( - 'Unable to find tethering interface. The device may not be tethered.' - ) - - def can_ping(self, ip, extra_params='', count=10): - """Run ping test and check and check ping lost rate. - - Args: - ip: ip address for ping. - extra_params: params for ping test. - count: default ping count. - - Returns: - True: If no packet loss. - False: Otherwise. - """ - out = job.run( - 'ping -c {} {} {}'.format(count, extra_params, ip), - ignore_status=True).stdout - self.log.info(out) - return '0%' in out.split(' ') - - def can_ping_through_usb_interface(self): - """Run ping test and check result after usb tethering enabled. - - Raises: - TestFailure when unable to ping through usb tethering interface. - """ - ip = '8.8.8.8' - interface = self.get_rndis_interface() - if not self.can_ping( - ip, '-I {}'.format(interface), count=self.ping_count): - raise signals.TestFailure( - 'Fail to ping through usb tethering interface.') - - def enable_usb_mtp(self): - """Enable usb mtp mode. - - Raises: - TestFailure when unable to set mtp mode. - """ - try: - self.dut.stop_services() - self.dut.adb.shell(USB_MTP_MODE, ignore_status=True) - self.dut.adb.wait_for_device() - self.dut.start_services() - except: - raise signals.TestFailure('Device can not enable mtp mode.') - - def check_sms_send_status(self, message='usb_sms_test'): - """Send a SMS and check send status. - - Args: - message: SMS string. - - Raises: - Exception when unable to send SMS. - """ - self.dut.droid.smsSendTextMessage(self.receiver_number, message, False) - self.log.info('Waiting for SMS sent event') - test_status = wait_for_sms_sent_success(self.log, self.dut) - if not test_status: - raise Exception('Failed to send SMS') - - def check_mms_send_status(self, - subject='usb_subject', - message='usb_mms_test'): - """Send a MMS and check send status. - - Args: - subject: MMS subject. - message: MMS string. - - Raises: - Exception when unable to send MMS. - """ - # Permission require for send MMS. - self.dut.adb.shell('su root setenforce 0') - self.dut.droid.smsSendMultimediaMessage(self.receiver_number, subject, - message) - self.log.info('Waiting for MMS sent event') - test_status = self.wait_for_mms_sent_success() - if not test_status: - raise Exception('Failed to send MMS') - - def wait_for_mms_sent_success(self, time_to_wait=60): - """Check MMS send status. - - Args: - time_to_wait: Time out for check MMS. - - Returns: - status = MMS send status. - """ - mms_sent_event = EventMmsSentSuccess - try: - event = self.dut.ed.pop_event(mms_sent_event, time_to_wait) - self.log.info(event) - except Empty: - self.log.error('Timeout: Expected event is not received.') - return False - return True - - @test_tracker_info(uuid="7c2ae85e-32a2-416e-a65e-c15a15e76f86") - def test_usb_tethering_wifi_only(self): - """Enable usb tethering with wifi only then executing ping test. - - Steps: - 1. Stop SL4A services. - 2. Enable usb tethering. - 3. Restart SL4A services. - 4. Mobile data disable and wifi enable. - 5. Run ping test through usb tethering interface. - """ - self.enable_usb_tethering() - self.log.info('Disable mobile data.') - self.dut.droid.setMobileDataEnabled(False) - self.log.info('Enable wifi.') - wutils.wifi_toggle_state(self.dut, True) - self.connect_to_wifi_network( - self.ssid_map[self.wifi_network[0]['SSID']]) - self.can_ping_through_usb_interface() - - @test_tracker_info(uuid="8910b07b-0beb-4d9d-b901-c4195b4e0930") - def test_usb_tethering_data_only(self): - """Enable usb tethering with data only then executing ping test. - - Steps: - 1. Stop SL4A services. - 2. Enable usb tethering. - 3. Restart SL4A services. - 4. Wifi disable and mobile data enable. - 5. Run ping test through usb tethering interface. - """ - self.enable_usb_tethering() - wutils.wifi_toggle_state(self.dut, False) - self.dut.droid.setMobileDataEnabled() - time.sleep(DEFAULT_SETTLE_TIME) - self.can_ping_through_usb_interface() - - @test_tracker_info(uuid="f971806e-e003-430a-bc80-321f128d31cb") - def test_usb_tethering_after_airplane_mode(self): - """Enable usb tethering after airplane mode then executing ping test. - - Steps: - 1. Stop SL4A services. - 2. Enable usb tethering. - 3. Restart SL4A services. - 4. Wifi disable and mobile data enable. - 5. Enable/disable airplane mode. - 6. Run ping test through usb tethering interface. - """ - self.enable_usb_tethering() - wutils.wifi_toggle_state(self.dut, False) - self.log.info('Enable airplane mode.') - utils.force_airplane_mode(self.dut, True) - self.log.info('Disable airplane mode.') - utils.force_airplane_mode(self.dut, False) - time.sleep(DEFAULT_SETTLE_TIME) - self.can_ping_through_usb_interface() - - @test_tracker_info(uuid="db1c561d-67bd-47d7-b65e-d882f0e2641e") - def test_usb_tethering_coexist_wifi_hotspot(self): - """Enable usb tethering with hotspot then executing ping test. - - Steps: - 1. Enable hotspot - 2. Stop SL4A services. - 3. Enable usb tethering. - 4. Restart SL4A services. - 5. Run ping test through tethering interface during hotspot enable. - 6. Run ping test through tethering interface during hotspot disable. - """ - self.log.info('Enable wifi hotspot.') - self.enable_wifi_hotspot() - self.enable_usb_tethering() - self.log.info('Ping test with hotspot enable.') - self.can_ping_through_usb_interface() - self.log.info('Disable wifi hotspot.') - self.dut.droid.connectivityStopTethering(tel_defines.TETHERING_WIFI) - self.log.info('Ping test with hotspot disable.') - self.can_ping_through_usb_interface() - - @test_tracker_info(uuid="7018abdb-049e-41aa-a4f9-e11012369d9b") - def test_usb_tethering_after_mtp(self): - """Enable usb tethering after mtp enable then executing ping test. - - Steps: - 1. Stop SL4A services. - 2. Enable usb tethering. - 3. Restart SL4A services. - 4. Enable usb mtp mode. - 5. Enable usb tethering and mtp will disable. - 6. Run ping test through usb tethering interface. - """ - self.enable_usb_tethering() - self.log.info('Enable usb mtp mode.') - self.enable_usb_mtp() - # Turn on mtp mode for 5 sec. - time.sleep(DEFAULT_SETTLE_TIME) - self.enable_usb_tethering() - self.log.info('Usb tethering enable, usb mtp mode disabled.') - self.can_ping_through_usb_interface() - - @test_tracker_info(uuid="f1ba2cbc-1cb2-4b8a-92eb-9b366c3f4c37") - def test_usb_tethering_after_sms_mms(self): - """Enable usb tethering after send sms and mms then executing ping test. - - Steps: - 1. Stop SL4A services. - 2. Enable usb tethering. - 3. Restart SL4A services. - 4. Send a sms and mms. - 5. Run ping test through usb tethering interface. - """ - self.enable_usb_tethering() - self.log.info('Start send SMS and check status.') - self.check_sms_send_status() - time.sleep(DEFAULT_SETTLE_TIME) - self.log.info('Start send MMS and check status.') - self.check_mms_send_status() - self.can_ping_through_usb_interface() - - @test_tracker_info(uuid="e6586b30-4886-4c3e-8225-633aa9333968") - def test_usb_tethering_after_reboot(self): - """Enable usb tethering after reboot then executing ping test. - - Steps: - 1. Reboot device. - 2. Stop SL4A services. - 3. Enable usb tethering. - 4. Restart SL4A services. - 5. Run ping test through usb tethering interface. - """ - self.enable_usb_tethering() - self.log.info('Reboot device.') - self.dut.reboot() - self.dut.droid.setMobileDataEnabled() - self.log.info('Start usb tethering and ping test.') - self.enable_usb_tethering() - self.can_ping_through_usb_interface() - - @test_tracker_info(uuid="40093ab8-6db4-4af4-97ae-9467bf33bf23") - def test_usb_tethering_after_wipe(self): - """Enable usb tethering after wipe. - - Steps: - 1. Enable usb tethering. - 2. Wipe device. - 3. Wake up device and unlock screen. - 4. Enable usb tethering. - 5. Run ping test through usb tethering interface. - """ - self.enable_usb_tethering() - tutils.fastboot_wipe(self.dut) - time.sleep(DEFAULT_SETTLE_TIME) - # Skip setup wizard after wipe. - self.dut.adb.shell( - 'am start -a com.android.setupwizard.EXIT', ignore_status=True) - self.dut.droid.setMobileDataEnabled() - self.dut.droid.wakeUpNow() - self.dut.unlock_screen() - self.enable_usb_tethering() - self.can_ping_through_usb_interface()
\ No newline at end of file diff --git a/acts/tests/google/usb/UsbTetheringThroughputTest.py b/acts/tests/google/usb/UsbTetheringThroughputTest.py deleted file mode 100644 index ebe13b8529..0000000000 --- a/acts/tests/google/usb/UsbTetheringThroughputTest.py +++ /dev/null @@ -1,292 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright 2019 - The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import re -import time - -from acts import base_test -from acts.libs.proc import job -from acts import signals -from acts.test_decorators import test_tracker_info - -# Time it takes for the usb tethering IP to show up in ifconfig. -IFCONFIG_SETTLE_TIME = 5 -USB_CHARGE_MODE = 'svc usb setFunctions' -USB_TETHERING_MODE = 'svc usb setFunctions rndis' -DEVICE_IP_ADDRESS = 'ip address' - - -class UsbTetheringThroughputTest(base_test.BaseTestClass): - """Tests for usb tethering throughput test. - - Test Bed Requirement: - * One Android device. - * Sim card with data call. - """ - - def setup_class(self): - """ Setup devices for usb tethering """ - self.dut = self.android_devices[0] - self.ip_server = self.iperf_servers[0] - self.port_num = self.ip_server.port - req_params = [ - 'iperf_usb_3_criteria', 'iperf_usb_2_criteria', 'controller_path', - 'iperf_test_sec' - ] - self.unpack_userparams(req_param_names=req_params) - if self.dut.model in self.user_params.get('legacy_projects', []): - self.usb_controller_path = self.user_params[ - 'legacy_controller_path'] - else: - self.usb_controller_path = self.controller_path - - def setup_test(self): - self.dut.adb.wait_for_device() - self.dut.droid.wakeLockAcquireBright() - self.dut.droid.wakeUpNow() - self.dut.unlock_screen() - - def teardown_test(self): - self.dut.droid.wakeLockRelease() - self.dut.droid.goToSleepNow() - # Reboot device to avoid the side effect that cause adb missing after echo usb speed. - self.dut.reboot() - - def on_fail(self, test_name, begin_time): - self.dut.take_bug_report(test_name, begin_time) - self.dut.cat_adb_log(test_name, begin_time) - - def enable_usb_tethering(self): - """Stop SL4A service and enable usb tethering. - - Logic steps are - 1. Stop SL4A service. - 2. Enable usb tethering. - 3. Restart SL4A service. - 4. Check usb tethering enabled. - - Raises: - Signals.TestFailure is raised by not find rndis string. - """ - self.dut.stop_services() - self.dut.adb.shell(USB_TETHERING_MODE, ignore_status=True) - self.dut.adb.wait_for_device() - self.dut.start_services() - if 'rndis' not in self.dut.adb.shell(DEVICE_IP_ADDRESS): - raise signals.TestFailure('Unable to enable USB tethering.') - - def get_pc_tethering_ip(self): - """Check usb tethering IP from PC. - - Returns: - Usb tethering IP from PC. - - Raises: - Signals.TestFailure is raised by not find usb tethering IP. - """ - time.sleep(IFCONFIG_SETTLE_TIME) - check_usb_tethering = job.run('ifconfig').stdout - matches = re.findall('inet (\d+.\d+.42.\d+)', check_usb_tethering) - if not matches: - raise signals.TestFailure( - 'Unable to find tethering IP. The device may not be tethered.') - else: - return matches[0] - - def get_dut_tethering_ip(self): - """Check usb tethering IP from Android device. - - Returns: - Usb tethering IP from Android device. - - Raises: - Signals.TestFailure is raised by not find usb tethering IP. - """ - time.sleep(IFCONFIG_SETTLE_TIME) - check_usb_tethering = self.dut.adb.shell('ifconfig') - matches = re.findall('addr:(\d+.\d+.42.\d+)', check_usb_tethering) - if not matches: - raise signals.TestFailure( - 'Unable to find tethering IP. The device may not be tethered.') - else: - return matches[0] - - def pc_can_ping(self, count=3): - """Run ping traffic from PC side. - - Logic steps are - 1. PC ping the usb server ip. - 2. Check the packet loss rate. - - Args: - count : count for ping test. - - Returns: - True: If no packet loss. - False: Otherwise. - """ - ip = self.get_dut_tethering_ip() - ping = job.run( - 'ping -c {} {}'.format(count, ip), ignore_status=True).stdout - self.log.info(ping) - return '0% packet loss' in ping - - def dut_can_ping(self, count=3): - """Run ping traffic from Android device side. - - Logic steps are - 1. Android device ping the 8.8.8.8. - 2. Check the packet loss rate. - - Args: - count : count for ping test. - - Returns: - True: If no packet loss. - False: Otherwise. - """ - ip = '8.8.8.8' - ping = self.dut.adb.shell( - 'ping -c {} {}'.format(count, ip), ignore_status=True) - self.log.info(ping) - return '0% packet loss' in ping - - def run_iperf_client(self, dut_ip, extra_params=''): - """Run iperf client command after iperf server enabled. - - Args: - dut_ip: string which contains the ip address. - extra_params: params to be added to the iperf client. - - Returns: - Success: True if the iperf execute. False otherwise. - Rate: throughput data. - """ - self.log.info('Run iperf process.') - cmd = "iperf3 -c {} {} -p {}".format(dut_ip, extra_params, - self.port_num) - self.log.info(cmd) - try: - result = self.dut.adb.shell(cmd, ignore_status=True) - self.log.info(result) - except: - self.log.error('Fail to execute iperf client.') - return False, 0 - rate = re.findall('(\d+.\d+) (.)bits/sec.*receiver', result) - return True, rate[0][0], rate[0][1] - - def run_iperf_tx_rx(self, usb_speed, criteria): - """Run iperf tx and rx. - - Args: - usb_speed: string which contains the speed info. - criteria: usb performance criteria. - - Raises: - Signals.TestFailure is raised by usb tethering under criteria. - """ - self.enable_usb_tethering() - self.dut.adb.wait_for_device() - self.ip_server.start() - pc_ip = self.get_pc_tethering_ip() - tx_success, tx_rate, tx_unit = self.run_iperf_client( - pc_ip, '-t{} -i1 -w2M'.format(self.iperf_test_sec)) - rx_success, rx_rate, rx_unit = self.run_iperf_client( - pc_ip, '-t{} -i1 -w2M -R'.format(self.iperf_test_sec)) - self.log.info('TestResult iperf_{}_rx'.format(usb_speed) + rx_rate + - ' ' + rx_unit + 'bits/sec') - self.log.info('TestResult iperf_{}_tx'.format(usb_speed) + tx_rate + - ' ' + tx_unit + 'bits/sec') - self.ip_server.stop() - if not tx_success or (float(tx_rate) < criteria and tx_unit != "G"): - raise signals.TestFailure('Iperf {}_tx test is {} {}bits/sec, ' - 'the throughput result failed.'.format( - usb_speed, tx_rate, tx_unit)) - if not rx_success or (float(rx_rate) < criteria and rx_unit != "G"): - raise signals.TestFailure('Iperf {}_rx test is {} {}bits/sec, ' - 'the throughput result failed.'.format( - usb_speed, rx_rate, rx_unit)) - - def get_usb_speed(self): - """Get current usb speed.""" - usb_controller_address = self.dut.adb.shell( - 'getprop sys.usb.controller', ignore_status=True) - usb_speed = self.dut.adb.shell( - 'cat sys/class/udc/{}/current_speed'.format( - usb_controller_address)) - return usb_speed, usb_controller_address - - @test_tracker_info(uuid="e7e0dfdc-3d1c-4642-a468-27326c49e4cb") - def test_tethering_ping(self): - """Enable usb tethering then executing ping test. - - Steps: - 1. Stop SL4A service. - 2. Enable usb tethering. - 3. Restart SL4A service. - 4. Execute ping test from PC and Android Device. - 5. Check the ping lost rate. - """ - self.enable_usb_tethering() - if self.pc_can_ping() and self.dut_can_ping(): - raise signals.TestPass( - 'Ping test is passed. Network is reachable.') - raise signals.TestFailure( - 'Ping test failed. Maybe network is unreachable.') - - @test_tracker_info(uuid="8263c880-8a7e-4a68-b47f-e7caba3e9968") - def test_usb_tethering_iperf_super_speed(self): - """Enable usb tethering then executing iperf test. - - Steps: - 1. Stop SL4A service. - 2. Enable usb tethering. - 3. Restart SL4A service. - 4. Skip test if device not support super-speed. - 5. Execute iperf test for usb tethering and get the throughput result. - 6. Check the iperf throughput result. - """ - if (self.get_usb_speed()[0] != 'super-speed'): - raise signals.TestSkip( - 'USB 3 not available for the device, skip super-speed performance test.' - ) - self.run_iperf_tx_rx('usb_3', self.iperf_usb_3_criteria) - - @test_tracker_info(uuid="5d8a22fd-1f9b-4758-a6b4-855d134b348a") - def test_usb_tethering_iperf_high_speed(self): - """Enable usb tethering then executing iperf test. - - Steps: - 1. Stop SL4A service. - 2. Enable usb tethering. - 3. Restart SL4A service. - 4. Force set usb speed to high-speed if default is super-speed. - 5. Execute iperf test for usb tethering and get the throughput result. - 6. Check the iperf throughput result. - """ - if (self.get_usb_speed()[0] != 'high-speed'): - self.log.info( - 'Default usb speed is USB 3,Force set usb to high-speed.') - self.dut.stop_services() - self.dut.adb.wait_for_device() - self.dut.adb.shell( - 'echo high > {}{}.ssusb/speed'.format( - self.usb_controller_path, - self.get_usb_speed()[1].strip('.dwc3')), - ignore_status=True) - self.dut.adb.wait_for_device() - self.dut.start_services() - self.run_iperf_tx_rx('usb_2', self.iperf_usb_2_criteria) diff --git a/acts_tests/tests/google/ble/api/BleAdvertiseApiTest.py b/acts_tests/tests/google/ble/api/BleAdvertiseApiTest.py index e69de29bb2..26c459f70a 100644 --- a/acts_tests/tests/google/ble/api/BleAdvertiseApiTest.py +++ b/acts_tests/tests/google/ble/api/BleAdvertiseApiTest.py @@ -0,0 +1,1273 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2016 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See thea +# License for the specific language governing permissions and limitations under +# the License. +""" +Test script to exercise Ble Advertisement Api's. This exercises all getters and +setters. This is important since there is a builder object that is immutable +after you set all attributes of each object. If this test suite doesn't pass, +then other test suites utilising Ble Advertisements will also fail. +""" + +from acts.controllers.sl4a_lib import rpc_client +from acts.test_decorators import test_tracker_info +from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest +from acts.test_utils.bt.bt_test_utils import adv_fail +from acts.test_utils.bt.bt_test_utils import generate_ble_advertise_objects +from acts.test_utils.bt.bt_constants import ble_advertise_settings_modes +from acts.test_utils.bt.bt_constants import ble_advertise_settings_tx_powers +from acts.test_utils.bt.bt_constants import java_integer + + +class BleAdvertiseVerificationError(Exception): + """Error in fetsching BleScanner Advertise result.""" + + +class BleAdvertiseApiTest(BluetoothBaseTest): + def setup_class(self): + super().setup_class() + self.ad_dut = self.android_devices[0] + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='d6d8d0a6-7b3e-4e4b-a5d0-bcfd6e207474') + def test_adv_settings_defaults(self): + """Tests the default advertisement settings. + + This builder object should have a proper "get" expectation for each + attribute of the builder object once it's built. + + Steps: + 1. Build a new advertise settings object. + 2. Get the attributes of the advertise settings object. + 3. Compare the attributes found against the attributes exp. + + Expected Result: + Found attributes should match expected attributes. + + Returns: + True is pass + False if fail + + TAGS: LE, Advertising + Priority: 0 + """ + test_result = True + droid = self.ad_dut.droid + adv_settings = droid.bleBuildAdvertiseSettings() + adv_mode = droid.bleGetAdvertiseSettingsMode(adv_settings) + tx_power_level = droid.bleGetAdvertiseSettingsTxPowerLevel( + adv_settings) + is_connectable = droid.bleGetAdvertiseSettingsIsConnectable( + adv_settings) + + exp_adv_mode = ble_advertise_settings_modes['low_power'] + exp_tx_power_level = ble_advertise_settings_tx_powers['medium'] + exp_is_connectable = True + if adv_mode != exp_adv_mode: + test_result = False + self.log.debug("exp filtering mode: {}," + " found filtering mode: {}".format( + exp_adv_mode, adv_mode)) + if tx_power_level != exp_tx_power_level: + test_result = False + self.log.debug("exp tx power level: {}," + " found filtering tx power level: {}".format( + exp_tx_power_level, tx_power_level)) + if exp_is_connectable != is_connectable: + test_result = False + self.log.debug("exp is connectable: {}," + " found filtering is connectable: {}".format( + exp_is_connectable, is_connectable)) + return test_result + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='f2a276ae-1436-43e4-aba7-1ede787200ee') + def test_adv_data_defaults(self): + """Tests the default advertisement data. + + This builder object should have a proper "get" expectation for each + attribute of the builder object once it's built. + + Steps: + 1. Build a new AdvertiseData object. + 2. Get the attributes of the advertise settings object. + 3. Compare the attributes found against the attributes exp. + + Expected Result: + Found attributes should match expected attributes. + + Returns: + True is pass + False if fail + + TAGS: LE, Advertising + Priority: 0 + """ + test_result = True + droid = self.ad_dut.droid + adv_data = droid.bleBuildAdvertiseData() + service_uuids = droid.bleGetAdvertiseDataServiceUuids(adv_data) + include_tx_power_level = droid.bleGetAdvertiseDataIncludeTxPowerLevel( + adv_data) + include_device_name = droid.bleGetAdvertiseDataIncludeDeviceName( + adv_data) + + exp_service_uuids = [] + exp_include_tx_power_level = False + exp_include_device_name = False + self.log.debug("Step 4: Verify all defaults match exp values.") + if service_uuids != exp_service_uuids: + test_result = False + self.log.debug("exp filtering service uuids: {}," + " found filtering service uuids: {}".format( + exp_service_uuids, service_uuids)) + if include_tx_power_level != exp_include_tx_power_level: + test_result = False + self.log.debug( + "exp filtering include tx power level:: {}," + " found filtering include tx power level: {}".format( + exp_include_tx_power_level, include_tx_power_level)) + if include_device_name != exp_include_device_name: + test_result = False + self.log.debug( + "exp filtering include tx power level: {}," + " found filtering include tx power level: {}".format( + exp_include_device_name, include_device_name)) + if not test_result: + self.log.debug("Some values didn't match the defaults.") + else: + self.log.debug("All default values passed.") + return test_result + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='8d462e60-6b4e-49f3-9ef4-5a8b612d285d') + def test_adv_settings_set_adv_mode_balanced(self): + """Tests advertise settings balanced mode. + + This advertisement settings from "set" advertisement mode should match + the corresponding "get" function. + + Steps: + 1. Build a new advertise settings object. + 2. Set the advertise mode attribute to balanced. + 3. Get the attributes of the advertise settings object. + 4. Compare the attributes found against the attributes exp. + + Expected Result: + Found attributes should match expected attributes. + + Returns: + True is pass + False if fail + + TAGS: LE, Advertising + Priority: 1 + """ + self.log.debug("Step 1: Setup environment.") + droid = self.ad_dut.droid + exp_adv_mode = ble_advertise_settings_modes['balanced'] + self.log.debug( + "Step 2: Set the filtering settings object's value to {}".format( + exp_adv_mode)) + return self.verify_adv_settings_adv_mode(droid, exp_adv_mode) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='334fefeb-365f-4ee3-9be0-42b1fabe3178') + def test_adv_settings_set_adv_mode_low_power(self): + """Tests advertise settings low power mode. + + This advertisement settings from "set" advertisement mode should match + the corresponding "get" function. + + Steps: + 1. Build a new advertise settings object. + 2. Set the advertise mode attribute to low power mode. + 3. Get the attributes of the advertise settings object. + 4. Compare the attributes found against the attributes exp. + + Expected Result: + Found attributes should match expected attributes. + + Returns: + True is pass + False if fail + + TAGS: LE, Advertising + Priority: 1 + """ + self.log.debug("Step 1: Setup environment.") + droid = self.ad_dut.droid + exp_adv_mode = ble_advertise_settings_modes['low_power'] + self.log.debug( + "Step 2: Set the filtering settings object's value to {}".format( + exp_adv_mode)) + return self.verify_adv_settings_adv_mode(droid, exp_adv_mode) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='ce087782-1535-4694-944a-e962c22638ed') + def test_adv_settings_set_adv_mode_low_latency(self): + """Tests advertise settings low latency mode. + + This advertisement settings from "set" advertisement mode should match + the corresponding "get" function. + + Steps: + 1. Build a new advertise settings object. + 2. Set the advertise mode attribute to low latency mode. + 3. Get the attributes of the advertise settings object. + 4. Compare the attributes found against the attributes exp. + + Expected Result: + Found attributes should match expected attributes. + + Returns: + True is pass + False if fail + + TAGS: LE, Advertising + Priority: 1 + """ + self.log.debug("Step 1: Setup environment.") + droid = self.ad_dut.droid + exp_adv_mode = ble_advertise_settings_modes['low_latency'] + self.log.debug( + "Step 2: Set the filtering settings object's value to {}".format( + exp_adv_mode)) + return self.verify_adv_settings_adv_mode(droid, exp_adv_mode) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='59b52be9-d38b-4814-af08-c68aa8910a16') + def test_adv_settings_set_invalid_adv_mode(self): + """Tests advertise settings invalid advertising mode. + + This advertisement settings from "set" advertisement mode should fail + when setting an invalid advertisement. + + Steps: + 1. Build a new advertise settings object. + 2. Set the advertise mode attribute to -1. + + Expected Result: + Building the advertise settings should fail. + + Returns: + True is pass + False if fail + + TAGS: LE, Advertising + Priority: 2 + """ + self.log.debug("Step 1: Setup environment.") + droid = self.ad_dut.droid + exp_adv_mode = -1 + self.log.debug("Step 2: Set the filtering mode to -1") + return self.verify_invalid_adv_settings_adv_mode(droid, exp_adv_mode) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='d8292633-831f-41c4-974a-ad267e9795e9') + def test_adv_settings_set_adv_tx_power_level_high(self): + """Tests advertise settings tx power level high. + + This advertisement settings from "set" advertisement tx power level + should match the corresponding "get" function. + + Steps: + 1. Build a new advertise settings object. + 2. Set the advertise mode attribute to tx power level high. + 3. Get the attributes of the advertise settings object. + 4. Compare the attributes found against the attributes exp. + + Expected Result: + Found attributes should match expected attributes. + + Returns: + True is pass + False if fail + + TAGS: LE, Advertising + Priority: 1 + """ + self.log.debug("Step 1: Setup environment.") + droid = self.ad_dut.droid + exp_adv_tx_power = ble_advertise_settings_tx_powers['high'] + self.log.debug( + "Step 2: Set the filtering settings object's value to {}".format( + exp_adv_tx_power)) + return self.verify_adv_settings_tx_power_level(droid, exp_adv_tx_power) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='d577de1f-4fd9-43d5-beff-c0696c5e0ea1') + def test_adv_settings_set_adv_tx_power_level_medium(self): + """Tests advertise settings tx power level medium. + + This advertisement settings from "set" advertisement tx power level + should match the corresponding "get" function. + + Steps: + 1. Build a new advertise settings object. + 2. Set the advertise mode attribute to tx power level medium. + 3. Get the attributes of the advertise settings object. + 4. Compare the attributes found against the attributes exp. + + Expected Result: + Found attributes should match expected attributes. + + Returns: + True is pass + False if fail + + TAGS: LE, Advertising + Priority: 1 + """ + self.log.debug("Step 1: Setup environment.") + test_result = True + droid = self.ad_dut.droid + exp_adv_tx_power = ble_advertise_settings_tx_powers['medium'] + self.log.debug( + "Step 2: Set the filtering settings object's value to {}".format( + exp_adv_tx_power)) + return self.verify_adv_settings_tx_power_level(droid, exp_adv_tx_power) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='e972f8b5-a3cf-4b3f-9223-a8a74c0fd855') + def test_adv_settings_set_adv_tx_power_level_low(self): + """Tests advertise settings tx power level low. + + This advertisement settings from "set" advertisement tx power level + should match the corresponding "get" function. + + Steps: + 1. Build a new advertise settings object. + 2. Set the advertise mode attribute to tx power level low. + 3. Get the attributes of the advertise settings object. + 4. Compare the attributes found against the attributes exp. + + Expected Result: + Found attributes should match expected attributes. + + Returns: + True is pass + False if fail + + TAGS: LE, Advertising + Priority: 1 + """ + self.log.debug("Step 1: Setup environment.") + droid = self.ad_dut.droid + exp_adv_tx_power = (ble_advertise_settings_tx_powers['low']) + self.log.debug( + "Step 2: Set the filtering settings object's value to ".format( + exp_adv_tx_power)) + return self.verify_adv_settings_tx_power_level(droid, exp_adv_tx_power) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='e972f8b5-a3cf-4b3f-9223-a8a74c0fd855') + def test_adv_settings_set_adv_tx_power_level_ultra_low(self): + """Tests advertise settings tx power level ultra low. + + This advertisement settings from "set" advertisement tx power level + should match the corresponding "get" function. + + Steps: + 1. Build a new advertise settings object. + 2. Set the advertise mode attribute to tx power level ultra low. + 3. Get the attributes of the advertise settings object. + 4. Compare the attributes found against the attributes exp. + + Expected Result: + Found attributes should match expected attributes. + + Returns: + True is pass + False if fail + + TAGS: LE, Advertising + Priority: 1 + """ + self.log.debug("Step 1: Setup environment.") + droid = self.ad_dut.droid + exp_adv_tx_power = ble_advertise_settings_tx_powers['ultra_low'] + self.log.debug( + "Step 2: Set the filtering settings object's value to ".format( + exp_adv_tx_power)) + return self.verify_adv_settings_tx_power_level(droid, exp_adv_tx_power) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='e972f8b5-a3cf-4b3f-9223-a8a74c0fd855') + def test_adv_settings_set_invalid_adv_tx_power_level(self): + """Tests advertise settings invalid advertising tx power level. + + This advertisement settings from "set" advertisement mode should fail + when setting an invalid advertisement. + + Steps: + 1. Build a new advertise settings object. + 2. Set the advertise tx power level attribute to -1. + + Expected Result: + Building the advertise settings should fail. + + Returns: + True is pass + False if fail + + TAGS: LE, Advertising + Priority: 1 + """ + self.log.debug("Step 1: Setup environment.") + droid = self.ad_dut.droid + exp_adv_tx_power = -1 + self.log.debug("Step 2: Set the filtering mode to -1") + return self.verify_invalid_adv_settings_tx_power_level( + droid, exp_adv_tx_power) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='1be71f77-64af-42b7-84cb-e06df0836966') + def test_adv_settings_set_is_connectable_true(self): + """Tests advertise settings is connectable true. + + This advertisement settings from "set" advertisement tx power level + should match the corresponding "get" function. + + Steps: + 1. Build a new advertise settings object. + 2. Set the advertise is connectable to true. + 3. Get the attributes of the advertise settings object. + 4. Compare the attributes found against the attributes exp. + + Expected Result: + Found attributes should match expected attributes. + + Returns: + True is pass + False if fail + + TAGS: LE, Advertising + Priority: 1 + """ + self.log.debug("Step 1: Setup environment.") + droid = self.ad_dut.droid + exp_is_connectable = True + self.log.debug( + "Step 2: Set the filtering settings object's value to {}".format( + exp_is_connectable)) + return self.verify_adv_settings_is_connectable(droid, + exp_is_connectable) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='f9865333-9198-4385-938d-5fc641ee9968') + def test_adv_settings_set_is_connectable_false(self): + """Tests advertise settings is connectable false. + + This advertisement settings from "set" advertisement tx power level + should match the corresponding "get" function. + + Steps: + 1. Build a new advertise settings object. + 2. Set the advertise is connectable to false. + 3. Get the attributes of the advertise settings object. + 4. Compare the attributes found against the attributes exp. + + Expected Result: + Found attributes should match expected attributes. + + Returns: + True is pass + False if fail + + TAGS: LE, Advertising + Priority: 1 + """ + self.log.debug("Step 1: Setup environment.") + droid = self.ad_dut.droid + exp_is_connectable = False + self.log.debug("Step 2: Set the filtering settings object's value to " + + str(exp_is_connectable)) + return self.verify_adv_settings_is_connectable(droid, + exp_is_connectable) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='a770ed7e-c6cd-4533-8876-e42e68f8b4fb') + def test_adv_data_set_service_uuids_empty(self): + """Tests advertisement data's service uuids to empty. + + This advertisement data from "set" advertisement service uuid + should match the corresponding "get" function. + + Steps: + 1. Build a new AdvertiseData object. + 2. Set the AdvertiseData's service uuid to empty. + 3. Get the attributes of the AdvertiseData object. + 4. Compare the attributes found against the attributes exp. + + Expected Result: + Found attributes should match expected attributes. + + Returns: + True is pass + False if fail + + TAGS: LE, Advertising + Priority: 1 + """ + self.log.debug("Step 1: Setup environment.") + droid = self.ad_dut.droid + exp_service_uuids = [] + self.log.debug("Step 2: Set the filtering data object's value to " + + str(exp_service_uuids)) + return self.verify_adv_data_service_uuids(droid, exp_service_uuids) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='3da511db-d024-45c8-be3c-fe8e123129fa') + def test_adv_data_set_service_uuids_single(self): + """Tests advertisement data's service uuids to empty. + + This advertisement data from "set" advertisement service uuid + should match the corresponding "get" function. + + Steps: + 1. Build a new AdvertiseData object. + 2. Set the AdvertiseData's service uuid to empty. + 3. Get the attributes of the AdvertiseData object. + 4. Compare the attributes found against the attributes exp. + + Expected Result: + Found attributes should match expected attributes. + + Returns: + True is pass + False if fail + + TAGS: LE, Advertising + Priority: 1 + """ + self.log.debug("Step 1: Setup environment.") + droid = self.ad_dut.droid + exp_service_uuids = ["00000000-0000-1000-8000-00805f9b34fb"] + self.log.debug("Step 2: Set the filtering data object's value to " + + str(exp_service_uuids)) + return self.verify_adv_data_service_uuids(droid, exp_service_uuids) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='15073359-d607-4a76-b60a-00a4b34f9a85') + def test_adv_data_set_service_uuids_multiple(self): + """Tests advertisement data's service uuids to multiple uuids. + + This advertisement data from "set" advertisement service uuid + should match the corresponding "get" function. + + Steps: + 1. Build a new AdvertiseData object. + 2. Set the AdvertiseData's service uuid to multiple uuids. + 3. Get the attributes of the AdvertiseData object. + 4. Compare the attributes found against the attributes exp. + + Expected Result: + Found attributes should match expected attributes. + + Returns: + True is pass + False if fail + + TAGS: LE, Advertising + Priority: 1 + """ + self.log.debug("Step 1: Setup environment.") + droid = self.ad_dut.droid + exp_service_uuids = [ + "00000000-0000-1000-8000-00805f9b34fb", + "00000000-0000-1000-8000-00805f9b34fb" + ] + self.log.debug("Step 2: Set the filtering data object's value to " + + str(exp_service_uuids)) + return self.verify_adv_data_service_uuids(droid, exp_service_uuids) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='af783a71-ef80-4974-a077-16a4ed8f0114') + def test_adv_data_set_service_uuids_invalid_uuid(self): + """Tests advertisement data's service uuids to an invalid uuid. + + This advertisement data from "set" advertisement service uuid + should fail when there is an invalid service uuid. + + Steps: + 1. Build a new AdvertiseData object. + 2. Set the AdvertiseData's service uuid to an invalid uuid. + + Expected Result: + Building the AdvertiseData should fail. + + Returns: + True is pass + False if fail + + TAGS: LE, Advertising + Priority: 1 + """ + self.log.debug("Step 1: Setup environment.") + droid = self.ad_dut.droid + exp_service_uuids = ["0"] + self.log.debug("Step 2: Set the filtering data service uuids to " + + str(exp_service_uuids)) + return self.verify_invalid_adv_data_service_uuids( + droid, exp_service_uuids) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='51d634e7-6271-4cc0-a57b-3c1b632a7db6') + def test_adv_data_set_service_data(self): + """Tests advertisement data's service data. + + This advertisement data from "set" advertisement service data + should match the corresponding "get" function. + + Steps: + 1. Build a new AdvertiseData object. + 2. Set the AdvertiseData's service data. + 3. Get the attributes of the AdvertiseData object. + 4. Compare the attributes found against the attributes exp. + + Expected Result: + Found attributes should match expected attributes. + + Returns: + True is pass + False if fail + + TAGS: LE, Advertising + Priority: 1 + """ + self.log.debug("Step 1: Setup environment.") + droid = self.ad_dut.droid + exp_service_data_uuid = "00000000-0000-1000-8000-00805f9b34fb" + exp_service_data = [1, 2, 3] + self.log.debug( + "Step 2: Set the filtering data object's service data uuid to: {}, " + "service data: {}".format(exp_service_data_uuid, exp_service_data)) + return self.verify_adv_data_service_data(droid, exp_service_data_uuid, + exp_service_data) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='aa18b0af-2a41-4b2a-af64-ea639961d561') + def test_adv_data_set_service_data_invalid_service_data(self): + """Tests advertisement data's invalid service data. + + This advertisement data from "set" advertisement service data + should fail on an invalid value. + + Steps: + 1. Build a new AdvertiseData object. + 2. Set the AdvertiseData's service data to an invalid value. + 3. Get the attributes of the AdvertiseData object. + 4. Compare the attributes found against the attributes exp. + + Expected Result: + Found attributes should match expected attributes. + + Returns: + True is pass + False if fail + + TAGS: LE, Advertising + Priority: 1 + """ + self.log.debug("Step 1: Setup environment.") + droid = self.ad_dut.droid + exp_service_data_uuid = "00000000-0000-1000-8000-00805f9b34fb" + exp_service_data = "helloworld" + self.log.debug( + "Step 2: Set the filtering data object's service data uuid to: {}, " + "service data: {}".format(exp_service_data_uuid, exp_service_data)) + return self.verify_invalid_adv_data_service_data( + droid, exp_service_data_uuid, exp_service_data) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='13a75a47-eff4-429f-a436-d244bbfe4496') + def test_adv_data_set_service_data_invalid_service_data_uuid(self): + """Tests advertisement data's invalid service data and uuid. + + This advertisement data from "set" advertisement service data + should fail on an invalid value. + + Steps: + 1. Build a new AdvertiseData object. + 2. Set the AdvertiseData's service data and uuid to an invalid value. + 3. Get the attributes of the AdvertiseData object. + 4. Compare the attributes found against the attributes exp. + + Expected Result: + Found attributes should match expected attributes. + + Returns: + True is pass + False if fail + + TAGS: LE, Advertising + Priority: 1 + """ + self.log.debug("Step 1: Setup environment.") + droid = self.ad_dut.droid + exp_service_data_uuid = "0" + exp_service_data = "1,2,3" + self.log.debug( + "Step 2: Set the filtering data object's service data uuid to: {}, " + "service data: {}".format(exp_service_data_uuid, exp_service_data)) + return self.verify_invalid_adv_data_service_data( + droid, exp_service_data_uuid, exp_service_data) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='386024e2-212e-4eed-8ef3-43d0c0239ea5') + def test_adv_data_set_manu_id(self): + """Tests advertisement data's manufacturers data and id. + + This advertisement data from "set" advertisement manufacturers data + should match the corresponding "get" function. + + Steps: + 1. Build a new AdvertiseData object. + 2. Set the AdvertiseData's manufacturers data and id. + 3. Get the attributes of the AdvertiseData object. + 4. Compare the attributes found against the attributes exp. + + Expected Result: + Found attributes should match expected attributes. + + Returns: + True is pass + False if fail + + TAGS: LE, Advertising + Priority: 1 + """ + self.log.debug("Step 1: Setup environment.") + droid = self.ad_dut.droid + exp_manu_id = 0 + exp_manu_specific_data = [1, 2, 3] + self.log.debug( + "Step 2: Set the filtering data object's service data manu id: {}" + ", manu specific data: {}".format(exp_manu_id, + exp_manu_specific_data)) + return self.verify_adv_data_manu_id(droid, exp_manu_id, + exp_manu_specific_data) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='650ceff2-2760-4a34-90fb-e637a2c5ebb5') + def test_adv_data_set_manu_id_invalid_manu_id(self): + """Tests advertisement data's manufacturers invalid id. + + This advertisement data from "set" advertisement manufacturers data + should not be successful on an invalid id. + + Steps: + 1. Build a new AdvertiseData object. + 2. Set the AdvertiseData's manufacturers id to -1. + 3. Build the advertisement data. + + Expected Result: + Building the advertisement data should fail. + + Returns: + True is pass + False if fail + + TAGS: LE, Advertising + Priority: 1 + """ + self.log.debug("Step 1: Setup environment.") + droid = self.ad_dut.droid + exp_manu_id = -1 + exp_manu_specific_data = [1, 2, 3] + self.log.debug( + "Step 2: Set the filtering data object's service data manu id: {}" + ", manu specific data: {}".format(exp_manu_id, + exp_manu_specific_data)) + return self.verify_invalid_adv_data_manu_id(droid, exp_manu_id, + exp_manu_specific_data) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='27ccd7d7-9cd2-4e95-8198-ef6ca746d1cc') + def test_adv_data_set_manu_id_invalid_manu_specific_data(self): + """Tests advertisement data's manufacturers invalid specific data. + + This advertisement data from "set" advertisement manufacturers data + should not be successful on an invalid specific data. + + Steps: + 1. Build a new AdvertiseData object. + 2. Set the AdvertiseData's manufacturers specific data to helloworld. + 3. Build the advertisement data. + + Expected Result: + Building the advertisement data should fail. + + Returns: + True is pass + False if fail + + TAGS: LE, Advertising + Priority: 1 + """ + self.log.debug("Step 1: Setup environment.") + droid = self.ad_dut.droid + exp_manu_id = 0 + exp_manu_specific_data = ['helloworld'] + self.log.debug( + "Step 2: Set the filtering data object's service data manu id: {}" + ", manu specific data: {}".format(exp_manu_id, + exp_manu_specific_data)) + return self.verify_invalid_adv_data_manu_id(droid, exp_manu_id, + exp_manu_specific_data) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='8e78d444-cd25-4c17-9532-53972a6f0ffe') + def test_adv_data_set_manu_id_max(self): + """Tests advertisement data's manufacturers id to the max size. + + This advertisement data from "set" advertisement manufacturers data + should match the corresponding "get" function. + + Steps: + 1. Build a new AdvertiseData object. + 2. Set the AdvertiseData's manufacturers id to JavaInterger.MAX value. + 3. Get the attributes of the AdvertiseData object. + 4. Compare the attributes found against the attributes exp. + + Expected Result: + Found attributes should match expected attributes. + + Returns: + True is pass + False if fail + + TAGS: LE, Advertising + Priority: 3 + """ + self.log.debug("Step 1: Setup environment.") + droid = self.ad_dut.droid + exp_manu_id = java_integer['max'] + exp_manu_specific_data = [1, 2, 3] + self.log.debug( + "Step 2: Set the filtering data object's service data manu id: {}" + ", manu specific data: {}".format(exp_manu_id, + exp_manu_specific_data)) + return self.verify_adv_data_manu_id(droid, exp_manu_id, + exp_manu_specific_data) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='6c4866b7-ddf5-44ef-a231-0af683c6db80') + def test_adv_data_set_include_tx_power_level_true(self): + """Tests advertisement data's include tx power level to True. + + This advertisement data from "set" advertisement manufacturers data + should match the corresponding "get" function. + + Steps: + 1. Build a new AdvertiseData object. + 2. Set the AdvertiseData's include tx power level to True. + 3. Get the attributes of the AdvertiseData object. + 4. Compare the attributes found against the attributes exp. + + Expected Result: + Found attributes should match expected attributes. + + Returns: + True is pass + False if fail + + TAGS: LE, Advertising + Priority: 1 + """ + self.log.debug("Step 1: Setup environment.") + droid = self.ad_dut.droid + exp_include_tx_power_level = True + self.log.debug( + "Step 2: Set the filtering data object's include tx power level: " + "{}".format(exp_include_tx_power_level)) + return self.verify_adv_data_include_tx_power_level( + droid, exp_include_tx_power_level) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='db06cc5f-60cf-4f04-b0fe-0c354f987541') + def test_adv_data_set_include_tx_power_level_false(self): + """Tests advertisement data's include tx power level to False. + + This advertisement data from "set" advertisement manufacturers data + should match the corresponding "get" function. + + Steps: + 1. Build a new AdvertiseData object. + 2. Set the AdvertiseData's include tx power level to False. + 3. Get the attributes of the AdvertiseData object. + 4. Compare the attributes found against the attributes exp. + + Expected Result: + Found attributes should match expected attributes. + + Returns: + True is pass + False if fail + + TAGS: LE, Advertising + Priority: 1 + """ + self.log.debug("Step 1: Setup environment.") + droid = self.ad_dut.droid + exp_include_tx_power_level = False + self.log.debug( + "Step 2: Set the filtering data object's include tx power level: {}" + .format(exp_include_tx_power_level)) + return self.verify_adv_data_include_tx_power_level( + droid, exp_include_tx_power_level) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='e99480c4-fd37-4791-a8d0-7eb8f8f72d62') + def test_adv_data_set_include_device_name_true(self): + """Tests advertisement data's include device name to True. + + This advertisement data from "set" advertisement manufacturers data + should match the corresponding "get" function. + + Steps: + 1. Build a new AdvertiseData object. + 2. Set the AdvertiseData's include device name to True. + 3. Get the attributes of the AdvertiseData object. + 4. Compare the attributes found against the attributes exp. + + Expected Result: + Found attributes should match expected attributes. + + Returns: + True is pass + False if fail + + TAGS: LE, Advertising + Priority: 1 + """ + self.log.debug("Step 1: Setup environment.") + droid = self.ad_dut.droid + exp_include_device_name = True + self.log.debug( + "Step 2: Set the filtering data object's include device name: {}" + .format(exp_include_device_name)) + return self.verify_adv_data_include_device_name( + droid, exp_include_device_name) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='b89ed642-c426-4777-8217-7bb8c2058592') + def test_adv_data_set_include_device_name_false(self): + """Tests advertisement data's include device name to False. + + This advertisement data from "set" advertisement manufacturers data + should match the corresponding "get" function. + + Steps: + 1. Build a new AdvertiseData object. + 2. Set the AdvertiseData's include device name to False. + 3. Get the attributes of the AdvertiseData object. + 4. Compare the attributes found against the attributes exp. + + Expected Result: + Found attributes should match expected attributes. + + Returns: + True is pass + False if fail + + TAGS: LE, Advertising + Priority: 1 + """ + self.log.debug("Step 1: Setup environment.") + test_result = True + droid = self.ad_dut.droid + exp_include_device_name = False + self.log.debug( + "Step 2: Set the filtering data object's include device name: {}". + format(exp_include_device_name)) + return self.verify_adv_data_include_device_name( + droid, exp_include_device_name) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='5033bcf5-a841-4b8b-af35-92c7237c7b36') + def test_advertisement_greater_than_31_bytes(self): + """Tests advertisement data's size to be greater than 31 bytes. + + This advertisement data from "set" advertisement manufacturers data + should match the corresponding "get" function. + + Steps: + 1. Build a new AdvertiseData object. + 2. Set the AdvertiseData's size to be greater than 31 bytes + 3. Build the advertisement data. + + Expected Result: + Api fails to build the AdvertiseData. + + Returns: + True is pass + False if fail + + TAGS: LE, Advertising + Priority: 1 + """ + test_result = True + droid = self.ad_dut.droid + ed = self.android_devices[0].ed + service_data = [] + for i in range(25): + service_data.append(i) + droid.bleAddAdvertiseDataServiceData( + "0000110D-0000-1000-8000-00805F9B34FB", service_data) + advcallback, adv_data, adv_settings = generate_ble_advertise_objects( + droid) + droid.bleStartBleAdvertising(advcallback, adv_data, adv_settings) + try: + ed.pop_event(adv_fail.format(advcallback)) + except rpc_client.Sl4aApiError: + self.log.info("{} event was not found.".format( + adv_fail.format(advcallback))) + return False + return test_result + + def verify_adv_settings_adv_mode(self, droid, exp_adv_mode): + try: + droid.bleSetAdvertiseSettingsAdvertiseMode(exp_adv_mode) + except BleAdvertiseVerificationError as error: + self.log.debug(str(error)) + return False + self.log.debug("Step 3: Get a filtering settings object's index.") + settings_index = droid.bleBuildAdvertiseSettings() + self.log.debug("Step 4: Get the filtering setting's filtering mode.") + adv_mode = droid.bleGetAdvertiseSettingsMode(settings_index) + if exp_adv_mode is not adv_mode: + self.log.debug("exp value: {}, Actual value: {}".format( + exp_adv_mode, adv_mode)) + return False + self.log.debug("Advertise Setting's filtering mode {} value " + "test Passed.".format(exp_adv_mode)) + return True + + def verify_adv_settings_tx_power_level(self, droid, exp_adv_tx_power): + try: + droid.bleSetAdvertiseSettingsTxPowerLevel(exp_adv_tx_power) + except BleAdvertiseVerificationError as error: + self.log.debug(str(error)) + return False + self.log.debug("Step 3: Get a filtering settings object's index.") + settings_index = droid.bleBuildAdvertiseSettings() + self.log.debug("Step 4: Get the filtering setting's tx power level.") + adv_tx_power_level = droid.bleGetAdvertiseSettingsTxPowerLevel( + settings_index) + if exp_adv_tx_power is not adv_tx_power_level: + self.log.debug("exp value: {}, Actual value: {}".format( + exp_adv_tx_power, adv_tx_power_level)) + return False + self.log.debug("Advertise Setting's tx power level {}" + " value test Passed.".format(exp_adv_tx_power)) + return True + + def verify_adv_settings_is_connectable(self, droid, exp_is_connectable): + try: + droid.bleSetAdvertiseSettingsIsConnectable(exp_is_connectable) + except BleAdvertiseVerificationError as error: + self.log.debug(str(error)) + return False + self.log.debug("Step 3: Get a filtering settings object's index.") + settings_index = droid.bleBuildAdvertiseSettings() + self.log.debug( + "Step 4: Get the filtering setting's is connectable value.") + is_connectable = droid.bleGetAdvertiseSettingsIsConnectable( + settings_index) + if exp_is_connectable is not is_connectable: + self.log.debug("exp value: {}, Actual value: {}".format( + exp_is_connectable, is_connectable)) + return False + self.log.debug("Advertise Setting's is connectable {}" + " value test Passed.".format(exp_is_connectable)) + return True + + def verify_adv_data_service_uuids(self, droid, exp_service_uuids): + try: + droid.bleSetAdvertiseDataSetServiceUuids(exp_service_uuids) + except BleAdvertiseVerificationError as error: + self.log.debug(str(error)) + return False + self.log.debug("Step 3: Get a filtering data object's index.") + data_index = droid.bleBuildAdvertiseData() + self.log.debug("Step 4: Get the filtering data's service uuids.") + service_uuids = droid.bleGetAdvertiseDataServiceUuids(data_index) + if exp_service_uuids != service_uuids: + self.log.debug("exp value: {}, Actual value: {}".format( + exp_service_uuids, service_uuids)) + return False + self.log.debug( + "Advertise Data's service uuids {}, value test Passed.".format( + exp_service_uuids)) + return True + + def verify_adv_data_service_data(self, droid, exp_service_data_uuid, + exp_service_data): + try: + droid.bleAddAdvertiseDataServiceData(exp_service_data_uuid, + exp_service_data) + except BleAdvertiseVerificationError as error: + self.log.debug(str(error)) + return False + self.log.debug("Step 3: Get a filtering data object's index.") + data_index = droid.bleBuildAdvertiseData() + self.log.debug("Step 4: Get the filtering data's service data.") + service_data = droid.bleGetAdvertiseDataServiceData( + data_index, exp_service_data_uuid) + if exp_service_data != service_data: + self.log.debug("exp value: {}, Actual value: {}".format( + exp_service_data, service_data)) + return False + self.log.debug("Advertise Data's service data uuid: {}, service data: " + "{}, value test Passed.".format(exp_service_data_uuid, + exp_service_data)) + return True + + def verify_adv_data_manu_id(self, droid, exp_manu_id, + exp_manu_specific_data): + try: + droid.bleAddAdvertiseDataManufacturerId(exp_manu_id, + exp_manu_specific_data) + except BleAdvertiseVerificationError as error: + self.log.debug(str(error)) + return False + self.log.debug("Step 3: Get a filtering data object's index.") + data_index = droid.bleBuildAdvertiseData() + self.log.debug("Step 5: Get the filtering data's manu specific data.") + manu_specific_data = droid.bleGetAdvertiseDataManufacturerSpecificData( + data_index, exp_manu_id) + if exp_manu_specific_data != manu_specific_data: + self.log.debug("exp value: " + str(exp_manu_specific_data) + + ", Actual value: " + str(manu_specific_data)) + return False + self.log.debug("Advertise Data's manu id: " + str(exp_manu_id) + + ", manu's specific data: " + + str(exp_manu_specific_data) + " value test Passed.") + return True + + def verify_adv_data_include_tx_power_level(self, droid, + exp_include_tx_power_level): + try: + droid.bleSetAdvertiseDataIncludeTxPowerLevel( + exp_include_tx_power_level) + except BleAdvertiseVerificationError as error: + self.log.debug(str(error)) + return False + self.log.debug("Step 3: Get a filtering settings object's index.") + data_index = droid.bleBuildAdvertiseData() + self.log.debug( + "Step 4: Get the filtering data's include tx power level.") + include_tx_power_level = droid.bleGetAdvertiseDataIncludeTxPowerLevel( + data_index) + if exp_include_tx_power_level is not include_tx_power_level: + self.log.debug("exp value: " + str(exp_include_tx_power_level) + + ", Actual value: " + str(include_tx_power_level)) + return False + self.log.debug("Advertise Setting's include tx power level " + str( + exp_include_tx_power_level) + " value test Passed.") + return True + + def verify_adv_data_include_device_name(self, droid, + exp_include_device_name): + try: + droid.bleSetAdvertiseDataIncludeDeviceName(exp_include_device_name) + except BleAdvertiseVerificationError as error: + self.log.debug(str(error)) + return False + self.log.debug("Step 3: Get a filtering settings object's index.") + data_index = droid.bleBuildAdvertiseData() + self.log.debug("Step 4: Get the filtering data's include device name.") + include_device_name = droid.bleGetAdvertiseDataIncludeDeviceName( + data_index) + if exp_include_device_name is not include_device_name: + self.log.debug("exp value: {}, Actual value: {}".format( + exp_include_device_name, include_device_name)) + return False + self.log.debug("Advertise Setting's include device name {}" + " value test Passed.".format(exp_include_device_name)) + return True + + def verify_invalid_adv_settings_adv_mode(self, droid, exp_adv_mode): + try: + droid.bleSetAdvertiseSettingsAdvertiseMode(exp_adv_mode) + droid.bleBuildAdvertiseSettings() + self.log.debug("Set Advertise settings invalid filtering mode " + "passed with input as {}".format(exp_adv_mode)) + return False + except rpc_client.Sl4aApiError: + self.log.debug( + "Set Advertise settings invalid filtering mode " + "failed successfully with input as {}".format(exp_adv_mode)) + return True + + def verify_invalid_adv_settings_tx_power_level(self, droid, + exp_adv_tx_power): + try: + droid.bleSetAdvertiseSettingsTxPowerLevel(exp_adv_tx_power) + droid.bleBuildAdvertiseSettings() + self.log.debug("Set Advertise settings invalid tx power level " + + " with input as {}".format(exp_adv_tx_power)) + return False + except rpc_client.Sl4aApiError: + self.log.debug( + "Set Advertise settings invalid tx power level " + "failed successfullywith input as {}".format(exp_adv_tx_power)) + return True + + def verify_invalid_adv_data_service_uuids(self, droid, exp_service_uuids): + try: + droid.bleSetAdvertiseDataSetServiceUuids(exp_service_uuids) + droid.bleBuildAdvertiseData() + self.log.debug("Set Advertise Data service uuids " + + " with input as {}".format(exp_service_uuids)) + return False + except rpc_client.Sl4aApiError: + self.log.debug( + "Set Advertise Data invalid service uuids failed " + "successfully with input as {}".format(exp_service_uuids)) + return True + + def verify_invalid_adv_data_service_data( + self, droid, exp_service_data_uuid, exp_service_data): + try: + droid.bleAddAdvertiseDataServiceData(exp_service_data_uuid, + exp_service_data) + droid.bleBuildAdvertiseData() + self.log.debug("Set Advertise Data service data uuid: {}," + ", service data: {}".format(exp_service_data_uuid, + exp_service_data)) + return False + except rpc_client.Sl4aApiError: + self.log.debug("Set Advertise Data service data uuid: " + + str(exp_service_data_uuid) + ", service data: " + + str(exp_service_data) + " failed successfully.") + return True + + def verify_invalid_adv_data_manu_id(self, droid, exp_manu_id, + exp_manu_specific_data): + try: + droid.bleAddAdvertiseDataManufacturerId(exp_manu_id, + exp_manu_specific_data) + droid.bleBuildAdvertiseData() + self.log.debug( + "Set Advertise Data manu id: " + str(exp_manu_id) + + ", manu specific data: " + str(exp_manu_specific_data)) + return False + except rpc_client.Sl4aApiError: + self.log.debug("Set Advertise Data manu id: {}," + " manu specific data: {},".format( + exp_manu_id, exp_manu_specific_data)) + return True diff --git a/acts_tests/tests/google/ble/api/BleScanApiTest.py b/acts_tests/tests/google/ble/api/BleScanApiTest.py index e69de29bb2..06f2362079 100644 --- a/acts_tests/tests/google/ble/api/BleScanApiTest.py +++ b/acts_tests/tests/google/ble/api/BleScanApiTest.py @@ -0,0 +1,1296 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2016 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +""" +Test script to exercise Ble Scan Api's. This exercises all getters and +setters. This is important since there is a builder object that is immutable +after you set all attributes of each object. If this test suite doesn't pass, +then other test suites utilising Ble Scanner will also fail. +""" + +from acts.controllers.sl4a_lib import rpc_client +from acts.test_decorators import test_tracker_info +from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest +from acts.test_utils.bt.bt_constants import ble_scan_settings_callback_types +from acts.test_utils.bt.bt_constants import ble_scan_settings_modes +from acts.test_utils.bt.bt_constants import ble_scan_settings_result_types +from acts.test_utils.bt.bt_constants import ble_scan_settings_report_delay_milli_seconds +from acts.test_utils.bt.bt_constants import ble_uuids + + +class BleScanResultsError(Exception): + """Error in getting scan results""" + + +class BleScanVerificationError(Exception): + """Error in comparing BleScan results""" + + +class BleSetScanSettingsError(Exception): + """Error in setting Ble Scan Settings""" + + +class BleSetScanFilterError(Exception): + """Error in setting Ble Scan Settings""" + + +class BleScanApiTest(BluetoothBaseTest): + def setup_class(self): + super().setup_class() + self.ad_dut = self.android_devices[0] + + def _format_defaults(self, input): + """ + Creates a dictionary of default ScanSetting and ScanFilter Values. + :return: input: dict + """ + if 'ScanSettings' not in input.keys(): + input['ScanSettings'] = ( + ble_scan_settings_callback_types['all_matches'], 0, + ble_scan_settings_modes['low_power'], + ble_scan_settings_result_types['full']) + if 'ScanFilterManufacturerDataId' not in input.keys(): + input['ScanFilterManufacturerDataId'] = -1 + if 'ScanFilterDeviceName' not in input.keys(): + input['ScanFilterDeviceName'] = None + if 'ScanFilterDeviceAddress' not in input.keys(): + input['ScanFilterDeviceAddress'] = None + if 'ScanFilterManufacturerData' not in input.keys(): + input['ScanFilterManufacturerData'] = None + return input + + def validate_scan_settings_helper(self, input, droid): + """ + Validates each input of the scan settings object that is matches what + was set or not set such that it matches the defaults. + :return: False at any point something doesn't match. True if everything + matches. + """ + filter_list = droid.bleGenFilterList() + if 'ScanSettings' in input.keys(): + try: + droid.bleSetScanSettingsCallbackType(input['ScanSettings'][0]) + droid.bleSetScanSettingsReportDelayMillis( + input['ScanSettings'][1]) + droid.bleSetScanSettingsScanMode(input['ScanSettings'][2]) + droid.bleSetScanSettingsResultType(input['ScanSettings'][3]) + except rpc_client.Sl4aApiError as error: + self.log.debug("Set Scan Settings failed with: ".format(error)) + return False + if 'ScanFilterDeviceName' in input.keys(): + try: + droid.bleSetScanFilterDeviceName(input['ScanFilterDeviceName']) + except rpc_client.Sl4aApiError as error: + self.log.debug("Set Scan Filter Device Name failed with: {}" + .format(error)) + return False + if 'ScanFilterDeviceAddress' in input.keys(): + try: + droid.bleSetScanFilterDeviceAddress( + input['ScanFilterDeviceAddress']) + except rpc_client.Sl4aApiError as error: + self.log.debug("Set Scan Filter Device Address failed with: {}" + .format(error)) + return False + if ('ScanFilterManufacturerDataId' in input.keys() + and 'ScanFilterManufacturerDataMask' in input.keys()): + try: + droid.bleSetScanFilterManufacturerData( + input['ScanFilterManufacturerDataId'], + input['ScanFilterManufacturerData'], + input['ScanFilterManufacturerDataMask']) + except rpc_client.Sl4aApiError as error: + self.log.debug("Set Scan Filter Manufacturer info with data " + "mask failed with: {}".format(error)) + return False + if ('ScanFilterManufacturerDataId' in input.keys() + and 'ScanFilterManufacturerData' in input.keys() + and 'ScanFilterManufacturerDataMask' not in input.keys()): + try: + droid.bleSetScanFilterManufacturerData( + input['ScanFilterManufacturerDataId'], + input['ScanFilterManufacturerData']) + except rpc_client.Sl4aApiError as error: + self.log.debug( + "Set Scan Filter Manufacturer info failed with: " + "{}".format(error)) + return False + if ('ScanFilterServiceUuid' in input.keys() + and 'ScanFilterServiceMask' in input.keys()): + + droid.bleSetScanFilterServiceUuid(input['ScanFilterServiceUuid'], + input['ScanFilterServiceMask']) + + input = self._format_defaults(input) + scan_settings_index = droid.bleBuildScanSetting() + scan_settings = ( + droid.bleGetScanSettingsCallbackType(scan_settings_index), + droid.bleGetScanSettingsReportDelayMillis(scan_settings_index), + droid.bleGetScanSettingsScanMode(scan_settings_index), + droid.bleGetScanSettingsScanResultType(scan_settings_index)) + + scan_filter_index = droid.bleBuildScanFilter(filter_list) + device_name_filter = droid.bleGetScanFilterDeviceName( + filter_list, scan_filter_index) + device_address_filter = droid.bleGetScanFilterDeviceAddress( + filter_list, scan_filter_index) + manufacturer_id = droid.bleGetScanFilterManufacturerId( + filter_list, scan_filter_index) + manufacturer_data = droid.bleGetScanFilterManufacturerData( + filter_list, scan_filter_index) + + if scan_settings != input['ScanSettings']: + self.log.debug("Scan Settings did not match. expected: {}, found: " + "{}".format(input['ScanSettings'], scan_settings)) + return False + if device_name_filter != input['ScanFilterDeviceName']: + self.log.debug("Scan Filter device name did not match. expected: " + "{}, found {}".format(input['ScanFilterDeviceName'], + device_name_filter)) + return False + if device_address_filter != input['ScanFilterDeviceAddress']: + self.log.debug( + "Scan Filter address name did not match. expected: " + "{}, found: {}".format(input['ScanFilterDeviceAddress'], + device_address_filter)) + return False + if manufacturer_id != input['ScanFilterManufacturerDataId']: + self.log.debug("Scan Filter manufacturer data id did not match. " + "expected: {}, found: {}".format( + input['ScanFilterManufacturerDataId'], + manufacturer_id)) + return False + if manufacturer_data != input['ScanFilterManufacturerData']: + self.log.debug("Scan Filter manufacturer data did not match. " + "expected: {}, found: {}".format( + input['ScanFilterManufacturerData'], + manufacturer_data)) + return False + if 'ScanFilterManufacturerDataMask' in input.keys(): + manufacturer_data_mask = droid.bleGetScanFilterManufacturerDataMask( + filter_list, scan_filter_index) + if manufacturer_data_mask != input['ScanFilterManufacturerDataMask']: + self.log.debug( + "Manufacturer data mask did not match. expected:" + " {}, found: {}".format( + input['ScanFilterManufacturerDataMask'], + manufacturer_data_mask)) + + return False + if ('ScanFilterServiceUuid' in input.keys() + and 'ScanFilterServiceMask' in input.keys()): + + expected_service_uuid = input['ScanFilterServiceUuid'] + expected_service_mask = input['ScanFilterServiceMask'] + service_uuid = droid.bleGetScanFilterServiceUuid( + filter_list, scan_filter_index) + service_mask = droid.bleGetScanFilterServiceUuidMask( + filter_list, scan_filter_index) + if service_uuid != expected_service_uuid.lower(): + self.log.debug("Service uuid did not match. expected: {}, " + "found {}".format(expected_service_uuid, + service_uuid)) + return False + if service_mask != expected_service_mask.lower(): + self.log.debug("Service mask did not match. expected: {}, " + "found {}".format(expected_service_mask, + service_mask)) + return False + self.scan_settings_index = scan_settings_index + self.filter_list = filter_list + self.scan_callback = droid.bleGenScanCallback() + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='5ffc9f7b-c261-4bf0-9a6b-7fda182b6c97') + def test_start_ble_scan_with_default_settings(self): + """Test LE scan with default settings. + + Test to validate all default scan settings values. + + Steps: + 1. Create LE scan objects. + 2. Start LE scan. + + Expected Result: + Scan starts successfully and matches expected settings. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Scanning + Priority: 1 + """ + input = {} + return self.validate_scan_settings_helper(input, self.ad_dut.droid) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='88c3b0cb-b4d4-45d1-be25-9855290a6d03') + def test_stop_ble_scan_default_settings(self): + """Test stopping an LE scan. + + Test default scan settings on an actual scan. Verify it can also stop + the scan. + + Steps: + 1. Validate default scan settings. + 2. Start ble scan. + 3. Stop ble scan. + + Expected Result: + LE scan is stopped successfully. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Scanning + Priority: 0 + """ + input = {} + test_result = self.validate_scan_settings_helper( + input, self.ad_dut.droid) + if not test_result: + self.log.error("Could not setup ble scanner.") + return test_result + self.ad_dut.droid.bleStartBleScan( + self.filter_list, self.scan_settings_index, self.scan_callback) + try: + self.ad_dut.droid.bleStopBleScan(self.scan_callback) + except BleScanResultsError as error: + self.log.error(str(error)) + test_result = False + return test_result + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='5aa7a4c2-0b7d-4000-a980-f00c9329a7b9') + def test_scan_settings_callback_type_all_matches(self): + """Test LE scan settings callback type all matches. + + Test scan settings callback type all matches. + + Steps: + 1. Validate the scan settings callback type with all other settings set + to their respective defaults. + + Expected Result: + Expected Scan settings should match found scan settings. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Scanning + Priority: 1 + """ + input = {} + input["ScanSettings"] = ( + ble_scan_settings_callback_types['all_matches'], 0, + ble_scan_settings_modes['low_power'], + ble_scan_settings_result_types['full']) + return self.validate_scan_settings_helper(input, self.ad_dut.droid) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='fd764861-aa76-480e-b2d2-5d55a888d123') + def test_scan_settings_set_callback_type_first_match(self): + """Test LE scan settings callback type first match + + Test scan settings callback type first match. + + Steps: + 1. Validate the scan settings callback type with all other settings set + to their respective defaults. + + Expected Result: + Expected Scan settings should match found scan settings. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Scanning + Priority: 1 + """ + input = {} + input["ScanSettings"] = ( + ble_scan_settings_callback_types['first_match'], 0, + ble_scan_settings_modes['low_power'], + ble_scan_settings_result_types['full']) + test_result = self.validate_scan_settings_helper( + input, self.ad_dut.droid) + return test_result + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='52e4626e-199c-4755-b9f1-8b38ecb30896') + def test_scan_settings_set_callback_type_match_lost(self): + """Test LE scan settings callback type match lost. + + Test scan settings callback type match lost. + + Steps: + 1. Validate the scan settings callback type with all other settings set + to their respective defaults. + + Expected Result: + Expected Scan settings should match found scan settings. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Scanning + Priority: 1 + """ + input = {} + input["ScanSettings"] = ( + ble_scan_settings_callback_types['match_lost'], 0, + ble_scan_settings_modes['low_power'], + ble_scan_settings_result_types['full']) + test_result = self.validate_scan_settings_helper( + input, self.ad_dut.droid) + return test_result + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='57476b3c-ba7a-4342-86f6-1b56b2c00181') + def test_scan_settings_set_invalid_callback_type(self): + """Test LE scan settings invalid callback type. + + Test scan settings invalid callback type -1. + + Steps: + 1. Build a LE ScanSettings object with an invalid callback type. + + Expected Result: + Api should fail to build object. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Scanning + Priority: 2 + """ + input = {} + input["ScanSettings"] = (-1, 0, ble_scan_settings_modes['low_power'], + ble_scan_settings_result_types['full']) + test_result = self.validate_scan_settings_helper( + input, self.ad_dut.droid) + return not test_result + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='52c80f0c-4f26-4cda-8a6b-291ac52f673a') + def test_scan_settings_set_scan_mode_low_power(self): + """Test LE scan settings scan mode low power mode. + + Test scan settings scan mode low power. + + Steps: + 1. Validate the scan settings scan mode with all other settings set to + their respective defaults. + + Expected Result: + Expected Scan settings should match found scan settings. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Scanning + Priority: 1 + """ + input = {} + input["ScanSettings"] = ( + ble_scan_settings_callback_types['all_matches'], 0, + ble_scan_settings_modes['low_power'], + ble_scan_settings_result_types['full']) + test_result = self.validate_scan_settings_helper( + input, self.ad_dut.droid) + return test_result + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='20f4513c-44a7-435d-be4e-03420093297a') + def test_scan_settings_set_scan_mode_balanced(self): + """Test LE scan settings scan mode balanced. + + Test scan settings scan mode balanced. + + Steps: + 1. Validate the scan settings scan mode with all other settings set to + their respective defaults. + + Expected Result: + Expected Scan settings should match found scan settings. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Scanning + Priority: 1 + """ + input = {} + input["ScanSettings"] = ( + ble_scan_settings_callback_types['all_matches'], 0, + ble_scan_settings_modes['balanced'], + ble_scan_settings_result_types['full']) + return self.validate_scan_settings_helper(input, self.ad_dut.droid) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='bf14e7fd-853b-4833-8fef-8c4bd629374b') + def test_scan_settings_set_scan_mode_low_latency(self): + """Test LE scan settings scan mode low latency. + + Test scan settings scan mode low latency. + + Steps: + 1. Validate the scan settings scan mode with all other settings set to + their respective defaults. + + Expected Result: + Expected Scan settings should match found scan settings. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Scanning + Priority: 1 + """ + input = {} + input["ScanSettings"] = ( + ble_scan_settings_callback_types['all_matches'], 0, + ble_scan_settings_modes['low_latency'], + ble_scan_settings_result_types['full']) + return self.validate_scan_settings_helper(input, self.ad_dut.droid) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='9f3b2e10-98f8-4d6a-b6b6-e8dee87063f0') + def test_scan_settings_set_invalid_scan_mode(self): + """Test LE scan settings scan mode as an invalid value. + Test scan settings invalid scan mode -2. + Steps: + 1. Set the scan settings scan mode to -2. + + Expected Result: + Building the ScanSettings object should fail. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Scanning + Priority: 1 + """ + input = {} + input["ScanSettings"] = ( + ble_scan_settings_callback_types['all_matches'], 0, -2, + ble_scan_settings_result_types['full']) + return not self.validate_scan_settings_helper(input, self.ad_dut.droid) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='cb246be7-4fef-4313-964d-5fb6dbe558c8') + def test_scan_settings_set_report_delay_millis_min(self): + """Test scan settings report delay millis as min value + + Test scan settings report delay millis min acceptable value. + + Steps: + 1. Validate the scan settings report delay millis with all other + settings set to their respective defaults. + + Expected Result: + Expected Scan settings should match found scan settings. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Scanning + Priority: 2 + """ + input = {} + input["ScanSettings"] = ( + ble_scan_settings_callback_types['all_matches'], + ble_scan_settings_report_delay_milli_seconds['min'], + ble_scan_settings_modes['low_power'], + ble_scan_settings_result_types['full']) + return self.validate_scan_settings_helper(input, self.ad_dut.droid) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='db1ea8f6-503d-4e9a-b61a-01210508c5a2') + def test_scan_settings_set_report_delay_millis_min_plus_one(self): + """Test scan settings report delay millis as min value plus one. + + Test scan settings report delay millis as min value plus one. + + Steps: + 1. Validate the scan settings report delay millis with all other + settings set to their respective defaults. + + Expected Result: + Expected Scan settings should match found scan settings. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Scanning + Priority: 4 + """ + input = {} + input["ScanSettings"] = ( + ble_scan_settings_callback_types['all_matches'], + ble_scan_settings_report_delay_milli_seconds['min'] + 1, + ble_scan_settings_modes['low_power'], + ble_scan_settings_result_types['full']) + return self.validate_scan_settings_helper(input, self.ad_dut.droid) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='54e83ff8-92b0-473e-839a-1ff1c7dcea83') + def test_scan_settings_set_report_delay_millis_max(self): + """Test scan settings report delay millis as max value. + + Test scan settings report delay millis max value. + + Steps: + 1. Validate the scan settings report delay millis with all other + settings set to their respective defaults. + + Expected Result: + Expected Scan settings should match found scan settings. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Scanning + Priority: 3 + """ + input = {} + input["ScanSettings"] = ( + ble_scan_settings_callback_types['all_matches'], + ble_scan_settings_report_delay_milli_seconds['max'], + ble_scan_settings_modes['low_power'], + ble_scan_settings_result_types['full']) + return self.validate_scan_settings_helper(input, self.ad_dut.droid) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='45d918ec-7e43-463b-8f07-f009f8808903') + def test_scan_settings_set_report_delay_millis_max_minus_one(self): + """Test scan settings report delay millis as max value minus one. + + Test scan settings report delay millis max value - 1. + + Steps: + 1. Validate the scan settings report delay millis with all other + settings set to their respective defaults. + + Expected Result: + Expected Scan settings should match found scan settings. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Scanning + Priority: 3 + """ + input = {} + input["ScanSettings"] = ( + ble_scan_settings_callback_types['all_matches'], + ble_scan_settings_report_delay_milli_seconds['max'] - 1, + ble_scan_settings_modes['low_power'], + ble_scan_settings_result_types['full']) + return self.validate_scan_settings_helper(input, self.ad_dut.droid) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='eb94b5ee-f2e7-4322-b3df-7bdd3a250262') + def test_scan_settings_set_invalid_report_delay_millis_min_minus_one(self): + """Test scan settings report delay millis as an invalid value. + + Test scan settings invalid report delay millis min value - 1. + + Steps: + 1. Set scan settings report delay millis to min value -1. + 2. Build scan settings object. + + Expected Result: + Building scan settings object should fail. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Scanning + Priority: 2 + """ + droid = self.ad_dut.droid + input = {} + input["ScanSettings"] = ( + ble_scan_settings_callback_types['all_matches'], + ble_scan_settings_report_delay_milli_seconds['min'] - 1, + ble_scan_settings_modes['low_power'], + ble_scan_settings_result_types['full']) + return not self.validate_scan_settings_helper(input, droid) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='8f5a2bd0-6037-4ac6-a962-f11e7fc13920') + def test_scan_settings_set_scan_result_type_full(self): + """Test scan settings result type full. + + Test scan settings result type full. + + Steps: + 1. Validate the scan settings result type with all other settings + set to their respective defaults. + + Expected Result: + Expected Scan settings should match found scan settings. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Scanning + Priority: 1 + """ + input = {} + input["ScanSettings"] = ( + ble_scan_settings_callback_types['all_matches'], 0, + ble_scan_settings_modes['low_power'], + ble_scan_settings_result_types['full']) + return self.validate_scan_settings_helper(input, self.ad_dut.droid) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='610fe301-600e-443e-a28b-cd722cc8a4c1') + def test_scan_settings_set_scan_result_type_abbreviated(self): + """Test scan settings result type abbreviated. + + Test scan settings result type abbreviated. + + Steps: + 1. Validate the scan settings result type with all other settings + set to their respective defaults. + + Expected Result: + Expected Scan settings should match found scan settings. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Scanning + Priority: 1 + """ + input = {} + input["ScanSettings"] = ( + ble_scan_settings_callback_types['all_matches'], 0, + ble_scan_settings_modes['low_power'], + ble_scan_settings_result_types['abbreviated']) + return self.validate_scan_settings_helper(input, self.ad_dut.droid) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='ed58430b-8180-472f-a118-64f5fce5e84c') + def test_scan_settings_set_invalid_scan_result_type(self): + """Test scan settings result type as an invalid value. + + Test scan settings invalid result type -1. + + Steps: + 1. Set scan settings result type as an invalid value. + 2. Build scan settings object. + + Expected Result: + Expected Scan settings should match found scan settings. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Scanning + Priority: 2 + """ + input = {} + input["ScanSettings"] = ( + ble_scan_settings_callback_types['all_matches'], 0, + ble_scan_settings_modes['low_power'], -1) + return not self.validate_scan_settings_helper(input, self.ad_dut.droid) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='6489665f-313d-4b1b-bd7f-f0fdeeaad335') + def test_scan_filter_set_device_name(self): + """Test scan filter set valid device name. + + Test scan filter device name sl4atest. + + Steps: + 1. Validate the scan filter device name with all other settings + set to their respective defaults. + + Expected Result: + Expected Scan filter should match found scan settings. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Scanning + Priority: 1 + """ + input = {} + input['ScanFilterDeviceName'] = "sl4atest" + return self.validate_scan_settings_helper(input, self.ad_dut.droid) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='76021a9a-14ca-4a2f-a908-96ab90db39ce') + def test_scan_filter_set_device_name_blank(self): + """Test scan filter set blank device name. + + Test scan filter device name blank. + + Steps: + 1. Validate the scan filter device name with all other settings + set to their respective defaults. + + Expected Result: + Expected Scan filter should match found scan filter. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Scanning + Priority: 1 + """ + droid = self.ad_dut.droid + input = {} + input['ScanFilterDeviceName'] = "" + return self.validate_scan_settings_helper(input, droid) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='d77c3d81-43a9-4572-a99b-87969117ede5') + def test_scan_filter_set_device_name_special_chars(self): + """Test scan filter set device name as special chars. + + Test scan filter device name special characters. + + Steps: + 1. Validate the scan filter device name with all other settings + set to their respective defaults. + + Expected Result: + Expected Scan filter should match found scan filter. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Scanning + Priority: 1 + """ + input = {} + input['ScanFilterDeviceName'] = "!@#$%^&*()\":<>/" + return self.validate_scan_settings_helper(input, self.ad_dut.droid) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='1697004e-76ab-444b-9419-0437e30444ad') + def test_scan_filter_set_device_address(self): + """Test scan filter set valid device address. + + Test scan filter device address valid. + + Steps: + 1. Validate the scan filter device address with all other settings + set to their respective defaults. + + Expected Result: + Expected Scan filter should match found scan filter. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Scanning + Priority: 1 + """ + input = {} + input['ScanFilterDeviceAddress'] = "01:02:03:AB:CD:EF" + return self.validate_scan_settings_helper(input, self.ad_dut.droid) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='eab0409c-7fc5-4d1f-8fbe-5ee2bb743f7e') + def test_scan_filter_set_invalid_device_address_lower_case(self): + """Test scan filter set invalid device address. + + Test scan filter device address lower case. + + Steps: + 1. Set the scan filter address to an invalid, lowercase mac address + + Expected Result: + Api to build scan filter should fail. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Scanning + Priority: 2 + """ + input = {} + input['ScanFilterDeviceAddress'] = "01:02:03:ab:cd:ef" + return not self.validate_scan_settings_helper(input, self.ad_dut.droid) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='0ec491ac-d273-468e-bbfe-e36a290aeb2a') + def test_scan_filter_set_invalid_device_address_blank(self): + """Test scan filter set invalid device address. + + Test scan filter invalid device address blank. + + Steps: + 1. Set the scan filter address to an invalid, blank mac address + + Expected Result: + Api to build scan filter should fail. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Scanning + Priority: 2 + """ + input = {} + input['ScanFilterDeviceAddress'] = "" + test_result = self.validate_scan_settings_helper( + input, self.ad_dut.droid) + return not test_result + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='5cebc454-091c-4e46-b200-1e52c8dffbec') + def test_scan_filter_set_invalid_device_address_bad_format(self): + """Test scan filter set badly formatted device address. + + Test scan filter badly formatted device address. + + Steps: + 1. Set the scan filter address to an invalid, blank mac address + + Expected Result: + Api to build scan filter should fail. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Scanning + Priority: 2 + """ + input = {} + input['ScanFilterDeviceAddress'] = "10.10.10.10.10" + return not self.validate_scan_settings_helper(input, self.ad_dut.droid) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='d5249d10-1486-4c38-a22d-1f1b077926db') + def test_scan_filter_set_invalid_device_address_bad_address(self): + """Test scan filter device address as an invalid value. + + Test scan filter invalid device address invalid characters. + + Steps: + 1. Set a scan filter's device address as ZZ:ZZ:ZZ:ZZ:ZZ:ZZ + + Expected Result: + Api to build the scan filter should fail. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Scanning + Priority: 1 + """ + input = {} + input['ScanFilterDeviceAddress'] = "ZZ:ZZ:ZZ:ZZ:ZZ:ZZ" + return not self.validate_scan_settings_helper(input, self.ad_dut.droid) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='65c62d50-69f6-4a0b-bd74-2340e0ce32ca') + def test_scan_filter_set_manufacturer_id_data(self): + """Test scan filter manufacturer data. + + Test scan filter manufacturer data with a valid input. + + Steps: + 1. Validate the scan filter manufacturer id with all other settings + set to their respective defaults. + + Expected Result: + Expected Scan filter should match found scan filter. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Scanning + Priority: 1 + """ + expected_manufacturer_id = 0 + expected_manufacturer_data = [1, 2, 1, 3, 4, 5, 6] + input = {} + input['ScanFilterManufacturerDataId'] = expected_manufacturer_id + input['ScanFilterManufacturerData'] = expected_manufacturer_data + return self.validate_scan_settings_helper(input, self.ad_dut.droid) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='12807021-9f66-4784-b34a-80859cf4a32f') + def test_scan_filter_set_manufacturer_id_data_mask(self): + """Test scan filter manufacturer data mask. + + Test scan filter manufacturer data with a valid data mask. + + Steps: + 1. Validate the scan filter manufacturer id with all other settings + set to their respective defaults. + + Expected Result: + Expected Scan filter should match found scan filter. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Scanning + Priority: 1 + """ + expected_manufacturer_id = 1 + expected_manufacturer_data = [1] + expected_manufacturer_data_mask = [1, 2, 1, 3, 4, 5, 6] + input = {} + input['ScanFilterManufacturerDataId'] = expected_manufacturer_id + input['ScanFilterManufacturerData'] = expected_manufacturer_data + input[ + 'ScanFilterManufacturerDataMask'] = expected_manufacturer_data_mask + return self.validate_scan_settings_helper(input, self.ad_dut.droid) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='980e5ab6-5381-4471-8e5b-0b716665a9b8') + def test_scan_filter_set_manufacturer_max_id(self): + """Test scan filter manufacturer data id. + + Test scan filter manufacturer data max id. + + Steps: + 1. Validate the scan filter manufacturer id with all other settings + set to their respective defaults. + + Expected Result: + Expected Scan filter should match found scan filter. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Scanning + Priority: 2 + """ + expected_manufacturer_id = 2147483647 + expected_manufacturer_data = [1, 2, 1, 3, 4, 5, 6] + input = {} + input['ScanFilterManufacturerDataId'] = expected_manufacturer_id + input['ScanFilterManufacturerData'] = expected_manufacturer_data + return self.validate_scan_settings_helper(input, self.ad_dut.droid) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='cf0efe38-8621-4288-be26-742719da2f6c') + def test_scan_filter_set_manufacturer_data_empty(self): + """Test scan filter empty manufacturer data. + + Test scan filter manufacturer data as empty but valid manufacturer data. + + Steps: + 1. Validate the scan filter manufacturer id with all other settings + set to their respective defaults. + + Expected Result: + Expected Scan filter should match found scan filter. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Scanning + Priority: 2 + """ + expected_manufacturer_id = 1 + expected_manufacturer_data = [] + input = {} + input['ScanFilterManufacturerDataId'] = expected_manufacturer_id + input['ScanFilterManufacturerData'] = expected_manufacturer_data + return self.validate_scan_settings_helper(input, self.ad_dut.droid) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='7ea0e82e-e92a-469c-8432-8f21978508cb') + def test_scan_filter_set_manufacturer_data_mask_empty(self): + """Test scan filter empty manufacturer data mask. + + Test scan filter manufacturer mask empty. + + Steps: + 1. Validate the scan filter manufacturer id with all other settings + set to their respective defaults. + + Expected Result: + Expected Scan filter should match found scan filter. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Scanning + Priority: 1 + """ + expected_manufacturer_id = 1 + expected_manufacturer_data = [1, 2, 1, 3, 4, 5, 6] + expected_manufacturer_data_mask = [] + input = {} + input['ScanFilterManufacturerDataId'] = expected_manufacturer_id + input['ScanFilterManufacturerData'] = expected_manufacturer_data + input[ + 'ScanFilterManufacturerDataMask'] = expected_manufacturer_data_mask + return self.validate_scan_settings_helper(input, self.ad_dut.droid) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='88e4a9b8-afae-48cb-873a-fd6b4ef84116') + def test_scan_filter_set_invalid_manufacturer_min_id_minus_one(self): + """Test scan filter invalid manufacturer data. + + Test scan filter invalid manufacturer id min value - 1. + + Steps: + 1. Set the scan filters manufacturer id to -1. + 2. Build the scan filter. + + Expected Result: + Api to build the scan filter should fail. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Scanning + Priority: 2 + """ + expected_manufacturer_id = -1 + expected_manufacturer_data = [1, 2, 1, 3, 4, 5, 6] + input = {} + input['ScanFilterManufacturerDataId'] = expected_manufacturer_id + input['ScanFilterManufacturerData'] = expected_manufacturer_data + return not self.validate_scan_settings_helper(input, self.ad_dut.droid) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='2e8438dc-29cd-4f72-8747-4a161974d4d3') + def test_scan_filter_set_service_uuid(self): + """Test scan filter set valid service uuid. + + Test scan filter service uuid. + + Steps: + 1. Validate the scan filter service uuid with all other settings + set to their respective defaults. + + Expected Result: + Expected Scan filter should match found scan filter. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Scanning + Priority: 1 + """ + expected_service_uuid = "00000000-0000-1000-8000-00805F9B34FB" + expected_service_mask = "00000000-0000-1000-8000-00805F9B34FB" + input = {} + input['ScanFilterServiceUuid'] = expected_service_uuid + input['ScanFilterServiceMask'] = expected_service_mask + return self.validate_scan_settings_helper(input, self.ad_dut.droid) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='e07b9985-44b6-4dc4-b570-0833b5d2893c') + def test_scan_filter_service_uuid_p_service(self): + """Test scan filter service uuid. + + Test scan filter service uuid p service + + Steps: + 1. Validate the scan filter service uuid with all other settings + set to their respective defaults. + + Expected Result: + Expected Scan filter should match found scan filter. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Scanning + Priority: 2 + """ + expected_service_uuid = ble_uuids['p_service'] + expected_service_mask = "00000000-0000-1000-8000-00805F9B34FB" + self.log.debug("Step 1: Setup environment.") + + input = {} + input['ScanFilterServiceUuid'] = expected_service_uuid + input['ScanFilterServiceMask'] = expected_service_mask + return self.validate_scan_settings_helper(input, self.ad_dut.droid) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='0467af19-6e9a-4cfe-9e10-878b0c224df2') + def test_classic_ble_scan_with_service_uuids_p(self): + """Test classic LE scan with valid service uuid. + + Test classic ble scan with scan filter service uuid p service uuids. + + Steps: + 1. Validate the scan filter service uuid with all other settings + set to their respective defaults. + 2. Start classic ble scan. + 3. Stop classic ble scan + + Expected Result: + Expected Scan filter should match found scan filter. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Scanning + Priority: 1 + """ + + droid = self.ad_dut.droid + service_uuid_list = [ble_uuids['p_service']] + scan_callback = droid.bleGenLeScanCallback() + return self.verify_classic_ble_scan_with_service_uuids( + droid, scan_callback, service_uuid_list) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='516c295f-a2df-44f6-b2ad-54451af43ce8') + def test_classic_ble_scan_with_service_uuids_hr(self): + """Test classic LE scan with valid service uuid. + + Test classic ble scan with scan filter service uuid hr service + + Steps: + 1. Validate the scan filter service uuid with all other settings + set to their respective defaults. + 2. Start classic ble scan. + 3. Stop classic ble scan + + Expected Result: + Expected Scan filter should match found scan filter. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Scanning + Priority: 1 + """ + droid = self.ad_dut.droid + service_uuid_list = [ble_uuids['hr_service']] + scan_callback = droid.bleGenLeScanCallback() + return self.verify_classic_ble_scan_with_service_uuids( + droid, scan_callback, service_uuid_list) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='0458b5e0-bb0b-4d6e-ab79-e21169d3256b') + def test_classic_ble_scan_with_service_uuids_empty_uuid_list(self): + """Test classic LE scan with empty but valid uuid list. + + Test classic ble scan with service uuids as empty list. + + Steps: + 1. Validate the scan filter service uuid with all other settings + set to their respective defaults. + 2. Start classic ble scan. + 3. Stop classic ble scan + + Expected Result: + Expected Scan filter should match found scan filter. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Scanning + Priority: 1 + """ + droid = self.ad_dut.droid + service_uuid_list = [] + scan_callback = droid.bleGenLeScanCallback() + return self.verify_classic_ble_scan_with_service_uuids( + droid, scan_callback, service_uuid_list) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='c0d84a37-c86c-43c4-9dc7-d16959fdbc2a') + def test_classic_ble_scan_with_service_uuids_hr_and_p(self): + """Test classic LE scan with multiple service uuids. + + Test classic ble scan with service uuids a list of hr and p service. + + Steps: + 1. Validate the scan filter service uuid with all other settings + set to their respective defaults. + 2. Start classic ble scan. + 3. Stop classic ble scan + + Expected Result: + Expected Scan filter should match found scan filter. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Scanning + Priority: 1 + """ + droid = self.ad_dut.droid + service_uuid_list = [ble_uuids['hr_service'], ble_uuids['p_service']] + scan_callback = droid.bleGenLeScanCallback() + return self.verify_classic_ble_scan_with_service_uuids( + droid, scan_callback, service_uuid_list) + + def verify_classic_ble_scan_with_service_uuids(self, droid, scan_callback, + service_uuid_list): + + test_result = True + try: + test_result = droid.bleStartClassicBleScanWithServiceUuids( + scan_callback, service_uuid_list) + except BleScanResultsError as error: + self.log.error(str(error)) + return False + droid.bleStopClassicBleScan(scan_callback) + if not test_result: + self.log.error( + "Start classic ble scan with service uuids return false " + "boolean value.") + return False + return True diff --git a/acts_tests/tests/google/ble/api/GattApiTest.py b/acts_tests/tests/google/ble/api/GattApiTest.py index e69de29bb2..cc87979a73 100644 --- a/acts_tests/tests/google/ble/api/GattApiTest.py +++ b/acts_tests/tests/google/ble/api/GattApiTest.py @@ -0,0 +1,119 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2016 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +""" +Test script to exercise Gatt Apis. +""" + +from acts.controllers.sl4a_lib import rpc_client +from acts.test_decorators import test_tracker_info +from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest +from acts.test_utils.bt.bt_test_utils import setup_multiple_devices_for_bt_test + + +class GattApiTest(BluetoothBaseTest): + def setup_class(self): + super().setup_class() + self.ad = self.android_devices[0] + + return setup_multiple_devices_for_bt_test(self.android_devices) + + def setup_test(self): + for a in self.android_devices: + a.ed.clear_all_events() + return True + + def teardown_test(self): + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='fffe5c46-eb97-477b-ac3e-3f70700bb84e') + def test_open_gatt_server(self): + """Test a gatt server. + + Test opening a gatt server. + + Steps: + 1. Create a gatt server callback. + 2. Open the gatt server. + + Expected Result: + Api to open gatt server should not fail. + + Returns: + Pass if True + Fail if False + + TAGS: LE, GATT + Priority: 1 + """ + gatt_server_cb = self.ad.droid.gattServerCreateGattServerCallback() + self.ad.droid.gattServerOpenGattServer(gatt_server_cb) + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='12828c2c-b6ae-4670-a829-9867e75fb711') + def test_open_gatt_server_on_same_callback(self): + """Test repetitive opening of a gatt server. + + Test opening a gatt server on the same callback twice in a row. + + Steps: + 1. Create a gatt server callback. + 2. Open the gatt server. + 3. Open the gatt server on the same callback as step 2. + + Expected Result: + Api to open gatt server should not fail. + + Returns: + Pass if True + Fail if False + + TAGS: LE, GATT + Priority: 2 + """ + gatt_server_cb = self.ad.droid.gattServerCreateGattServerCallback() + self.ad.droid.gattServerOpenGattServer(gatt_server_cb) + self.ad.droid.gattServerOpenGattServer(gatt_server_cb) + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='63fc684d-6c1d-455e-afdb-1887123b4d2f') + def test_open_gatt_server_on_invalid_callback(self): + """Test gatt server an an invalid callback. + + Test opening a gatt server with an invalid callback. + + Steps: + 1. Open a gatt server with the gall callback set to -1. + + Expected Result: + Api should fail to open a gatt server. + + Returns: + Pass if True + Fail if False + + TAGS: LE, GATT + Priority: 2 + """ + invalid_callback_index = -1 + try: + self.ad.droid.gattServerOpenGattServer(invalid_callback_index) + except rpc_client.Sl4aApiError as e: + self.log.info("Failed successfully with exception: {}.".format(e)) + return True + return False diff --git a/acts_tests/tests/google/ble/beacon_tests/BeaconSwarmTest.py b/acts_tests/tests/google/ble/beacon_tests/BeaconSwarmTest.py index e69de29bb2..0df9a7b2be 100644 --- a/acts_tests/tests/google/ble/beacon_tests/BeaconSwarmTest.py +++ b/acts_tests/tests/google/ble/beacon_tests/BeaconSwarmTest.py @@ -0,0 +1,341 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2016 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +""" +This test script exercises different testcases with a lot of ble beacon traffic. + +This test script was designed with this setup in mind: +Shield box one: Android Device as DUT. 7x Sprout devices acting as 192 beacons +""" + +import threading + +from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest +from acts.test_utils.bt.BleEnum import AdvertiseSettingsAdvertiseMode +from acts.test_utils.bt.BleEnum import ScanSettingsScanMode +from acts.test_utils.bt.bt_test_utils import adv_succ +from acts.test_utils.bt.bt_test_utils import batch_scan_result +from acts.test_utils.bt.bt_test_utils import scan_result +from acts.test_utils.bt.bt_test_utils import generate_ble_advertise_objects +from acts.test_utils.bt.bt_test_utils import generate_ble_scan_objects +from acts.test_utils.bt.bt_test_utils import reset_bluetooth +from acts.test_utils.bt.bt_test_utils import setup_multiple_devices_for_bt_test +from acts.test_utils.bt.bt_test_utils import take_btsnoop_logs + + +class BeaconSwarmTest(BluetoothBaseTest): + default_timeout = 10 + beacon_swarm_count = 0 + advertising_device_name_list = [] + discovered_mac_address_list = [] + + def setup_test(self): + self.discovered_mac_address_list = [] + for a in self.android_devices: + a.ed.clear_all_events() + return True + + def teardown_test(self): + reset_bluetooth([self.android_devices[0]]) + return True + + def setup_class(self): + self.scn_ad = self.android_devices[0] + if not setup_multiple_devices_for_bt_test(self.android_devices): + return False + return self._start_special_advertisements() + + def cleanup_class(self): + return reset_bluetooth(self.android_devices) + + def on_fail(self, test_name, begin_time): + take_btsnoop_logs(self.android_devices, self, test_name) + reset_bluetooth([self.scn_ad]) + + def _start_advertisements_thread(self, ad, beacon_count, restart=False): + d, e = ad.droid, ad.ed + if restart: + try: + reset_bluetooth([ad]) + except Exception: + self.log.debug("Failed resetting Bluetooth, continuing...") + return + try: + for _ in range(beacon_count): + d.bleSetAdvertiseDataIncludeDeviceName(True) + d.bleSetAdvertiseSettingsAdvertiseMode( + AdvertiseSettingsAdvertiseMode.ADVERTISE_MODE_LOW_LATENCY. + value) + advertise_callback, advertise_data, advertise_settings = ( + generate_ble_advertise_objects(d)) + d.bleStartBleAdvertising(advertise_callback, advertise_data, + advertise_settings) + try: + e.pop_event( + adv_succ.format(advertise_callback), + self.default_timeout) + self.beacon_swarm_count += 1 + local_bt_name = d.bluetoothGetLocalName() + if local_bt_name not in self.advertising_device_name_list: + self.advertising_device_name_list.append( + d.bluetoothGetLocalName()) + except Exception as e: + self.log.info("Advertising failed due to " + str(e)) + self.log.info("Beacons active: {}".format( + self.beacon_swarm_count)) + except Exception: + self.log.debug( + "Something went wrong in starting advertisements, continuing.") + return + + def _start_special_advertisements(self): + self.log.info("Setting up advertisements.") + beacon_serials = [] + beacon_count = 0 + try: + beacon_serials = self.user_params['beacon_devices'] + beacon_count = self.user_params['beacon_count'] + except AttributeError: + self.log.info( + "No controllable devices connected to create beacons with." + " Continuing...") + threads = [] + for a in self.android_devices: + d, e = a.droid, a.ed + serial_no = a.serial + if serial_no not in beacon_serials: + continue + thread = threading.Thread(target=self._start_advertisements_thread, + args=(d, e, beacon_count)) + threads.append(thread) + thread.start() + for t in threads: + t.join() + if self.beacon_swarm_count < (beacon_count * len(beacon_serials)): + self.log.error("Not enough beacons advertising: {}".format( + self.beacon_swarm_count)) + return False + return True + + def _restart_special_advertisements_thread(self): + beacon_serials = [] + beacon_count = 0 + try: + beacon_serials = self.user_params['beacon_devices'] + beacon_count = self.user_params['beacon_count'] + except AttributeError: + self.log.info("No controllable devices connected to create beacons" + " with. Continuing...") + threads = [] + while True: + self.log.info("Restarting advertisements.") + for a in self.android_devices: + d, e = a.droid, a.ed + serial_no = a.serial + if serial_no not in beacon_serials: + continue + thread = threading.Thread( + target=self._start_advertisements_thread, + args=(d, e, beacon_count, True)) + threads.append(thread) + thread.start() + for t in threads: + t.join() + return True + + def test_swarm_1000_on_scan_result(self): + """Test LE scanning in a mass beacon deployment. + + Test finding 1000 LE scan results in a mass beacon deployment. + + Steps: + 1. Assume that mass beacon deployment is setup. + 2. Set LE scanning mode to low latency. + 3. Start LE scan. + 4. Pop scan results off the event dispatcher 1000 times. + 5. Stop LE scanning. + + Expected Result: + 1000 scan results should be found without any exceptions. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Scanning, Beacon + Priority: 1 + """ + self.scn_ad.droid.bleSetScanSettingsScanMode( + ScanSettingsScanMode.SCAN_MODE_LOW_LATENCY.value) + filter_list, scan_settings, scan_callback = generate_ble_scan_objects( + self.scn_ad.droid) + self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, + scan_callback) + for _ in range(1000000): + event_info = self.scn_ad.ed.pop_event( + scan_result.format(scan_callback), self.default_timeout) + mac_address = event_info['data']['Result']['deviceInfo']['address'] + if mac_address not in self.discovered_mac_address_list: + self.discovered_mac_address_list.append(mac_address) + self.log.info("Discovered {} different devices.".format(len( + self.discovered_mac_address_list))) + self.log.debug("Discovered {} different devices.".format(len( + self.discovered_mac_address_list))) + self.scn_ad.droid.bleStopBleScan(scan_callback) + return True + + def test_swarm_10000_on_batch_scan_result(self): + """Test LE batch scanning in a mass beacon deployment. + + Test finding 10000 LE batch scan results in a mass beacon deployment. + + Steps: + 1. Assume that mass beacon deployment is setup. + 2. Set LE scanning mode to low latency and report delay millis to 1 + second. + 3. Start LE scan. + 4. Pop batch scan results off the event dispatcher 10000 times. + 5. Stop LE scanning. + + Expected Result: + 1000 scan results should be found without any exceptions. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Scanning, Beacon + Priority: 1 + """ + self.scn_ad.droid.bleSetScanSettingsScanMode( + ScanSettingsScanMode.SCAN_MODE_LOW_LATENCY.value) + self.scn_ad.droid.bleSetScanSettingsReportDelayMillis(1000) + filter_list, scan_settings, scan_callback = generate_ble_scan_objects( + self.scn_ad.droid) + self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, + scan_callback) + for _ in range(10000): + event_info = self.scn_ad.ed.pop_event( + batch_scan_result.format(scan_callback), self.default_timeout) + for result in event_info['data']['Results']: + mac_address = result['deviceInfo']['address'] + if mac_address not in self.discovered_mac_address_list: + self.discovered_mac_address_list.append(mac_address) + self.log.info("Discovered {} different devices.".format(len( + self.discovered_mac_address_list))) + self.scn_ad.droid.bleStopBleScan(scan_callback) + return True + + def test_swarm_scan_result_filter_each_device_name(self): + """Test basic LE scan filtering in a mass beacon deployment. + + Test finding LE scan results in a mass beacon deployment. This + test specifically tests scan filtering of different device names and + that each device name is found. + + Steps: + 1. Assume that mass beacon deployment is setup with device names + advertising. + 2. Set LE scanning mode to low latency. + 3. Filter device name from one of the known advertising device names + 4. Start LE scan. + 5. Pop scan results matching the scan filter. + 6. Stop LE scanning. + 7. Repeat steps 2-6 until all advertising device names are found. + + Expected Result: + All advertising beacons are found by their device name. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Scanning, Beacon, Filtering + Priority: 1 + """ + for filter_name in self.advertising_device_name_list: + self.scn_ad.droid.bleSetScanSettingsScanMode( + ScanSettingsScanMode.SCAN_MODE_LOW_LATENCY.value) + filter_list, scan_settings, scan_callback = ( + generate_ble_scan_objects(self.scn_ad.droid)) + try: + self.scn_ad.droid.bleSetScanFilterDeviceName(filter_name) + self.scn_ad.droid.bleBuildScanFilter(filter_list) + self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, + scan_callback) + self.log.debug(self.scn_ad.ed.pop_event( + scan_result.format(scan_callback), self.default_timeout)) + except Exception: + self.log.info("Couldn't find advertiser name {}.".format( + filter_name)) + return False + self.scn_ad.droid.bleStopBleScan(scan_callback) + return True + + def test_swarm_rotate_addresses(self): + """Test basic LE scan filtering in a mass beacon deployment. + + Test finding LE scan results in a mass beacon deployment. This test + rotates the mac address of the advertising devices at a consistent + interval in order to make the scanning device think there are + thousands of devices nearby. + + Steps: + 1. Assume that mass beacon deployment is setup with device names + advertising. + 2. Set LE scanning mode to low latency on 28 scan instances. + 3. Start LE scan on each of the scan instances. + 5. Continuously Pop scan results matching the scan filter. + 6. Rotate mac address of each advertising device sequentially. + 7. 5-6 10,000 times. + 8. Stop LE scanning + + Expected Result: + The Bluetooth stack doesn't crash. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Scanning, Beacon + Priority: 1 + """ + scan_callback_list = [] + for _ in range(28): + self.scn_ad.droid.bleSetScanSettingsScanMode( + ScanSettingsScanMode.SCAN_MODE_LOW_LATENCY.value) + filter_list, scan_settings, scan_callback = generate_ble_scan_objects( + self.scn_ad.droid) + self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, + scan_callback) + scan_callback_list.append(scan_callback) + thread = threading.Thread( + target=self._restart_special_advertisements_thread, + args=()) + thread.start() + n = 0 + while n < 10000: + for cb in scan_callback_list: + event_info = self.scn_ad.ed.pop_event( + scan_result.format(cb), self.default_timeout) + mac_address = event_info['data']['Result']['deviceInfo'][ + 'address'] + if mac_address not in self.discovered_mac_address_list: + self.discovered_mac_address_list.append(mac_address) + self.log.info("Discovered {} different devices.".format(len( + self.discovered_mac_address_list))) + n += 1 + self.scn_ad.droid.bleStopBleScan(scan_callback) + return True diff --git a/acts_tests/tests/google/ble/bt5/AdvertisingSetTest.py b/acts_tests/tests/google/ble/bt5/AdvertisingSetTest.py index e69de29bb2..de4192f125 100644 --- a/acts_tests/tests/google/ble/bt5/AdvertisingSetTest.py +++ b/acts_tests/tests/google/ble/bt5/AdvertisingSetTest.py @@ -0,0 +1,197 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2017 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +""" +This test script exercises different Bluetooth 5 specific scan scenarios. +It is expected that the second AndroidDevice is able to advertise. + +This test script was designed with this setup in mind: +Shield box one: Android Device, Android Device +""" + +from queue import Empty + +from acts.asserts import assert_equal +from acts.asserts import assert_true +from acts.test_decorators import test_tracker_info +from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest +from acts.test_utils.bt.bt_constants import ble_scan_settings_modes +from acts.test_utils.bt.bt_constants import advertising_set_started +from acts.test_utils.bt.bt_constants import advertising_set_stopped +from acts.test_utils.bt.bt_constants import advertising_set_enabled +from acts.test_utils.bt.bt_constants import advertising_set_data_set +from acts.test_utils.bt.bt_constants import advertising_set_scan_response_set +from acts.test_utils.bt.bt_constants import advertising_set_parameters_update +from acts.test_utils.bt.bt_constants import advertising_set_periodic_parameters_updated +from acts.test_utils.bt.bt_constants import advertising_set_periodic_data_set +from acts.test_utils.bt.bt_constants import advertising_set_periodic_enable +from acts.test_utils.bt.bt_test_utils import reset_bluetooth +from acts import signals + + +class AdvertisingSetTest(BluetoothBaseTest): + default_timeout = 10 + report_delay = 2000 + scan_callbacks = [] + adv_callbacks = [] + active_scan_callback_list = [] + big_adv_data = { + "includeDeviceName": True, + "manufacturerData": [0x0123, "00112233445566778899AABBCCDDEE"], + "manufacturerData2": + [0x2540, [0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0xFF]], + "serviceData": [ + "b19d42dc-58ba-4b20-b6c1-6628e7d21de4", + "00112233445566778899AABBCCDDEE" + ], + "serviceData2": [ + "000042dc-58ba-4b20-b6c1-6628e7d21de4", + [0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0xFF] + ] + } + + def setup_class(self): + super(AdvertisingSetTest, self).setup_class() + self.adv_ad = self.android_devices[0] + + if not self.adv_ad.droid.bluetoothIsLeExtendedAdvertisingSupported(): + raise signals.TestAbortClass( + "Advertiser does not support LE Extended Advertising") + + def teardown_test(self): + self.active_scan_callback_list = [] + + def on_exception(self, test_name, begin_time): + reset_bluetooth(self.android_devices) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='58182f7e-443f-47fb-b718-1be3ac850287') + def test_reenabling(self): + """Test re-enabling an Advertising Set + + Test GATT notify characteristic value. + + Steps: + 1. Start an advertising set that only lasts for a few seconds + 2. Restart advertising set + 3. Repeat steps 1-2 + + Expected Result: + Verify that advertising set re-enables + + Returns: + Pass if True + Fail if False + + TAGS: LE, GATT, Characteristic + Priority: 1 + """ + adv_callback = self.adv_ad.droid.bleAdvSetGenCallback() + duration = 0 + max_ext_adv_events = 0 + self.adv_ad.droid.bleAdvSetStartAdvertisingSet({ + "connectable": False, + "legacyMode": False, + "primaryPhy": "PHY_LE_1M", + "secondaryPhy": "PHY_LE_1M", + "interval": 320 + }, self.big_adv_data, None, None, None, duration, max_ext_adv_events, + adv_callback) + + set_started_evt = self.adv_ad.ed.pop_event( + advertising_set_started.format(adv_callback), self.default_timeout) + set_id = set_started_evt['data']['setId'] + assert_equal(0, set_started_evt['data']['status']) + assert_equal(0, set_started_evt['data']['status']) + + self.log.info("Successfully started set " + str(set_id)) + + self.adv_ad.droid.bleAdvSetEnableAdvertising(set_id, False, duration, + max_ext_adv_events) + enable_evt = self.adv_ad.ed.pop_event( + advertising_set_enabled.format(adv_callback), self.default_timeout) + assert_equal(set_id, enable_evt['data']['setId']) + assert_equal(False, enable_evt['data']['enable']) + assert_equal(0, enable_evt['data']['status']) + self.log.info("Successfully disabled advertising set " + str(set_id)) + + self.log.info("Enabling advertising for 2 seconds... ") + duration_200 = 200 + self.adv_ad.droid.bleAdvSetEnableAdvertising( + set_id, True, duration_200, max_ext_adv_events) + enable_evt = self.adv_ad.ed.pop_event( + advertising_set_enabled.format(adv_callback), self.default_timeout) + assert_equal(set_id, enable_evt['data']['setId']) + assert_equal(True, enable_evt['data']['enable']) + assert_equal(0, enable_evt['data']['status']) + self.log.info("Enabled. Waiting for disable event ~2s ...") + + enable_evt = self.adv_ad.ed.pop_event( + advertising_set_enabled.format(adv_callback), self.default_timeout) + assert_equal(set_id, enable_evt['data']['setId']) + assert_equal(False, enable_evt['data']['enable']) + assert_equal(0, enable_evt['data']['status']) + self.log.info("Disable event received. Now trying to set data...") + + self.adv_ad.droid.bleAdvSetSetAdvertisingData( + set_id, + {"manufacturerData": [0x0123, "00112233445566778899AABBCCDDEE"]}) + data_set_evt = self.adv_ad.ed.pop_event( + advertising_set_data_set.format(adv_callback), + self.default_timeout) + assert_equal(set_id, data_set_evt['data']['setId']) + assert_equal(0, data_set_evt['data']['status']) + self.log.info("Data changed successfully.") + + max_len = self.adv_ad.droid.bluetoothGetLeMaximumAdvertisingDataLength( + ) + + self.log.info("Will try to set data to maximum possible length") + data_len = max_len - 4 + test_fill = '01' * data_len + self.adv_ad.droid.bleAdvSetSetAdvertisingData( + set_id, {"manufacturerData": [0x0123, test_fill]}) + data_set_evt = self.adv_ad.ed.pop_event( + advertising_set_data_set.format(adv_callback), + self.default_timeout) + assert_equal(set_id, data_set_evt['data']['setId']) + assert_equal(0, data_set_evt['data']['status']) + self.log.info("Data changed successfully.") + + if max_len < 1650: + self.log.info("Will try to set data to more than maximum length") + data_len = max_len - 4 + 1 + test_fill = '01' * data_len + self.adv_ad.droid.bleAdvSetSetAdvertisingData( + set_id, {"manufacturerData": [0x0123, test_fill]}) + data_set_evt = self.adv_ad.ed.pop_event( + advertising_set_data_set.format(adv_callback), + self.default_timeout) + assert_equal(set_id, data_set_evt['data']['setId']) + #TODO(jpawlowski): make nicer error fot this case + assert_true(data_set_evt['data']['status'] != 0, + "Setting data should fail because data too long.") + + self.log.info("Data change failed as expected.") + + self.adv_ad.droid.bleAdvSetStopAdvertisingSet(adv_callback) + try: + self.adv_ad.ed.pop_event( + advertising_set_stopped.format(adv_callback), + self.default_timeout) + except Empty: + self.log.error("Failed to find advertising set stopped event.") + return False + return True diff --git a/acts_tests/tests/google/ble/bt5/Bt5ScanTest.py b/acts_tests/tests/google/ble/bt5/Bt5ScanTest.py index e69de29bb2..e2c9c83cc3 100644 --- a/acts_tests/tests/google/ble/bt5/Bt5ScanTest.py +++ b/acts_tests/tests/google/ble/bt5/Bt5ScanTest.py @@ -0,0 +1,480 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2016 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +""" +This test script exercises different Bluetooth 5 specific scan scenarios. +It is expected that the second AndroidDevice is able to advertise. + +This test script was designed with this setup in mind: +Shield box one: Android Device, Android Device +""" + +from queue import Empty + +from acts import asserts +from acts.test_decorators import test_tracker_info +from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest +from acts.test_utils.bt.bt_constants import ble_scan_settings_phys +from acts.test_utils.bt.bt_constants import ble_scan_settings_modes +from acts.test_utils.bt.bt_constants import batch_scan_result +from acts.test_utils.bt.bt_test_utils import cleanup_scanners_and_advertisers +from acts.test_utils.bt.bt_test_utils import generate_ble_advertise_objects +from acts.test_utils.bt.bt_test_utils import generate_ble_scan_objects +from acts.test_utils.bt.bt_test_utils import reset_bluetooth +from acts.test_utils.bt.bt_constants import scan_result +from acts.test_utils.bt.bt_constants import advertising_set_on_own_address_read +from acts.test_utils.bt.bt_constants import advertising_set_started +from acts import signals + + +class Bt5ScanTest(BluetoothBaseTest): + default_timeout = 10 + report_delay = 2000 + scan_callbacks = [] + adv_callbacks = [] + active_scan_callback_list = [] + big_adv_data = { + "includeDeviceName": True, + "manufacturerData": [0x0123, "00112233445566778899AABBCCDDEE"], + "manufacturerData2": + [0x2540, [0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0xFF]], + "serviceData": [ + "b19d42dc-58ba-4b20-b6c1-6628e7d21de4", + "00112233445566778899AABBCCDDEE" + ], + "serviceData2": [ + "000042dc-58ba-4b20-b6c1-6628e7d21de4", + [0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0xFF] + ] + } + + def setup_class(self): + super(Bt5ScanTest, self).setup_class() + self.scn_ad = self.android_devices[0] + self.adv_ad = self.android_devices[1] + + if not self.scn_ad.droid.bluetoothIsLeExtendedAdvertisingSupported(): + raise signals.TestAbortClass( + "Scanner does not support LE Extended Advertising") + + if not self.adv_ad.droid.bluetoothIsLeExtendedAdvertisingSupported(): + raise signals.TestAbortClass( + "Advertiser does not support LE Extended Advertising") + + def teardown_test(self): + cleanup_scanners_and_advertisers( + self.scn_ad, self.active_scan_callback_list, self.adv_ad, []) + self.active_scan_callback_list = [] + + def on_exception(self, test_name, begin_time): + reset_bluetooth(self.android_devices) + + # This one does not relly test anything, but display very helpful + # information that might help with debugging. + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='787e0877-269f-4b9b-acb0-b98a8bb3770a') + def test_capabilities(self): + """Test capabilities + + Test BT 5.0 scan scapabilities + + Steps: + 1. Test various vapabilities. + + Expected Result: + Pass + + Returns: + Pass if True + Fail if False + + TAGS: BT5.0, Scanning + Priority: 2 + """ + d = self.scn_ad.droid + sup2M = d.bluetoothIsLe2MPhySupported() + supCoded = d.bluetoothIsLeCodedPhySupported() + supExt = d.bluetoothIsLeExtendedAdvertisingSupported() + supPeriodic = d.bluetoothIsLePeriodicAdvertisingSupported() + maxDataLen = d.bluetoothGetLeMaximumAdvertisingDataLength() + self.log.info("Scanner capabilities:") + self.log.info("LE 2M: " + str(sup2M) + ", LE Coded: " + str( + supCoded) + ", LE Extended Advertising: " + str( + supExt) + ", LE Periodic Advertising: " + str(supPeriodic) + + ", maximum advertising data length: " + str(maxDataLen)) + d = self.adv_ad.droid + sup2M = d.bluetoothIsLe2MPhySupported() + supCoded = d.bluetoothIsLeCodedPhySupported() + supExt = d.bluetoothIsLeExtendedAdvertisingSupported() + supPeriodic = d.bluetoothIsLePeriodicAdvertisingSupported() + maxDataLen = d.bluetoothGetLeMaximumAdvertisingDataLength() + self.log.info("Advertiser capabilities:") + self.log.info("LE 2M: " + str(sup2M) + ", LE Coded: " + str( + supCoded) + ", LE Extended Advertising: " + str( + supExt) + ", LE Periodic Advertising: " + str(supPeriodic) + + ", maximum advertising data length: " + str(maxDataLen)) + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='62d36679-bb91-465e-897f-2635433aac2f') + def test_1m_1m_extended_scan(self): + """Test scan on LE 1M PHY using LE 1M PHY as secondary. + + Tests test verify that device is able to receive extended advertising + on 1M PHY when secondary is 1M PHY. + + Steps: + 1. Start advertising set on dut1 + 2. Start scanning on dut0, scan filter set to advertiser's device name + 3. Try to find an event, expect found + 4. Stop advertising + + Expected Result: + Scan finds a advertisement. + + Returns: + Pass if True + Fail if False + + TAGS: LE Advertising Extension, BT5, LE, Advertising, Scanning + Priority: 1 + """ + adv_callback = self.adv_ad.droid.bleAdvSetGenCallback() + self.adv_ad.droid.bleAdvSetStartAdvertisingSet({ + "connectable": True, + "legacyMode": False, + "primaryPhy": "PHY_LE_1M", + "secondaryPhy": "PHY_LE_1M", + "interval": 320 + }, self.big_adv_data, None, None, None, 0, 0, adv_callback) + + self.scn_ad.droid.bleSetScanSettingsLegacy(False) + self.scn_ad.droid.bleSetScanSettingsPhy(ble_scan_settings_phys['1m']) + + filter_list, scan_settings, scan_callback = generate_ble_scan_objects( + self.scn_ad.droid) + + adv_device_name = self.adv_ad.droid.bluetoothGetLocalName() + self.scn_ad.droid.bleSetScanFilterDeviceName(adv_device_name) + self.scn_ad.droid.bleBuildScanFilter(filter_list) + self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, + scan_callback) + self.active_scan_callback_list.append(scan_callback) + + try: + self.scn_ad.ed.pop_event( + scan_result.format(scan_callback), self.default_timeout) + except Empty: + self.log.error("Scan result not found") + self.adv_ad.droid.bleAdvSetStopAdvertisingSet(adv_callback) + return False + + self.adv_ad.droid.bleAdvSetStopAdvertisingSet(adv_callback) + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='3e3c9757-f7b6-4d1d-a2d6-8e2330d1a18e') + def test_1m_2m_extended_scan(self): + """Test scan on LE 1M PHY using LE 2M PHY as secondary. + + Tests test verify that device is able to receive extended advertising + on 1M PHY when secondary is 2M PHY. + + Steps: + 1. Start advertising set on dut1 + 2. Start scanning on dut0, scan filter set to advertiser's device name + 3. Try to find an event, expect found + 4. Stop advertising + + Expected Result: + Scan finds a advertisement. + + Returns: + Pass if True + Fail if False + + TAGS: LE Advertising Extension, BT5, LE, Advertising, Scanning + Priority: 1 + """ + adv_callback = self.adv_ad.droid.bleAdvSetGenCallback() + self.adv_ad.droid.bleAdvSetStartAdvertisingSet({ + "connectable": True, + "legacyMode": False, + "primaryPhy": "PHY_LE_1M", + "secondaryPhy": "PHY_LE_2M", + "interval": 320 + }, self.big_adv_data, None, None, None, 0, 0, adv_callback) + + self.scn_ad.droid.bleSetScanSettingsLegacy(False) + self.scn_ad.droid.bleSetScanSettingsPhy(ble_scan_settings_phys['1m']) + + filter_list, scan_settings, scan_callback = generate_ble_scan_objects( + self.scn_ad.droid) + + adv_device_name = self.adv_ad.droid.bluetoothGetLocalName() + self.scn_ad.droid.bleSetScanFilterDeviceName(adv_device_name) + self.scn_ad.droid.bleBuildScanFilter(filter_list) + self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, + scan_callback) + self.active_scan_callback_list.append(scan_callback) + + try: + self.scn_ad.ed.pop_event( + scan_result.format(scan_callback), self.default_timeout) + except Empty: + self.log.error("Scan result not found") + self.adv_ad.droid.bleAdvSetStopAdvertisingSet(adv_callback) + return False + + self.adv_ad.droid.bleAdvSetStopAdvertisingSet(adv_callback) + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='236e9e5b-3853-4762-81ae-e88db03d74f3') + def test_legacy_scan_result_raw_length(self): + """Test that raw scan record data in legacy scan is 62 bytes long. + + This is required for compability with older apps that make this + assumption. + + Steps: + 1. Start legacy advertising set on dut1 + 2. Start scanning on dut0, scan filter set to advertiser's device name + 3. Try to find an event, expect found, verify scan recurd data length + 4. Stop advertising + + Expected Result: + Scan finds a legacy advertisement of proper size + + Returns: + Pass if True + Fail if False + + TAGS: LE Advertising Extension, BT5, LE, Advertising, Scanning + Priority: 1 + """ + adv_callback = self.adv_ad.droid.bleAdvSetGenCallback() + self.adv_ad.droid.bleAdvSetStartAdvertisingSet({ + "connectable": True, + "scannable": True, + "legacyMode": True, + "interval": 320 + }, {"includeDeviceName": True}, None, None, None, 0, 0, adv_callback) + + self.scn_ad.droid.bleSetScanSettingsLegacy(True) + self.scn_ad.droid.bleSetScanSettingsPhy(ble_scan_settings_phys['1m']) + + filter_list, scan_settings, scan_callback = generate_ble_scan_objects( + self.scn_ad.droid) + + adv_device_name = self.adv_ad.droid.bluetoothGetLocalName() + self.scn_ad.droid.bleSetScanFilterDeviceName(adv_device_name) + self.scn_ad.droid.bleBuildScanFilter(filter_list) + self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, + scan_callback) + self.active_scan_callback_list.append(scan_callback) + + try: + evt = self.scn_ad.ed.pop_event( + scan_result.format(scan_callback), self.default_timeout) + rawData = evt['data']['Result']['scanRecord'] + asserts.assert_true(62 == len(rawData.split(",")), + "Raw data should be 62 bytes long.") + except Empty: + self.log.error("Scan result not found") + self.adv_ad.droid.bleAdvSetStopAdvertisingSet(adv_callback) + return False + + self.adv_ad.droid.bleAdvSetStopAdvertisingSet(adv_callback) + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='04632d8d-4303-476f-8f83-52c16be3713a') + def test_duration(self): + """Test scanning duration + + Tests BT5.0 scanning duration + + Steps: + 1. Start advertising set + 2. Start 5.0 scan + 3. Scan for advertisement event + + Expected Result: + Scan finds a legacy advertisement of proper size + + Returns: + Pass if True + Fail if False + + TAGS: BT5.0, LE, Advertising, Scanning + Priority: 1 + """ + adv_callback = self.adv_ad.droid.bleAdvSetGenCallback() + self.adv_ad.droid.bleAdvSetStartAdvertisingSet({ + "connectable": True, + "legacyMode": False, + "primaryPhy": "PHY_LE_1M", + "secondaryPhy": "PHY_LE_2M", + "interval": 320 + }, self.big_adv_data, None, None, None, 0, 0, adv_callback) + + self.scn_ad.droid.bleSetScanSettingsLegacy(False) + self.scn_ad.droid.bleSetScanSettingsPhy(ble_scan_settings_phys['1m']) + + filter_list, scan_settings, scan_callback = generate_ble_scan_objects( + self.scn_ad.droid) + + adv_device_name = self.adv_ad.droid.bluetoothGetLocalName() + self.scn_ad.droid.bleSetScanFilterDeviceName(adv_device_name) + self.scn_ad.droid.bleBuildScanFilter(filter_list) + self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, + scan_callback) + self.active_scan_callback_list.append(scan_callback) + + try: + self.scn_ad.ed.pop_event( + scan_result.format(scan_callback), self.default_timeout) + except Empty: + self.log.error("Scan result not found") + self.adv_ad.droid.bleAdvSetStopAdvertisingSet(adv_callback) + return False + + self.adv_ad.droid.bleAdvSetStopAdvertisingSet(adv_callback) + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='a3704083-0f5c-4a46-b979-32ebc594d6ee') + def test_anonymous_advertising(self): + """Test anonymous advertising. + + Tests test verify that device is able to receive anonymous advertising + on 1M PHY when secondary is 2M PHY. + + Steps: + 1. Start anonymous advertising set on dut1 + 2. Start scanning on dut0, scan filter set to advertiser's device name + 3. Try to find an event, expect found + 4. Stop advertising + + Expected Result: + Scan finds a advertisement. + + Returns: + Pass if True + Fail if False + + TAGS: LE Advertising Extension, BT5, LE, Advertising, Scanning + Priority: 1 + """ + adv_callback = self.adv_ad.droid.bleAdvSetGenCallback() + self.adv_ad.droid.bleAdvSetStartAdvertisingSet({ + "connectable": False, + "anonymous": True, + "legacyMode": False, + "primaryPhy": "PHY_LE_1M", + "secondaryPhy": "PHY_LE_2M", + "interval": 320 + }, self.big_adv_data, None, None, None, 0, 0, adv_callback) + + self.scn_ad.droid.bleSetScanSettingsLegacy(False) + self.scn_ad.droid.bleSetScanSettingsPhy(ble_scan_settings_phys['1m']) + + filter_list, scan_settings, scan_callback = generate_ble_scan_objects( + self.scn_ad.droid) + + adv_device_name = self.adv_ad.droid.bluetoothGetLocalName() + self.scn_ad.droid.bleSetScanFilterDeviceName(adv_device_name) + self.scn_ad.droid.bleBuildScanFilter(filter_list) + self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, + scan_callback) + self.active_scan_callback_list.append(scan_callback) + + try: + evt = self.scn_ad.ed.pop_event( + scan_result.format(scan_callback), self.default_timeout) + address = evt['data']['Result']['deviceInfo']['address'] + asserts.assert_true( + '00:00:00:00:00:00' == address, + "Anonymous address should be 00:00:00:00:00:00, but was " + + str(address)) + except Empty: + self.log.error("Scan result not found") + self.adv_ad.droid.bleAdvSetStopAdvertisingSet(adv_callback) + return False + + self.adv_ad.droid.bleAdvSetStopAdvertisingSet(adv_callback) + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='e3277355-eebf-4760-9502-e49a9289f6ab') + def test_get_own_address(self): + """Test obtaining own address for PTS. + + Test obtaining own address. + + Steps: + 1. Start advertising set dut1 + 2. Grab address + 3. Stop advertising + + Expected Result: + Callback with address is received. + + Returns: + Pass if True + Fail if False + + TAGS: LE Advertising Extension, BT5, LE, Advertising + Priority: 1 + """ + adv_callback = self.adv_ad.droid.bleAdvSetGenCallback() + self.adv_ad.droid.bleAdvSetStartAdvertisingSet({ + "connectable": False, + "anonymous": True, + "legacyMode": False, + "primaryPhy": "PHY_LE_1M", + "secondaryPhy": "PHY_LE_2M", + "interval": 320 + }, self.big_adv_data, None, None, None, 0, 0, adv_callback) + + set_id = -1 + + try: + evt = self.adv_ad.ed.pop_event( + advertising_set_started.format(adv_callback), + self.default_timeout) + self.log.info("data: " + str(evt['data'])) + set_id = evt['data']['setId'] + except Empty: + self.log.error("did not receive the set started event!") + self.adv_ad.droid.bleAdvSetStopAdvertisingSet(adv_callback) + return False + + self.adv_ad.droid.bleAdvSetGetOwnAddress(set_id) + + try: + evt = self.adv_ad.ed.pop_event( + advertising_set_on_own_address_read.format(set_id), + self.default_timeout) + address = evt['data']['address'] + self.log.info("Advertiser address is: " + str(address)) + except Empty: + self.log.error("onOwnAddressRead not received.") + self.adv_ad.droid.bleAdvSetStopAdvertisingSet(adv_callback) + return False + + self.adv_ad.droid.bleAdvSetStopAdvertisingSet(adv_callback) + return True diff --git a/acts_tests/tests/google/ble/bt5/PhyTest.py b/acts_tests/tests/google/ble/bt5/PhyTest.py index e69de29bb2..0b1ecfade8 100644 --- a/acts_tests/tests/google/ble/bt5/PhyTest.py +++ b/acts_tests/tests/google/ble/bt5/PhyTest.py @@ -0,0 +1,248 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2017 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +""" +This test script exercises set PHY and read PHY procedures. +""" + +from queue import Empty + +from acts.test_decorators import test_tracker_info +from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest +from acts.test_utils.bt.GattConnectedBaseTest import GattConnectedBaseTest +from acts.test_utils.bt.bt_constants import gatt_connection_priority +from acts.test_utils.bt.bt_constants import gatt_event +from acts.test_utils.bt.bt_constants import gatt_phy +from acts import signals + +CONNECTION_PRIORITY_HIGH = gatt_connection_priority['high'] +PHY_LE_1M = gatt_phy['1m'] +PHY_LE_2M = gatt_phy['2m'] + + +def lfmt(txPhy, rxPhy): + return '(' + list(gatt_phy.keys())[list(gatt_phy.values()).index( + txPhy)] + ', ' + list(gatt_phy.keys())[list(gatt_phy.values()).index( + rxPhy)] + ')' + + +class PhyTest(GattConnectedBaseTest): + def setup_class(self): + super(PhyTest, self).setup_class() + if not self.cen_ad.droid.bluetoothIsLe2MPhySupported(): + raise signals.TestAbortClass( + "Central device does not support LE 2M PHY") + + if not self.per_ad.droid.bluetoothIsLe2MPhySupported(): + raise signals.TestAbortClass( + "Peripheral device does not support LE 2M PHY") + + # Some controllers auto-update PHY to 2M, and both client and server + # might receive PHY Update event right after connection, if the + # connection was established over 1M PHY. We will ignore this event, but + # must pop it from queue. + def pop_initial_phy_update(self): + try: + maybe_event = gatt_event['phy_update']['evt'].format( + self.gatt_callback) + self.cen_ad.ed.pop_event(maybe_event, 0) + except Empty: + pass + + try: + maybe_event = gatt_event['serv_phy_update']['evt'].format( + self.gatt_server_callback) + self.per_ad.ed.pop_event(maybe_event, 0) + except Empty: + pass + + # this helper method checks wether both client and server received PHY + # update event with proper txPhy and rxPhy + def ensure_both_updated_phy(self, clientTxPhy, clientRxPhy): + event = self._client_wait(gatt_event['phy_update']) + txPhy = event['data']['TxPhy'] + rxPhy = event['data']['RxPhy'] + self.log.info("\tClient PHY updated: " + lfmt(txPhy, rxPhy)) + self.assertEqual(0, event['data']['Status'], "Status should be 0") + self.assertEqual(clientTxPhy, event['data']['TxPhy']) + self.assertEqual(clientRxPhy, event['data']['RxPhy']) + + bt_device_id = 0 + event = self._server_wait(gatt_event['serv_phy_update']) + txPhy = event['data']['TxPhy'] + rxPhy = event['data']['RxPhy'] + self.log.info("\tServer PHY updated: " + lfmt(txPhy, rxPhy)) + self.assertEqual(0, event['data']['Status'], "Status should be 0") + self.assertEqual(clientRxPhy, event['data']['TxPhy']) + self.assertEqual(clientTxPhy, event['data']['RxPhy']) + + # read the client phy, return (txPhy, rxPhy) + def read_client_phy(self): + self.cen_ad.droid.gattClientReadPhy(self.bluetooth_gatt) + event = self._client_wait(gatt_event['phy_read']) + self.assertEqual(0, event['data']['Status'], "Status should be 0") + return (event['data']['TxPhy'], event['data']['RxPhy']) + + # read the server phy, return (txPhy, rxPhy) + def read_server_phy(self): + bt_device_id = 0 + self.per_ad.droid.gattServerReadPhy(self.gatt_server, bt_device_id) + event = self._server_wait(gatt_event['serv_phy_read']) + self.assertEqual(0, event['data']['Status'], "Status should be 0") + return (event['data']['TxPhy'], event['data']['RxPhy']) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='edb95ae1-97e5-4337-9a60-1e113aa43a4d') + def test_phy_read(self): + """Test LE read PHY. + + Test LE read PHY. + + Steps: + 1. Central, Peripheral : read PHY, make sure values are same. + 2. Central: update PHY. + 3. Ensure both Central and Peripheral received PHY update event. + 4. Central, Peripheral: read PHY, make sure values are same. + + Expected Result: + Verify that read PHY works properly. + + Returns: + Pass if True + Fail if False + + TAGS: LE, PHY + Priority: 0 + """ + self.cen_ad.droid.gattClientRequestConnectionPriority( + self.bluetooth_gatt, CONNECTION_PRIORITY_HIGH) + self.pop_initial_phy_update() + + # read phy from client and server, make sure they're same + cTxPhy, cRxPhy = self.read_client_phy() + sTxPhy, sRxPhy = self.read_server_phy() + self.assertEqual(cTxPhy, sTxPhy) + self.assertEqual(cRxPhy, sRxPhy) + + self.log.info("Initial connection PHY was: " + lfmt(cTxPhy, cRxPhy)) + + nextTxPhy = (cTxPhy == PHY_LE_1M) and PHY_LE_2M or PHY_LE_1M + nextRxPhy = (cRxPhy == PHY_LE_1M) and PHY_LE_2M or PHY_LE_1M + + # try to update PHY from Client + self.log.info("Will try to set PHY to: " + lfmt(nextTxPhy, nextRxPhy)) + self.cen_ad.droid.gattClientSetPreferredPhy(self.bluetooth_gatt, + nextTxPhy, nextRxPhy, 0) + self.ensure_both_updated_phy(nextTxPhy, nextRxPhy) + + # read phy on client and server, make sure values are same and equal + # the newly set value + cTxPhy, cRxPhy = self.read_client_phy() + sTxPhy, sRxPhy = self.read_server_phy() + self.assertEqual(cTxPhy, sTxPhy) + self.assertEqual(cRxPhy, sRxPhy) + + self.assertEqual(nextTxPhy, cTxPhy) + self.assertEqual(nextRxPhy, cRxPhy) + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='6b66af0a-35eb-42af-acd5-9634684f275d') + def test_phy_change_20_times(self): + """Test PHY update. + + Test LE PHY update. + + Steps: + 1. Central: read PHY. + 2. Central: update PHY to 1M, 2M, 1M... 20 times, each time ensuring + both client and server received PHY update event. + + Expected Result: + Verify that read update PHY worked properly each time. + + Returns: + Pass if True + Fail if False + + TAGS: LE, PHY + Priority: 0 + """ + self.cen_ad.droid.gattClientRequestConnectionPriority( + self.bluetooth_gatt, CONNECTION_PRIORITY_HIGH) + self.pop_initial_phy_update() + + txPhyB, rxPhyB = self.read_client_phy() + txPhyA = (txPhyB == PHY_LE_1M) and PHY_LE_2M or PHY_LE_1M + rxPhyA = (rxPhyB == PHY_LE_1M) and PHY_LE_2M or PHY_LE_1M + + self.log.info("Initial connection PHY was: " + lfmt(txPhyB, rxPhyB)) + + for i in range(20): + #swap values between iterations + txPhy = (i & 1) and txPhyB or txPhyA + rxPhy = (i & 1) and rxPhyB or rxPhyA + + self.log.info("Will try to set PHY to: " + lfmt(txPhy, rxPhy)) + self.cen_ad.droid.gattClientSetPreferredPhy(self.bluetooth_gatt, + txPhy, rxPhy, 0) + self.ensure_both_updated_phy(txPhy, rxPhy) + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='13f28de4-07f4-458c-a3e5-3ba95318616f') + def test_phy_change_asym(self): + """Test PHY update with asymetric rx and tx PHY. + + Test PHY update with asymetric rx and tx PHY. + + Steps: + 1. Central: read PHY. + 2. Central: update PHY to tx: 1M, rx: 2M, ensure both devices received + the asymetric update. + 3. Central: update PHY to tx: 2M, rx: 1M, ensure both devices received + the asymetric update. + + Expected Result: + Verify that read update PHY worked properly each time. + + Returns: + Pass if True + Fail if False + + TAGS: LE, PHY + Priority: 0 + """ + self.cen_ad.droid.gattClientRequestConnectionPriority( + self.bluetooth_gatt, CONNECTION_PRIORITY_HIGH) + self.pop_initial_phy_update() + + txPhy, rxPhy = self.read_client_phy() + + self.log.info("Initial connection PHY was: " + lfmt(txPhy, rxPhy)) + self.log.info("will try to set PHY to: PHY_LE_1M, PHY_LE_2M") + + #try to update PHY to tx 1M, rx 2M from Client + self.cen_ad.droid.gattClientSetPreferredPhy(self.bluetooth_gatt, + PHY_LE_1M, PHY_LE_2M, 0) + self.ensure_both_updated_phy(PHY_LE_1M, PHY_LE_2M) + + #try to update PHY to TX 2M, RX 1M from Client + self.log.info("will try to set PHY to: PHY_LE_2M, PHY_LE_1M") + self.cen_ad.droid.gattClientSetPreferredPhy(self.bluetooth_gatt, + PHY_LE_2M, PHY_LE_1M, 0) + self.ensure_both_updated_phy(PHY_LE_2M, PHY_LE_1M) + + return True diff --git a/acts_tests/tests/google/ble/concurrency/ConcurrentBleAdvertisementDiscoveryTest.py b/acts_tests/tests/google/ble/concurrency/ConcurrentBleAdvertisementDiscoveryTest.py index 2af4c05bcc..c38fc935de 100644 --- a/acts_tests/tests/google/ble/concurrency/ConcurrentBleAdvertisementDiscoveryTest.py +++ b/acts_tests/tests/google/ble/concurrency/ConcurrentBleAdvertisementDiscoveryTest.py @@ -43,22 +43,21 @@ from acts.test_utils.bt.bt_test_utils import scan_and_verify_n_advertisements class ConcurrentBleAdvertisementDiscoveryTest(BluetoothBaseTest): default_timeout = 10 + droid_list = [] max_advertisements = -1 advertise_callback_list = [] def setup_class(self): super().setup_class() - self.droid_list = get_advanced_droid_list(self.android_devices) self.scn_ad = self.android_devices[0] self.adv_ad = self.android_devices[1] + self.droid_list = get_advanced_droid_list(self.android_devices) self.max_advertisements = self.droid_list[1]['max_advertisements'] def setup_test(self): - return reset_bluetooth(self.android_devices) - - def setup_test(self): - super(BluetoothBaseTest, self).setup_test() + super().setup_test() self.log.info("Setting up advertisements") + reset_bluetooth(self.android_devices) try: self.advertise_callback_list = setup_n_advertisements( self.adv_ad, self.max_advertisements) diff --git a/acts_tests/tests/google/ble/concurrency/ConcurrentBleAdvertisingTest.py b/acts_tests/tests/google/ble/concurrency/ConcurrentBleAdvertisingTest.py index 94ee0f771e..09c6cd3a5e 100644 --- a/acts_tests/tests/google/ble/concurrency/ConcurrentBleAdvertisingTest.py +++ b/acts_tests/tests/google/ble/concurrency/ConcurrentBleAdvertisingTest.py @@ -43,17 +43,18 @@ from acts.test_utils.bt.bt_test_utils import teardown_n_advertisements class ConcurrentBleAdvertisingTest(BluetoothBaseTest): default_timeout = 10 + droid_list = [] max_advertisements = -1 def setup_class(self): super().setup_class() - self.droid_list = get_advanced_droid_list(self.android_devices) self.scn_ad = self.android_devices[0] self.adv_ad = self.android_devices[1] + self.droid_list = get_advanced_droid_list(self.android_devices) self.max_advertisements = self.droid_list[1]['max_advertisements'] def setup_test(self): - super(BluetoothBaseTest, self).setup_test() + super().setup_test() return reset_bluetooth(self.android_devices) def _verify_n_advertisements(self, num_advertisements): diff --git a/acts_tests/tests/google/ble/concurrency/ConcurrentBleScanningTest.py b/acts_tests/tests/google/ble/concurrency/ConcurrentBleScanningTest.py index e69de29bb2..512aed8f16 100644 --- a/acts_tests/tests/google/ble/concurrency/ConcurrentBleScanningTest.py +++ b/acts_tests/tests/google/ble/concurrency/ConcurrentBleScanningTest.py @@ -0,0 +1,352 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2016 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +""" +Test script to exercises Ble Scans can run in concurrency. +This test was designed to be run in a shield box. +""" + +import concurrent +import time + +from queue import Empty +from acts.test_decorators import test_tracker_info +from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest +from acts.test_utils.bt.bt_constants import ble_advertise_settings_modes +from acts.test_utils.bt.bt_constants import ble_scan_settings_callback_types +from acts.test_utils.bt.bt_constants import ble_scan_settings_modes +from acts.test_utils.bt.bt_constants import adv_succ +from acts.test_utils.bt.bt_test_utils import generate_ble_advertise_objects +from acts.test_utils.bt.bt_test_utils import reset_bluetooth +from acts.test_utils.bt.bt_constants import scan_failed +from acts.test_utils.bt.bt_constants import scan_result +from acts.test_utils.bt.bt_test_utils import take_btsnoop_logs + + +class ConcurrentBleScanningTest(BluetoothBaseTest): + default_timeout = 20 + max_concurrent_scans = 27 + + def setup_class(self): + super().setup_class() + self.scn_ad = self.android_devices[0] + self.adv_ad = self.android_devices[1] + + def on_fail(self, test_name, begin_time): + self.log.debug("Test {} failed. Gathering bugreport and btsnoop logs." + .format(test_name)) + take_btsnoop_logs(self.android_devices, self, test_name) + reset_bluetooth(self.android_devices) + + def setup_test(self): + return reset_bluetooth(self.android_devices) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='e7f68b9b-fb3f-48e9-a272-e41c2a32b4bd') + def test_max_concurrent_ble_scans(self): + """Test max LE scans. + + Test that a single device can have max scans concurrently scanning. + + Steps: + 1. Initialize scanner + 2. Initialize advertiser + 3. Start advertising on the device from step 2 + 4. Create max ble scan callbacks + 5. Start ble scan on each callback + 6. Verify that each callback triggers + 7. Stop all scans and advertisements + + Expected Result: + All scanning instances should start without errors and the advertisement + should be found on each scan instance. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Scanning, Concurrency + Priority: 0 + """ + test_result = True + self.adv_ad.droid.bleSetAdvertiseDataIncludeDeviceName(True) + self.scn_ad.droid.bleSetScanSettingsCallbackType( + ble_scan_settings_callback_types['all_matches']) + self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ + 'low_latency']) + self.adv_ad.droid.bleSetAdvertiseSettingsAdvertiseMode( + ble_advertise_settings_modes['low_latency']) + advertise_callback, advertise_data, advertise_settings = ( + generate_ble_advertise_objects(self.adv_ad.droid)) + self.adv_ad.droid.bleSetAdvertiseSettingsIsConnectable(False) + self.adv_ad.droid.bleStartBleAdvertising( + advertise_callback, advertise_data, advertise_settings) + try: + self.adv_ad.ed.pop_event( + adv_succ.format(advertise_callback), self.default_timeout) + except Empty as error: + self.log.exception("Test failed with Empty error: {}".format( + error)) + test_result = False + except concurrent.futures._base.TimeoutError as error: + self.log.exception( + "Test failed callback onSuccess never occurred: " + "{}".format(error)) + test_result = False + if not test_result: + return test_result + filter_list = self.scn_ad.droid.bleGenFilterList() + self.scn_ad.droid.bleSetScanFilterDeviceName( + self.adv_ad.droid.bluetoothGetLocalName()) + self.scn_ad.droid.bleBuildScanFilter(filter_list) + scan_settings = self.scn_ad.droid.bleBuildScanSetting() + scan_callback_list = [] + for i in range(self.max_concurrent_scans): + self.log.debug("Concurrent Ble Scan iteration {}".format(i + 1)) + scan_callback = self.scn_ad.droid.bleGenScanCallback() + scan_callback_list.append(scan_callback) + self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, + scan_callback) + try: + self.scn_ad.ed.pop_event( + scan_result.format(scan_callback), self.default_timeout) + self.log.info("Found scan event successfully. Iteration {} " + "successful.".format(i)) + except Exception: + self.log.info("Failed to find a scan result for callback {}" + .format(scan_callback)) + test_result = False + break + for callback in scan_callback_list: + self.scn_ad.droid.bleStopBleScan(callback) + self.adv_ad.droid.bleStopBleAdvertising(advertise_callback) + if not test_result: + return test_result + self.log.info("Waiting for scan callbacks to stop completely.") + # Wait for all scan callbacks to stop. There is no confirmation + # otherwise. + time.sleep(10) + return test_result + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='58b0c45e-1cbc-420a-9e89-901518ffe3d1') + def test_max_concurrent_ble_scans_then_discover_advertisement(self): + """Test max LE scans variant. + + Test that a single device can have max scans concurrently scanning. + + Steps: + 1. Initialize scanner + 2. Initialize advertiser + 3. Create max ble scan callbacks + 4. Start ble scan on each callback + 5. Start advertising on the device from step 2 + 6. Verify that each callback triggers + 7. Stop all scans and advertisements + + Expected Result: + All scanning instances should start without errors and the advertisement + should be found on each scan instance. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Scanning, Concurrency + Priority: 1 + """ + self.adv_ad.droid.bleSetAdvertiseDataIncludeDeviceName(True) + self.scn_ad.droid.bleSetScanSettingsCallbackType( + ble_scan_settings_callback_types['all_matches']) + self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ + 'low_latency']) + self.adv_ad.droid.bleSetAdvertiseSettingsAdvertiseMode( + ble_advertise_settings_modes['low_latency']) + advertise_callback, advertise_data, advertise_settings = ( + generate_ble_advertise_objects(self.adv_ad.droid)) + filter_list = self.scn_ad.droid.bleGenFilterList() + self.scn_ad.droid.bleSetScanFilterDeviceName( + self.adv_ad.droid.bluetoothGetLocalName()) + self.scn_ad.droid.bleBuildScanFilter(filter_list) + scan_settings = self.scn_ad.droid.bleBuildScanSetting() + scan_callback_list = [] + for i in range(self.max_concurrent_scans): + self.log.debug("Concurrent Ble Scan iteration {}".format(i + 1)) + scan_callback = self.scn_ad.droid.bleGenScanCallback() + scan_callback_list.append(scan_callback) + self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, + scan_callback) + self.adv_ad.droid.bleStartBleAdvertising( + advertise_callback, advertise_data, advertise_settings) + try: + self.adv_ad.ed.pop_event( + adv_succ.format(advertise_callback), self.default_timeout) + except Empty as error: + self.log.exception("Test failed with Empty error: {}".format( + error)) + return False + except concurrent.futures._base.TimeoutError as error: + self.log.exception("Test failed, filtering callback onSuccess " + "never occurred: {}".format(error)) + return False + i = 0 + for callback in scan_callback_list: + try: + self.scn_ad.ed.pop_event( + scan_result.format(callback), self.default_timeout) + self.log.info( + "Found scan event successfully. Iteration {} successful." + .format(i)) + except Exception: + self.log.info("Failed to find a scan result for callback {}" + .format(callback)) + return False + i += 1 + for callback in scan_callback_list: + self.scn_ad.droid.bleStopBleScan(callback) + self.adv_ad.droid.bleStopBleAdvertising(advertise_callback) + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='7a45e45c-faf3-4e89-abb7-a52f63e53208') + def test_max_concurrent_ble_scans_plus_one(self): + """Test mac LE scans variant. + + Test that a single device can have max scans concurrently scanning. + + Steps: + 1. Initialize scanner + 3. Create max ble scan callbacks plus one + 5. Start ble scan on each callback + 6. Verify that the n+1th scan fails. + 7. Stop all scans + + Expected Result: + The n+1th scan should fail to start. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Scanning, Concurrency + Priority: 1 + """ + test_result = True + filter_list = self.scn_ad.droid.bleGenFilterList() + scan_settings = self.scn_ad.droid.bleBuildScanSetting() + scan_callback_list = [] + for i in range(self.max_concurrent_scans): + self.log.debug("Concurrent Ble Scan iteration {}".format(i + 1)) + scan_callback = self.scn_ad.droid.bleGenScanCallback() + self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, + scan_callback) + scan_callback_list.append(scan_callback) + scan_callback = self.scn_ad.droid.bleGenScanCallback() + self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, + scan_callback) + try: + self.scn_ad.ed.pop_event( + scan_failed.format(scan_callback), self.default_timeout) + self.log.info( + "Found scan event successfully. Iteration {} successful." + .format(self.max_concurrent_scans + 1)) + except Exception: + self.log.error("Failed to find a onScanFailed event for callback {}" + .format(scan_callback)) + test_result = False + for callback in scan_callback_list: + self.scn_ad.droid.bleStopBleScan(callback) + return test_result + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='5a91f612-69e5-490f-b9d0-50d58a3db736') + def test_max_concurrent_ble_scans_verify_scans_stop_independently(self): + """Test max LE scans variant. + + Test that a single device can have max scans concurrently scanning. + + Steps: + 1. Initialize scanner + 2. Initialize advertiser + 3. Create max ble scan callbacks + 4. Start ble scan on each callback + 5. Start advertising on the device from step 2 + 6. Verify that the first callback triggers + 7. Stop the scan and repeat steps 6 and 7 until all scans stopped + + Expected Result: + All scanning instances should start without errors and the advertisement + should be found on each scan instance. All scanning instances should + stop successfully. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Scanning, Concurrency + Priority: 1 + """ + self.adv_ad.droid.bleSetAdvertiseDataIncludeDeviceName(True) + self.scn_ad.droid.bleSetScanSettingsCallbackType( + ble_scan_settings_callback_types['all_matches']) + self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ + 'low_latency']) + self.adv_ad.droid.bleSetAdvertiseSettingsAdvertiseMode( + ble_advertise_settings_modes['low_latency']) + advertise_callback, advertise_data, advertise_settings = ( + generate_ble_advertise_objects(self.adv_ad.droid)) + filter_list = self.scn_ad.droid.bleGenFilterList() + self.scn_ad.droid.bleSetScanFilterDeviceName( + self.adv_ad.droid.bluetoothGetLocalName()) + self.scn_ad.droid.bleBuildScanFilter(filter_list) + scan_settings = self.scn_ad.droid.bleBuildScanSetting() + scan_callback_list = [] + for i in range(self.max_concurrent_scans): + self.log.debug("Concurrent Ble Scan iteration {}".format(i + 1)) + scan_callback = self.scn_ad.droid.bleGenScanCallback() + scan_callback_list.append(scan_callback) + self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, + scan_callback) + self.adv_ad.droid.bleStartBleAdvertising( + advertise_callback, advertise_data, advertise_settings) + try: + self.adv_ad.ed.pop_event( + adv_succ.format(advertise_callback), self.default_timeout) + except Empty as error: + self.log.exception("Test failed with Empty error: {}".format( + error)) + return False + except concurrent.futures._base.TimeoutError as error: + self.log.exception( + "Test failed, filtering callback onSuccess never" + " occurred: {}".format(error)) + return False + i = 0 + for callback in scan_callback_list: + expected_scan_event_name = scan_result.format(scan_callback) + try: + self.scn_ad.ed.pop_event(expected_scan_event_name, + self.default_timeout) + self.log.info( + "Found scan event successfully. Iteration {} successful.". + format(i)) + i += 1 + except Exception: + self.log.info("Failed to find a scan result for callback {}". + format(scan_callback)) + return False + self.scn_ad.droid.bleStopBleScan(callback) + self.adv_ad.droid.bleStopBleAdvertising(advertise_callback) + return True diff --git a/acts_tests/tests/google/ble/concurrency/ConcurrentGattConnectTest.py b/acts_tests/tests/google/ble/concurrency/ConcurrentGattConnectTest.py index e69de29bb2..ec5e09cae8 100644 --- a/acts_tests/tests/google/ble/concurrency/ConcurrentGattConnectTest.py +++ b/acts_tests/tests/google/ble/concurrency/ConcurrentGattConnectTest.py @@ -0,0 +1,291 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2018 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +""" +Test script for concurrent Gatt connections. +Testbed assumes 6 Android devices. One will be the central and the rest +peripherals. +""" + +from queue import Empty +import concurrent.futures +import threading +import time +from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest +from acts.test_utils.bt.bt_constants import ble_scan_settings_modes +from acts.test_utils.bt.bt_constants import ble_advertise_settings_modes +from acts.test_utils.bt.bt_constants import bt_profile_constants +from acts.test_utils.bt.bt_constants import gatt_characteristic +from acts.test_utils.bt.bt_constants import gatt_characteristic_value_format +from acts.test_utils.bt.bt_constants import gatt_char_desc_uuids +from acts.test_utils.bt.bt_constants import gatt_descriptor +from acts.test_utils.bt.bt_constants import gatt_service_types +from acts.test_utils.bt.bt_constants import scan_result +from acts.test_utils.bt.bt_gatt_utils import run_continuous_write_descriptor +from acts.test_utils.bt.bt_gatt_utils import setup_gatt_connection +from acts.test_utils.bt.gatts_lib import GattServerLib +from acts.test_decorators import test_tracker_info + +service_uuid = '0000a00a-0000-1000-8000-00805f9b34fb' +characteristic_uuid = 'aa7edd5a-4d1d-4f0e-883a-d145616a1630' +descriptor_uuid = "00000003-0000-1000-8000-00805f9b34fb" + +gatt_server_read_descriptor_sample = { + 'services': [{ + 'uuid': + service_uuid, + 'type': + gatt_service_types['primary'], + 'characteristics': [{ + 'uuid': + characteristic_uuid, + 'properties': + gatt_characteristic['property_write'], + 'permissions': + gatt_characteristic['permission_write'], + 'instance_id': + 0x002a, + 'value_type': + gatt_characteristic_value_format['string'], + 'value': + 'Test Database', + 'descriptors': [{ + 'uuid': descriptor_uuid, + 'permissions': gatt_descriptor['permission_write'], + }] + }] + }] +} + + +class ConcurrentGattConnectTest(BluetoothBaseTest): + bt_default_timeout = 10 + max_connections = 5 + # List of tuples (android_device, advertise_callback) + advertise_callbacks = [] + # List of tuples (android_device, advertisement_name) + advertisement_names = [] + list_of_arguments_list = [] + + def setup_class(self): + super(BluetoothBaseTest, self).setup_class() + self.pri_dut = self.android_devices[0] + + + # Create 5 advertisements from different android devices + for i in range(1, self.max_connections + 1): + # Set device name + ad = self.android_devices[i] + name = "test_adv_{}".format(i) + self.advertisement_names.append((ad, name)) + ad.droid.bluetoothSetLocalName(name) + + # Setup and start advertisements + ad.droid.bleSetAdvertiseDataIncludeDeviceName(True) + ad.droid.bleSetAdvertiseSettingsAdvertiseMode( + ble_advertise_settings_modes['low_latency']) + advertise_data = ad.droid.bleBuildAdvertiseData() + advertise_settings = ad.droid.bleBuildAdvertiseSettings() + advertise_callback = ad.droid.bleGenBleAdvertiseCallback() + ad.droid.bleStartBleAdvertising(advertise_callback, advertise_data, + advertise_settings) + self.advertise_callbacks.append((ad, advertise_callback)) + + def obtain_address_list_from_scan(self): + """Returns the address list of all devices that match the scan filter. + + Returns: + A list if all devices are found; None is any devices are not found. + """ + # From central device, scan for all appropriate addresses by name. + filter_list = self.pri_dut.droid.bleGenFilterList() + self.pri_dut.droid.bleSetScanSettingsScanMode( + ble_scan_settings_modes['low_latency']) + scan_settings = self.pri_dut.droid.bleBuildScanSetting() + scan_callback = self.pri_dut.droid.bleGenScanCallback() + for android_device, name in self.advertisement_names: + self.pri_dut.droid.bleSetScanFilterDeviceName(name) + self.pri_dut.droid.bleBuildScanFilter(filter_list) + self.pri_dut.droid.bleStartBleScan(filter_list, scan_settings, + scan_callback) + address_list = [] + devices_found = [] + # Set the scan time out to 20 sec to provide enough time to discover the + # devices in busy environment + scan_timeout = 20 + end_time = time.time() + scan_timeout + while time.time() < end_time and len(address_list) < len( + self.advertisement_names): + try: + event = self.pri_dut.ed.pop_event( + "BleScan{}onScanResults".format(scan_callback), + self.bt_default_timeout) + + adv_name = event['data']['Result']['deviceInfo']['name'] + mac_address = event['data']['Result']['deviceInfo']['address'] + # Look up the android device handle based on event name + device = [ + item for item in self.advertisement_names + if adv_name in item + ] + devices_found.append(device[0][0].serial) + if len(device) is not 0: + address_list_tuple = (device[0][0], mac_address) + else: + continue + result = [item for item in address_list if mac_address in item] + # if length of result is 0, it indicates that we have discovered + # new mac address. + if len(result) is 0: + self.log.info("Found new mac address: {}".format( + address_list_tuple[1])) + address_list.append(address_list_tuple) + except Empty as err: + self.log.error("Failed to find any scan results.") + return None + if len(address_list) < self.max_connections: + self.log.info("Only found these devices: {}".format(devices_found)) + self.log.error("Could not find all necessary advertisements.") + return None + return address_list + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='6638282c-69b5-4237-9f0d-18e131424a9f') + def test_concurrent_gatt_connections(self): + """Test max concurrent GATT connections + + Connect to all peripherals. + + Steps: + 1. Scan + 2. Save addresses + 3. Connect all addresses of the peripherals + + Expected Result: + All connections successful. + + Returns: + Pass if True + Fail if False + + TAGS: Bluetooth, GATT + Priority: 2 + """ + + address_list = self.obtain_address_list_from_scan() + if address_list is None: + return False + + # Connect to all addresses + for address_tuple in address_list: + address = address_tuple[1] + try: + autoconnect = False + bluetooth_gatt, gatt_callback = setup_gatt_connection( + self.pri_dut, address, autoconnect) + self.log.info("Successfully connected to {}".format(address)) + except Exception as err: + self.log.error( + "Failed to establish connection to {}".format(address)) + return False + if (len( + self.pri_dut.droid.bluetoothGetConnectedLeDevices( + bt_profile_constants['gatt_server'])) != + self.max_connections): + self.log.error("Did not reach max connection count.") + return False + + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='660bf05e-a8e5-45f3-b42b-b66b4ac0d85f') + def test_data_transfer_to_concurrent_gatt_connections(self): + """Test writing GATT descriptors concurrently to many peripherals. + + Connect to all peripherals and write gatt descriptors concurrently. + + + Steps: + 1. Scan the addresses by names + 2. Save mac addresses of the peripherals + 3. Connect all addresses of the peripherals and write gatt descriptors + + + Expected Result: + All connections and data transfers are successful. + + Returns: + Pass if True + Fail if False + + TAGS: Bluetooth, GATT + Priority: 2 + """ + + address_list = self.obtain_address_list_from_scan() + if address_list is None: + return False + + # Connect to all addresses + executor = concurrent.futures.ThreadPoolExecutor(max_workers=10) + + for address_tuple in address_list: + ad, address = address_tuple + + gatts = GattServerLib(log=self.log, dut=ad) + gatt_server, gatt_server_callback = gatts.setup_gatts_db( + database=gatt_server_read_descriptor_sample) + + try: + bluetooth_gatt, gatt_callback = setup_gatt_connection( + self.pri_dut, address, autoconnect=False) + self.log.info("Successfully connected to {}".format(address)) + + except Exception as err: + self.log.error( + "Failed to establish connection to {}".format(address)) + return False + + if self.pri_dut.droid.gattClientDiscoverServices(bluetooth_gatt): + event = self.pri_dut.ed.pop_event( + "GattConnect{}onServicesDiscovered".format(bluetooth_gatt), + self.bt_default_timeout) + discovered_services_index = event['data']['ServicesIndex'] + else: + self.log.info("Failed to discover services.") + return False + services_count = self.pri_dut.droid.gattClientGetDiscoveredServicesCount( + discovered_services_index) + + arguments_list = [ + self.pri_dut.droid, self.pri_dut.ed, ad.droid, ad.ed, + gatt_server, gatt_server_callback, bluetooth_gatt, + services_count, discovered_services_index, 100 + ] + self.list_of_arguments_list.append(arguments_list) + + for arguments_list in self.list_of_arguments_list: + executor.submit(run_continuous_write_descriptor, *arguments_list) + + executor.shutdown(wait=True) + + if (len( + self.pri_dut.droid.bluetoothGetConnectedLeDevices( + bt_profile_constants['gatt_server'])) != + self.max_connections): + self.log.error("Failed to write concurrently.") + return False + + return True diff --git a/acts_tests/tests/google/ble/conn_oriented_chan/BleCoc2ConnTest.py b/acts_tests/tests/google/ble/conn_oriented_chan/BleCoc2ConnTest.py index e69de29bb2..353f507088 100644 --- a/acts_tests/tests/google/ble/conn_oriented_chan/BleCoc2ConnTest.py +++ b/acts_tests/tests/google/ble/conn_oriented_chan/BleCoc2ConnTest.py @@ -0,0 +1,510 @@ +#!/usr/bin/env python3 +# +# Copyright 2017 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +""" +Test script to execute Bluetooth Connection-orient Channel (CoC) functionality for +2 connections test cases. This test was designed to be run in a shield box. +""" + +import threading +import time + +from acts import utils +from queue import Empty +from acts.test_decorators import test_tracker_info +from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest +from acts.test_utils.bt.bt_coc_test_utils import orchestrate_coc_connection +from acts.test_utils.bt.bt_coc_test_utils import do_multi_connection_throughput +from acts.test_utils.bt.bt_constants import default_le_data_length +from acts.test_utils.bt.bt_constants import default_bluetooth_socket_timeout_ms +from acts.test_utils.bt.bt_constants import l2cap_coc_header_size +from acts.test_utils.bt.bt_constants import l2cap_max_inactivity_delay_after_disconnect +from acts.test_utils.bt.bt_constants import le_connection_event_time_step_ms +from acts.test_utils.bt.bt_test_utils import clear_bonded_devices +from acts.test_utils.bt.bt_test_utils import kill_bluetooth_process +from acts.test_utils.bt.bt_test_utils import reset_bluetooth +from acts.test_utils.bt.bt_test_utils import setup_multiple_devices_for_bt_test +from acts.test_utils.bt.bt_test_utils import take_btsnoop_logs +from acts.test_utils.bt.bt_test_utils import write_read_verify_data +from acts.test_utils.bt.bt_test_utils import verify_server_and_client_connected + + +class BleCoc2ConnTest(BluetoothBaseTest): + def setup_class(self): + super().setup_class() + self.client_ad = self.android_devices[0] + # The client which is scanning will need location to be enabled in order to + # start scan and get scan results. + utils.set_location_service(self.client_ad, True) + self.server_ad = self.android_devices[1] + # Note that some tests required a third device. + if len(self.android_devices) > 2: + self.server2_ad = self.android_devices[2] + + return setup_multiple_devices_for_bt_test(self.android_devices) + + def teardown_test(self): + self.client_ad.droid.bluetoothSocketConnStop() + self.server_ad.droid.bluetoothSocketConnStop() + # Give sufficient time for the physical LE link to be disconnected. + time.sleep(l2cap_max_inactivity_delay_after_disconnect) + + # This utility function calculates the max and min connection event (ce) time. + # The formula is that the min/max ce time should be less than half the connection + # interval and must be multiples of the le_connection_event_time_step. + def _calc_min_max_ce_time(self, le_connection_interval): + conn_event_time_steps = int((le_connection_interval/2)/le_connection_event_time_step_ms) + conn_event_time_steps -= 1 + return (le_connection_event_time_step_ms * conn_event_time_steps) + + def _run_coc_connection_throughput_2_conn( + self, + is_secured, + buffer_size, + le_connection_interval=0, + le_tx_data_length=default_le_data_length, + min_ce_len=0, + max_ce_len=0): + + # The num_iterations is that number of repetitions of each + # set of buffers r/w. + # number_buffers is the total number of data buffers to transmit per + # set of buffers r/w. + # buffer_size is the number of bytes per L2CAP data buffer. + num_iterations = 10 + number_buffers = 100 + + # Make sure at least 3 phones are setup + if len(self.android_devices) <= 2: + self.log.info("test_coc_connection_throughput_2_conn: " + "Error: 3rd phone not configured in file") + return False + + self.log.info( + "_run_coc_connection_throughput_2_conn: is_secured={}, Interval={}, buffer_size={}, " + "le_tx_data_length={}, min_ce_len={}".format(is_secured, le_connection_interval, + buffer_size, le_tx_data_length, min_ce_len)) + status, client_conn_id1, server_conn_id1 = orchestrate_coc_connection( + self.client_ad, self.server_ad, True, is_secured, + le_connection_interval, le_tx_data_length, default_bluetooth_socket_timeout_ms, + min_ce_len, max_ce_len) + if not status: + return False + + status, client_conn_id2, server_conn_id2 = orchestrate_coc_connection( + self.client_ad, self.server2_ad, True, is_secured, + le_connection_interval, le_tx_data_length, default_bluetooth_socket_timeout_ms, + min_ce_len, max_ce_len) + if not status: + return False + + list_server_ad = [self.server_ad, self.server2_ad] + list_client_conn_id = [client_conn_id1, client_conn_id2] + data_rate = do_multi_connection_throughput( + self.client_ad, list_server_ad, list_client_conn_id, + num_iterations, number_buffers, buffer_size) + if data_rate <= 0: + return False + + self.log.info( + "test_coc_connection_throughput_2_conn: throughput=%d bytes per " + "sec", data_rate) + + self.client_ad.droid.bluetoothSocketConnStop(client_conn_id1) + self.client_ad.droid.bluetoothSocketConnStop(client_conn_id2) + self.server_ad.droid.bluetoothSocketConnStop(server_conn_id1) + self.server2_ad.droid.bluetoothSocketConnStop(server_conn_id2) + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='27226006-b725-4312-920e-6193cf0539d4') + def test_coc_insecured_connection_throughput_2_conn(self): + """Test LE CoC data throughput on two insecured connections + + Test Data Throughput of 2 L2CAP CoC insecured connections. + 3 phones are required. + + Steps: + 1. Get the mac address of the server device. + 2. Establish a L2CAP CoC connection from the client to the server#1 AD. + The connection is insecured. + 3. Verify that the L2CAP CoC connection is active from both the client + and server. + 4. Establish a L2CAP CoC connection from the client to the server#2 AD. + The connection is insecured. + 5. Verify that the L2CAP CoC connection is active from both the client + and server. + 6. Write data from the client to both server#1 and server#2. + 7. Verify data matches from client and server + + Expected Result: + L2CAP CoC connections are established and data written correctly to both servers. + + Returns: + Pass if True + Fail if False + + TAGS: BLE, CoC + Priority: 2 + """ + + # Note: A 117 octets buffer size would fix nicely to a 123 bytes Data Length + status = self._run_coc_connection_throughput_2_conn(False, 117) + return status + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='1a5fb032-8a27-42f1-933f-3e39311c09a6') + def test_coc_secured_connection_throughput_2_conn(self): + """Test LE CoC data throughput on two secured connections + + Test Data Throughput of 2 L2CAP CoC secured connections. + 3 phones are required. + + Steps: + 1. Get the mac address of the server device. + 2. Establish a L2CAP CoC connection from the client to the server#1 AD. + The connection is secured. + 3. Verify that the L2CAP CoC connection is active from both the client + and server. + 4. Establish a L2CAP CoC connection from the client to the server#2 AD. + The connection is secured. + 5. Verify that the L2CAP CoC connection is active from both the client + and server. + 6. Write data from the client to both server#1 and server#2. + 7. Verify data matches from client and server + + Expected Result: + L2CAP CoC connections are established and data written correctly to both servers. + + Returns: + Pass if True + Fail if False + + TAGS: BLE, CoC + Priority: 2 + """ + + # Note: A 117 octets buffer size would fix nicely to a 123 bytes Data Length + status = self._run_coc_connection_throughput_2_conn(True, 117) + return status + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='b198f8cc-26af-44bd-bb4d-7dc8f8645617') + def test_coc_connection_throughput_2_conn_NOSEC_10CI_60SIZE(self): + """Test LE CoC data throughput with 10msec CI and 60bytes buffer size. + + Test data throughput of 2 L2CAP CoC insecured connections with 20msec connection interval + and 60 bytes buffer size. 3 phones are required. + + Steps: + 1. Get the mac address of the server device. + 2. Establish a L2CAP CoC connection from the client to the server#1 AD. + The connection is insecured. + 3. Set the connection interval to 20 msec and buffer size to 60 bytes. + 4. Verify that the L2CAP CoC connection is active from both the client + and server. + 5. Establish a L2CAP CoC connection from the client to the server#2 AD. + The connection is insecured. + 6. Set the connection interval to 20 msec and buffer size to 60 bytes. + 7. Verify that the L2CAP CoC connection is active from both the client + and server. + 8. Write data from the client to both server#1 and server#2. + 9. Verify data matches from client and server + + Expected Result: + L2CAP CoC connections are established and data written correctly to both servers. + + Returns: + Pass if True + Fail if False + + TAGS: BLE, CoC + Priority: 1 + """ + + is_secured = False + le_connection_interval = 10 + buffer_size = 60 + le_tx_data_length = buffer_size + l2cap_coc_header_size + + status = self._run_coc_connection_throughput_2_conn( + is_secured, buffer_size, le_connection_interval, le_tx_data_length, + self._calc_min_max_ce_time(le_connection_interval), + self._calc_min_max_ce_time(le_connection_interval)) + return status + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='12dc2a6c-8283-4617-a911-42335dd693a8') + def test_coc_connection_throughput_2_conn_NOSEC_10CI_80SIZE(self): + """Test LE CoC data throughput with 10msec CI and 80bytes buffer size. + + Test data throughput of 2 L2CAP CoC insecured connections with 20msec connection interval + and 80 bytes buffer size. 3 phones are required. + + Steps: + 1. Get the mac address of the server device. + 2. Establish a L2CAP CoC connection from the client to the server#1 AD. + The connection is insecured. + 3. Set the connection interval to 20 msec and buffer size to 80 bytes. + 4. Verify that the L2CAP CoC connection is active from both the client + and server. + 5. Establish a L2CAP CoC connection from the client to the server#2 AD. + The connection is insecured. + 6. Set the connection interval to 20 msec and buffer size to 80 bytes. + 7. Verify that the L2CAP CoC connection is active from both the client + and server. + 8. Write data from the client to both server#1 and server#2. + 9. Verify data matches from client and server + + Expected Result: + L2CAP CoC connections are established and data written correctly to both servers. + + Returns: + Pass if True + Fail if False + + TAGS: BLE, CoC + Priority: 1 + """ + + is_secured = False + le_connection_interval = 10 + buffer_size = 80 + le_tx_data_length = buffer_size + l2cap_coc_header_size + status = self._run_coc_connection_throughput_2_conn( + is_secured, buffer_size, le_connection_interval, le_tx_data_length, + self._calc_min_max_ce_time(le_connection_interval), + self._calc_min_max_ce_time(le_connection_interval)) + return status + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='4730df05-3909-4adf-a365-7f0c3258c402') + def test_coc_connection_throughput_2_conn_NOSEC_10CI_120SIZE(self): + """Test LE CoC data throughput with 10msec CI and 120bytes buffer size. + + Test data throughput of 2 L2CAP CoC insecured connections with 20msec connection interval + and 120 bytes buffer size. 3 phones are required. + + Steps: + 1. Get the mac address of the server device. + 2. Establish a L2CAP CoC connection from the client to the server#1 AD. + The connection is insecured. + 3. Set the connection interval to 20 msec and buffer size to 120 bytes. + 4. Verify that the L2CAP CoC connection is active from both the client + and server. + 5. Establish a L2CAP CoC connection from the client to the server#2 AD. + The connection is insecured. + 6. Set the connection interval to 20 msec and buffer size to 120 bytes. + 7. Verify that the L2CAP CoC connection is active from both the client + and server. + 8. Write data from the client to both server#1 and server#2. + 9. Verify data matches from client and server + + Expected Result: + L2CAP CoC connections are established and data written correctly to both servers. + + Returns: + Pass if True + Fail if False + + TAGS: BLE, CoC + Priority: 1 + """ + + is_secured = False + le_connection_interval = 10 + buffer_size = 120 + le_tx_data_length = buffer_size + l2cap_coc_header_size + status = self._run_coc_connection_throughput_2_conn( + is_secured, buffer_size, le_connection_interval, le_tx_data_length, + self._calc_min_max_ce_time(le_connection_interval), + self._calc_min_max_ce_time(le_connection_interval)) + return status + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='471a8748-b0a5-4be5-9322-7c75e2b5d048') + def test_coc_connection_throughput_2_conn_NOSEC_15CI_120SIZE(self): + """Test LE CoC data throughput with 15msec CI and 120bytes buffer size. + + Test data throughput of 2 L2CAP CoC insecured connections with 15msec connection interval + and 120 bytes buffer size. 3 phones are required. + + Steps: + 1. Get the mac address of the server device. + 2. Establish a L2CAP CoC connection from the client to the server#1 AD. + The connection is insecured. + 3. Set the connection interval to 15 msec and buffer size to 120 bytes. + 4. Verify that the L2CAP CoC connection is active from both the client + and server. + 5. Establish a L2CAP CoC connection from the client to the server#2 AD. + The connection is insecured. + 6. Set the connection interval to 15 msec and buffer size to 120 bytes. + 7. Verify that the L2CAP CoC connection is active from both the client + and server. + 8. Write data from the client to both server#1 and server#2. + 9. Verify data matches from client and server + + Expected Result: + L2CAP CoC connections are established and data written correctly to both servers. + + Returns: + Pass if True + Fail if False + + TAGS: BLE, CoC + Priority: 1 + """ + + is_secured = False + le_connection_interval = 15 + buffer_size = 120 + le_tx_data_length = buffer_size + l2cap_coc_header_size + status = self._run_coc_connection_throughput_2_conn( + is_secured, buffer_size, le_connection_interval, le_tx_data_length, + self._calc_min_max_ce_time(le_connection_interval), + self._calc_min_max_ce_time(le_connection_interval)) + return status + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='053e59c2-f312-4bec-beaf-9e4efdce063a') + def test_coc_connection_throughput_2_conn_NOSEC_15CI_180SIZE(self): + """Test LE CoC data throughput with 15msec CI and 180bytes buffer size. + + Test data throughput of 2 L2CAP CoC insecured connections with 15msec connection interval + and 120 bytes buffer size. 3 phones are required. + + Steps: + 1. Get the mac address of the server device. + 2. Establish a L2CAP CoC connection from the client to the server#1 AD. + The connection is insecured. + 3. Set the connection interval to 15 msec and buffer size to 180 bytes. + 4. Verify that the L2CAP CoC connection is active from both the client + and server. + 5. Establish a L2CAP CoC connection from the client to the server#2 AD. + The connection is insecured. + 6. Set the connection interval to 15 msec and buffer size to 180 bytes. + 7. Verify that the L2CAP CoC connection is active from both the client + and server. + 8. Write data from the client to both server#1 and server#2. + 9. Verify data matches from client and server + + Expected Result: + L2CAP CoC connections are established and data written correctly to both servers. + + Returns: + Pass if True + Fail if False + + TAGS: BLE, CoC + Priority: 1 + """ + + is_secured = False + le_connection_interval = 15 + buffer_size = 180 + le_tx_data_length = buffer_size + l2cap_coc_header_size + status = self._run_coc_connection_throughput_2_conn( + is_secured, buffer_size, le_connection_interval, le_tx_data_length, + self._calc_min_max_ce_time(le_connection_interval), + self._calc_min_max_ce_time(le_connection_interval)) + return status + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='2b43caa6-76b3-48c5-b342-32ebb31ac52c') + def test_coc_connection_throughput_2_conn_NOSEC_20CI_240SIZE(self): + """Test LE CoC data throughput with 20msec CI and 240bytes buffer size. + + Test data throughput of 2 L2CAP CoC insecured connections with 20msec connection interval + and 240 bytes buffer size. 3 phones are required. + + Steps: + 1. Get the mac address of the server device. + 2. Establish a L2CAP CoC connection from the client to the server#1 AD. + The connection is insecured. + 3. Set the connection interval to 20 msec and buffer size to 240 bytes. + 4. Verify that the L2CAP CoC connection is active from both the client + and server. + 5. Establish a L2CAP CoC connection from the client to the server#2 AD. + The connection is insecured. + 6. Set the connection interval to 20 msec and buffer size to 240 bytes. + 7. Verify that the L2CAP CoC connection is active from both the client + and server. + 8. Write data from the client to both server#1 and server#2. + 9. Verify data matches from client and server + + Expected Result: + L2CAP CoC connections are established and data written correctly to both servers. + + Returns: + Pass if True + Fail if False + + TAGS: BLE, CoC + Priority: 1 + """ + + is_secured = False + le_connection_interval = 20 + buffer_size = 240 + le_tx_data_length = buffer_size + l2cap_coc_header_size + status = self._run_coc_connection_throughput_2_conn( + is_secured, buffer_size, le_connection_interval, le_tx_data_length, + self._calc_min_max_ce_time(le_connection_interval), + self._calc_min_max_ce_time(le_connection_interval)) + return status + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='f630df02-3fd6-4aa0-bc15-06837b705e97') + def test_coc_connection_throughput_2_conn_NOSEC_30CI_240SIZE(self): + """Test LE CoC data throughput with 30msec CI and 240bytes buffer size. + + Test data throughput of 2 L2CAP CoC insecured connections with 20msec connection interval + and 240 bytes buffer size. 3 phones are required. + + Steps: + 1. Get the mac address of the server device. + 2. Establish a L2CAP CoC connection from the client to the server#1 AD. + The connection is insecured. + 3. Set the connection interval to 30 msec and buffer size to 240 bytes. + 4. Verify that the L2CAP CoC connection is active from both the client + and server. + 5. Establish a L2CAP CoC connection from the client to the server#2 AD. + The connection is insecured. + 6. Set the connection interval to 30 msec and buffer size to 240 bytes. + 7. Verify that the L2CAP CoC connection is active from both the client + and server. + 8. Write data from the client to both server#1 and server#2. + 9. Verify data matches from client and server + + Expected Result: + L2CAP CoC connections are established and data written correctly to both servers. + + Returns: + Pass if True + Fail if False + + TAGS: BLE, CoC + Priority: 2 + """ + + is_secured = False + le_connection_interval = 30 + buffer_size = 240 + le_tx_data_length = buffer_size + l2cap_coc_header_size + status = self._run_coc_connection_throughput_2_conn( + is_secured, buffer_size, le_connection_interval, le_tx_data_length, + self._calc_min_max_ce_time(le_connection_interval), + self._calc_min_max_ce_time(le_connection_interval)) + return status diff --git a/acts_tests/tests/google/ble/conn_oriented_chan/BleCocTest.py b/acts_tests/tests/google/ble/conn_oriented_chan/BleCocTest.py index 97ace9bbbb..166b848f26 100644 --- a/acts_tests/tests/google/ble/conn_oriented_chan/BleCocTest.py +++ b/acts_tests/tests/google/ble/conn_oriented_chan/BleCocTest.py @@ -49,14 +49,14 @@ class BleCocTest(BluetoothBaseTest): def setup_class(self): super().setup_class() self.client_ad = self.android_devices[0] - # The client which is scanning will need location to be enabled in order to - # start scan and get scan results. - utils.set_location_service(self.client_ad, True) self.server_ad = self.android_devices[1] # Note that some tests required a third device. if len(self.android_devices) > 2: self.server2_ad = self.android_devices[2] + # The client which is scanning will need location to be enabled in order to + # start scan and get scan results. + utils.set_location_service(self.client_ad, True) return setup_multiple_devices_for_bt_test(self.android_devices) def teardown_test(self): diff --git a/acts_tests/tests/google/ble/examples/BleExamplesTest.py b/acts_tests/tests/google/ble/examples/BleExamplesTest.py index e69de29bb2..1ced2db965 100644 --- a/acts_tests/tests/google/ble/examples/BleExamplesTest.py +++ b/acts_tests/tests/google/ble/examples/BleExamplesTest.py @@ -0,0 +1,143 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2016 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +""" +This script shows simple examples of how to get started with bluetooth low energy testing in acts. +""" + +import pprint + +from acts.controllers import android_device +from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest +from acts.test_utils.bt.bt_constants import adv_succ +from acts.test_utils.bt.bt_constants import scan_result +from acts.test_utils.bt.bt_test_utils import cleanup_scanners_and_advertisers +from acts.test_utils.bt.bt_test_utils import reset_bluetooth + + +class BleExamplesTest(BluetoothBaseTest): + default_timeout = 10 + active_scan_callback_list = [] + active_adv_callback_list = [] + scn_droid = None + adv_droid = None + + def setup_class(self): + super().setup_class() + self.scn_droid, self.scn_ed = (self.android_devices[0].droid, + self.android_devices[0].ed) + self.adv_droid, self.adv_ed = (self.android_devices[1].droid, + self.android_devices[1].ed) + + def teardown_test(self): + cleanup_scanners_and_advertisers( + self.android_devices[0], self.active_adv_callback_list, + self.android_devices[1], self.active_adv_callback_list) + self.active_adv_callback_list = [] + self.active_scan_callback_list = [] + + # An optional function. This overrides the default + # on_exception in base_test. If the test throws an + # unexpected exception, you can customise it. + def on_exception(self, test_name, begin_time): + self.log.debug("Test {} failed. Gathering bugreport and btsnoop logs". + format(test_name)) + android_devices.take_bug_reports(self.android_devices, test_name, + begin_time) + + @BluetoothBaseTest.bt_test_wrap + def test_bt_toggle(self): + """ + Test that simply toggle bluetooth + :return: + """ + return reset_bluetooth([self.android_devices[0]]) + + ''' + Start: Examples of BLE Scanning + ''' + + @BluetoothBaseTest.bt_test_wrap + def test_start_ble_scan(self): + """Test to demonstrate how to start an LE scan + + Test that shows the steps to start a new ble scan. + + Steps: + 1. Create a scan filter object. + 2. Create a scan setting object. + 3. Create a scan callback object. + 4. Start an LE scan using the objects created in steps 1-3. + 5. Find an advertisement with the scanner's event dispatcher. + + Expected Result: + A generic advertisement is found. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Scanning + Priority: 4 + """ + filter_list = self.scn_droid.bleGenFilterList() + scan_settings = self.scn_droid.bleBuildScanSetting() + scan_callback = self.scn_droid.bleGenScanCallback() + self.scn_droid.bleStartBleScan(filter_list, scan_settings, + scan_callback) + self.active_scan_callback_list.append(scan_callback) + event_name = scan_result.format(scan_callback) + try: + event = self.scn_ed.pop_event(event_name, self.default_timeout) + self.log.info("Found scan result: {}".format( + pprint.pformat(event))) + except Exception: + self.log.info("Didn't find any scan results.") + return True + + ''' + End: Examples of BLE Scanning + ''' + + @BluetoothBaseTest.bt_test_wrap + def test_start_ble_advertise(self): + """Test to demonstrate how to start an LE advertisement + + Test that shows the steps to start a new ble scan. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising + Priority: 4 + """ + advertise_data = self.adv_droid.bleBuildAdvertiseData() + advertise_settings = self.adv_droid.bleBuildAdvertiseSettings() + advertise_callback = self.adv_droid.bleGenBleAdvertiseCallback() + self.adv_droid.bleStartBleAdvertising( + advertise_callback, advertise_data, advertise_settings) + self.adv_ed.pop_event(adv_succ.format(advertise_callback)) + return True diff --git a/acts_tests/tests/google/ble/examples/GattServerExampleTest.py b/acts_tests/tests/google/ble/examples/GattServerExampleTest.py index e69de29bb2..e1f6476017 100644 --- a/acts_tests/tests/google/ble/examples/GattServerExampleTest.py +++ b/acts_tests/tests/google/ble/examples/GattServerExampleTest.py @@ -0,0 +1,67 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2018 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + +from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest +from acts.test_utils.bt.bt_constants import gatt_characteristic +from acts.test_utils.bt.bt_constants import gatt_descriptor +from acts.test_utils.bt.bt_constants import gatt_service_types +from acts.test_utils.bt.bt_constants import gatt_characteristic_value_format +from acts.test_utils.bt.bt_constants import gatt_char_desc_uuids +from acts.test_utils.bt.gatts_lib import GattServerLib + +service_uuid = '0000a00a-0000-1000-8000-00805f9b34fb' +characteristic_uuid = 'aa7edd5a-4d1d-4f0e-883a-d145616a1630' +descriptor_uuid = gatt_char_desc_uuids['client_char_cfg'] + +gatt_server_read_descriptor_sample = { + 'services': [{ + 'uuid': + service_uuid, + 'type': + gatt_service_types['primary'], + 'characteristics': [{ + 'uuid': + characteristic_uuid, + 'properties': + gatt_characteristic['property_read'], + 'permissions': + gatt_characteristic['permission_read'], + 'instance_id': + 0x002a, + 'value_type': + gatt_characteristic_value_format['string'], + 'value': + 'Test Database', + 'descriptors': [{ + 'uuid': descriptor_uuid, + 'permissions': gatt_descriptor['permission_read'], + }] + }] + }] +} + + +class GattServerExampleTest(BluetoothBaseTest): + def setup_class(self): + super().setup_class() + self.dut = self.android_devices[0] + + @BluetoothBaseTest.bt_test_wrap + def test_create_gatt_server_db_example(self): + gatts = GattServerLib(log=self.log, dut=self.dut) + gatts.setup_gatts_db(database=gatt_server_read_descriptor_sample) + self.log.info(gatts.list_all_uuids()) + return True diff --git a/acts_tests/tests/google/ble/filtering/FilteringTest.py b/acts_tests/tests/google/ble/filtering/FilteringTest.py index e69de29bb2..d1bdc399c9 100644 --- a/acts_tests/tests/google/ble/filtering/FilteringTest.py +++ b/acts_tests/tests/google/ble/filtering/FilteringTest.py @@ -0,0 +1,12100 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2016 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + +import itertools as it +import pprint +import time + +from queue import Empty +from acts.test_decorators import test_tracker_info +from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest +from acts.test_utils.bt.bt_constants import ble_advertise_settings_modes +from acts.test_utils.bt.bt_constants import ble_advertise_settings_tx_powers +from acts.test_utils.bt.bt_constants import java_integer +from acts.test_utils.bt.bt_constants import ble_scan_settings_modes +from acts.test_utils.bt.bt_constants import ble_scan_settings_modes +from acts.test_utils.bt.bt_constants import small_timeout +from acts.test_utils.bt.bt_constants import adv_fail +from acts.test_utils.bt.bt_constants import adv_succ +from acts.test_utils.bt.bt_test_utils import generate_ble_advertise_objects +from acts.test_utils.bt.bt_test_utils import reset_bluetooth +from acts.test_utils.bt.bt_constants import scan_result + + +class FilteringTest(BluetoothBaseTest): + default_timeout = 30 + default_callback = 1 + default_is_connectable = True + default_advertise_mode = 0 + default_tx_power_level = 2 + + #Data constant variants + manu_sepecific_data_small = [1] + manu_sepecific_data_small_2 = [1, 2] + manu_specific_data_small_3 = [127] + manu_sepecific_data_large = [14, 0, 54, 0, 0, 0, 0, 0] + manu_sepecific_data_mask_small = [1] + manu_specific_data_id_1 = 1 + manu_specific_data_id_2 = 2 + manu_specific_data_id_3 = 65535 + + service_data_small = [13] + service_data_small_2 = [127] + service_data_medium = [11, 14, 50] + service_data_large = [ + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 26, 17, 18, 19, 20, + 21, 22, 23, 24 + ] + + service_mask_1 = "00000000-0000-1000-8000-00805f9b34fb" + service_uuid_1 = "00000000-0000-1000-8000-00805f9b34fb" + service_uuid_2 = "FFFFFFFF-0000-1000-8000-00805f9b34fb" + service_uuid_3 = "3846D7A0-69C8-11E4-BA00-0002A5D5C51B" + + def setup_class(self): + super().setup_class() + self.scn_ad = self.android_devices[0] + self.adv_ad = self.android_devices[1] + self.log.info("Scanner device model: {}".format( + self.scn_ad.droid.getBuildModel())) + self.log.info("Advertiser device model: {}".format( + self.adv_ad.droid.getBuildModel())) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='be72fc18-e7e9-41cf-80b5-e31babd763f6') + def test_filter_combo_0(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='92e11460-1877-4dd1-998b-8f78354dd776') + def test_filter_combo_1(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': [1] + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='9cdb7ad3-9f1e-4cbc-ae3f-af27d9833ae3') + def test_filter_combo_2(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='ae06ece8-28ae-4c2f-a768-d0e1e60cc253') + def test_filter_combo_3(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='7a7c40fb-1398-4659-af46-ba01ca23ba7f') + def test_filter_combo_4(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': [1] + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='85cab0b7-4ba2-408c-b78b-c45d0cad1d1e') + def test_filter_combo_5(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='31e7a496-6626-4d73-8337-b250f7386ab6') + def test_filter_combo_6(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='465f5426-1157-4a6f-8c33-a266ee7439bc') + def test_filter_combo_7(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': [1] + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='77552584-74c7-4a1b-a98e-8863e91f4e74') + def test_filter_combo_8(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='fb2b5f08-53cd-400b-98a0-bbd96093e466') + def test_filter_combo_9(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='edacb609-9508-4394-9c94-9ed13a4205b5') + def test_filter_combo_10(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': [1] + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='73a86198-3213-43c5-b083-0a37089b8e44') + def test_filter_combo_11(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='9ca92075-d22b-4e82-9e7b-495060f3af45') + def test_filter_combo_12(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='a0689f97-c616-49a5-b690-00b6193ac822') + def test_filter_combo_13(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': [1] + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='dbdf3a68-c79a-43a6-89a7-5269a1fad9a5') + def test_filter_combo_14(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='93e45b16-dff0-4067-9c14-7adf32a0f484') + def test_filter_combo_15(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='dace8a1c-e71a-4668-9e8f-b1cb19071087') + def test_filter_combo_16(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': [1] + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='192528e2-4a67-4984-9c68-f9d716470d5b') + def test_filter_combo_17(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='2a9ffd92-f02d-45bc-81f5-f398e2572f14') + def test_filter_combo_18(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='ab98e5e5-ac35-4ebe-8b37-780b0ab56b82') + def test_filter_combo_19(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': [1] + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='0b4ca831-dbf6-44da-84b6-9425b7f50577') + def test_filter_combo_20(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='f615206a-16bf-4481-be31-7b2a28d8009b') + def test_filter_combo_21(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='e9a0e69e-bc5c-479e-a716-cbb88180e719') + def test_filter_combo_22(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': [1] + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='16c2949d-e7c8-4fa1-a781-3ced2c902c4c') + def test_filter_combo_23(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='ffd7a3a8-b9b5-4bf0-84c1-ed3823b8a52c') + def test_filter_combo_24(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='457b5dee-1034-4973-88c1-bde0a6ef700c') + def test_filter_combo_25(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': [1] + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='b848e90c-37ed-4ecb-8c49-601f3b66a4cc') + def test_filter_combo_26(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='c03df405-b7aa-42cf-b282-adf5c228e513') + def test_filter_combo_27(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='83de681d-89fb-45e1-b8e0-0488e43b3248') + def test_filter_combo_28(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': [1] + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='712bf6b2-0cdc-4782-b593-17a846fd1c65') + def test_filter_combo_29(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='725c37e5-046b-4234-a7eb-ad8836531a74') + def test_filter_combo_30(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='665344f9-c246-4b08-aff6-73f7ff35431b') + def test_filter_combo_31(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': [1] + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='6994ceff-fed8-42e4-a3cb-be6ed3a9a5c9') + def test_filter_combo_32(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='2fb756c0-8b72-403a-a769-d22d31376037') + def test_filter_combo_33(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='146203bb-04cc-4b3d-b372-66e1b8da3e08') + def test_filter_combo_34(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': [1] + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='1e123df5-db37-4e8d-ac1f-9399fe8487f9') + def test_filter_combo_35(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='886f0978-a2df-4005-810b-5e2cc0c2a5a4') + def test_filter_combo_36(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='94f61b07-e90a-42e3-b97b-07afc73755e6') + def test_filter_combo_37(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': [1] + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='1dbb67ed-2f9e-464d-8ba8-dd7ac668d765') + def test_filter_combo_38(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='3a3e5aa9-a5cc-4e99-aeb4-b32357186e1d') + def test_filter_combo_39(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='2c51245a-7be3-4dfb-87c5-7c4530ab5908') + def test_filter_combo_40(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': [1] + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='9d33bae5-0a5f-4d2c-96fc-fc1ec8107814') + def test_filter_combo_41(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='05b5ee9e-9a64-4bf8-91ab-a7762358d25e') + def test_filter_combo_42(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='589f4d3f-c644-4981-a0f8-cd9bcf4d5142') + def test_filter_combo_43(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': [1] + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='10ce4d36-081f-4353-a484-2c7988e7cda8') + def test_filter_combo_44(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='6f52f24d-adda-4e2d-b52e-1b24b978c343') + def test_filter_combo_45(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='5aacbec9-4a8b-4c76-9684-590a29f73854') + def test_filter_combo_46(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': [1] + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='e1fa3728-9acb-47e9-bea4-3ac886c68a22') + def test_filter_combo_47(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='9ce98edd-5f94-456c-8083-3dd37eefe086') + def test_filter_combo_48(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='cb93cdab-6443-4946-a7f6-9c34e0b21272') + def test_filter_combo_49(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': [1] + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='d9069a4d-8635-4b91-9a0f-31a64586a216') + def test_filter_combo_50(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='559f4f49-bd6a-4490-b8b3-da13ef57eb83') + def test_filter_combo_51(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='d769aa3c-c039-45f3-8ef7-f91ccbbcdfaf') + def test_filter_combo_52(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': [1] + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='4c6adf11-7c79-4a97-b507-cc8044d2c7c6') + def test_filter_combo_53(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='b99f7238-197b-4fb0-80a9-a51a20c00093') + def test_filter_combo_54(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='f1e3e036-b611-4325-81e2-114ad777d00e') + def test_filter_combo_55(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': [1] + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='9f786760-8a33-4076-b33e-38acc6689b5c') + def test_filter_combo_56(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='9e6466c3-ce73-471e-8b4a-dce1a1c9d046') + def test_filter_combo_57(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='b44f6d43-07cb-477d-bcc8-460cc2094475') + def test_filter_combo_58(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': [1] + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='38dcb64b-6564-4116-8abb-3a8e8ed530a9') + def test_filter_combo_59(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='b0918c1a-1291-482c-9ecb-2df085ec036f') + def test_filter_combo_60(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='6c317053-6fdc-45e1-9109-bd2726b2490f') + def test_filter_combo_61(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': [1] + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='af057157-3ef5-48af-918d-53ba6b2e8405') + def test_filter_combo_62(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='4693bb43-a4b6-4595-a75b-ff18c4be50c7') + def test_filter_combo_63(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='6e2037c1-5e99-4dc7-8950-5fd3df29fa08') + def test_filter_combo_64(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': [1] + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='a85acfbb-e6d2-42f4-b917-6b0bac26e457') + def test_filter_combo_65(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='d05f3aaa-833c-40a1-b3a0-c69756919218') + def test_filter_combo_66(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='1dd2b27b-f9fe-41e3-b884-3500d6bf9a38') + def test_filter_combo_67(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': [1] + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='e31e7d9d-878b-442e-9ae9-b07d5e903df3') + def test_filter_combo_68(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='05c05a71-27a4-4620-940b-ce3747d4e6c5') + def test_filter_combo_69(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='c4bb2251-1246-466b-a6bb-76ae13089101') + def test_filter_combo_70(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': [1] + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='b284008a-81be-42b6-8176-906a780f92a2') + def test_filter_combo_71(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='01bc025f-4696-4e80-a590-ec7b0eeea1a3') + def test_filter_combo_72(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='ef674d1e-f3b1-43fc-a037-718ffe650d12') + def test_filter_combo_73(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': [1] + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='cbc29a50-76fe-40b8-93fa-b274605660b2') + def test_filter_combo_74(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='0674b703-2571-4bcf-91f2-a34a323e179b') + def test_filter_combo_75(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='a65046b3-4aed-47f3-86cd-838155dfd309') + def test_filter_combo_76(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': [1] + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='a379dfdd-8924-4e62-95ac-14fe3ae358da') + def test_filter_combo_77(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='3ed6b73f-23fb-4ef2-8bd5-e59a34f362cd') + def test_filter_combo_78(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='9d3fc46a-07b7-48ad-9a31-fcdba259c670') + def test_filter_combo_79(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': [1] + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='9ba5e905-634f-485b-829c-1ef79fa5f116') + def test_filter_combo_80(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='b275ff76-eec5-467b-b12d-7440ff588cec') + def test_filter_combo_81(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='009ecb1c-2860-4a4e-867b-c712569ddfd1') + def test_filter_combo_82(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': [1] + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='61c7da36-6b19-49d2-9981-120bb0b76372') + def test_filter_combo_83(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='4c22688a-4d03-4145-aa2f-f989832f8086') + def test_filter_combo_84(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='cc159f43-5619-46fe-b8ad-209a446f10c0') + def test_filter_combo_85(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': [1] + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='9a81d52e-cd46-4e2b-9ac1-ecebcc04d788') + def test_filter_combo_86(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='938c404f-8dd8-46a5-afe4-f87559bb2c9d') + def test_filter_combo_87(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='4bc6a2db-e845-435d-8d8e-a990f4b1fcdc') + def test_filter_combo_88(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': [1] + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='e245fb6a-35fc-488f-ada6-393fe4a09134') + def test_filter_combo_89(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='4dd70ebf-ec85-4e95-a9f5-a10e1791293c') + def test_filter_combo_90(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='b0085042-0fd6-4ff3-af69-156f270953b1') + def test_filter_combo_91(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': [1] + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='6b9a539b-b6cc-46b1-a9a5-ef20808f5e74') + def test_filter_combo_92(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='1f18a94c-a72e-4912-a91a-0be96e708be4') + def test_filter_combo_93(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='9f2d3923-a932-40c8-b527-8baedcf3254c') + def test_filter_combo_94(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': [1] + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='edf61fa9-b51f-41fd-b3ca-0035ee7dbd65') + def test_filter_combo_95(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='8b8adcf5-adb9-4a48-8570-4e1d2e6b47c6') + def test_filter_combo_96(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='cc7857e0-5a5b-468f-bf5e-dc1478716715') + def test_filter_combo_97(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': [1] + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='b4c9e01f-944c-4d8e-9a3f-49efaa22887c') + def test_filter_combo_98(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='951e19cf-c138-4d8e-92e6-b42410b8114f') + def test_filter_combo_99(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='ad50f0c0-c19e-45b8-8fb2-95afe81f7620') + def test_filter_combo_100(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': [1] + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='a7fd36d6-77ec-453e-a67c-0c2fc78e572a') + def test_filter_combo_101(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='d661aafd-005d-4a31-88b0-a238e328b16d') + def test_filter_combo_102(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='7fe951d2-28c5-43a9-af79-c0fbf3a3388f') + def test_filter_combo_103(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': [1] + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='d802f38b-830f-4cd2-af2c-a44ba625a401') + def test_filter_combo_104(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='e1a30f67-1577-4cfb-9a0d-c07493a341b2') + def test_filter_combo_105(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='774a6bf9-cfd6-40ef-8b91-3576f23eb01b') + def test_filter_combo_106(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': [1] + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='b85d0c78-69bc-42e3-ac78-61ad8176a1d0') + def test_filter_combo_107(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='bd93c530-4ab0-4d9b-b202-ea6dd1c8a27d') + def test_filter_combo_108(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='4590bfbb-006f-46be-bd03-5afe8b81ac52') + def test_filter_combo_109(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': [1] + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='2626f60e-cb01-45a1-a23e-f1eaa85ac9ce') + def test_filter_combo_110(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='24cf16ac-10a6-4a02-9b72-84c280fa77a2') + def test_filter_combo_111(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='6242aadb-028b-4932-9024-8b6d2148c458') + def test_filter_combo_112(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': [1] + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='5918fef7-0578-4999-b331-d2948e62e720') + def test_filter_combo_113(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='63160fc2-306f-46a4-bf1f-b512642478c4') + def test_filter_combo_114(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='849749ae-e5f3-4029-be92-66a1353ba165') + def test_filter_combo_115(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': [1] + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='5f150448-94f6-4f0b-a8da-0c4a78541a4f') + def test_filter_combo_116(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='39af4eca-990a-4b3b-bcf2-1a840e8a9308') + def test_filter_combo_117(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='a59cb1fa-eb7d-4161-84a9-cda157b6b8c5') + def test_filter_combo_118(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': [1] + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='cfaf02e5-76e4-4593-849c-b63de4907638') + def test_filter_combo_119(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='9eb40c09-89ea-44e9-8514-e58cdce91779') + def test_filter_combo_120(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='e2d2a8d5-0554-49cc-9cc9-66e97378d260') + def test_filter_combo_121(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': [1] + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='cb72c86a-a7c6-4bf9-9eec-53f7d190a9f1') + def test_filter_combo_122(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='cb75e56e-a029-478d-8031-8de12f5fbebf') + def test_filter_combo_123(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='277a98c4-4b1f-428d-8c10-8697a3fe1f0f') + def test_filter_combo_124(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': [1] + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='2d884bf2-c678-429c-8aee-3be78b3176ff') + def test_filter_combo_125(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='e6b5fcff-8a6e-4eb7-9070-74caf9e18349') + def test_filter_combo_126(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='682ffa88-2d13-4d21-878e-c2a8a510cf71') + def test_filter_combo_127(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': [1] + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='a27d8f58-7523-404a-bf99-744afdb52aba') + def test_filter_combo_128(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='f2c77cf7-dc52-471d-b66d-54e72f7f7ea0') + def test_filter_combo_129(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='3e21ad66-88fc-48ee-a698-6c475f478a86') + def test_filter_combo_130(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': [1] + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='af046c81-524e-4016-b6a8-459538f320c2') + def test_filter_combo_131(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='f3aad5f8-6214-4c67-9a84-2da7171fb111') + def test_filter_combo_132(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='16ab8d79-15ca-4ab3-b004-834edb4da37b') + def test_filter_combo_133(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': [1] + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='cb37c6a3-496f-49a6-b02a-552b8260205e') + def test_filter_combo_134(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': True, + 'include_device_name': False, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='9e3ad4d0-4fab-4d85-9543-5e2c2fea79ec') + def test_filter_combo_135(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='37f93abf-237e-4917-91a6-afa2629b5f98') + def test_filter_combo_136(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': [1] + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='1131c908-ddf2-4cdd-b1a2-9b73990e72c3') + def test_filter_combo_137(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='1b283fa0-485b-4f45-a353-36f9cdd6c123') + def test_filter_combo_138(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='e4bdc84e-413c-4a2b-9049-f5b04e32b5b7') + def test_filter_combo_139(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': [1] + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='8791e036-3f30-4a44-b3a8-23371da893a6') + def test_filter_combo_140(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='27201535-9537-4e11-a1d7-1b1f5f01e213') + def test_filter_combo_141(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='e40e7b8f-44f0-4f87-8206-fea14d0fef52') + def test_filter_combo_142(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': [1] + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='0f369e78-c5ae-4cbc-8511-597cdc38b1ae') + def test_filter_combo_143(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='174418c1-6938-4319-9d8b-361df3fc28f3') + def test_filter_combo_144(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='6bc94d17-b532-413b-86fc-185c194b430c') + def test_filter_combo_145(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': [1] + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='3c47822e-5e74-4270-bcb4-72e3995bd5c5') + def test_filter_combo_146(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='19515def-b28d-4ef7-bae7-c4f64940879a') + def test_filter_combo_147(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='a45abd7c-24ca-400c-b2d5-233431b07522') + def test_filter_combo_148(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': [1] + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='4492a245-c91f-4df1-a55b-57541ce410c8') + def test_filter_combo_149(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='e4c485af-66a0-413b-b70e-3396e130fffb') + def test_filter_combo_150(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='31369cd6-feb7-47f3-9022-2d619c961ba7') + def test_filter_combo_151(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': [1] + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='5cf0da7f-a515-4f67-bae4-956d86275423') + def test_filter_combo_152(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='a78293f0-aee5-40d1-9c97-3fdda3ddd43e') + def test_filter_combo_153(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='3fd7d0cb-6d98-4ca8-9a14-8ca23b6dae07') + def test_filter_combo_154(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': [1] + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='19434f33-5bc5-427f-b332-36f85c997fe3') + def test_filter_combo_155(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='4195c9e1-b87c-4fa1-8039-ec0f2652e216') + def test_filter_combo_156(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='0536e50e-f33c-4772-b078-4f95231c3de6') + def test_filter_combo_157(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': [1] + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='116dcfef-caae-496f-abfa-0863f2968f6f') + def test_filter_combo_158(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='00f37533-9ca5-4c58-adb3-d3d709c7b215') + def test_filter_combo_159(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='d86e57da-29b5-445e-bf75-3e2843b9b739') + def test_filter_combo_160(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': [1] + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='792736ce-8f43-4d21-b9b9-30d3bfd66b6a') + def test_filter_combo_161(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': False, + 'include_device_name': False, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='ec387a8a-e7b2-4df7-9580-b09362c3dc4d') + def test_filter_combo_162(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='93a8f3b0-0fb0-47bd-88fb-6dc847ac14e4') + def test_filter_combo_163(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': [1] + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='283356e9-58ac-4edc-bf08-0bc9c7313053') + def test_filter_combo_164(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='ab4f0d84-58fd-4a2a-b3ed-128231f3e22f') + def test_filter_combo_165(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='02bbbdd0-3c57-41c5-ab32-28185f33802c') + def test_filter_combo_166(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': [1] + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='f6c67a80-bede-4186-b7a1-09756b4c1a68') + def test_filter_combo_167(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='4fc73f9c-4826-4ff2-bba0-bc64cc469f3a') + def test_filter_combo_168(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='58a6fafc-bbc5-466b-a586-310d9dfc14c1') + def test_filter_combo_169(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': [1] + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='38de3927-212c-4948-bd46-cca1d09ead90') + def test_filter_combo_170(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='b03a34cf-c3e1-4954-9cb6-b5f1a59e94e9') + def test_filter_combo_171(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='455ead9d-1e50-46e4-907c-c5b9bbbdcc9c') + def test_filter_combo_172(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': [1] + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='a7320afc-affb-4fa5-877d-7eb8bd1f8558') + def test_filter_combo_173(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='163c5c85-bef7-4da6-8e8a-89b0656b71d0') + def test_filter_combo_174(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='31147187-c5a9-4c2e-8be6-b79ff71cdaf3') + def test_filter_combo_175(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': [1] + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='783b5756-ca16-4a17-b1f0-8a16ddc009c4') + def test_filter_combo_176(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='924a107b-fe1c-4b9d-b29b-47c3b2df1de3') + def test_filter_combo_177(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='096a6596-fd8c-4d8c-88c6-45903047fe2c') + def test_filter_combo_178(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': [1] + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='e37b2083-a9d0-4337-aa11-d9205c15f456') + def test_filter_combo_179(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='3de8087b-7f25-4cda-8f07-fa9326524deb') + def test_filter_combo_180(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='f218bf14-0a6e-4c5f-b151-3ac9719ca1a2') + def test_filter_combo_181(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': [1] + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='1a13171d-b9a9-4b42-8cec-5c5841c4f3a5') + def test_filter_combo_182(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='53311ac1-239f-4033-aaa6-084523916fc6') + def test_filter_combo_183(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='f8bb89b2-2dae-4d41-9d19-6c9af0fe6da8') + def test_filter_combo_184(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': [1] + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='4747ab09-8d62-4866-80e6-c9b8e4cf5061') + def test_filter_combo_185(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='be6db894-57dd-452a-8f08-3ce462ac9417') + def test_filter_combo_186(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='2070329b-b7c8-4958-af9c-2e1044b71564') + def test_filter_combo_187(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': [1] + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='1a428d9e-46fd-4bd2-a12c-25c89ead74b1') + def test_filter_combo_188(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': True, + 'include_device_name': True, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='f07220c2-c0a9-471a-871d-a87931feb278') + def test_filter_combo_189(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='b3af8fb0-cd93-4ab0-b8f3-4111969c7cbb') + def test_filter_combo_190(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': [1] + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='b630cc10-4cda-487d-ab84-599963c172d7') + def test_filter_combo_191(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='9cdbe1df-e3e1-45e4-b816-96b8a6efb90f') + def test_filter_combo_192(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='10cd2757-a182-419f-9512-8b536539a134') + def test_filter_combo_193(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': [1] + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='5c7af5b2-8a2c-4c2d-911f-dad8216d849f') + def test_filter_combo_194(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='0acb37c7-0ece-4f5b-9294-014dd7fcb3ed') + def test_filter_combo_195(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='14f07972-6403-49be-8eed-ce7294e33d32') + def test_filter_combo_196(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': [1] + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='f2db7e80-d3ea-4beb-8e09-24ae33904716') + def test_filter_combo_197(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='30c1303f-956f-4b2d-af6a-3570aa4567fd') + def test_filter_combo_198(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='8e210748-f842-4fa1-ac40-2bfd291f08a1') + def test_filter_combo_199(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': [1] + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='756c687d-8183-4bc9-90dc-4e46a5579fca') + def test_filter_combo_200(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='8f904946-a9c7-4f7a-af96-0d22c5592709') + def test_filter_combo_201(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='abdfce9f-3529-435b-8fdc-9dd7bf0fc01c') + def test_filter_combo_202(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': [1] + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='71289aa2-f74d-44b7-ad18-515a3c438a15') + def test_filter_combo_203(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='223db6ca-7190-4f3f-89cc-92dcc2dcd109') + def test_filter_combo_204(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='8a61a11e-fc25-4e28-928d-e2be2d95af63') + def test_filter_combo_205(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': [1] + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='8c62bc17-6998-4ec8-923b-e29fe1693ae3') + def test_filter_combo_206(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': [1, 2], + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='85f168fa-a868-4940-aef1-de063a497083') + def test_filter_combo_207(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='7697ca45-fc34-4f8c-9b61-58cc7d4f3321') + def test_filter_combo_208(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': [1] + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='f5221c06-c006-4363-ab9c-90b9d8c31b43') + def test_filter_combo_209(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='b7119a2d-6269-408c-ae69-39ebad1e4192') + def test_filter_combo_210(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='2025037f-433b-4167-a0c9-3265a53fe6ba') + def test_filter_combo_211(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': [1] + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='ecf2c84b-88b0-48d9-8a4f-3660f039cd97') + def test_filter_combo_212(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_2, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='844a6bcb-cd5a-4023-9af7-cab68ed2e847') + def test_filter_combo_213(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': self.service_data_medium + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='b7e5ff94-93e0-45c9-a160-33628f5fcf9e') + def test_filter_combo_214(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': [1] + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='b9781df2-59e4-44ba-9a98-1d35670a6f63') + def test_filter_combo_215(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_3, + 'service_data_uuid': self.service_uuid_1, + 'manufacturer_specific_data': self.manu_specific_data_small_3, + 'include_tx_power_level': False, + 'include_device_name': True, + 'service_data': self.service_data_small_2 + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='4ad156f8-8d80-4635-b6d8-7bca07d8a899') + def test_filter_combo_216(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['high'], + 'is_connectable': True, + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['balanced'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='5b68c344-bfd1-44cb-9add-c81122d6b04f') + def test_filter_combo_217(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['low'], + 'is_connectable': True, + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['balanced'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='355ca57c-998c-4e7e-b0d2-66854b5192bb') + def test_filter_combo_218(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['ultra_low'], + 'is_connectable': True, + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['balanced'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='a9ec0f76-6b8f-42e0-8310-07c02de49d9d') + def test_filter_combo_219(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['medium'], + 'is_connectable': True, + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['balanced'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='73f448ff-e9f6-4608-80ba-92131485234f') + def test_filter_combo_220(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['high'], + 'is_connectable': True, + 'scan_mode': ble_scan_settings_modes['opportunistic'], + 'mode': ble_advertise_settings_modes['balanced'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='55ec509d-8cdd-4ab5-8e57-2ccadd5f8c0d') + def test_filter_combo_221(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['low'], + 'is_connectable': True, + 'scan_mode': ble_scan_settings_modes['opportunistic'], + 'mode': ble_advertise_settings_modes['balanced'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='1f6835fd-b33b-4be3-b133-b77f6c9872c8') + def test_filter_combo_222(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['ultra_low'], + 'is_connectable': True, + 'scan_mode': ble_scan_settings_modes['opportunistic'], + 'mode': ble_advertise_settings_modes['balanced'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='62d483c0-7d08-4b7c-9b1f-3b0324006554') + def test_filter_combo_223(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['medium'], + 'is_connectable': True, + 'scan_mode': ble_scan_settings_modes['opportunistic'], + 'mode': ble_advertise_settings_modes['balanced'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='01bcb867-3f39-4aef-baf5-50b439768b43') + def test_filter_combo_224(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['high'], + 'is_connectable': True, + 'scan_mode': ble_scan_settings_modes['balanced'], + 'mode': ble_advertise_settings_modes['balanced'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='faab6211-4408-4272-93d9-7b09b8c3b8cd') + def test_filter_combo_225(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['low'], + 'is_connectable': True, + 'scan_mode': ble_scan_settings_modes['balanced'], + 'mode': ble_advertise_settings_modes['balanced'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='a0f9ad8d-c00a-4420-9205-eeb081bf2b35') + def test_filter_combo_226(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['ultra_low'], + 'is_connectable': True, + 'scan_mode': ble_scan_settings_modes['balanced'], + 'mode': ble_advertise_settings_modes['balanced'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='7a2e8186-e8b0-4956-b8bc-fb2ba91b8f67') + def test_filter_combo_227(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['medium'], + 'is_connectable': True, + 'scan_mode': ble_scan_settings_modes['balanced'], + 'mode': ble_advertise_settings_modes['balanced'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='414b5464-b135-453b-acf3-aebc728d0366') + def test_filter_combo_228(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['high'], + 'is_connectable': True, + 'scan_mode': ble_scan_settings_modes['low_power'], + 'mode': ble_advertise_settings_modes['balanced'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='580e3ff8-4648-402e-a531-ddb85bbf4c89') + def test_filter_combo_229(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['low'], + 'is_connectable': True, + 'scan_mode': ble_scan_settings_modes['low_power'], + 'mode': ble_advertise_settings_modes['balanced'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='7fe0c829-94b5-4e88-aa92-47159c1eb232') + def test_filter_combo_230(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['ultra_low'], + 'is_connectable': True, + 'scan_mode': ble_scan_settings_modes['low_power'], + 'mode': ble_advertise_settings_modes['balanced'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='93c1747d-4b76-4faf-9efc-4ca40e751f08') + def test_filter_combo_231(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['medium'], + 'is_connectable': True, + 'scan_mode': ble_scan_settings_modes['low_power'], + 'mode': ble_advertise_settings_modes['balanced'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='96f7e662-6f74-407a-b1d8-e29ac3405ff4') + def test_filter_combo_232(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['high'], + 'is_connectable': True, + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='cde6415b-1138-4913-ab4f-542d4057542d') + def test_filter_combo_233(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['low'], + 'is_connectable': True, + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='4ca75288-0af8-462b-9146-022b9f915b1f') + def test_filter_combo_234(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['ultra_low'], + 'is_connectable': True, + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='4db5dae2-f974-4208-9c01-84ca050f8fc3') + def test_filter_combo_235(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['medium'], + 'is_connectable': True, + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='c9f7abf0-b333-4500-9fd0-e4678574cf18') + def test_filter_combo_236(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['high'], + 'is_connectable': True, + 'scan_mode': ble_scan_settings_modes['opportunistic'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='b8176ca4-478c-49c6-a638-4f53d7d2720c') + def test_filter_combo_237(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['low'], + 'is_connectable': True, + 'scan_mode': ble_scan_settings_modes['opportunistic'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='7e84c371-f28e-4995-86a9-bb99a4a29d0c') + def test_filter_combo_238(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['ultra_low'], + 'is_connectable': True, + 'scan_mode': ble_scan_settings_modes['opportunistic'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='3b8eb500-6885-4273-9c53-f7930896e895') + def test_filter_combo_239(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['medium'], + 'is_connectable': True, + 'scan_mode': ble_scan_settings_modes['opportunistic'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='f80ef69f-d71c-4c94-893d-363cf5a658f6') + def test_filter_combo_240(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['high'], + 'is_connectable': True, + 'scan_mode': ble_scan_settings_modes['balanced'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='dca1ab9d-7923-4917-8a82-1917dbad4923') + def test_filter_combo_241(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['low'], + 'is_connectable': True, + 'scan_mode': ble_scan_settings_modes['balanced'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='36faab09-d874-4f24-b7ea-8985d60dc4c3') + def test_filter_combo_242(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['ultra_low'], + 'is_connectable': True, + 'scan_mode': ble_scan_settings_modes['balanced'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='c94b7e3b-064c-4885-a4aa-899e83d0e754') + def test_filter_combo_243(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['medium'], + 'is_connectable': True, + 'scan_mode': ble_scan_settings_modes['balanced'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='f6680820-8843-47e4-b4fb-0ee1b76d51f8') + def test_filter_combo_244(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['high'], + 'is_connectable': True, + 'scan_mode': ble_scan_settings_modes['low_power'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='4b1bf9a9-7761-435a-8c6c-511b20312c04') + def test_filter_combo_245(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['low'], + 'is_connectable': True, + 'scan_mode': ble_scan_settings_modes['low_power'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='5c5b0147-cacd-46f0-a6b7-ff8b37cf985b') + def test_filter_combo_246(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['ultra_low'], + 'is_connectable': True, + 'scan_mode': ble_scan_settings_modes['low_power'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='c31e26f2-2e82-40bc-a9a5-5ae059b702d8') + def test_filter_combo_247(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['medium'], + 'is_connectable': True, + 'scan_mode': ble_scan_settings_modes['low_power'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='5a1a4438-6bb3-4acc-85ab-b48432c340db') + def test_filter_combo_248(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['high'], + 'is_connectable': False, + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['balanced'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='0dd54bff-d170-441f-81ae-bc11f7c8491b') + def test_filter_combo_249(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['low'], + 'is_connectable': False, + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['balanced'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='98d878cf-1548-4e79-9527-8741e5b523d0') + def test_filter_combo_250(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['ultra_low'], + 'is_connectable': False, + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['balanced'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='ec0c9a9b-3df3-4cba-84fc-9a17a11b1be7') + def test_filter_combo_251(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['medium'], + 'is_connectable': False, + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['balanced'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='eabddddc-29c7-4804-93a8-c259957538ae') + def test_filter_combo_252(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['high'], + 'is_connectable': False, + 'scan_mode': ble_scan_settings_modes['opportunistic'], + 'mode': ble_advertise_settings_modes['balanced'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='ee0abe8f-254e-4802-b808-4aa8e0306203') + def test_filter_combo_253(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['low'], + 'is_connectable': False, + 'scan_mode': ble_scan_settings_modes['opportunistic'], + 'mode': ble_advertise_settings_modes['balanced'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='9482cda2-a6f5-4dff-8809-6dfabaaf9f71') + def test_filter_combo_254(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['ultra_low'], + 'is_connectable': False, + 'scan_mode': ble_scan_settings_modes['opportunistic'], + 'mode': ble_advertise_settings_modes['balanced'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='279f54ee-975b-4edc-a6c8-f018e45846c3') + def test_filter_combo_255(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['medium'], + 'is_connectable': False, + 'scan_mode': ble_scan_settings_modes['opportunistic'], + 'mode': ble_advertise_settings_modes['balanced'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='a3508588-ca01-4063-ae7e-c845ac4a595b') + def test_filter_combo_256(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['high'], + 'is_connectable': False, + 'scan_mode': ble_scan_settings_modes['balanced'], + 'mode': ble_advertise_settings_modes['balanced'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='8bde1746-dec8-4b17-93ba-90448addcb13') + def test_filter_combo_257(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['low'], + 'is_connectable': False, + 'scan_mode': ble_scan_settings_modes['balanced'], + 'mode': ble_advertise_settings_modes['balanced'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='9ae7e798-0981-4501-9302-54553c76a54c') + def test_filter_combo_258(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['ultra_low'], + 'is_connectable': False, + 'scan_mode': ble_scan_settings_modes['balanced'], + 'mode': ble_advertise_settings_modes['balanced'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='28e1efdc-1c5f-44d8-8650-02720db32048') + def test_filter_combo_259(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['medium'], + 'is_connectable': False, + 'scan_mode': ble_scan_settings_modes['balanced'], + 'mode': ble_advertise_settings_modes['balanced'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='a309d9d0-bf5e-4878-b6bb-89d3c388d5b2') + def test_filter_combo_260(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['high'], + 'is_connectable': False, + 'scan_mode': ble_scan_settings_modes['low_power'], + 'mode': ble_advertise_settings_modes['balanced'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='b0db2d76-8039-4257-bed0-e5e154a5874f') + def test_filter_combo_261(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['low'], + 'is_connectable': False, + 'scan_mode': ble_scan_settings_modes['low_power'], + 'mode': ble_advertise_settings_modes['balanced'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='06ecd167-4dbc-4a8c-9c1c-2daea87f7a51') + def test_filter_combo_262(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['ultra_low'], + 'is_connectable': False, + 'scan_mode': ble_scan_settings_modes['low_power'], + 'mode': ble_advertise_settings_modes['balanced'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='12f6c002-8627-4477-8e5a-6d7b5335ed60') + def test_filter_combo_263(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['medium'], + 'is_connectable': False, + 'scan_mode': ble_scan_settings_modes['low_power'], + 'mode': ble_advertise_settings_modes['balanced'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='ccd43a09-cb39-4d84-8ffc-99ad8449783b') + def test_filter_combo_264(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['high'], + 'is_connectable': False, + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='f9d9abad-e543-4996-b369-09fddd9c4965') + def test_filter_combo_265(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['low'], + 'is_connectable': False, + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='2a14e619-23a6-4a49-acd6-e712b026d75b') + def test_filter_combo_266(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['ultra_low'], + 'is_connectable': False, + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='2ed25b96-54fd-4a81-b8d1-732b959aff8d') + def test_filter_combo_267(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['medium'], + 'is_connectable': False, + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='0ef9198b-78ac-4fa6-afe2-cc87007c2c0d') + def test_filter_combo_268(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['high'], + 'is_connectable': False, + 'scan_mode': ble_scan_settings_modes['opportunistic'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='43d97df2-07d7-4c45-bb83-908746e60923') + def test_filter_combo_269(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['low'], + 'is_connectable': False, + 'scan_mode': ble_scan_settings_modes['opportunistic'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='55262e57-7b47-45a3-8926-18cea480c2b2') + def test_filter_combo_270(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['ultra_low'], + 'is_connectable': False, + 'scan_mode': ble_scan_settings_modes['opportunistic'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='5ece141d-43ad-448c-900c-500666cb0e1c') + def test_filter_combo_271(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['medium'], + 'is_connectable': False, + 'scan_mode': ble_scan_settings_modes['opportunistic'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='66d3c0de-7e3b-4108-9ab0-3e101c6a14cd') + def test_filter_combo_272(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['high'], + 'is_connectable': False, + 'scan_mode': ble_scan_settings_modes['balanced'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='9703d50a-8b23-4d42-8ed3-9b0704dac9d2') + def test_filter_combo_273(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['low'], + 'is_connectable': False, + 'scan_mode': ble_scan_settings_modes['balanced'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='a5739a21-0e1b-4ba7-b259-acb7b38a8e09') + def test_filter_combo_274(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['ultra_low'], + 'is_connectable': False, + 'scan_mode': ble_scan_settings_modes['balanced'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='c399011c-54c0-47a1-9e05-a52c2190f89d') + def test_filter_combo_275(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['medium'], + 'is_connectable': False, + 'scan_mode': ble_scan_settings_modes['balanced'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='7854fdcc-5771-463a-91da-5b394484b065') + def test_filter_combo_276(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['high'], + 'is_connectable': False, + 'scan_mode': ble_scan_settings_modes['low_power'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='fa0fe141-c99f-4228-b249-96232194e740') + def test_filter_combo_277(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['low'], + 'is_connectable': False, + 'scan_mode': ble_scan_settings_modes['low_power'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='d2143fe1-bbec-429a-8241-19f39361b490') + def test_filter_combo_278(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['ultra_low'], + 'is_connectable': False, + 'scan_mode': ble_scan_settings_modes['low_power'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='21d025ef-2f89-49fd-bb31-2130dbe83c5c') + def test_filter_combo_279(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_tx_powers['medium'], + 'is_connectable': False, + 'scan_mode': ble_scan_settings_modes['low_power'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='19c5f91d-e10a-43af-8727-c66ee43187f2') + def test_filter_combo_280(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_tx_power_level': True} + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='7bda5df3-2644-46ca-b6de-e3d5557395cf') + def test_filter_combo_281(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'filter_device_address': True} + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='a80f6a40-9a60-4d68-b5e1-66d6e157cdd8') + def test_filter_combo_282(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='503bfb94-cfb8-4194-b451-23f19aff7b8e') + def test_filter_combo_283(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'manufacturer_specific_data': self.manu_sepecific_data_large + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='9bae0612-559b-460f-9723-fac896974835') + def test_filter_combo_284(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'manufacturer_specific_data_mask': [1] + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='f1ad0e3a-17cd-4e06-a395-7e5dde2268b4') + def test_filter_combo_285(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'service_data_uuid': '0000110A-0000-1000-8000-00805F9B34FB', + 'service_data': self.service_data_large + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='84f29360-9219-4f39-8ead-b43779c65504') + def test_filter_combo_286(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'service_data_uuid': '0000110B-0000-1000-8000-00805F9B34FB', + 'service_data': [13] + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='caece017-8379-46a3-913b-a21d3057e096') + def test_filter_combo_287(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'service_data_uuid': '0000110C-0000-1000-8000-00805F9B34FB', + 'service_data': [11, 14, 50] + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='37d63f4e-ed0c-4003-8044-f7032238a449') + def test_filter_combo_288(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'service_data_uuid': '0000110D-0000-1000-8000-00805F9B34FB', + 'service_data': [16, 22, 11] + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='7a57c0d7-1b8d-44e7-b407-7a6c58095058') + def test_filter_combo_289(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'service_data_uuid': '0000110E-0000-1000-8000-00805F9B34FB', + 'service_data': [2, 9, 54] + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='38f80b83-2aba-40f4-9238-7e108acea1e4') + def test_filter_combo_290(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'service_data_uuid': '0000110F-0000-1000-8000-00805F9B34FB', + 'service_data': [69, 11, 50] + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='adec5d6d-c1f2-46d0-8b05-2c46c02435a6') + def test_filter_combo_291(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'service_data_uuid': '00001101-0000-1000-8000-00805F9B34FB', + 'service_data': [12, 11, 21] + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='cd3cbc57-80a6-43d8-8042-9f163beda73a') + def test_filter_combo_292(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'service_data_uuid': '00001102-0000-1000-8000-00805F9B34FB', + 'service_data': [12, 12, 44] + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='35d9ab80-1ceb-4b45-ae9e-304c413f9273') + def test_filter_combo_293(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'service_data_uuid': '00001103-0000-1000-8000-00805F9B34FB', + 'service_data': [4, 54, 1] + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='07cecc9f-6e72-407e-a11d-c982f92c1834') + def test_filter_combo_294(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'service_data_uuid': '00001104-0000-1000-8000-00805F9B34FB', + 'service_data': [33, 22, 44] + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='8c0de318-4c57-47c3-8068-d1b0fde7f448') + def test_filter_combo_295(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'service_uuid': '00000000-0000-1000-8000-00805f9b34fb', + 'service_mask': '00000000-0000-1000-8000-00805f9b34fb' + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='8fbd96a9-5844-4714-8f63-5b92432d23d1') + def test_filter_combo_296(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'service_uuid': 'FFFFFFFF-0000-1000-8000-00805f9b34fb', + 'service_mask': '00000000-0000-1000-8000-00805f9b34fb' + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='d127b973-46ca-4a9f-a1e1-5cda6affaa53') + def test_filter_combo_297(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'service_uuid': '3846D7A0-69C8-11E4-BA00-0002A5D5C51B', + 'service_mask': '00000000-0000-1000-8000-00805f9b34fb' + } + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='efaad273-f953-43ca-b4f6-f9eba10d3ba5') + def test_filter_combo_298(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='373ba3e8-01e8-4c26-ad7f-7b7ba69d1a70') + def test_filter_combo_299(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_tx_power_level': True} + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='e1848bba-b9a6-473b-bceb-101b14b4ccc1') + def test_filter_combo_300(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'filter_device_address': True} + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='3a6068a5-0dd1-4503-b25a-79bc0f4a7006') + def test_filter_combo_301(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='c54e14e7-c5f6-4c16-9900-2b8ac9ee96a5') + def test_filter_combo_302(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'manufacturer_specific_data': self.manu_sepecific_data_large + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='bb188de9-8c63-4eba-96ab-b8577001412d') + def test_filter_combo_303(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'manufacturer_specific_data_id': self.manu_specific_data_id_1, + 'manufacturer_specific_data': self.manu_sepecific_data_small, + 'manufacturer_specific_data_mask': [1] + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='4e42416b-fe86-41e7-99cd-3ea0ab61a027') + def test_filter_combo_304(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'service_data_uuid': '0000110A-0000-1000-8000-00805F9B34FB', + 'service_data': self.service_data_large + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='a519609b-cd95-4017-adac-86954153669e') + def test_filter_combo_305(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'service_data_uuid': '0000110B-0000-1000-8000-00805F9B34FB', + 'service_data': [13] + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='ad1f5bdd-b532-482c-8f62-cc6804f0f8a2') + def test_filter_combo_306(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'service_data_uuid': '0000110C-0000-1000-8000-00805F9B34FB', + 'service_data': [11, 14, 50] + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='a44af1a3-f5ac-419b-a11b-a72734b57fa7') + def test_filter_combo_307(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'service_data_uuid': '0000110D-0000-1000-8000-00805F9B34FB', + 'service_data': [16, 22, 11] + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='1b2b17e7-5a1a-4795-974d-3a239c7fccc8') + def test_filter_combo_308(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'service_data_uuid': '0000110E-0000-1000-8000-00805F9B34FB', + 'service_data': [2, 9, 54] + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='9e9944cc-a85c-4077-9129-ca348a6c0286') + def test_filter_combo_309(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'service_data_uuid': '0000110F-0000-1000-8000-00805F9B34FB', + 'service_data': [69, 11, 50] + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='e0bb52ea-ac8f-4951-bd00-5322d0e72fd2') + def test_filter_combo_310(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'service_data_uuid': '00001101-0000-1000-8000-00805F9B34FB', + 'service_data': [12, 11, 21] + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='719d258d-6556-47b6-92d6-224c691b5dfd') + def test_filter_combo_311(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'service_data_uuid': '00001102-0000-1000-8000-00805F9B34FB', + 'service_data': [12, 12, 44] + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='1ab27561-6e2d-4da8-b2b1-dc4bd2c42f97') + def test_filter_combo_312(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'service_data_uuid': '00001103-0000-1000-8000-00805F9B34FB', + 'service_data': [4, 54, 1] + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='5b460a48-f6d6-469c-9553-11817171dacb') + def test_filter_combo_313(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'service_data_uuid': '00001104-0000-1000-8000-00805F9B34FB', + 'service_data': [33, 22, 44] + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='e0439501-b72d-43ac-a51f-c44b4d0c86d9') + def test_filter_combo_314(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'service_uuid': '00000000-0000-1000-8000-00805f9b34fb', + 'service_mask': '00000000-0000-1000-8000-00805f9b34fb' + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='3a7f4527-2a77-4172-8402-78d90fbc5a8a') + def test_filter_combo_315(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'service_uuid': 'FFFFFFFF-0000-1000-8000-00805f9b34fb', + 'service_mask': '00000000-0000-1000-8000-00805f9b34fb' + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='c6661021-33ad-4628-99f0-1a3b4b4a8263') + def test_filter_combo_316(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = { + 'service_uuid': '3846D7A0-69C8-11E4-BA00-0002A5D5C51B', + 'service_mask': '00000000-0000-1000-8000-00805f9b34fb' + } + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='3a633941-1716-4bf6-a8d7-8a4ad0be24aa') + def test_filter_combo_317(self): + """Test a combination scan filter and advertisement + + Test that an advertisement is found and matches corresponding + settings. + + Steps: + 1. Create a advertise data object + 2. Create a advertise settings object. + 3. Create a advertise callback object. + 4. Start an LE advertising using the objects created in steps 1-3. + 5. Find the onSuccess advertisement event. + + Expected Result: + Advertisement is successfully advertising. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + filters = {'include_device_name': True} + settings_in_effect = { + 'scan_mode': ble_scan_settings_modes['low_latency'], + 'mode': ble_advertise_settings_modes['low_latency'] + } + return self._magic((filters, settings_in_effect)) + + def _blescan_verify_onscanresult_event(self, event, filters): + test_result = True + self.log.debug("Verifying onScanResult event: {}".format(event)) + callback_type = event['data']['CallbackType'] + if 'callback_type' in filters.keys(): + if filters['callback_type'] != callback_type: + self.log.error("Expected callback type: {}, Found callback " + "type: {}".format(filters['callback_type'], + callback_type)) + test_result = False + elif self.default_callback != callback_type: + self.log.error("Expected callback type: {}, Found callback type: " + "{}".format(self.default_callback, callback_type)) + test_result = False + if 'include_device_name' in filters.keys() and filters[ + 'include_device_name'] is not False: + if event['data']['Result']['deviceName'] != filters[ + 'include_device_name']: + self.log.error( + "Expected device name: {}, Found device name: {}" + .format(filters['include_device_name'], event['data'][ + 'Result']['deviceName'])) + + test_result = False + elif 'deviceName' in event['data']['Result'].keys(): + self.log.error( + "Device name was found when it wasn't meant to be included.") + test_result = False + if ('include_tx_power_level' in filters.keys() and + filters['include_tx_power_level'] is not False): + if not event['data']['Result']['txPowerLevel']: + self.log.error( + "Expected to find tx power level in event but found none.") + test_result = False + if not event['data']['Result']['rssi']: + self.log.error("Expected rssi in the advertisement, found none.") + test_result = False + if not event['data']['Result']['timestampNanos']: + self.log.error("Expected rssi in the advertisement, found none.") + test_result = False + return test_result + + def _bleadvertise_verify_onsuccess(self, event, settings_in_effect): + self.log.debug("Verifying {} event".format(adv_succ)) + test_result = True + if 'is_connectable' in settings_in_effect.keys(): + if (event['data']['SettingsInEffect']['isConnectable'] != + settings_in_effect['is_connectable']): + self.log.error("Expected is connectable value: {}, Actual is " + "connectable value:".format(settings_in_effect[ + 'is_connectable'], event['data'][ + 'SettingsInEffect']['isConnectable'])) + test_result = False + elif (event['data']['SettingsInEffect']['isConnectable'] != + self.default_is_connectable): + self.log.error( + "Default value for isConnectable did not match what was found.") + test_result = False + if 'mode' in settings_in_effect.keys(): + if (event['data']['SettingsInEffect']['mode'] != + settings_in_effect['mode']): + self.log.error("Expected mode value: {}, Actual mode value: {}" + .format(settings_in_effect['mode'], event[ + 'data']['SettingsInEffect']['mode'])) + test_result = False + elif (event['data']['SettingsInEffect']['mode'] != + self.default_advertise_mode): + self.log.error( + "Default value for filtering mode did not match what was " + "found.") + test_result = False + if 'tx_power_level' in settings_in_effect.keys(): + if (event['data']['SettingsInEffect']['txPowerLevel'] == + java_integer['min']): + self.log.error("Expected tx power level was not meant to be: " + "{}".format(java_integer['min'])) + test_result = False + elif (event['data']['SettingsInEffect']['txPowerLevel'] != + self.default_tx_power_level): + self.log.error( + "Default value for tx power level did not match what" + " was found.") + test_result = False + return test_result + + def _magic(self, params): + (filters, settings_in_effect) = params + test_result = True + + self.log.debug("Settings in effect: {}".format( + pprint.pformat(settings_in_effect))) + self.log.debug("Filters:".format(pprint.pformat(filters))) + if 'is_connectable' in settings_in_effect.keys(): + self.log.debug("Setting advertisement is_connectable to {}".format( + settings_in_effect['is_connectable'])) + self.adv_ad.droid.bleSetAdvertiseSettingsIsConnectable( + settings_in_effect['is_connectable']) + if 'mode' in settings_in_effect.keys(): + self.log.debug("Setting advertisement mode to {}" + .format(settings_in_effect['mode'])) + self.adv_ad.droid.bleSetAdvertiseSettingsAdvertiseMode( + settings_in_effect['mode']) + if 'tx_power_level' in settings_in_effect.keys(): + self.log.debug("Setting advertisement tx_power_level to {}".format( + settings_in_effect['tx_power_level'])) + self.adv_ad.droid.bleSetAdvertiseSettingsTxPowerLevel( + settings_in_effect['tx_power_level']) + filter_list = self.scn_ad.droid.bleGenFilterList() + if ('include_device_name' in filters.keys() and + filters['include_device_name'] is not False): + + self.log.debug("Setting advertisement include_device_name to {}" + .format(filters['include_device_name'])) + self.adv_ad.droid.bleSetAdvertiseDataIncludeDeviceName(True) + filters['include_device_name'] = ( + self.adv_ad.droid.bluetoothGetLocalName()) + self.log.debug("Setting scanner include_device_name to {}".format( + filters['include_device_name'])) + self.scn_ad.droid.bleSetScanFilterDeviceName(filters[ + 'include_device_name']) + else: + self.log.debug( + "Setting advertisement include_device_name to False") + self.adv_ad.droid.bleSetAdvertiseDataIncludeDeviceName(False) + if ('include_tx_power_level' in filters.keys() and + filters['include_tx_power_level'] is not False): + self.log.debug( + "Setting advertisement include_tx_power_level to True") + self.adv_ad.droid.bleSetAdvertiseDataIncludeTxPowerLevel(True) + if 'manufacturer_specific_data_id' in filters.keys(): + if 'manufacturer_specific_data_mask' in filters.keys(): + self.adv_ad.droid.bleAddAdvertiseDataManufacturerId( + filters['manufacturer_specific_data_id'], + filters['manufacturer_specific_data']) + self.scn_ad.droid.bleSetScanFilterManufacturerData( + filters['manufacturer_specific_data_id'], + filters['manufacturer_specific_data'], + filters['manufacturer_specific_data_mask']) + else: + self.adv_ad.droid.bleAddAdvertiseDataManufacturerId( + filters['manufacturer_specific_data_id'], + filters['manufacturer_specific_data']) + self.scn_ad.droid.bleSetScanFilterManufacturerData( + filters['manufacturer_specific_data_id'], + filters['manufacturer_specific_data']) + if 'service_data' in filters.keys(): + self.adv_ad.droid.bleAddAdvertiseDataServiceData( + filters['service_data_uuid'], filters['service_data']) + self.scn_ad.droid.bleSetScanFilterServiceData( + filters['service_data_uuid'], filters['service_data']) + if 'manufacturer_specific_data_list' in filters.keys(): + for pair in filters['manufacturer_specific_data_list']: + (manu_id, manu_data) = pair + self.adv_ad.droid.bleAddAdvertiseDataManufacturerId(manu_id, + manu_data) + if 'service_mask' in filters.keys(): + self.scn_ad.droid.bleSetScanFilterServiceUuid( + filters['service_uuid'].upper(), filters['service_mask']) + self.adv_ad.droid.bleSetAdvertiseDataSetServiceUuids( + [filters['service_uuid'].upper()]) + elif 'service_uuid' in filters.keys(): + self.scn_ad.droid.bleSetScanFilterServiceUuid(filters[ + 'service_uuid']) + self.adv_ad.droid.bleSetAdvertiseDataSetServiceUuids( + [filters['service_uuid']]) + self.scn_ad.droid.bleBuildScanFilter(filter_list) + advertise_callback, advertise_data, advertise_settings = ( + generate_ble_advertise_objects(self.adv_ad.droid)) + if ('scan_mode' in settings_in_effect and + settings_in_effect['scan_mode'] != + ble_scan_settings_modes['opportunistic']): + self.scn_ad.droid.bleSetScanSettingsScanMode(settings_in_effect[ + 'scan_mode']) + else: + self.scn_ad.droid.bleSetScanSettingsScanMode( + ble_scan_settings_modes['low_latency']) + scan_settings = self.scn_ad.droid.bleBuildScanSetting() + scan_callback = self.scn_ad.droid.bleGenScanCallback() + self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, + scan_callback) + opportunistic = False + scan_settings2, scan_callback2 = None, None + if ('scan_mode' in settings_in_effect and + settings_in_effect['scan_mode'] == + ble_scan_settings_modes['opportunistic']): + opportunistic = True + scan_settings2 = self.scn_ad.droid.bleBuildScanSetting() + scan_callback2 = self.scn_ad.droid.bleGenScanCallback() + self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings2, + scan_callback2) + self.scn_ad.droid.bleSetScanSettingsScanMode( + ble_scan_settings_modes['opportunistic']) + self.adv_ad.droid.bleStartBleAdvertising( + advertise_callback, advertise_data, advertise_settings) + regex = "(" + adv_succ.format( + advertise_callback) + "|" + adv_fail.format( + advertise_callback) + ")" + self.log.debug(regex) + try: + event = self.adv_ad.ed.pop_events(regex, self.default_timeout, + small_timeout) + except Empty: + self.adv_ad.log.error("Failed to get success or failed event.") + return False + if event[0]["name"] == adv_succ.format(advertise_callback): + if not self._bleadvertise_verify_onsuccess(event[0], + settings_in_effect): + return False + else: + self.adv_ad.log.info("Advertisement started successfully.") + else: + self.adv_ad.log.error("Failed to start advertisement: {}".format( + event[0]["data"]["Error"])) + expected_scan_event_name = scan_result.format(scan_callback) + try: + event = self.scn_ad.ed.pop_event(expected_scan_event_name, + self.default_timeout) + except Empty: + self.log.error("Scan event not found: {}".format( + expected_scan_event_name)) + return False + if not self._blescan_verify_onscanresult_event(event, filters): + return False + if opportunistic: + expected_scan_event_name = scan_result.format(scan_callback2) + try: + event = self.scn_ad.ed.pop_event(expected_scan_event_name, + self.default_timeout) + except Empty: + self.log.error("Opportunistic scan event not found: {}".format( + expected_scan_event_name)) + return False + if not self._blescan_verify_onscanresult_event(event, filters): + return False + self.scn_ad.droid.bleStopBleScan(scan_callback2) + self.adv_ad.droid.bleStopBleAdvertising(advertise_callback) + self.scn_ad.droid.bleStopBleScan(scan_callback) + return test_result diff --git a/acts_tests/tests/google/ble/filtering/UniqueFilteringTest.py b/acts_tests/tests/google/ble/filtering/UniqueFilteringTest.py index e69de29bb2..c2e837c567 100644 --- a/acts_tests/tests/google/ble/filtering/UniqueFilteringTest.py +++ b/acts_tests/tests/google/ble/filtering/UniqueFilteringTest.py @@ -0,0 +1,650 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2016 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +""" +This test script exercises different filters and outcomes not exercised in +FilteringTest. +""" + +import concurrent +import json +import pprint +import time + +from queue import Empty +from acts.test_decorators import test_tracker_info +from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest +from acts.test_utils.bt.bt_constants import ble_advertise_settings_modes +from acts.test_utils.bt.bt_constants import ble_scan_settings_modes +from acts.test_utils.bt.bt_test_utils import generate_ble_advertise_objects +from acts.test_utils.bt.bt_test_utils import generate_ble_scan_objects +from acts.test_utils.bt.bt_constants import adv_succ +from acts.test_utils.bt.bt_constants import batch_scan_result +from acts.test_utils.bt.bt_constants import scan_result + + +class UniqueFilteringTest(BluetoothBaseTest): + default_timeout = 10 + + def setup_class(self): + super().setup_class() + self.scn_ad = self.android_devices[0] + self.adv_ad = self.android_devices[1] + + def blescan_verify_onfailure_event_handler(self, event): + self.log.debug("Verifying onFailure event") + self.log.debug(pprint.pformat(event)) + return event + + def blescan_verify_onscanresult_event_handler(self, + event, + expected_callbacktype=None, + system_time_nanos=None): + test_result = True + self.log.debug("Verifying onScanResult event") + self.log.debug(pprint.pformat(event)) + callbacktype = event['data']['CallbackType'] + if callbacktype != expected_callbacktype: + self.log.debug( + "Expected callback type: {}, Found callback type: {}".format( + expected_callbacktype, callbacktype)) + test_result = False + return test_result + + def blescan_get_mac_address_event_handler(self, event): + return event['data']['Result']['deviceInfo']['address'] + + def blescan_verify_onbatchscanresult_event_handler( + self, event, system_time_nanos=None, report_delay_nanos=None): + test_result = True + self.log.debug("Verifying onBatchScanResult event") + self.log.debug(pprint.pformat(event)) + for result in event['data']['Results']: + timestamp_nanos = result['timestampNanos'] + length_of_time = timestamp_nanos - system_time_nanos + self.log.debug("Difference in time in between scan start and " + "onBatchScanResult: {}".format(length_of_time)) + buffer = 1000000000 # 1 second + if length_of_time > (report_delay_nanos + buffer): + self.log.debug( + "Difference was greater than the allowable difference.") + test_result = False + return test_result + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='c3764358-cd65-451c-9a2d-4bfb6cf98f48') + def test_scan_flush_pending_scan_results(self): + """Test LE scan api flush pending results. + + Test that flush pending scan results doesn't affect onScanResults from + triggering. + + Steps: + 1. Setup the scanning android device. + 2. Setup the advertiser android devices. + 3. Trigger bluetoothFlushPendingScanResults on the scanning droid. + 4. Verify that only one onScanResults callback was triggered. + + Expected Result: + After flushing pending scan results, make sure only one onScanResult + callback was triggered. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 1 + """ + test_result = True + self.adv_ad.droid.bleSetAdvertiseDataIncludeDeviceName(True) + self.adv_ad.droid.bleSetAdvertiseSettingsAdvertiseMode( + ble_advertise_settings_modes['low_latency']) + filter_list, scan_settings, scan_callback = generate_ble_scan_objects( + self.scn_ad.droid) + expected_event_name = scan_result.format(scan_callback) + advertise_callback, advertise_data, advertise_settings = ( + generate_ble_advertise_objects(self.adv_ad.droid)) + self.adv_ad.droid.bleStartBleAdvertising( + advertise_callback, advertise_data, advertise_settings) + self.scn_ad.droid.bleSetScanFilterDeviceName( + self.adv_ad.droid.bluetoothGetLocalName()) + self.scn_ad.droid.bleBuildScanFilter(filter_list) + + self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, + scan_callback) + self.scn_ad.droid.bleFlushPendingScanResults(scan_callback) + worker = self.scn_ad.ed.handle_event( + self.blescan_verify_onscanresult_event_handler, + expected_event_name, ([1]), self.default_timeout) + try: + self.log.debug(worker.result(self.default_timeout)) + except Empty as error: + test_result = False + self.log.error("Test failed with Empty error: {}".format(error)) + except concurrent.futures._base.TimeoutError as error: + test_result = False + self.log.error("Test failed with TimeoutError: {}".format(error)) + self.scn_ad.droid.bleStopBleScan(scan_callback) + self.adv_ad.droid.bleStopBleAdvertising(advertise_callback) + return test_result + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='4b358654-db69-4b51-98ec-7599aee2db10') + def test_scan_trigger_on_batch_scan_results(self): + """Test triggering batch scan results. + + Test that triggers onBatchScanResults and verifies the time to trigger + within one second leeway. + + Steps: + 1. Setup the scanning android device with report delay seconds set to + 5000. + 2. Setup the advertiser android devices. + 3. Verify that only one onBatchScanResult callback was triggered. + 4. Compare the system time that the scan was started with the elapsed + time that is in the callback. + + Expected Result: + The scan event dispatcher should find an onBatchScanResult event. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning, Batch Scanning + Priority: 2 + """ + test_result = True + self.scn_ad.droid.bleSetScanSettingsReportDelayMillis(5000) + filter_list, scan_settings, scan_callback = generate_ble_scan_objects( + self.scn_ad.droid) + expected_event_name = batch_scan_result.format(scan_callback) + self.adv_ad.droid.bleSetAdvertiseDataIncludeDeviceName(True) + self.adv_ad.droid.bleSetAdvertiseDataIncludeTxPowerLevel(True) + advertise_callback, advertise_data, advertise_settings = ( + generate_ble_advertise_objects(self.adv_ad.droid)) + self.adv_ad.droid.bleStartBleAdvertising( + advertise_callback, advertise_data, advertise_settings) + self.scn_ad.droid.bleSetScanFilterDeviceName( + self.adv_ad.droid.bluetoothGetLocalName()) + self.scn_ad.droid.bleBuildScanFilter(filter_list) + self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, + scan_callback) + system_time_nanos = self.scn_ad.droid.getSystemElapsedRealtimeNanos() + self.log.debug("Current system time: {}".format(system_time_nanos)) + worker = self.scn_ad.ed.handle_event( + self.blescan_verify_onbatchscanresult_event_handler, + expected_event_name, ([system_time_nanos, 5000000000]), + self.default_timeout) + try: + self.log.debug(worker.result(self.default_timeout)) + except Empty as error: + test_result = False + self.log.debug("Test failed with: {}".format(error)) + except concurrent.futures._base.TimeoutError as error: + test_result = False + self.log.debug("Test failed with: {}".format(error)) + self.scn_ad.droid.bleStopBleScan(scan_callback) + self.adv_ad.droid.bleStopBleAdvertising(advertise_callback) + return test_result + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='94dbe8b2-9e7f-4da4-973e-5162b84a7ce0') + def test_scan_flush_results_without_on_batch_scan_results_triggered(self): + """Test that doesn't expect a batch scan result. + + Test flush pending scan results with a report delay seconds set to 0. + No onBatchScanResults callback should be triggered. + + Steps: + 1. Setup the scanning android device with report delay seconds set to 0 + (or just use default). + 2. Setup the advertiser android devices. + + Expected Result: + Verify that no onBatchScanResults were triggered. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning, Batch Scanning + Priority: 2 + """ + test_result = True + filter_list, scan_settings, scan_callback = generate_ble_scan_objects( + self.scn_ad.droid) + expected_event_name = batch_scan_result.format(scan_callback) + self.adv_ad.droid.bleSetAdvertiseDataIncludeDeviceName(True) + advertise_callback, advertise_data, advertise_settings = ( + generate_ble_advertise_objects(self.adv_ad.droid)) + self.adv_ad.droid.bleStartBleAdvertising( + advertise_callback, advertise_data, advertise_settings) + self.scn_ad.droid.bleSetScanFilterDeviceName( + self.adv_ad.droid.bluetoothGetLocalName()) + self.scn_ad.droid.bleBuildScanFilter(filter_list) + self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, + scan_callback) + worker = self.scn_ad.ed.handle_event( + self.blescan_verify_onbatchscanresult_event_handler, + expected_event_name, ([]), self.default_timeout) + self.scn_ad.droid.bleFlushPendingScanResults(scan_callback) + try: + event_info = self.scn_ad.ed.pop_event(expected_event_name, 10) + self.log.debug( + "Unexpectedly found an advertiser: {}".format(event_info)) + test_result = False + except Empty: + self.log.debug("No {} events were found as expected.".format( + batch_scan_result)) + self.scn_ad.droid.bleStopBleScan(scan_callback) + self.adv_ad.droid.bleStopBleAdvertising(advertise_callback) + return test_result + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='5856882e-3d82-4a6f-b110-389086b0ac41') + def test_scan_non_existent_name_filter(self): + """Test non-existent name filter. + + Test scan filter on non-existent device name. + + Steps: + 1. Setup the scanning android device with scan filter for device name + set to an unexpected value. + 2. Setup the advertiser android devices. + 3. Verify that no onScanResults were triggered. + + Expected Result: + No advertisements were found. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + test_result = True + filter_name = "{}_probably_wont_find".format( + self.adv_ad.droid.bluetoothGetLocalName()) + self.adv_ad.droid.bleSetAdvertiseDataIncludeDeviceName(True) + self.scn_ad.droid.bleSetScanFilterDeviceName(filter_name) + filter_list, scan_settings, scan_callback = generate_ble_scan_objects( + self.scn_ad.droid) + self.scn_ad.droid.bleBuildScanFilter(filter_list) + expected_event_name = scan_result.format(scan_callback) + self.adv_ad.droid.bleSetAdvertiseDataIncludeDeviceName(True) + self.adv_ad.droid.bleSetAdvertiseDataIncludeTxPowerLevel(True) + advertise_callback, advertise_data, advertise_settings = ( + generate_ble_advertise_objects(self.adv_ad.droid)) + self.adv_ad.droid.bleStartBleAdvertising( + advertise_callback, advertise_data, advertise_settings) + self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, + scan_callback) + try: + event_info = self.scn_ad.ed.pop_event(expected_event_name, + self.default_timeout) + self.log.error( + "Unexpectedly found an advertiser: {}".format(event_info)) + test_result = False + except Empty: + self.log.debug("No events were found as expected.") + self.scn_ad.droid.bleStopBleScan(scan_callback) + self.adv_ad.droid.bleStopBleAdvertising(advertise_callback) + return test_result + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='0a54c50b-d4ef-4d8c-8328-775781aab2c7') + def test_scan_advertisement_with_device_service_uuid_filter_expect_no_events( + self): + """Test scan filtering against an advertisement with no data. + + Test that exercises a service uuid filter on the scanner but no server + uuid added to the advertisement. + + Steps: + 1. Setup the scanning android device with scan filter including a + service uuid and mask. + 2. Setup the advertiser android devices. + 3. Verify that no onScanResults were triggered. + + Expected Result: + Verify no advertisements found. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 1 + """ + test_result = True + service_uuid = "00000000-0000-1000-8000-00805F9B34FB" + service_mask = "00000000-0000-1000-8000-00805F9B34FA" + self.scn_ad.droid.bleSetScanFilterServiceUuid(service_uuid, + service_mask) + self.adv_ad.droid.bleSetAdvertiseSettingsAdvertiseMode( + ble_advertise_settings_modes['low_latency']) + filter_list, scan_settings, scan_callback = generate_ble_scan_objects( + self.scn_ad.droid) + expected_event_name = scan_result.format(scan_callback) + self.adv_ad.droid.bleSetAdvertiseDataIncludeDeviceName(True) + self.adv_ad.droid.bleSetAdvertiseDataIncludeTxPowerLevel(True) + advertise_callback, advertise_data, advertise_settings = ( + generate_ble_advertise_objects(self.adv_ad.droid)) + self.adv_ad.droid.bleStartBleAdvertising( + advertise_callback, advertise_data, advertise_settings) + self.scn_ad.droid.bleSetScanFilterDeviceName( + self.adv_ad.droid.bluetoothGetLocalName()) + self.scn_ad.droid.bleBuildScanFilter(filter_list) + self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, + scan_callback) + worker = self.scn_ad.ed.handle_event( + self.blescan_verify_onscanresult_event_handler, + expected_event_name, ([1]), self.default_timeout) + try: + event_info = self.scn_ad.ed.pop_event(expected_event_name, + self.default_timeout) + self.log.error( + "Unexpectedly found an advertiser: {}".format(event_info)) + test_result = False + except Empty as error: + self.log.debug("No events were found as expected.") + self.scn_ad.droid.bleStopBleScan(scan_callback) + self.adv_ad.droid.bleStopBleAdvertising(advertise_callback) + return test_result + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='aefbc70c-ea46-4a63-a627-6fcceb72ac9e') + def test_scan_filtering_multiple_advertisements_manufacturer_data(self): + """Test scan filtering against multiple varying advertisements. + + Test scan filtering against multiple varying advertisements. The first + advertisement will have partial manufacturer data that matches the + the full manufacturer data in the second advertisement. + + Steps: + 1. Setup up an advertisement with manufacturer data [1,2,3]. + 2. Setup a second advertisement with manufacturer data + [1,2,3,4,5,6,7,8]. + 3. Start advertising on each advertisement. + 4. Create a scan filter that includes manufacturer data [1,2,3]. + + Expected Result: + TBD. Right now Shamu finds only the first advertisement with + manufacturer data [1,2,3]. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 2 + """ + test_result = True + self.adv_ad.droid.bleSetAdvertiseSettingsAdvertiseMode( + ble_advertise_settings_modes['low_latency']) + self.adv_ad.droid.bleAddAdvertiseDataManufacturerId(117, [1, 2, 3]) + advertise_callback, advertise_data, advertise_settings = ( + generate_ble_advertise_objects(self.adv_ad.droid)) + self.adv_ad.droid.bleSetAdvertiseSettingsAdvertiseMode( + ble_advertise_settings_modes['low_latency']) + self.adv_ad.droid.bleAddAdvertiseDataManufacturerId( + 117, [1, 2, 3, 4, 5, 6, 7, 8]) + advertise_callback1, advertise_data1, advertise_settings1 = ( + generate_ble_advertise_objects(self.adv_ad.droid)) + self.adv_ad.droid.bleStartBleAdvertising( + advertise_callback, advertise_data, advertise_settings) + self.adv_ad.droid.bleStartBleAdvertising( + advertise_callback1, advertise_data1, advertise_settings1) + + filter_list = self.scn_ad.droid.bleGenFilterList() + self.scn_ad.droid.bleSetScanSettingsScanMode( + ble_scan_settings_modes['low_latency']) + scan_settings = self.scn_ad.droid.bleBuildScanSetting() + scan_callback = self.scn_ad.droid.bleGenScanCallback() + self.scn_ad.droid.bleSetScanFilterManufacturerData( + 117, [1, 2, 3], [127, 127, 127]) + self.scn_ad.droid.bleBuildScanFilter(filter_list) + self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, + scan_callback) + return test_result + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='cdbeeb8e-895e-4d11-9e42-7b89ff6917ce') + def test_scan_filter_device_address(self): + """Test scan filtering of a device address. + + This test will have to create two scanning instances. The first will + have no filters and will find the generic advertisement's mac address. + The second will have a filter of the found mac address. + + Steps: + 1. Start a generic advertisement. + 2. Start a generic scanner. + 3. Find the advertisement and extract the mac address. + 4. Stop the first scanner. + 5. Create a new scanner with scan filter with a mac address filter of + what was found in step 3. + 6. Start the scanner. + + Expected Result: + Verify that the advertisement was found in the second scan instance. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 1 + """ + test_result = True + self.scn_ad.droid.bleSetScanSettingsScanMode( + ble_scan_settings_modes['low_latency']) + filter_list, scan_settings, scan_callback = generate_ble_scan_objects( + self.scn_ad.droid) + expected_event_name = scan_result.format(scan_callback) + self.adv_ad.droid.bleSetAdvertiseSettingsAdvertiseMode( + ble_advertise_settings_modes['low_latency']) + self.adv_ad.droid.bleSetAdvertiseDataIncludeDeviceName(True) + advertise_callback, advertise_data, advertise_settings = ( + generate_ble_advertise_objects(self.adv_ad.droid)) + self.adv_ad.droid.bleStartBleAdvertising( + advertise_callback, advertise_data, advertise_settings) + self.scn_ad.droid.bleSetScanFilterDeviceName( + self.adv_ad.droid.bluetoothGetLocalName()) + self.scn_ad.droid.bleBuildScanFilter(filter_list) + self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, + scan_callback) + try: + event_info = self.scn_ad.ed.pop_event(expected_event_name, + self.default_timeout) + except Empty as error: + self.log.error("Could not find initial advertisement.") + return False + mac_address = event_info['data']['Result']['deviceInfo']['address'] + self.log.info( + "Filter advertisement with address {}".format(mac_address)) + self.scn_ad.droid.bleStopBleScan(scan_callback) + self.scn_ad.droid.bleSetScanSettingsScanMode( + ble_scan_settings_modes['low_latency']) + self.scn_ad.droid.bleSetScanFilterDeviceAddress(mac_address) + filter_list2, scan_settings2, scan_callback2 = ( + generate_ble_scan_objects(self.scn_ad.droid)) + + self.scn_ad.droid.bleBuildScanFilter(filter_list2) + self.scn_ad.droid.bleStartBleScan(filter_list2, scan_settings2, + scan_callback2) + expected_event_name = scan_result.format(scan_callback2) + found_event = self.scn_ad.ed.pop_event(expected_event_name, + self.default_timeout) + if (found_event['data']['Result']['deviceInfo']['address'] != + mac_address): + test_result = False + self.scn_ad.droid.bleStopBleScan(scan_callback2) + self.adv_ad.droid.bleStopBleAdvertising(advertise_callback) + return test_result + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='a4921d7b-cdd5-4d52-834c-f4bb85a9e2e8') + def test_filter_simulated_ibeacon(self): + """Test scan filtering of a simulated ibeacon. + + This test will setup one Android device as an ibeacon and + a second Android device will be used to test filtering of + the manufacturer data for 60 seconds. + + Steps: + 1. Start an advertisement with manufacturer id set to 0x004c + 2. Start a generic scanner. + 3. Find the advertisement and extract the mac address. + 4. Stop the first scanner. + 5. Create a new scanner with scan filter with a mac address filter of + what was found in step 3. + 6. Start the scanner. + + Expected Result: + Verify that the advertisement was found in the second scan instance. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 1 + """ + manufacturer_id = 0x4c + self.adv_ad.droid.bleAddAdvertiseDataManufacturerId( + manufacturer_id, [0x01]) + self.adv_ad.droid.bleSetAdvertiseSettingsAdvertiseMode( + ble_advertise_settings_modes['low_latency']) + advertise_callback, advertise_data, advertise_settings = ( + generate_ble_advertise_objects(self.adv_ad.droid)) + self.adv_ad.droid.bleStartBleAdvertising( + advertise_callback, advertise_data, advertise_settings) + expected_event = adv_succ.format(advertise_callback) + try: + self.adv_ad.ed.pop_event(expected_event) + except Empty: + self.log.info("Failed to start advertisement.") + return False + + self.scn_ad.droid.bleSetScanSettingsScanMode( + ble_scan_settings_modes['low_latency']) + self.scn_ad.droid.bleSetScanFilterManufacturerData( + manufacturer_id, [0x01]) + filter_list = self.scn_ad.droid.bleGenFilterList() + scan_settings = self.scn_ad.droid.bleBuildScanSetting() + scan_filter = self.scn_ad.droid.bleBuildScanFilter(filter_list) + scan_callback = self.scn_ad.droid.bleGenScanCallback() + self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, + scan_callback) + # continuously scan for 60 seconds + scan_time = 60 + end_time = time.time() + scan_time + expected_event_name = scan_result.format(scan_callback) + event = None + while time.time() < end_time: + try: + event = self.scn_ad.ed.pop_event(expected_event_name, + self.default_timeout) + found_manufacturer_id = json.loads( + event['data']['Result']['manufacturerIdList']) + if found_manufacturer_id[0] != manufacturer_id: + self.log.error( + "Manufacturer id mismatch. Found {}, Expected {}". + format(found_manufacturer_id, manufacturer_id)) + return False + except Empty: + self.log.error("Unable to find ibeacon advertisement.") + return False + self.scn_ad.droid.bleStopBleScan(scan_callback) + self.adv_ad.droid.bleStopBleAdvertising(advertise_callback) + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='a70a276d-7990-4754-8899-792b586ecce6') + def test_filter_manufacturer_id_bounds(self): + """Test scan filtering of lower and upper bounds of allowed manu data + + This test will setup one Android device as an advertiser and the + second as the scanner and test the upper and lower bounds of + manufacturer data filtering + + Steps: + 1. Start an advertisement with manufacturer id set to 0x004c + 2. Start a generic scanner. + 3. Find the advertisement and extract the mac address. + 4. Stop the first scanner. + 5. Create a new scanner with scan filter with a mac address filter of + what was found in step 3. + 6. Start the scanner. + + Expected Result: + Verify that the advertisement was found in the second scan instance. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning + Priority: 1 + """ + manufacturer_id_list = [0, 1, 65534, 65535] + for manufacturer_id in manufacturer_id_list: + self.adv_ad.droid.bleAddAdvertiseDataManufacturerId( + manufacturer_id, [0x01]) + self.adv_ad.droid.bleSetAdvertiseSettingsAdvertiseMode( + ble_advertise_settings_modes['low_latency']) + advertise_callback, advertise_data, advertise_settings = ( + generate_ble_advertise_objects(self.adv_ad.droid)) + self.adv_ad.droid.bleStartBleAdvertising( + advertise_callback, advertise_data, advertise_settings) + expected_event = adv_succ.format(advertise_callback) + try: + self.adv_ad.ed.pop_event(expected_event) + except Empty: + self.log.info("Failed to start advertisement.") + return False + + self.scn_ad.droid.bleSetScanSettingsScanMode( + ble_scan_settings_modes['low_latency']) + self.scn_ad.droid.bleSetScanFilterManufacturerData( + manufacturer_id, [0x01]) + filter_list = self.scn_ad.droid.bleGenFilterList() + scan_settings = self.scn_ad.droid.bleBuildScanSetting() + scan_filter = self.scn_ad.droid.bleBuildScanFilter(filter_list) + scan_callback = self.scn_ad.droid.bleGenScanCallback() + self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, + scan_callback) + expected_event_name = scan_result.format(scan_callback) + event = None + try: + event = self.scn_ad.ed.pop_event(expected_event_name, + self.default_timeout) + except Empty: + self.log.error("Unable to find beacon advertisement.") + return False + found_manufacturer_id = json.loads( + event['data']['Result']['manufacturerIdList']) + if found_manufacturer_id[0] != manufacturer_id: + self.log.error( + "Manufacturer id mismatch. Found {}, Expected {}".format( + found_manufacturer_id, manufacturer_id)) + return False + self.scn_ad.droid.bleStopBleScan(scan_callback) + self.adv_ad.droid.bleStopBleAdvertising(advertise_callback) + return True diff --git a/acts_tests/tests/google/ble/gatt/GattConnectTest.py b/acts_tests/tests/google/ble/gatt/GattConnectTest.py index e69de29bb2..52f3601cd0 100644 --- a/acts_tests/tests/google/ble/gatt/GattConnectTest.py +++ b/acts_tests/tests/google/ble/gatt/GattConnectTest.py @@ -0,0 +1,1184 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2016 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +""" +This test script exercises different GATT connection tests. +""" + +import pprint +from queue import Empty +import time + +from acts.test_decorators import test_tracker_info +from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest +from acts.test_utils.bt.bt_constants import ble_advertise_settings_modes +from acts.test_utils.bt.bt_constants import ble_scan_settings_modes +from acts.test_utils.bt.bt_constants import ble_scan_settings_match_nums +from acts.test_utils.bt.bt_constants import bt_profile_constants +from acts.test_utils.bt.bt_constants import gatt_characteristic +from acts.test_utils.bt.bt_constants import gatt_descriptor +from acts.test_utils.bt.bt_constants import gatt_service_types +from acts.test_utils.bt.bt_constants import gatt_cb_err +from acts.test_utils.bt.bt_constants import gatt_cb_strings +from acts.test_utils.bt.bt_constants import gatt_connection_state +from acts.test_utils.bt.bt_constants import gatt_mtu_size +from acts.test_utils.bt.bt_constants import gatt_phy_mask +from acts.test_utils.bt.bt_constants import gatt_transport +from acts.test_utils.bt.bt_constants import scan_result +from acts.test_utils.bt.bt_gatt_utils import GattTestUtilsError +from acts.test_utils.bt.bt_gatt_utils import disconnect_gatt_connection +from acts.test_utils.bt.bt_gatt_utils import wait_for_gatt_disconnect_event +from acts.test_utils.bt.bt_gatt_utils import close_gatt_client +from acts.test_utils.bt.bt_gatt_utils import log_gatt_server_uuids +from acts.test_utils.bt.bt_gatt_utils import orchestrate_gatt_connection +from acts.test_utils.bt.bt_gatt_utils import setup_gatt_connection +from acts.test_utils.bt.bt_gatt_utils import setup_multiple_services +from acts.test_utils.bt.bt_test_utils import get_mac_address_of_generic_advertisement +from acts.test_utils.bt.bt_test_utils import clear_bonded_devices + +PHYSICAL_DISCONNECT_TIMEOUT = 5 + + +class GattConnectTest(BluetoothBaseTest): + adv_instances = [] + bluetooth_gatt_list = [] + gatt_server_list = [] + default_timeout = 10 + default_discovery_timeout = 3 + + def setup_class(self): + super().setup_class() + self.cen_ad = self.android_devices[0] + self.per_ad = self.android_devices[1] + + def setup_test(self): + super(BluetoothBaseTest, self).setup_test() + bluetooth_gatt_list = [] + self.gatt_server_list = [] + self.adv_instances = [] + # Ensure there is ample time for a physical disconnect in between + # testcases. + self.log.info( + "Waiting for {} seconds for physical GATT disconnections".format( + PHYSICAL_DISCONNECT_TIMEOUT)) + time.sleep(PHYSICAL_DISCONNECT_TIMEOUT) + + def teardown_test(self): + for bluetooth_gatt in self.bluetooth_gatt_list: + self.cen_ad.droid.gattClientClose(bluetooth_gatt) + for gatt_server in self.gatt_server_list: + self.per_ad.droid.gattServerClose(gatt_server) + for adv in self.adv_instances: + self.per_ad.droid.bleStopBleAdvertising(adv) + return True + + def _orchestrate_gatt_disconnection(self, bluetooth_gatt, gatt_callback): + self.log.info("Disconnecting from peripheral device.") + try: + disconnect_gatt_connection(self.cen_ad, bluetooth_gatt, + gatt_callback) + close_gatt_client(self.cen_ad, bluetooth_gatt) + if bluetooth_gatt in self.bluetooth_gatt_list: + self.bluetooth_gatt_list.remove(bluetooth_gatt) + except GattTestUtilsError as err: + self.log.error(err) + return False + return True + + def _find_service_added_event(self, gatt_server_cb, uuid): + expected_event = gatt_cb_strings['serv_added'].format(gatt_server_cb) + try: + event = self.per_ad.ed.pop_event(expected_event, + self.default_timeout) + except Empty: + self.log.error( + gatt_cb_strings['serv_added_err'].format(expected_event)) + return False + if event['data']['serviceUuid'].lower() != uuid.lower(): + self.log.error("Uuid mismatch. Found: {}, Expected {}.".format( + event['data']['serviceUuid'], uuid)) + return False + return True + + def _verify_mtu_changed_on_client_and_server( + self, expected_mtu, gatt_callback, gatt_server_callback): + expected_event = gatt_cb_strings['mtu_changed'].format(gatt_callback) + try: + mtu_event = self.cen_ad.ed.pop_event(expected_event, + self.default_timeout) + mtu_size_found = mtu_event['data']['MTU'] + if mtu_size_found != expected_mtu: + self.log.error("MTU size found: {}, expected: {}".format( + mtu_size_found, expected_mtu)) + return False + except Empty: + self.log.error( + gatt_cb_err['mtu_changed_err'].format(expected_event)) + return False + + expected_event = gatt_cb_strings['mtu_serv_changed'].format( + gatt_server_callback) + try: + mtu_event = self.per_ad.ed.pop_event(expected_event, + self.default_timeout) + mtu_size_found = mtu_event['data']['MTU'] + if mtu_size_found != expected_mtu: + self.log.error("MTU size found: {}, expected: {}".format( + mtu_size_found, expected_mtu)) + return False + except Empty: + self.log.error( + gatt_cb_err['mtu_serv_changed_err'].format(expected_event)) + return False + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='8a3530a3-c8bb-466b-9710-99e694c38618') + def test_gatt_connect(self): + """Test GATT connection over LE. + + Test establishing a gatt connection between a GATT server and GATT + client. + + Steps: + 1. Start a generic advertisement. + 2. Start a generic scanner. + 3. Find the advertisement and extract the mac address. + 4. Stop the first scanner. + 5. Create a GATT connection between the scanner and advertiser. + 6. Disconnect the GATT connection. + + Expected Result: + Verify that a connection was established and then disconnected + successfully. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning, GATT + Priority: 0 + """ + gatt_server_cb = self.per_ad.droid.gattServerCreateGattServerCallback() + gatt_server = self.per_ad.droid.gattServerOpenGattServer( + gatt_server_cb) + self.gatt_server_list.append(gatt_server) + try: + bluetooth_gatt, gatt_callback, adv_callback = ( + orchestrate_gatt_connection(self.cen_ad, self.per_ad)) + self.bluetooth_gatt_list.append(bluetooth_gatt) + except GattTestUtilsError as err: + self.log.error(err) + return False + self.adv_instances.append(adv_callback) + return self._orchestrate_gatt_disconnection(bluetooth_gatt, + gatt_callback) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='a839b505-03ac-4783-be7e-1d43129a1948') + def test_gatt_connect_stop_advertising(self): + """Test GATT connection over LE then stop advertising + + A test case that verifies the GATT connection doesn't + disconnect when LE advertisement is stopped. + + Steps: + 1. Start a generic advertisement. + 2. Start a generic scanner. + 3. Find the advertisement and extract the mac address. + 4. Stop the first scanner. + 5. Create a GATT connection between the scanner and advertiser. + 6. Stop the advertiser. + 7. Verify no connection state changed happened. + 8. Disconnect the GATT connection. + + Expected Result: + Verify that a connection was established and not disconnected + when advertisement stops. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning, GATT + Priority: 0 + """ + gatt_server_cb = self.per_ad.droid.gattServerCreateGattServerCallback() + gatt_server = self.per_ad.droid.gattServerOpenGattServer( + gatt_server_cb) + self.gatt_server_list.append(gatt_server) + try: + bluetooth_gatt, gatt_callback, adv_callback = ( + orchestrate_gatt_connection(self.cen_ad, self.per_ad)) + self.bluetooth_gatt_list.append(bluetooth_gatt) + except GattTestUtilsError as err: + self.log.error(err) + return False + self.per_ad.droid.bleStopBleAdvertising(adv_callback) + try: + event = self.cen_ad.ed.pop_event( + gatt_cb_strings['gatt_conn_change'].format( + gatt_callback, self.default_timeout)) + self.log.error( + "Connection event found when not expected: {}".format(event)) + return False + except Empty: + self.log.info("No connection state change as expected") + try: + self._orchestrate_gatt_disconnection(bluetooth_gatt, gatt_callback) + except Exception as err: + self.log.info("Failed to orchestrate disconnect: {}".format(err)) + return False + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='b82f91a8-54bb-4779-a117-73dc7fdb28cc') + def test_gatt_connect_autoconnect(self): + """Test GATT connection over LE. + + Test re-establishing a gatt connection using autoconnect + set to True in order to test connection whitelist. + + Steps: + 1. Start a generic advertisement. + 2. Start a generic scanner. + 3. Find the advertisement and extract the mac address. + 4. Stop the first scanner. + 5. Create a GATT connection between the scanner and advertiser. + 6. Disconnect the GATT connection. + 7. Create a GATT connection with autoconnect set to True + 8. Disconnect the GATT connection. + + Expected Result: + Verify that a connection was re-established and then disconnected + successfully. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning, GATT + Priority: 0 + """ + gatt_server_cb = self.per_ad.droid.gattServerCreateGattServerCallback() + gatt_server = self.per_ad.droid.gattServerOpenGattServer( + gatt_server_cb) + self.gatt_server_list.append(gatt_server) + autoconnect = False + mac_address, adv_callback, scan_callback = ( + get_mac_address_of_generic_advertisement(self.cen_ad, self.per_ad)) + self.adv_instances.append(adv_callback) + try: + bluetooth_gatt, gatt_callback = setup_gatt_connection( + self.cen_ad, mac_address, autoconnect) + self.cen_ad.droid.bleStopBleScan(scan_callback) + self.bluetooth_gatt_list.append(bluetooth_gatt) + except GattTestUtilsError as err: + self.log.error(err) + return False + try: + disconnect_gatt_connection(self.cen_ad, bluetooth_gatt, + gatt_callback) + close_gatt_client(self.cen_ad, bluetooth_gatt) + if bluetooth_gatt in self.bluetooth_gatt_list: + self.bluetooth_gatt_list.remove(bluetooth_gatt) + except GattTestUtilsError as err: + self.log.error(err) + return False + autoconnect = True + bluetooth_gatt = self.cen_ad.droid.gattClientConnectGatt( + gatt_callback, mac_address, autoconnect, gatt_transport['auto'], + False, gatt_phy_mask['1m_mask']) + self.bluetooth_gatt_list.append(bluetooth_gatt) + expected_event = gatt_cb_strings['gatt_conn_change'].format( + gatt_callback) + try: + event = self.cen_ad.ed.pop_event(expected_event, + self.default_timeout) + except Empty: + self.log.error( + gatt_cb_err['gatt_conn_changed_err'].format(expected_event)) + test_result = False + return self._orchestrate_gatt_disconnection(bluetooth_gatt, + gatt_callback) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='e506fa50-7cd9-4bd8-938a-6b85dcfe6bc6') + def test_gatt_connect_opportunistic(self): + """Test opportunistic GATT connection over LE. + + Test establishing a gatt connection between a GATT server and GATT + client in opportunistic mode. + + Steps: + 1. Start a generic advertisement. + 2. Start a generic scanner. + 3. Find the advertisement and extract the mac address. + 4. Stop the first scanner. + 5. Create GATT connection 1 between the scanner and advertiser normally + 6. Create GATT connection 2 between the scanner and advertiser using + opportunistic mode + 7. Disconnect GATT connection 1 + + Expected Result: + Verify GATT connection 2 automatically disconnects when GATT connection + 1 disconnect + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning, GATT + Priority: 0 + """ + gatt_server_cb = self.per_ad.droid.gattServerCreateGattServerCallback() + gatt_server = self.per_ad.droid.gattServerOpenGattServer( + gatt_server_cb) + self.gatt_server_list.append(gatt_server) + mac_address, adv_callback, scan_callback = ( + get_mac_address_of_generic_advertisement(self.cen_ad, self.per_ad)) + # Make GATT connection 1 + try: + bluetooth_gatt_1, gatt_callback_1 = setup_gatt_connection( + self.cen_ad, + mac_address, + False, + transport=gatt_transport['auto'], + opportunistic=False) + self.cen_ad.droid.bleStopBleScan(scan_callback) + self.adv_instances.append(adv_callback) + self.bluetooth_gatt_list.append(bluetooth_gatt_1) + except GattTestUtilsError as err: + self.log.error(err) + return False + # Make GATT connection 2 + try: + bluetooth_gatt_2, gatt_callback_2 = setup_gatt_connection( + self.cen_ad, + mac_address, + False, + transport=gatt_transport['auto'], + opportunistic=True) + self.bluetooth_gatt_list.append(bluetooth_gatt_2) + except GattTestUtilsError as err: + self.log.error(err) + return False + # Disconnect GATT connection 1 + try: + disconnect_gatt_connection(self.cen_ad, bluetooth_gatt_1, + gatt_callback_1) + close_gatt_client(self.cen_ad, bluetooth_gatt_1) + if bluetooth_gatt_1 in self.bluetooth_gatt_list: + self.bluetooth_gatt_list.remove(bluetooth_gatt_1) + except GattTestUtilsError as err: + self.log.error(err) + return False + # Confirm that GATT connection 2 also disconnects + wait_for_gatt_disconnect_event(self.cen_ad, gatt_callback_2) + close_gatt_client(self.cen_ad, bluetooth_gatt_2) + if bluetooth_gatt_2 in self.bluetooth_gatt_list: + self.bluetooth_gatt_list.remove(bluetooth_gatt_2) + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='1e01838e-c4de-4720-9adf-9e0419378226') + def test_gatt_request_min_mtu(self): + """Test GATT connection over LE and exercise MTU sizes. + + Test establishing a gatt connection between a GATT server and GATT + client. Request an MTU size that matches the correct minimum size. + + Steps: + 1. Start a generic advertisement. + 2. Start a generic scanner. + 3. Find the advertisement and extract the mac address. + 4. Stop the first scanner. + 5. Create a GATT connection between the scanner and advertiser. + 6. From the scanner (client) request MTU size change to the + minimum value. + 7. Find the MTU changed event on the client. + 8. Disconnect the GATT connection. + + Expected Result: + Verify that a connection was established and the MTU value found + matches the expected MTU value. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning, GATT, MTU + Priority: 0 + """ + gatt_server_cb = self.per_ad.droid.gattServerCreateGattServerCallback() + gatt_server = self.per_ad.droid.gattServerOpenGattServer( + gatt_server_cb) + self.gatt_server_list.append(gatt_server) + try: + bluetooth_gatt, gatt_callback, adv_callback = ( + orchestrate_gatt_connection(self.cen_ad, self.per_ad)) + self.bluetooth_gatt_list.append(bluetooth_gatt) + except GattTestUtilsError as err: + self.log.error(err) + return False + self.adv_instances.append(adv_callback) + expected_mtu = gatt_mtu_size['min'] + self.cen_ad.droid.gattClientRequestMtu(bluetooth_gatt, expected_mtu) + if not self._verify_mtu_changed_on_client_and_server( + expected_mtu, gatt_callback, gatt_server_cb): + return False + return self._orchestrate_gatt_disconnection(bluetooth_gatt, + gatt_callback) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='c1fa3a2d-fb47-47db-bdd1-458928cd6a5f') + def test_gatt_request_max_mtu(self): + """Test GATT connection over LE and exercise MTU sizes. + + Test establishing a gatt connection between a GATT server and GATT + client. Request an MTU size that matches the correct maximum size. + + Steps: + 1. Start a generic advertisement. + 2. Start a generic scanner. + 3. Find the advertisement and extract the mac address. + 4. Stop the first scanner. + 5. Create a GATT connection between the scanner and advertiser. + 6. From the scanner (client) request MTU size change to the + maximum value. + 7. Find the MTU changed event on the client. + 8. Disconnect the GATT connection. + + Expected Result: + Verify that a connection was established and the MTU value found + matches the expected MTU value. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning, GATT, MTU + Priority: 0 + """ + gatt_server_cb = self.per_ad.droid.gattServerCreateGattServerCallback() + gatt_server = self.per_ad.droid.gattServerOpenGattServer( + gatt_server_cb) + self.gatt_server_list.append(gatt_server) + try: + bluetooth_gatt, gatt_callback, adv_callback = ( + orchestrate_gatt_connection(self.cen_ad, self.per_ad)) + self.bluetooth_gatt_list.append(bluetooth_gatt) + except GattTestUtilsError as err: + self.log.error(err) + return False + self.adv_instances.append(adv_callback) + expected_mtu = gatt_mtu_size['max'] + self.cen_ad.droid.gattClientRequestMtu(bluetooth_gatt, expected_mtu) + if not self._verify_mtu_changed_on_client_and_server( + expected_mtu, gatt_callback, gatt_server_cb): + return False + return self._orchestrate_gatt_disconnection(bluetooth_gatt, + gatt_callback) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='4416d483-dec3-46cb-8038-4d82620f873a') + def test_gatt_request_out_of_bounds_mtu(self): + """Test GATT connection over LE and exercise an out of bound MTU size. + + Test establishing a gatt connection between a GATT server and GATT + client. Request an MTU size that is the MIN value minus 1. + + Steps: + 1. Start a generic advertisement. + 2. Start a generic scanner. + 3. Find the advertisement and extract the mac address. + 4. Stop the first scanner. + 5. Create a GATT connection between the scanner and advertiser. + 6. From the scanner (client) request MTU size change to the + minimum value minus one. + 7. Find the MTU changed event on the client. + 8. Disconnect the GATT connection. + + Expected Result: + Verify that an MTU changed event was not discovered and that + it didn't cause an exception when requesting an out of bounds + MTU. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning, GATT, MTU + Priority: 0 + """ + gatt_server_cb = self.per_ad.droid.gattServerCreateGattServerCallback() + gatt_server = self.per_ad.droid.gattServerOpenGattServer( + gatt_server_cb) + self.gatt_server_list.append(gatt_server) + try: + bluetooth_gatt, gatt_callback, adv_callback = ( + orchestrate_gatt_connection(self.cen_ad, self.per_ad)) + self.bluetooth_gatt_list.append(bluetooth_gatt) + except GattTestUtilsError as err: + self.log.error(err) + return False + self.adv_instances.append(adv_callback) + unexpected_mtu = gatt_mtu_size['min'] - 1 + self.cen_ad.droid.gattClientRequestMtu(bluetooth_gatt, unexpected_mtu) + if self._verify_mtu_changed_on_client_and_server( + unexpected_mtu, gatt_callback, gatt_server_cb): + return False + return self._orchestrate_gatt_disconnection(bluetooth_gatt, + gatt_callback) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='31ffb9ca-cc75-43fb-9802-c19f1c5856b6') + def test_gatt_connect_trigger_on_read_rssi(self): + """Test GATT connection over LE read RSSI. + + Test establishing a gatt connection between a GATT server and GATT + client then read the RSSI. + + Steps: + 1. Start a generic advertisement. + 2. Start a generic scanner. + 3. Find the advertisement and extract the mac address. + 4. Stop the first scanner. + 5. Create a GATT connection between the scanner and advertiser. + 6. From the scanner, request to read the RSSI of the advertiser. + 7. Disconnect the GATT connection. + + Expected Result: + Verify that a connection was established and then disconnected + successfully. Verify that the RSSI was ready correctly. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning, GATT, RSSI + Priority: 1 + """ + gatt_server_cb = self.per_ad.droid.gattServerCreateGattServerCallback() + gatt_server = self.per_ad.droid.gattServerOpenGattServer( + gatt_server_cb) + self.gatt_server_list.append(gatt_server) + try: + bluetooth_gatt, gatt_callback, adv_callback = ( + orchestrate_gatt_connection(self.cen_ad, self.per_ad)) + self.bluetooth_gatt_list.append(bluetooth_gatt) + except GattTestUtilsError as err: + self.log.error(err) + return False + self.adv_instances.append(adv_callback) + expected_event = gatt_cb_strings['rd_remote_rssi'].format( + gatt_callback) + if self.cen_ad.droid.gattClientReadRSSI(bluetooth_gatt): + try: + self.cen_ad.ed.pop_event(expected_event, self.default_timeout) + except Empty: + self.log.error( + gatt_cb_err['rd_remote_rssi_err'].format(expected_event)) + return self._orchestrate_gatt_disconnection(bluetooth_gatt, + gatt_callback) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='dee9ef28-b872-428a-821b-cc62f27ba936') + def test_gatt_connect_trigger_on_services_discovered(self): + """Test GATT connection and discover services of peripheral. + + Test establishing a gatt connection between a GATT server and GATT + client the discover all services from the connected device. + + Steps: + 1. Start a generic advertisement. + 2. Start a generic scanner. + 3. Find the advertisement and extract the mac address. + 4. Stop the first scanner. + 5. Create a GATT connection between the scanner and advertiser. + 6. From the scanner (central device), discover services. + 7. Disconnect the GATT connection. + + Expected Result: + Verify that a connection was established and then disconnected + successfully. Verify that the service were discovered. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning, GATT, Services + Priority: 1 + """ + gatt_server_cb = self.per_ad.droid.gattServerCreateGattServerCallback() + gatt_server = self.per_ad.droid.gattServerOpenGattServer( + gatt_server_cb) + self.gatt_server_list.append(gatt_server) + try: + bluetooth_gatt, gatt_callback, adv_callback = ( + orchestrate_gatt_connection(self.cen_ad, self.per_ad)) + self.bluetooth_gatt_list.append(bluetooth_gatt) + except GattTestUtilsError as err: + self.log.error(err) + return False + self.adv_instances.append(adv_callback) + if self.cen_ad.droid.gattClientDiscoverServices(bluetooth_gatt): + expected_event = gatt_cb_strings['gatt_serv_disc'].format( + gatt_callback) + try: + event = self.cen_ad.ed.pop_event(expected_event, + self.default_timeout) + except Empty: + self.log.error( + gatt_cb_err['gatt_serv_disc'].format(expected_event)) + return False + return self._orchestrate_gatt_disconnection(bluetooth_gatt, + gatt_callback) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='01883bdd-0cf8-48fb-bf15-467bbd4f065b') + def test_gatt_connect_trigger_on_services_discovered_iterate_attributes( + self): + """Test GATT connection and iterate peripherals attributes. + + Test establishing a gatt connection between a GATT server and GATT + client and iterate over all the characteristics and descriptors of the + discovered services. + + Steps: + 1. Start a generic advertisement. + 2. Start a generic scanner. + 3. Find the advertisement and extract the mac address. + 4. Stop the first scanner. + 5. Create a GATT connection between the scanner and advertiser. + 6. From the scanner (central device), discover services. + 7. Iterate over all the characteristics and descriptors of the + discovered features. + 8. Disconnect the GATT connection. + + Expected Result: + Verify that a connection was established and then disconnected + successfully. Verify that the services, characteristics, and descriptors + were discovered. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning, GATT, Services + Characteristics, Descriptors + Priority: 1 + """ + gatt_server_cb = self.per_ad.droid.gattServerCreateGattServerCallback() + gatt_server = self.per_ad.droid.gattServerOpenGattServer( + gatt_server_cb) + self.gatt_server_list.append(gatt_server) + try: + bluetooth_gatt, gatt_callback, adv_callback = ( + orchestrate_gatt_connection(self.cen_ad, self.per_ad)) + self.bluetooth_gatt_list.append(bluetooth_gatt) + except GattTestUtilsError as err: + self.log.error(err) + return False + self.adv_instances.append(adv_callback) + if self.cen_ad.droid.gattClientDiscoverServices(bluetooth_gatt): + expected_event = gatt_cb_strings['gatt_serv_disc'].format( + gatt_callback) + try: + event = self.cen_ad.ed.pop_event(expected_event, + self.default_timeout) + discovered_services_index = event['data']['ServicesIndex'] + except Empty: + self.log.error( + gatt_cb_err['gatt_serv_disc'].format(expected_event)) + return False + log_gatt_server_uuids(self.cen_ad, discovered_services_index) + return self._orchestrate_gatt_disconnection(bluetooth_gatt, + gatt_callback) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='d4277bee-da99-4f48-8a4d-f81b5389da18') + def test_gatt_connect_with_service_uuid_variations(self): + """Test GATT connection with multiple service uuids. + + Test establishing a gatt connection between a GATT server and GATT + client with multiple service uuid variations. + + Steps: + 1. Start a generic advertisement. + 2. Start a generic scanner. + 3. Find the advertisement and extract the mac address. + 4. Stop the first scanner. + 5. Create a GATT connection between the scanner and advertiser. + 6. From the scanner (central device), discover services. + 7. Verify that all the service uuid variations are found. + 8. Disconnect the GATT connection. + + Expected Result: + Verify that a connection was established and then disconnected + successfully. Verify that the service uuid variations are found. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning, GATT, Services + Priority: 2 + """ + try: + gatt_server_cb, gatt_server = setup_multiple_services(self.per_ad) + self.gatt_server_list.append(gatt_server) + except GattTestUtilsError as err: + self.log.error(err) + return False + try: + bluetooth_gatt, gatt_callback, adv_callback = ( + orchestrate_gatt_connection(self.cen_ad, self.per_ad)) + self.bluetooth_gatt_list.append(bluetooth_gatt) + except GattTestUtilsError as err: + self.log.error(err) + return False + self.adv_instances.append(adv_callback) + if self.cen_ad.droid.gattClientDiscoverServices(bluetooth_gatt): + expected_event = gatt_cb_strings['gatt_serv_disc'].format( + gatt_callback) + try: + event = self.cen_ad.ed.pop_event(expected_event, + self.default_timeout) + except Empty: + self.log.error( + gatt_cb_err['gatt_serv_disc'].format(expected_event)) + return False + discovered_services_index = event['data']['ServicesIndex'] + log_gatt_server_uuids(self.cen_ad, discovered_services_index) + + return self._orchestrate_gatt_disconnection(bluetooth_gatt, + gatt_callback) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='7d3442c5-f71f-44ae-bd35-f2569f01b3b8') + def test_gatt_connect_in_quick_succession(self): + """Test GATT connections multiple times. + + Test establishing a gatt connection between a GATT server and GATT + client with multiple iterations. + + Steps: + 1. Start a generic advertisement. + 2. Start a generic scanner. + 3. Find the advertisement and extract the mac address. + 4. Stop the first scanner. + 5. Create a GATT connection between the scanner and advertiser. + 6. Disconnect the GATT connection. + 7. Repeat steps 5 and 6 twenty times. + + Expected Result: + Verify that a connection was established and then disconnected + successfully twenty times. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning, GATT, Stress + Priority: 1 + """ + gatt_server_cb = self.per_ad.droid.gattServerCreateGattServerCallback() + gatt_server = self.per_ad.droid.gattServerOpenGattServer( + gatt_server_cb) + self.gatt_server_list.append(gatt_server) + mac_address, adv_callback, scan_callback = get_mac_address_of_generic_advertisement( + self.cen_ad, self.per_ad) + autoconnect = False + for i in range(1000): + self.log.info("Starting connection iteration {}".format(i + 1)) + try: + bluetooth_gatt, gatt_callback = setup_gatt_connection( + self.cen_ad, mac_address, autoconnect) + self.cen_ad.droid.bleStopBleScan(scan_callback) + except GattTestUtilsError as err: + self.log.error(err) + return False + test_result = self._orchestrate_gatt_disconnection( + bluetooth_gatt, gatt_callback) + if not test_result: + self.log.info("Failed to disconnect from peripheral device.") + return False + self.adv_instances.append(adv_callback) + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='148469d9-7ab0-4c08-b2e9-7e49e88da1fc') + def test_gatt_connect_mitm_attack(self): + """Test GATT connection with permission write encrypted mitm. + + Test establishing a gatt connection between a GATT server and GATT + client while the GATT server's characteristic includes the property + write value and the permission write encrypted mitm value. This will + prompt LE pairing and then the devices will create a bond. + + Steps: + 1. Create a GATT server and server callback on the peripheral device. + 2. Create a unique service and characteristic uuid on the peripheral. + 3. Create a characteristic on the peripheral with these properties: + gatt_characteristic['property_write'], + gatt_characteristic['permission_write_encrypted_mitm'] + 4. Create a GATT service on the peripheral. + 5. Add the characteristic to the GATT service. + 6. Create a GATT connection between your central and peripheral device. + 7. From the central device, discover the peripheral's services. + 8. Iterate the services found until you find the unique characteristic + created in step 3. + 9. Once found, write a random but valid value to the characteristic. + 10. Start pairing helpers on both devices immediately after attempting + to write to the characteristic. + 11. Within 10 seconds of writing the characteristic, there should be + a prompt to bond the device from the peripheral. The helpers will + handle the UI interaction automatically. (see + BluetoothConnectionFacade.java bluetoothStartPairingHelper). + 12. Verify that the two devices are bonded. + + Expected Result: + Verify that a connection was established and the devices are bonded. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning, GATT, Characteristic, MITM + Priority: 1 + """ + gatt_server_cb = self.per_ad.droid.gattServerCreateGattServerCallback() + gatt_server = self.per_ad.droid.gattServerOpenGattServer( + gatt_server_cb) + self.gatt_server_list.append(gatt_server) + service_uuid = "3846D7A0-69C8-11E4-BA00-0002A5D5C51B" + test_uuid = "aa7edd5a-4d1d-4f0e-883a-d145616a1630" + bonded = False + characteristic = self.per_ad.droid.gattServerCreateBluetoothGattCharacteristic( + test_uuid, gatt_characteristic['property_write'], + gatt_characteristic['permission_write_encrypted_mitm']) + gatt_service = self.per_ad.droid.gattServerCreateService( + service_uuid, gatt_service_types['primary']) + self.per_ad.droid.gattServerAddCharacteristicToService( + gatt_service, characteristic) + self.per_ad.droid.gattServerAddService(gatt_server, gatt_service) + result = self._find_service_added_event(gatt_server_cb, service_uuid) + if not result: + return False + bluetooth_gatt, gatt_callback, adv_callback = ( + orchestrate_gatt_connection(self.cen_ad, self.per_ad)) + self.bluetooth_gatt_list.append(bluetooth_gatt) + self.adv_instances.append(adv_callback) + if self.cen_ad.droid.gattClientDiscoverServices(bluetooth_gatt): + expected_event = gatt_cb_strings['gatt_serv_disc'].format( + gatt_callback) + try: + event = self.cen_ad.ed.pop_event(expected_event, + self.default_timeout) + except Empty: + self.log.error( + gatt_cb_err['gatt_serv_disc'].format(expected_event)) + return False + discovered_services_index = event['data']['ServicesIndex'] + else: + self.log.info("Failed to discover services.") + return False + test_value = [1, 2, 3, 4, 5, 6, 7] + services_count = self.cen_ad.droid.gattClientGetDiscoveredServicesCount( + discovered_services_index) + for i in range(services_count): + characteristic_uuids = ( + self.cen_ad.droid.gattClientGetDiscoveredCharacteristicUuids( + discovered_services_index, i)) + for characteristic_uuid in characteristic_uuids: + if characteristic_uuid == test_uuid: + self.cen_ad.droid.bluetoothStartPairingHelper() + self.per_ad.droid.bluetoothStartPairingHelper() + self.cen_ad.droid.gattClientCharacteristicSetValue( + bluetooth_gatt, discovered_services_index, i, + characteristic_uuid, test_value) + self.cen_ad.droid.gattClientWriteCharacteristic( + bluetooth_gatt, discovered_services_index, i, + characteristic_uuid) + start_time = time.time() + self.default_timeout + target_name = self.per_ad.droid.bluetoothGetLocalName() + while time.time() < start_time and bonded == False: + bonded_devices = \ + self.cen_ad.droid.bluetoothGetBondedDevices() + for device in bonded_devices: + if ('name' in device.keys() + and device['name'] == target_name): + bonded = True + break + bonded = False + target_name = self.cen_ad.droid.bluetoothGetLocalName() + while time.time() < start_time and bonded == False: + bonded_devices = \ + self.per_ad.droid.bluetoothGetBondedDevices() + for device in bonded_devices: + if ('name' in device.keys() + and device['name'] == target_name): + bonded = True + break + + # Dual mode devices will establish connection over the classic transport, + # in order to establish bond over both transports, and do SDP. Starting + # disconnection before all this is finished is not safe, might lead to + # race conditions, i.e. bond over classic tranport shows up after LE + # bond is already removed. + time.sleep(4) + + for ad in [self.cen_ad, self.per_ad]: + if not clear_bonded_devices(ad): + return False + + # Necessary sleep time for entries to update unbonded state + time.sleep(2) + + for ad in [self.cen_ad, self.per_ad]: + bonded_devices = ad.droid.bluetoothGetBondedDevices() + if len(bonded_devices) > 0: + self.log.error( + "Failed to unbond devices: {}".format(bonded_devices)) + return False + return self._orchestrate_gatt_disconnection(bluetooth_gatt, + gatt_callback) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='cc3fc361-7bf1-4ee2-9e46-4a27c88ce6a8') + def test_gatt_connect_get_connected_devices(self): + """Test GATT connections show up in getConnectedDevices + + Test establishing a gatt connection between a GATT server and GATT + client. Verify that active connections show up using + BluetoothManager.getConnectedDevices API. + + Steps: + 1. Start a generic advertisement. + 2. Start a generic scanner. + 3. Find the advertisement and extract the mac address. + 4. Stop the first scanner. + 5. Create a GATT connection between the scanner and advertiser. + 7. Verify the GATT Client has an open connection to the GATT Server. + 8. Verify the GATT Server has an open connection to the GATT Client. + 9. Disconnect the GATT connection. + + Expected Result: + Verify that a connection was established, connected devices are found + on both the central and peripheral devices, and then disconnected + successfully. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Scanning, GATT + Priority: 2 + """ + gatt_server_cb = self.per_ad.droid.gattServerCreateGattServerCallback() + gatt_server = self.per_ad.droid.gattServerOpenGattServer( + gatt_server_cb) + self.gatt_server_list.append(gatt_server) + try: + bluetooth_gatt, gatt_callback, adv_callback = ( + orchestrate_gatt_connection(self.cen_ad, self.per_ad)) + self.bluetooth_gatt_list.append(bluetooth_gatt) + except GattTestUtilsError as err: + self.log.error(err) + return False + conn_cen_devices = self.cen_ad.droid.bluetoothGetConnectedLeDevices( + bt_profile_constants['gatt']) + conn_per_devices = self.per_ad.droid.bluetoothGetConnectedLeDevices( + bt_profile_constants['gatt_server']) + target_name = self.per_ad.droid.bluetoothGetLocalName() + error_message = ("Connected device {} not found in list of connected " + "devices {}") + if not any(d['name'] == target_name for d in conn_cen_devices): + self.log.error(error_message.format(target_name, conn_cen_devices)) + return False + # For the GATT server only check the size of the list since + # it may or may not include the device name. + target_name = self.cen_ad.droid.bluetoothGetLocalName() + if not conn_per_devices: + self.log.error(error_message.format(target_name, conn_per_devices)) + return False + self.adv_instances.append(adv_callback) + return self._orchestrate_gatt_disconnection(bluetooth_gatt, + gatt_callback) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='a0a37ca6-9fa8-4d35-9fdb-0e25b4b8a363') + def test_gatt_connect_second_adv_after_canceling_first_adv(self): + """Test GATT connection to peripherals second advertising address. + + The the ability of cancelling GATT connections and trying to reconnect + to the same device via a different address. + + Steps: + 1. A starts advertising + 2. B starts scanning and finds A's mac address + 3. Stop advertisement from step 1. Start a new advertisement on A and + find the new new mac address, B knows of both old and new address. + 4. B1 sends connect request to old address of A + 5. B1 cancel connect attempt after 10 seconds + 6. B1 sends connect request to new address of A + 7. Verify B1 establish connection to A in less than 10 seconds + + Expected Result: + Verify that a connection was established only on the second + advertisement's mac address. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Scanning, GATT + Priority: 3 + """ + autoconnect = False + transport = gatt_transport['auto'] + opportunistic = False + # Setup a basic Gatt server on the peripheral + gatt_server_cb = self.per_ad.droid.gattServerCreateGattServerCallback() + gatt_server = self.per_ad.droid.gattServerOpenGattServer( + gatt_server_cb) + + # Set advertisement settings to include local name in advertisement + # and set the advertising mode to low_latency. + self.per_ad.droid.bleSetAdvertiseSettingsIsConnectable(True) + self.per_ad.droid.bleSetAdvertiseDataIncludeDeviceName(True) + self.per_ad.droid.bleSetAdvertiseSettingsAdvertiseMode( + ble_advertise_settings_modes['low_latency']) + + # Setup necessary advertisement objects. + advertise_data = self.per_ad.droid.bleBuildAdvertiseData() + advertise_settings = self.per_ad.droid.bleBuildAdvertiseSettings() + advertise_callback = self.per_ad.droid.bleGenBleAdvertiseCallback() + + # Step 1: Start advertisement + self.per_ad.droid.bleStartBleAdvertising( + advertise_callback, advertise_data, advertise_settings) + + # Setup scan settings for low_latency scanning and to include the local name + # of the advertisement started in step 1. + filter_list = self.cen_ad.droid.bleGenFilterList() + self.cen_ad.droid.bleSetScanSettingsNumOfMatches( + ble_scan_settings_match_nums['one']) + self.cen_ad.droid.bleSetScanFilterDeviceName( + self.per_ad.droid.bluetoothGetLocalName()) + self.cen_ad.droid.bleBuildScanFilter(filter_list) + self.cen_ad.droid.bleSetScanSettingsScanMode( + ble_scan_settings_modes['low_latency']) + + # Setup necessary scan objects. + scan_settings = self.cen_ad.droid.bleBuildScanSetting() + scan_callback = self.cen_ad.droid.bleGenScanCallback() + + # Step 2: Start scanning on central Android device and find peripheral + # address. + self.cen_ad.droid.bleStartBleScan(filter_list, scan_settings, + scan_callback) + expected_event_name = scan_result.format(scan_callback) + try: + mac_address_pre_restart = self.cen_ad.ed.pop_event( + expected_event_name, self.default_timeout)['data']['Result'][ + 'deviceInfo']['address'] + self.log.info( + "Peripheral advertisement found with mac address: {}".format( + mac_address_pre_restart)) + except Empty: + self.log.info("Peripheral advertisement not found") + test_result = False + + # Step 3: Restart peripheral advertising such that a new mac address is + # created. + self.per_ad.droid.bleStopBleAdvertising(advertise_callback) + self.per_ad.droid.bleStartBleAdvertising( + advertise_callback, advertise_data, advertise_settings) + + mac_address_post_restart = mac_address_pre_restart + + while True: + try: + mac_address_post_restart = self.cen_ad.ed.pop_event( + expected_event_name, self.default_timeout)['data']['Result'][ + 'deviceInfo']['address'] + self.log.info( + "Peripheral advertisement found with mac address: {}".format( + mac_address_post_restart)) + except Empty: + self.log.info("Peripheral advertisement not found") + test_result = False + + if mac_address_pre_restart != mac_address_post_restart: + break + + self.cen_ad.droid.bleStopBleScan(scan_callback) + + # Steps 4: Try to connect to the first mac address + gatt_callback = self.cen_ad.droid.gattCreateGattCallback() + self.log.info( + "Gatt Connect to mac address {}.".format(mac_address_pre_restart)) + bluetooth_gatt = self.cen_ad.droid.gattClientConnectGatt( + gatt_callback, mac_address_pre_restart, autoconnect, transport, + opportunistic, gatt_phy_mask['1m_mask']) + self.bluetooth_gatt_list.append(bluetooth_gatt) + expected_event = gatt_cb_strings['gatt_conn_change'].format( + gatt_callback) + try: + event = self.cen_ad.ed.pop_event(expected_event, + self.default_timeout) + self.log.error( + "Connection callback updated unexpectedly: {}".format(event)) + return False + except Empty: + self.log.info("No connection update as expected.") + + # Step 5: Cancel connection request. + self.cen_ad.droid.gattClientDisconnect(bluetooth_gatt) + close_gatt_client(self.cen_ad, bluetooth_gatt) + if bluetooth_gatt in self.bluetooth_gatt_list: + self.bluetooth_gatt_list.remove(bluetooth_gatt) + + # Step 6: Connect to second mac address. + gatt_callback = self.cen_ad.droid.gattCreateGattCallback() + self.log.info( + "Gatt Connect to mac address {}.".format(mac_address_post_restart)) + bluetooth_gatt = self.cen_ad.droid.gattClientConnectGatt( + gatt_callback, mac_address_post_restart, autoconnect, transport, + opportunistic, gatt_phy_mask['1m_mask']) + self.bluetooth_gatt_list.append(bluetooth_gatt) + expected_event = gatt_cb_strings['gatt_conn_change'].format( + gatt_callback) + + # Step 7: Verify connection was setup successfully. + try: + event = self.cen_ad.ed.pop_event(expected_event, + self.default_timeout) + self.log.info( + "Connection callback updated successfully: {}".format(event)) + if event['data']['State'] != gatt_connection_state['connected']: + self.log.error( + "Could not establish a connection to the peripheral.") + return False + except Empty: + self.log.error("No connection update was found.") + return False + + self.per_ad.droid.bleStopBleAdvertising(advertise_callback) + + return self._orchestrate_gatt_disconnection(bluetooth_gatt, + gatt_callback) diff --git a/acts_tests/tests/google/ble/gatt/GattNotifyTest.py b/acts_tests/tests/google/ble/gatt/GattNotifyTest.py index e69de29bb2..7d62d65349 100644 --- a/acts_tests/tests/google/ble/gatt/GattNotifyTest.py +++ b/acts_tests/tests/google/ble/gatt/GattNotifyTest.py @@ -0,0 +1,97 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2016 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +""" +This test script exercises GATT notify/indicate procedures. +""" + +from acts.test_decorators import test_tracker_info +from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest +from acts.test_utils.bt.GattConnectedBaseTest import GattConnectedBaseTest +from acts.test_utils.bt.bt_constants import gatt_characteristic +from acts.test_utils.bt.bt_constants import gatt_descriptor +from acts.test_utils.bt.bt_constants import gatt_event +from acts.test_utils.bt.bt_constants import gatt_cb_strings +from acts.test_utils.bt.bt_constants import gatt_char_desc_uuids +from math import ceil + + +class GattNotifyTest(GattConnectedBaseTest): + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='e0ba60af-c1f2-4516-a5d5-89e2def0c757') + def test_notify_char(self): + """Test notify characteristic value. + + Test GATT notify characteristic value. + + Steps: + 1. Central: write CCC - register for notifications. + 2. Peripheral: receive CCC modification. + 3. Peripheral: send characteristic notification. + 4. Central: receive notification, verify it's conent matches what was + sent + + Expected Result: + Verify that notification registration and delivery works. + + Returns: + Pass if True + Fail if False + + TAGS: LE, GATT, Characteristic + Priority: 0 + """ + #write CCC descriptor to enable notifications + self.cen_ad.droid.gattClientDescriptorSetValue( + self.bluetooth_gatt, self.discovered_services_index, + self.test_service_index, self.NOTIFIABLE_CHAR_UUID, + gatt_char_desc_uuids['client_char_cfg'], + gatt_descriptor['enable_notification_value']) + + self.cen_ad.droid.gattClientWriteDescriptor( + self.bluetooth_gatt, self.discovered_services_index, + self.test_service_index, self.NOTIFIABLE_CHAR_UUID, + gatt_char_desc_uuids['client_char_cfg']) + + #enable notifications in app + self.cen_ad.droid.gattClientSetCharacteristicNotification( + self.bluetooth_gatt, self.discovered_services_index, + self.test_service_index, self.NOTIFIABLE_CHAR_UUID, True) + + event = self._server_wait(gatt_event['desc_write_req']) + + request_id = event['data']['requestId'] + bt_device_id = 0 + status = 0 + #confirm notification registration was successful + self.per_ad.droid.gattServerSendResponse( + self.gatt_server, bt_device_id, request_id, status, 0, []) + #wait for client to get response + event = self._client_wait(gatt_event['desc_write']) + + #set notified value + notified_value = [1, 5, 9, 7, 5, 3, 6, 4, 8, 2] + self.per_ad.droid.gattServerCharacteristicSetValue( + self.notifiable_char_index, notified_value) + + #send notification + self.per_ad.droid.gattServerNotifyCharacteristicChanged( + self.gatt_server, bt_device_id, self.notifiable_char_index, False) + + #wait for client to receive the notification + event = self._client_wait(gatt_event['char_change']) + self.assertEqual(notified_value, event["data"]["CharacteristicValue"]) + + return True diff --git a/acts_tests/tests/google/ble/gatt/GattReadTest.py b/acts_tests/tests/google/ble/gatt/GattReadTest.py index e69de29bb2..e880757586 100644 --- a/acts_tests/tests/google/ble/gatt/GattReadTest.py +++ b/acts_tests/tests/google/ble/gatt/GattReadTest.py @@ -0,0 +1,198 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2016 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +""" +This test script exercises different GATT read procedures. +""" + +from acts.test_decorators import test_tracker_info +from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest +from acts.test_utils.bt.GattConnectedBaseTest import GattConnectedBaseTest +from acts.test_utils.bt.bt_constants import gatt_characteristic +from acts.test_utils.bt.bt_constants import gatt_descriptor +from acts.test_utils.bt.bt_constants import gatt_event +from acts.test_utils.bt.bt_constants import gatt_cb_strings +from math import ceil + + +class GattReadTest(GattConnectedBaseTest): + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='ed8523f4-0eb8-4d14-b558-d3c28902f8bb') + def test_read_char(self): + """Test read characteristic value. + + Test GATT read characteristic value. + + Steps: + 1. Central: send read request. + 2. Peripheral: receive read request . + 3. Peripheral: send read response with status 0 (success), and + characteristic value. + 4. Central: receive read response, verify it's conent matches what was + sent + + Expected Result: + Verify that read request/response is properly delivered. + + Returns: + Pass if True + Fail if False + + TAGS: LE, GATT, Characteristic + Priority: 0 + """ + self.cen_ad.droid.gattClientReadCharacteristic( + self.bluetooth_gatt, self.discovered_services_index, + self.test_service_index, self.READABLE_CHAR_UUID) + + event = self._server_wait(gatt_event['char_read_req']) + + request_id = event['data']['requestId'] + self.assertEqual(0, event['data']['offset'], "offset should be 0") + + bt_device_id = 0 + status = 0 + char_value = [1, 2, 3, 4, 5, 6, 7, 20] + offset = 0 + self.per_ad.droid.gattServerSendResponse(self.gatt_server, + bt_device_id, request_id, + status, offset, char_value) + + event = self._client_wait(gatt_event['char_read']) + self.assertEqual(status, event["data"]["Status"], + "Write status should be 0") + self.assertEqual(char_value, event["data"]["CharacteristicValue"], + "Read value shall be equal to value sent from server") + + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='5916a78d-3db8-4df2-9b96-b25e99096e0d') + def test_read_long_char(self): + """Test read long characteristic value. + + Test GATT read long characteristic value. + + Steps: + 1. Central: send read request. + 2. Peripheral: receive read request . + 3. Peripheral: send read response with status 0 (success), and + characteristic content. + 5. Central: stack receives read response that was full, so stack sends + read blob request with increased offset. + 6. Peripheral: receive read blob request, send read blob response with + next piece of characteristic value. + 7. Central: stack receives read blob response, so stack sends read blob + request with increased offset. No Java callbacks are called here + 8. Repeat steps 6 and 7 until whole characteristic is read. + 9. Central: verify onCharacteristicRead callback is called with whole + characteristic content. + + Expected Result: + Verify that read request/response is properly delivered, and that read + blob reqest/response is properly sent internally by the stack. + + Returns: + Pass if True + Fail if False + + TAGS: LE, GATT, Characteristic + Priority: 0 + """ + char_value = [] + for i in range(512): + char_value.append(i % 256) + + self.cen_ad.droid.gattClientReadCharacteristic( + self.bluetooth_gatt, self.discovered_services_index, + self.test_service_index, self.READABLE_CHAR_UUID) + + # characteristic value is divided into packets, each contains MTU-1 + # bytes. Compute number of packets we expect to receive. + num_packets = ceil((len(char_value) + 1) / (self.mtu - 1)) + + for i in range(num_packets): + startOffset = i * (self.mtu - 1) + + event = self._server_wait(gatt_event['char_read_req']) + + request_id = event['data']['requestId'] + self.assertEqual(startOffset, event['data']['offset'], + "offset should be 0") + + bt_device_id = 0 + status = 0 + offset = 0 + self.per_ad.droid.gattServerSendResponse( + self.gatt_server, bt_device_id, request_id, status, offset, + char_value[startOffset:startOffset + self.mtu - 1]) + + event = self._client_wait(gatt_event['char_read']) + + self.assertEqual(status, event["data"]["Status"], + "Write status should be 0") + self.assertEqual(char_value, event["data"]["CharacteristicValue"], + "Read value shall be equal to value sent from server") + + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='12498522-cac5-478b-a0cd-faa542832fa8') + def test_read_using_char_uuid(self): + """Test read using characteristic UUID. + + Test GATT read value using characteristic UUID. + + Steps: + 1. Central: send read by UUID request. + 2. Peripheral: receive read request . + 3. Peripheral: send read response with status 0 (success), and + characteristic value. + 4. Central: receive read response, verify it's conent matches what was + sent + + Expected Result: + Verify that read request/response is properly delivered. + + Returns: + Pass if True + Fail if False + + TAGS: LE, GATT, Characteristic + Priority: 0 + """ + self.cen_ad.droid.gattClientReadUsingCharacteristicUuid( + self.bluetooth_gatt, self.READABLE_CHAR_UUID, 0x0001, 0xFFFF) + + event = self._server_wait(gatt_event['char_read_req']) + + request_id = event['data']['requestId'] + self.assertEqual(0, event['data']['offset'], "offset should be 0") + + bt_device_id = 0 + status = 0 + char_value = [1, 2, 3, 4, 5, 6, 7, 20] + offset = 0 + self.per_ad.droid.gattServerSendResponse(self.gatt_server, + bt_device_id, request_id, + status, offset, char_value) + + event = self._client_wait(gatt_event['char_read']) + self.assertEqual(status, event["data"]["Status"], + "Write status should be 0") + self.assertEqual(char_value, event["data"]["CharacteristicValue"], + "Read value shall be equal to value sent from server") + + return True diff --git a/acts_tests/tests/google/ble/gatt/GattToolTest.py b/acts_tests/tests/google/ble/gatt/GattToolTest.py index e69de29bb2..8e7a9f0182 100644 --- a/acts_tests/tests/google/ble/gatt/GattToolTest.py +++ b/acts_tests/tests/google/ble/gatt/GattToolTest.py @@ -0,0 +1,445 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2016 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +""" +This test script is for partial automation of LE devices + +This script requires these custom parameters in the config file: + +"ble_mac_address" +"service_uuid" +"notifiable_char_uuid" +""" + +import pprint +from queue import Empty +import time + +from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest +from acts.test_utils.bt.bt_constants import ble_scan_settings_modes +from acts.test_utils.bt.bt_constants import gatt_cb_err +from acts.test_utils.bt.bt_constants import gatt_cb_strings +from acts.test_utils.bt.bt_constants import gatt_descriptor +from acts.test_utils.bt.bt_constants import gatt_transport +from acts.test_utils.bt.bt_constants import scan_result +from acts.test_utils.bt.bt_gatt_utils import GattTestUtilsError +from acts.test_utils.bt.bt_gatt_utils import disconnect_gatt_connection +from acts.test_utils.bt.bt_test_utils import generate_ble_scan_objects +from acts.test_utils.bt.bt_gatt_utils import setup_gatt_connection +from acts.test_utils.bt.bt_gatt_utils import log_gatt_server_uuids +from acts.test_utils.bt.bt_test_utils import reset_bluetooth + + +class GattToolTest(BluetoothBaseTest): + AUTOCONNECT = False + DEFAULT_TIMEOUT = 10 + PAIRING_TIMEOUT = 20 + adv_instances = [] + timer_list = [] + + def setup_class(self): + super().setup_class() + # Central role Android device + self.cen_ad = self.android_devices[0] + self.ble_mac_address = self.user_params['ble_mac_address'] + self.SERVICE_UUID = self.user_params['service_uuid'] + self.NOTIFIABLE_CHAR_UUID = self.user_params['notifiable_char_uuid'] + # CCC == Client Characteristic Configuration + self.CCC_DESC_UUID = "00002902-0000-1000-8000-00805f9b34fb" + + def setup_test(self): + super(BluetoothBaseTest, self).setup_test() + if not self._is_peripheral_advertising(): + input("Press enter when peripheral is advertising...") + return True + + def teardown_test(self): + super(BluetoothBaseTest, self).teardown_test() + self.log_stats() + self.timer_list = [] + return True + + def _pair_with_peripheral(self): + self.cen_ad.droid.bluetoothDiscoverAndBond(self.ble_mac_address) + end_time = time.time() + self.PAIRING_TIMEOUT + self.log.info("Verifying devices are bonded") + while time.time() < end_time: + bonded_devices = self.cen_ad.droid.bluetoothGetBondedDevices() + if self.ble_mac_address in {d['address'] for d in bonded_devices}: + self.log.info("Successfully bonded to device") + return True + return False + + def _is_peripheral_advertising(self): + self.cen_ad.droid.bleSetScanFilterDeviceAddress(self.ble_mac_address) + self.cen_ad.droid.bleSetScanSettingsScanMode( + ble_scan_settings_modes['low_latency']) + filter_list, scan_settings, scan_callback = generate_ble_scan_objects( + self.cen_ad.droid) + self.cen_ad.droid.bleBuildScanFilter(filter_list) + + self.cen_ad.droid.bleStartBleScan(filter_list, scan_settings, + scan_callback) + expected_event_name = scan_result.format(scan_callback) + test_result = True + try: + self.cen_ad.ed.pop_event(expected_event_name, self.DEFAULT_TIMEOUT) + self.log.info( + "Peripheral found with event: {}".format(expected_event_name)) + except Empty: + self.log.info("Peripheral not advertising or not found: {}".format( + self.ble_mac_address)) + test_result = False + self.cen_ad.droid.bleStopBleScan(scan_callback) + return test_result + + def _unbond_device(self): + self.cen_ad.droid.bluetoothUnbond(self.ble_mac_address) + time.sleep(2) #Grace timeout for unbonding to finish + bonded_devices = self.cen_ad.droid.bluetoothGetBondedDevices() + if bonded_devices: + self.log.error( + "Failed to unbond device... found: {}".format(bonded_devices)) + return False + return True + + @BluetoothBaseTest.bt_test_wrap + def test_gatt_connect_without_scanning(self): + """Test the round trip speed of connecting to a peripheral + + This test will prompt the user to press "Enter" when the + peripheral is in a connecable advertisement state. Once + the user presses enter, this script will measure the amount + of time it takes to establish a GATT connection to the + peripheral. The test will then disconnect + + Steps: + 1. Wait for user input to confirm peripheral is advertising. + 2. Start timer + 3. Perform GATT connection to peripheral + 4. Upon successful connection, stop timer + 5. Disconnect from peripheral + + Expected Result: + Device should be connected successfully + + Returns: + Pass if True + Fail if False + + TAGS: LE, GATT + Priority: 1 + """ + self.AUTOCONNECT = False + start_time = self._get_time_in_milliseconds() + try: + bluetooth_gatt, gatt_callback = (setup_gatt_connection( + self.cen_ad, self.ble_mac_address, self.AUTOCONNECT, + gatt_transport['le'])) + except GattTestUtilsError as err: + self.log.error(err) + return False + end_time = self._get_time_in_milliseconds() + self.log.info("Total time (ms): {}".format(end_time - start_time)) + try: + disconnect_gatt_connection(self.cen_ad, bluetooth_gatt, + gatt_callback) + self.cen_ad.droid.gattClientClose(bluetooth_gatt) + except GattTestUtilsError as err: + self.log.error(err) + return False + self.cen_ad.droid.gattClientClose(bluetooth_gatt) + + @BluetoothBaseTest.bt_test_wrap + def test_gatt_connect_stress(self): + """Test the round trip speed of connecting to a peripheral many times + + This test will prompt the user to press "Enter" when the + peripheral is in a connecable advertisement state. Once + the user presses enter, this script will measure the amount + of time it takes to establish a GATT connection to the + peripheral. The test will then disconnect. It will attempt to + repeat this process multiple times. + + Steps: + 1. Wait for user input to confirm peripheral is advertising. + 2. Start timer + 3. Perform GATT connection to peripheral + 4. Upon successful connection, stop timer + 5. Disconnect from peripheral + 6. Repeat steps 2-5 1000 times. + + Expected Result: + Test should measure 1000 iterations of connect/disconnect cycles. + + Returns: + Pass if True + Fail if False + + TAGS: LE, GATT + Priority: 2 + """ + filter_list, scan_settings, scan_callback = generate_ble_scan_objects( + self.cen_ad.droid) + self.cen_ad.droid.bleStartBleScan(filter_list, scan_settings, + scan_callback) + self.AUTOCONNECT = False + iterations = 1000 + n = 0 + while n < iterations: + self.start_timer() + try: + bluetooth_gatt, gatt_callback = (setup_gatt_connection( + self.cen_ad, self.ble_mac_address, self.AUTOCONNECT, + gatt_transport['le'])) + except GattTestUtilsError as err: + self.log.error(err) + return False + self.log.info("Total time (ms): {}".format(self.end_timer())) + try: + disconnect_gatt_connection(self.cen_ad, bluetooth_gatt, + gatt_callback) + self.cen_ad.droid.gattClientClose(bluetooth_gatt) + except GattTestUtilsError as err: + self.log.error(err) + return False + n += 1 + return True + + @BluetoothBaseTest.bt_test_wrap + def test_gatt_connect_iterate_uuids(self): + """Test the discovery of uuids of a peripheral + + This test will prompt the user to press "Enter" when the + peripheral is in a connecable advertisement state. Once + the user presses enter, this script connects an Android device + to the periphal and attempt to discover all services, + characteristics, and descriptors. + + Steps: + 1. Wait for user input to confirm peripheral is advertising. + 2. Perform GATT connection to peripheral + 3. Upon successful connection, iterate through all services, + characteristics, and descriptors. + 5. Disconnect from peripheral + + Expected Result: + Device services, characteristics, and descriptors should all + be read. + + Returns: + Pass if True + Fail if False + + TAGS: LE, GATT + Priority: 2 + """ + try: + bluetooth_gatt, gatt_callback = (setup_gatt_connection( + self.cen_ad, self.ble_mac_address, self.AUTOCONNECT, + gatt_transport['le'])) + except GattTestUtilsError as err: + self.log.error(err) + return False + if self.cen_ad.droid.gattClientDiscoverServices(bluetooth_gatt): + expected_event = gatt_cb_strings['gatt_serv_disc'].format( + gatt_callback) + try: + event = self.cen_ad.ed.pop_event(expected_event, + self.DEFAULT_TIMEOUT) + discovered_services_index = event['data']['ServicesIndex'] + except Empty: + self.log.error( + gatt_cb_err['gatt_serv_disc'].format(expected_event)) + return False + log_gatt_server_uuids(self.cen_ad, discovered_services_index) + try: + disconnect_gatt_connection(self.cen_ad, bluetooth_gatt, + gatt_callback) + self.cen_ad.droid.gattClientClose(bluetooth_gatt) + except GattTestUtilsError as err: + self.log.error(err) + return False + self.cen_ad.droid.gattClientClose(bluetooth_gatt) + return True + + @BluetoothBaseTest.bt_test_wrap + def test_pairing(self): + """Test pairing to a GATT mac address + + This test will prompt the user to press "Enter" when the + peripheral is in a connecable advertisement state. Once + the user presses enter, this script will bond the Android device + to the peripheral. + + Steps: + 1. Wait for user input to confirm peripheral is advertising. + 2. Perform Bluetooth pairing to GATT mac address + 3. Upon successful bonding. + 4. Unbond from device + + Expected Result: + Device services, characteristics, and descriptors should all + be read. + + Returns: + Pass if True + Fail if False + + TAGS: LE, GATT + Priority: 1 + """ + if not self._pair_with_peripheral(): + return False + self.cen_ad.droid.bluetoothUnbond(self.ble_mac_address) + return self._unbond_device() + + @BluetoothBaseTest.bt_test_wrap + def test_pairing_stress(self): + """Test the round trip speed of pairing to a peripheral many times + + This test will prompt the user to press "Enter" when the + peripheral is in a connecable advertisement state. Once + the user presses enter, this script will measure the amount + of time it takes to establish a pairing with a BLE device. + + Steps: + 1. Wait for user input to confirm peripheral is advertising. + 2. Start timer + 3. Perform Bluetooth pairing to GATT mac address + 4. Upon successful bonding, stop timer. + 5. Unbond from device + 6. Repeat steps 2-5 100 times. + + Expected Result: + Test should measure 100 iterations of bonding. + + Returns: + Pass if True + Fail if False + + TAGS: LE, GATT + Priority: 3 + """ + iterations = 100 + for _ in range(iterations): + start_time = self.start_timer() + if not self._pair_with_peripheral(): + return False + self.log.info("Total time (ms): {}".format(self.end_timer())) + if not self._unbond_device(): + return False + return True + + @BluetoothBaseTest.bt_test_wrap + def test_gatt_notification_longev(self): + """Test GATT characterisitic notifications for long periods of time + + This test will prompt the user to press "Enter" when the + peripheral is in a connecable advertisement state. Once + the user presses enter, this script aims to set characteristic + notification to true on the config file's SERVICE_UUID, + NOTIFIABLE_CHAR_UUID, and CCC_DESC_UUID. This test assumes + the peripheral will constantly write data to a notifiable + characteristic. + + Steps: + 1. Wait for user input to confirm peripheral is advertising. + 2. Perform Bluetooth pairing to GATT mac address + 3. Perform a GATT connection to the periheral + 4. Get the discovered service uuid that matches the user's input + in the config file + 4. Write to the CCC descriptor to enable notifications + 5. Enable notifications on the user's input Characteristic UUID + 6. Continuously wait for Characteristic Changed events which + equate to recieving notifications for 15 minutes. + + Expected Result: + There should be no disconnects and we should constantly receive + Characteristic Changed information. Values should vary upon user + interaction with the peripheral. + + Returns: + Pass if True + Fail if False + + TAGS: LE, GATT + Priority: 1 + """ + #pair devices + if not self._pair_with_peripheral(): + return False + try: + bluetooth_gatt, gatt_callback = (setup_gatt_connection( + self.cen_ad, self.ble_mac_address, self.AUTOCONNECT, + gatt_transport['le'])) + except GattTestUtilsError as err: + self.log.error(err) + return False + if self.cen_ad.droid.gattClientDiscoverServices(bluetooth_gatt): + expected_event = gatt_cb_strings['gatt_serv_disc'].format( + gatt_callback) + try: + event = self.cen_ad.ed.pop_event(expected_event, + self.DEFAULT_TIMEOUT) + discovered_services_index = event['data']['ServicesIndex'] + except Empty: + self.log.error( + gatt_cb_err['gatt_serv_disc'].format(expected_event)) + return False + # TODO: in setup save service_cound and discovered_services_index + # programatically + services_count = self.cen_ad.droid.gattClientGetDiscoveredServicesCount( + discovered_services_index) + test_service_index = None + for i in range(services_count): + disc_service_uuid = ( + self.cen_ad.droid.gattClientGetDiscoveredServiceUuid( + discovered_services_index, i)) + if disc_service_uuid == self.SERVICE_UUID: + test_service_index = i + break + if not test_service_index: + self.log.error("Service not found.") + return False + + self.cen_ad.droid.gattClientDescriptorSetValue( + bluetooth_gatt, discovered_services_index, test_service_index, + self.NOTIFIABLE_CHAR_UUID, self.CCC_DESC_UUID, + gatt_descriptor['enable_notification_value']) + + self.cen_ad.droid.gattClientWriteDescriptor( + bluetooth_gatt, discovered_services_index, test_service_index, + self.NOTIFIABLE_CHAR_UUID, self.CCC_DESC_UUID) + + self.cen_ad.droid.gattClientSetCharacteristicNotification( + bluetooth_gatt, discovered_services_index, test_service_index, + self.NOTIFIABLE_CHAR_UUID, True) + + # set 15 minute notification test time + notification_test_time = 900 + end_time = time.time() + notification_test_time + expected_event = gatt_cb_strings['char_change'].format(gatt_callback) + while time.time() < end_time: + try: + event = self.cen_ad.ed.pop_event(expected_event, + self.DEFAULT_TIMEOUT) + self.log.info(event) + except Empty as err: + print(err) + self.log.error( + gatt_cb_err['char_change_err'].format(expected_event)) + return False + return True diff --git a/acts_tests/tests/google/ble/gatt/GattWriteTest.py b/acts_tests/tests/google/ble/gatt/GattWriteTest.py index e69de29bb2..d245e9e36e 100644 --- a/acts_tests/tests/google/ble/gatt/GattWriteTest.py +++ b/acts_tests/tests/google/ble/gatt/GattWriteTest.py @@ -0,0 +1,572 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2016 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +""" +This test script exercises different GATT write procedures. +""" + +from acts.test_decorators import test_tracker_info +from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest +from acts.test_utils.bt.GattConnectedBaseTest import GattConnectedBaseTest +from acts.test_utils.bt.bt_constants import gatt_characteristic +from acts.test_utils.bt.bt_constants import gatt_descriptor +from acts.test_utils.bt.bt_constants import gatt_event +from acts.test_utils.bt.bt_constants import gatt_cb_strings +from acts.test_utils.bt.bt_constants import gatt_connection_priority +from acts.test_utils.bt.bt_constants import gatt_characteristic_attr_length +from acts.test_utils.bt.bt_constants import gatt_mtu_size +from acts.test_utils.bt.bt_gatt_utils import setup_gatt_mtu + + +class GattWriteTest(GattConnectedBaseTest): + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='513f4cef-489e-4bb6-96cc-c298c589225c') + def test_write_char(self): + """Test write characteristic value + + Test write characteristic value using Write Request + + 1. Central: write WRITABLE_CHAR_UUID characteristic with char_value + using write request. + 2. Peripheral: receive the written data. + 3. Peripheral: send response with status 0 (success). + 4. Central: make sure write callback is called. + + Expected Result: + Verify that write request/response is properly delivered. + + Returns: + Pass if True + Fail if False + + TAGS: LE, GATT, Characteristic + Priority: 0 + """ + char_value = [1, 2, 3, 4, 5, 6, 7] + self.cen_ad.droid.gattClientCharacteristicSetValue( + self.bluetooth_gatt, self.discovered_services_index, + self.test_service_index, self.WRITABLE_CHAR_UUID, char_value) + + self.cen_ad.droid.gattClientCharacteristicSetWriteType( + self.bluetooth_gatt, self.discovered_services_index, + self.test_service_index, self.WRITABLE_CHAR_UUID, + gatt_characteristic['write_type_default']) + + self.cen_ad.droid.gattClientWriteCharacteristic( + self.bluetooth_gatt, self.discovered_services_index, + self.test_service_index, self.WRITABLE_CHAR_UUID) + + event = self._server_wait(gatt_event['char_write_req']) + + request_id = event['data']['requestId'] + self.assertEqual(True, event['data']['responseNeeded'], + "Should need response") + self.assertEqual(char_value, event['data']['value']) + self.assertEqual(0, event['data']['offset']) + + bt_device_id = 0 + status = 0 + #both offset and return value don't matter, just the status + offset = 0 + self.per_ad.droid.gattServerGetConnectedDevices(self.gatt_server) + self.per_ad.droid.gattServerSendResponse( + self.gatt_server, bt_device_id, request_id, status, offset, []) + + event = self._client_wait(gatt_event['char_write']) + self.assertEqual(status, event["data"]["Status"], + "Write status should be 0") + # Write response doesn't carry any data expcept status + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='329dbef8-1b54-47e2-a388-b33ef9384464') + def test_write_descr(self): + """Test write descriptor value + + Test write descriptor value + + 1. Central: write WRITABLE_DESC_UUID descriptor with desc_value. + 2. Peripheral: receive the written data. + 3. Peripheral: send response with status 0 (success). + 4. Central: make sure write callback is called. + + Expected Result: + Verify that write request/response is properly delivered. + + Returns: + Pass if True + Fail if False + + TAGS: LE, GATT, Descriptor + Priority: 0 + """ + desc_value = [1, 2, 3, 4, 5, 6, 7] + self.cen_ad.droid.gattClientDescriptorSetValue( + self.bluetooth_gatt, self.discovered_services_index, + self.test_service_index, self.WRITABLE_CHAR_UUID, + self.WRITABLE_DESC_UUID, desc_value) + + self.cen_ad.droid.gattClientWriteDescriptor( + self.bluetooth_gatt, self.discovered_services_index, + self.test_service_index, self.WRITABLE_CHAR_UUID, + self.WRITABLE_DESC_UUID) + + event = self._server_wait(gatt_event['desc_write_req']) + + request_id = event['data']['requestId'] + self.assertEqual(True, event['data']['responseNeeded'], + "Should need response") + self.assertEqual(desc_value, event['data']['value']) + self.assertEqual(0, event['data']['offset']) + + bt_device_id = 0 + status = 0 + #both offset and return value don't matter, just the status + offset = 0 + self.per_ad.droid.gattServerGetConnectedDevices(self.gatt_server) + self.per_ad.droid.gattServerSendResponse( + self.gatt_server, bt_device_id, request_id, status, offset, []) + + event = self._client_wait(gatt_event['desc_write']) + self.assertEqual(status, event["data"]["Status"], + "Write status should be 0") + # Write response doesn't carry any data except status + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='85757307-5bb1-43e5-9331-f1d7bdcbd6a0') + def test_write_char_no_resp(self): + """Test write characteristic value + + Test write characteristic value using Write Command + + 1. Central: write WRITABLE_CHAR_UUID characteristic with char_value + using write command. + 2. Central: make sure write callback is called. + 3. Peripheral: receive the written data. + + Expected Result: + Verify that write command is properly delivered. + + Returns: + Pass if True + Fail if False + + TAGS: LE, GATT, Characteristic + Priority: 0 + """ + char_value = [1, 2, 3, 4, 5, 6, 7] + self.cen_ad.droid.gattClientCharacteristicSetValue( + self.bluetooth_gatt, self.discovered_services_index, + self.test_service_index, self.WRITABLE_CHAR_UUID, char_value) + + self.cen_ad.droid.gattClientCharacteristicSetWriteType( + self.bluetooth_gatt, self.discovered_services_index, + self.test_service_index, self.WRITABLE_CHAR_UUID, + gatt_characteristic['write_type_no_response']) + + self.cen_ad.droid.gattClientWriteCharacteristic( + self.bluetooth_gatt, self.discovered_services_index, + self.test_service_index, self.WRITABLE_CHAR_UUID) + + event = self._client_wait(gatt_event['char_write']) + if event["data"]["Status"] != 0: + self.log.error("Write status should be 0") + return False + + event = self._server_wait(gatt_event['char_write_req']) + + request_id = event['data']['requestId'] + self.assertEqual(False, event['data']['responseNeeded'], + "Should not need response") + self.assertEqual(0, event['data']['offset']) + self.assertEqual(char_value, event['data']['value']) + + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='0bf0182a-c315-4160-81be-9ce09f93608b') + def test_write_characteristic_long_no_resp(self): + """Test write characteristic value + + Test write characteristic value using Write Command + + 1. Central: write WRITABLE_CHAR_UUID characteristic with char_value + using write command. + 2. Central: make sure write callback is called. + 3. Peripheral: receive the written data. Check it was properly trimmed. + + Expected Result: + Verify that write command is properly trimmed and delivered. + + Returns: + Pass if True + Fail if False + + TAGS: LE, GATT, Characteristic + Priority: 0 + """ + char_value = [] + for i in range(512): + char_value.append(i % 256) + + self.cen_ad.droid.gattClientCharacteristicSetValue( + self.bluetooth_gatt, self.discovered_services_index, + self.test_service_index, self.WRITABLE_CHAR_UUID, char_value) + + self.cen_ad.droid.gattClientCharacteristicSetWriteType( + self.bluetooth_gatt, self.discovered_services_index, + self.test_service_index, self.WRITABLE_CHAR_UUID, + gatt_characteristic['write_type_no_response']) + + self.cen_ad.droid.gattClientWriteCharacteristic( + self.bluetooth_gatt, self.discovered_services_index, + self.test_service_index, self.WRITABLE_CHAR_UUID) + + event = self._server_wait(gatt_event['char_write_req']) + + request_id = event['data']['requestId'] + self.assertEqual(False, event['data']['responseNeeded']) + + # value shall be trimmed to MTU-3 + trimmed_value = char_value[0:self.mtu - 3] + self.assertEqual( + trimmed_value, event['data']['value'], + "Received value should be sent value trimmed to MTU-3") + + event = self._client_wait(gatt_event['char_write']) + if event["data"]["Status"] != 0: + self.log.error("Write status should be 0") + return False + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='b80f1b5a-a223-441e-a6ed-d3c284c83cc7') + def test_write_characteristic_value_longer_than_mtu_request(self): + """Test writing characteristic value longer than what mtu limts + + Test establishing a gatt connection between a GATT Peripheral and GATT + Client. Request mtu size equal to the max MTU. + The max number of bytes can be sent within a characteristic is + (MTU - gatt_characteristic_attr_length['attr_2']) since + the gatt_characteristic_attr_length['attr_2'] (3 bytes) are + used for its attribute of the command code and its handle. + Then reduce mtu by 1 and re-send the same characteristic. + Make sure the characteristic value received by the remote side is + also reduced properly. + + Steps: + 1. Create a GATT connection between the scanner(Client) and + advertiser(Peripheral). + 2. Client: request new mtu size change to max MTU. + 3. Client: write a characteristic with char_value of max MTU bytes. + 4. Peripheral: receive the written data. Check it was properly + truncated to (max MTU - gatt_characteristic_attr_length['attr_2']). + 5. Client: request mtu size change to (max MTU - 1). + 6. Client: write the same characteristic again. + 7. Peripheral: receive the written data. Check it was properly + truncated to (max MTU - 1 - gatt_characteristic_attr_length['attr_2']) + 8. Client: return mtu size. + + Expected Result: + Verify that data received by the Peripheral side is properly truncated + when mtu is set. + + Returns: + Pass if True + Fail if False + + TAGS: LE, GATT, Characteristic, MTU + Priority: 2 + """ + self.mtu = gatt_mtu_size['max'] + self.log.info("Set mtu to max MTU: {}".format(self.mtu)) + # set new MTU to the middle point of min and max of MTU + if not setup_gatt_mtu(self.cen_ad, self.bluetooth_gatt, + self.gatt_callback, self.mtu): + return False + + # create a characteristic with max MTU (217) bytes + char_value = [] + for i in range(gatt_mtu_size['max']): + char_value.append(i) + + self.cen_ad.droid.gattClientCharacteristicSetValue( + self.bluetooth_gatt, self.discovered_services_index, + self.test_service_index, self.WRITABLE_CHAR_UUID, char_value) + + self.cen_ad.droid.gattClientCharacteristicSetWriteType( + self.bluetooth_gatt, self.discovered_services_index, + self.test_service_index, self.WRITABLE_CHAR_UUID, + gatt_characteristic['write_type_no_response']) + + # write data to the characteristic of the Peripheral + self.cen_ad.droid.gattClientWriteCharacteristic( + self.bluetooth_gatt, self.discovered_services_index, + self.test_service_index, self.WRITABLE_CHAR_UUID) + + event = self._server_wait(gatt_event['char_write_req']) + self.log.info("Received value with mtu = max MTU: {}".format(event[ + 'data']['value'])) + + # check the data received by Peripheral shall be truncated to + # (mtu - gatt_characteristic_attr_length['attr_2']) bytes + data_length = self.mtu - gatt_characteristic_attr_length['attr_2'] + expected_value = char_value[:data_length] + self.assertEqual( + expected_value, event['data']['value'], + "Received value should have {} bytes".format(data_length)) + + # set the mtu to max MTU-1 + self.mtu = gatt_mtu_size['max'] - 1 + self.log.info("Set mtu to max MTU - 1 : {}".format(self.mtu)) + data_length = self.mtu - gatt_characteristic_attr_length['attr_2'] + if not setup_gatt_mtu(self.cen_ad, self.bluetooth_gatt, + self.gatt_callback, self.mtu): + return False + + # write the same characteric to Peripheral again + self.cen_ad.droid.gattClientWriteCharacteristic( + self.bluetooth_gatt, self.discovered_services_index, + self.test_service_index, self.WRITABLE_CHAR_UUID) + + event = self._server_wait(gatt_event['char_write_req']) + self.log.info("Data received when mtu = max MTU - 1: {}".format(event[ + 'data']['value'])) + + # check the data received by Peripheral shall be truncated to + # (mtu - gatt_characteristic_attr_length['attr_2']) bytes + # when mtu is reduced + expected_value = char_value[:data_length] + self.assertEqual( + expected_value, event['data']['value'], + "Received value should have {} bytes".format(data_length)) + + # return the mtu to default + self.mtu = gatt_mtu_size['min'] + self.log.info("Set mtu to min : {}".format(self.mtu)) + if not setup_gatt_mtu(self.cen_ad, self.bluetooth_gatt, + self.gatt_callback, self.mtu): + return False + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='319eee6d-22d9-4498-bb15-21d0018e45e6') + def test_write_characteristic_stress(self): + """Stress test write characteristic value + + Test write characteristic value using Write Request + + 1. Central: write WRITABLE_CHAR_UUID characteristic with char_value + using write request. + 2. Peripheral: receive the written data. + 3. Peripheral: send response with status 0 (success). + 4. Central: make sure write callback is called. + 5. Repeat steps 1-4 100 times. + + Expected Result: + Verify that write request/response is properly delivered. + + Returns: + Pass if True + Fail if False + + TAGS: LE, GATT, Characteristic + Priority: 0 + """ + self.cen_ad.droid.gattClientRequestConnectionPriority( + self.bluetooth_gatt, gatt_connection_priority['high']) + + bt_device_id = 0 + + self.cen_ad.droid.gattClientCharacteristicSetWriteType( + self.bluetooth_gatt, self.discovered_services_index, + self.test_service_index, self.WRITABLE_CHAR_UUID, + gatt_characteristic['write_type_default']) + + for i in range(100): + + char_value = [] + for j in range(i, i + self.mtu - 3): + char_value.append(j % 256) + + self.cen_ad.droid.gattClientCharacteristicSetValue( + self.bluetooth_gatt, self.discovered_services_index, + self.test_service_index, self.WRITABLE_CHAR_UUID, char_value) + + self.cen_ad.droid.gattClientWriteCharacteristic( + self.bluetooth_gatt, self.discovered_services_index, + self.test_service_index, self.WRITABLE_CHAR_UUID) + + event = self._server_wait(gatt_event['char_write_req']) + + self.log.info("{} event found: {}".format(gatt_cb_strings[ + 'char_write_req'].format(self.gatt_server_callback), event[ + 'data']['value'])) + request_id = event['data']['requestId'] + found_value = event['data']['value'] + if found_value != char_value: + self.log.info("Values didn't match. Found: {}, " + "Expected: {}".format(found_value, char_value)) + return False + + # only status is sent + status = 0 + offset = 0 + char_value_return = [] + self.per_ad.droid.gattServerSendResponse( + self.gatt_server, bt_device_id, request_id, status, offset, + char_value_return) + + event = self._client_wait(gatt_event['char_write']) + if event["data"]["Status"] != status: + self.log.error("Write status should be 0") + return False + + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='b19d42dc-58ba-4b20-b6c1-6628e7d21de4') + def test_write_descriptor_stress(self): + """Stress test write descriptor value + + Stress test write descriptor value + + 1. Central: write WRITABLE_DESC_UUID descriptor with desc_value. + 2. Peripheral: receive the written data. + 3. Peripheral: send response with status 0 (success). + 4. Central: make sure write callback is called. + 5. Repeat 1-4 100 times + + Expected Result: + Verify that write request/response is properly delivered. + + Returns: + Pass if True + Fail if False + + TAGS: LE, GATT, Descriptor + Priority: 0 + """ + self.cen_ad.droid.gattClientRequestConnectionPriority( + self.bluetooth_gatt, gatt_connection_priority['high']) + + for i in range(100): + + desc_value = [] + for j in range(i, i + self.mtu - 3): + desc_value.append(j % 256) + + self.cen_ad.droid.gattClientDescriptorSetValue( + self.bluetooth_gatt, self.discovered_services_index, + self.test_service_index, self.WRITABLE_CHAR_UUID, + self.WRITABLE_DESC_UUID, desc_value) + + self.cen_ad.droid.gattClientWriteDescriptor( + self.bluetooth_gatt, self.discovered_services_index, + self.test_service_index, self.WRITABLE_CHAR_UUID, + self.WRITABLE_DESC_UUID) + + event = self._server_wait(gatt_event['desc_write_req']) + + self.log.info("{} event found: {}".format(gatt_cb_strings[ + 'char_write_req'].format(self.gatt_server_callback), event[ + 'data']['value'])) + + request_id = event['data']['requestId'] + self.assertEqual(True, event['data']['responseNeeded'], + "Should need response") + self.assertEqual(desc_value, event['data']['value']) + self.assertEqual(0, event['data']['offset']) + + bt_device_id = 0 + status = 0 + #both offset and return value don't matter, just the status + offset = 0 + self.per_ad.droid.gattServerGetConnectedDevices(self.gatt_server) + self.per_ad.droid.gattServerSendResponse( + self.gatt_server, bt_device_id, request_id, status, offset, []) + + event = self._client_wait(gatt_event['desc_write']) + self.assertEqual(status, event["data"]["Status"], + "Write status should be 0") + # Write response doesn't carry any data except status + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='74c147eb-2702-4cd8-be1f-efff3e9eaa6c') + def test_write_characteristic_no_resp_stress(self): + """Stress test write characteristic value + + Stress test write characteristic value using Write Command + + 1. Central: write WRITABLE_CHAR_UUID characteristic with char_value + using write command. + 2. Central: make sure write callback is called. + 3. Peripheral: receive the written data. + 4. Repeat steps 1-3 100 times. + + Expected Result: + Verify that write command is properly delivered. + + Returns: + Pass if True + Fail if False + + TAGS: LE, GATT, Characteristic + Priority: 0 + """ + self.cen_ad.droid.gattClientRequestConnectionPriority( + self.bluetooth_gatt, gatt_connection_priority['high']) + + bt_device_id = 0 + + self.cen_ad.droid.gattClientCharacteristicSetWriteType( + self.bluetooth_gatt, self.discovered_services_index, + self.test_service_index, self.WRITABLE_CHAR_UUID, + gatt_characteristic['write_type_no_response']) + + for i in range(100): + char_value = [] + for j in range(i, i + self.mtu - 3): + char_value.append(j % 256) + + self.cen_ad.droid.gattClientCharacteristicSetValue( + self.bluetooth_gatt, self.discovered_services_index, + self.test_service_index, self.WRITABLE_CHAR_UUID, char_value) + + self.cen_ad.droid.gattClientWriteCharacteristic( + self.bluetooth_gatt, self.discovered_services_index, + self.test_service_index, self.WRITABLE_CHAR_UUID) + + # client shall not wait for server, get complete event right away + event = self._client_wait(gatt_event['char_write']) + if event["data"]["Status"] != 0: + self.log.error("Write status should be 0") + return False + + event = self._server_wait(gatt_event['char_write_req']) + + self.log.info("{} event found: {}".format(gatt_cb_strings[ + 'char_write_req'].format(self.gatt_server_callback), event[ + 'data']['value'])) + request_id = event['data']['requestId'] + found_value = event['data']['value'] + if found_value != char_value: + self.log.info("Values didn't match. Found: {}, " + "Expected: {}".format(found_value, char_value)) + return False + + return True diff --git a/acts_tests/tests/google/ble/scan/BleBackgroundScanTest.py b/acts_tests/tests/google/ble/scan/BleBackgroundScanTest.py index e69de29bb2..68396023b4 100644 --- a/acts_tests/tests/google/ble/scan/BleBackgroundScanTest.py +++ b/acts_tests/tests/google/ble/scan/BleBackgroundScanTest.py @@ -0,0 +1,277 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2016 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +""" +This test script exercises background scan test scenarios. +""" + +from queue import Empty + +from acts import utils +from acts.test_decorators import test_tracker_info +from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest +from acts.test_utils.bt.bt_test_utils import bluetooth_off +from acts.test_utils.bt.bt_test_utils import bluetooth_on +from acts.test_utils.bt.bt_test_utils import cleanup_scanners_and_advertisers +from acts.test_utils.bt.bt_test_utils import enable_bluetooth +from acts.test_utils.bt.bt_test_utils import generate_ble_advertise_objects +from acts.test_utils.bt.bt_test_utils import generate_ble_scan_objects +from acts.test_utils.bt.bt_constants import bluetooth_le_off +from acts.test_utils.bt.bt_constants import bluetooth_le_on +from acts.test_utils.bt.bt_constants import bt_adapter_states +from acts.test_utils.bt.bt_constants import ble_scan_settings_modes +from acts.test_utils.bt.bt_constants import scan_result + +import time + + +class BleBackgroundScanTest(BluetoothBaseTest): + default_timeout = 10 + report_delay = 2000 + scan_callbacks = [] + adv_callbacks = [] + active_scan_callback_list = [] + active_adv_callback_list = [] + + def setup_class(self): + super(BluetoothBaseTest, self).setup_class() + self.scn_ad = self.android_devices[0] + self.adv_ad = self.android_devices[1] + + utils.set_location_service(self.scn_ad, True) + utils.set_location_service(self.adv_ad, True) + return True + + def setup_test(self): + # Always start tests with Bluetooth enabled and BLE disabled. + enable_bluetooth(self.scn_ad.droid, self.scn_ad.ed) + self.scn_ad.droid.bluetoothDisableBLE() + for a in self.android_devices: + a.ed.clear_all_events() + return True + + def teardown_test(self): + cleanup_scanners_and_advertisers( + self.scn_ad, self.active_adv_callback_list, self.adv_ad, + self.active_adv_callback_list) + self.active_adv_callback_list = [] + self.active_scan_callback_list = [] + + def _setup_generic_advertisement(self): + self.adv_ad.droid.bleSetAdvertiseDataIncludeDeviceName(True) + adv_callback, adv_data, adv_settings = generate_ble_advertise_objects( + self.adv_ad.droid) + self.adv_ad.droid.bleStartBleAdvertising(adv_callback, adv_data, + adv_settings) + self.active_adv_callback_list.append(adv_callback) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='4d13c3a8-1805-44ef-a92a-e385540767f1') + def test_background_scan(self): + """Test generic background scan. + + Tests LE background scan. The goal is to find scan results even though + Bluetooth is turned off. + + Steps: + 1. Setup an advertisement on dut1 + 2. Enable LE on the Bluetooth Adapter on dut0 + 3. Toggle BT off on dut1 + 4. Start a LE scan on dut0 + 5. Find the advertisement from dut1 + + Expected Result: + Find a advertisement from the scan instance. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Scanning, Background Scanning + Priority: 0 + """ + self.scn_ad.droid.bluetoothEnableBLE() + self._setup_generic_advertisement() + self.scn_ad.droid.bleSetScanSettingsScanMode( + ble_scan_settings_modes['low_latency']) + filter_list, scan_settings, scan_callback = generate_ble_scan_objects( + self.scn_ad.droid) + self.scn_ad.droid.bleSetScanFilterDeviceName( + self.adv_ad.droid.bluetoothGetLocalName()) + self.scn_ad.droid.bleBuildScanFilter(filter_list) + self.scn_ad.droid.bluetoothToggleState(False) + try: + self.scn_ad.ed.pop_event(bluetooth_off, self.default_timeout) + except Empty: + self.log.error("Bluetooth Off event not found. Expected {}".format( + bluetooth_off)) + return False + self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, + scan_callback) + expected_event = scan_result.format(scan_callback) + try: + self.scn_ad.ed.pop_event(expected_event, self.default_timeout) + except Empty: + self.log.error("Scan Result event not found. Expected {}".format( + expected_event)) + return False + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='9c4577f8-5e06-4034-b977-285956734974') + def test_background_scan_ble_disabled(self): + """Test background LE scanning with LE disabled. + + Tests LE background scan. The goal is to find scan results even though + Bluetooth is turned off. + + Steps: + 1. Setup an advertisement on dut1 + 2. Enable LE on the Bluetooth Adapter on dut0 + 3. Toggle BT off on dut1 + 4. Start a LE scan on dut0 + 5. Find the advertisement from dut1 + + Expected Result: + Find a advertisement from the scan instance. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Scanning, Background Scanning + Priority: 0 + """ + self._setup_generic_advertisement() + self.scn_ad.droid.bluetoothEnableBLE() + self.scn_ad.droid.bleSetScanSettingsScanMode( + ble_scan_settings_modes['low_latency']) + filter_list, scan_settings, scan_callback = generate_ble_scan_objects( + self.scn_ad.droid) + self.scn_ad.droid.bleSetScanFilterDeviceName( + self.adv_ad.droid.bluetoothGetLocalName()) + self.scn_ad.droid.bleBuildScanFilter(filter_list) + self.scn_ad.droid.bluetoothToggleState(False) + try: + self.scn_ad.ed.pop_event(bluetooth_off, self.default_timeout) + except Empty: + self.log.info(self.scn_ad.droid.bluetoothCheckState()) + self.log.error("Bluetooth Off event not found. Expected {}".format( + bluetooth_off)) + return False + try: + self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, + scan_callback) + expected_event = scan_result.format(scan_callback) + try: + self.scn_ad.ed.pop_event(expected_event, self.default_timeout) + except Empty: + self.log.error( + "Scan Result event not found. Expected {}".format( + expected_event)) + return False + except Exception: + self.log.info( + "Was not able to start a background scan as expected.") + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='0bdd1764-3dc6-4a82-b041-76e48ed0f424') + def test_airplane_mode_disables_ble(self): + """Try to start LE mode in Airplane Mode. + + This test will enable airplane mode, then attempt to start LE scanning + mode. This should result in bluetooth still being turned off, LE + not enabled. + + Steps: + 1. Start LE only mode. + 2. Bluetooth should be in LE ONLY mode + 2. Turn on airplane mode. + 3. Bluetooth should be OFF + 4. Try to start LE only mode. + 5. Bluetooth should stay in OFF mode (LE only start should fail) + 6. Turn off airplane mode. + 7. Bluetooth should be OFF. + + Expected Result: + No unexpected bluetooth state changes. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Airplane + Priority: 1 + """ + ble_state_error_msg = "Bluetooth LE State not OK {}. Expected {} got {}" + # Enable BLE always available (effectively enabling BT in location) + self.scn_ad.shell.enable_ble_scanning() + self.scn_ad.droid.bluetoothEnableBLE() + self.scn_ad.droid.bluetoothToggleState(False) + try: + self.scn_ad.ed.pop_event(bluetooth_off, self.default_timeout) + except Empty: + self.log.error("Bluetooth Off event not found. Expected {}".format( + bluetooth_off)) + self.log.info(self.scn_ad.droid.bluetoothCheckState()) + return False + + # Sleep because LE turns off after the bluetooth off event fires + time.sleep(self.default_timeout) + state = self.scn_ad.droid.bluetoothGetLeState() + if state != bt_adapter_states['ble_on']: + self.log.error( + ble_state_error_msg.format("after BT Disable", + bt_adapter_states['ble_on'], state)) + return False + + self.scn_ad.droid.bluetoothListenForBleStateChange() + self.scn_ad.droid.connectivityToggleAirplaneMode(True) + try: + self.scn_ad.ed.pop_event(bluetooth_le_off, self.default_timeout) + except Empty: + self.log.error( + "Bluetooth LE Off event not found. Expected {}".format( + bluetooth_le_off)) + return False + state = self.scn_ad.droid.bluetoothGetLeState() + if state != bt_adapter_states['off']: + self.log.error( + ble_state_error_msg.format("after Airplane Mode ON", + bt_adapter_states['off'], state)) + return False + result = self.scn_ad.droid.bluetoothEnableBLE() + if result: + self.log.error( + "Bluetooth Enable command succeded when it should have failed (in airplane mode)" + ) + return False + state = self.scn_ad.droid.bluetoothGetLeState() + if state != bt_adapter_states['off']: + self.log.error( + "Bluetooth LE State not OK after attempted enable. Expected {} got {}". + format(bt_adapter_states['off'], state)) + return False + self.scn_ad.droid.connectivityToggleAirplaneMode(False) + # Sleep to let Airplane Mode disable propogate through the system + time.sleep(self.default_timeout) + state = self.scn_ad.droid.bluetoothGetLeState() + if state != bt_adapter_states['off']: + self.log.error( + ble_state_error_msg.format("after Airplane Mode OFF", + bt_adapter_states['off'], state)) + return False + return True diff --git a/acts_tests/tests/google/ble/scan/BleOnLostOnFoundTest.py b/acts_tests/tests/google/ble/scan/BleOnLostOnFoundTest.py index e69de29bb2..01f7976db4 100644 --- a/acts_tests/tests/google/ble/scan/BleOnLostOnFoundTest.py +++ b/acts_tests/tests/google/ble/scan/BleOnLostOnFoundTest.py @@ -0,0 +1,292 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2016 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +""" +This test script exercises different onLost/onFound scenarios. +""" + +from queue import Empty +from acts import utils +from acts.test_decorators import test_tracker_info +from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest +from acts.test_utils.bt.bt_constants import ble_advertise_settings_modes +from acts.test_utils.bt.bt_constants import ble_scan_settings_callback_types +from acts.test_utils.bt.BleEnum import ScanSettingsMatchMode +from acts.test_utils.bt.BleEnum import ScanSettingsMatchNum +from acts.test_utils.bt.bt_constants import ble_scan_settings_modes +from acts.test_utils.bt.bt_constants import ble_scan_settings_match_modes +from acts.test_utils.bt.bt_constants import ble_scan_settings_match_nums +from acts.test_utils.bt.bt_constants import adv_succ +from acts.test_utils.bt.bt_test_utils import cleanup_scanners_and_advertisers +from acts.test_utils.bt.bt_test_utils import reset_bluetooth +from acts.test_utils.bt.bt_constants import scan_result + + +class BleOnLostOnFoundTest(BluetoothBaseTest): + default_timeout = 10 + active_scan_callback_list = [] + active_adv_callback_list = [] + + def setup_class(self): + super(BluetoothBaseTest, self).setup_class() + self.scn_ad = self.android_devices[0] + self.adv_ad = self.android_devices[1] + + utils.set_location_service(self.scn_ad, True) + utils.set_location_service(self.adv_ad, True) + return True + + def teardown_test(self): + cleanup_scanners_and_advertisers( + self.scn_ad, self.active_adv_callback_list, self.adv_ad, + self.active_adv_callback_list) + self.active_adv_callback_list = [] + self.active_scan_callback_list = [] + + def on_exception(self, test_name, begin_time): + reset_bluetooth(self.android_devices) + + def _start_generic_advertisement_include_device_name(self): + self.adv_ad.droid.bleSetAdvertiseDataIncludeDeviceName(True) + self.adv_ad.droid.bleSetAdvertiseSettingsAdvertiseMode( + ble_advertise_settings_modes['low_latency']) + advertise_data = self.adv_ad.droid.bleBuildAdvertiseData() + advertise_settings = self.adv_ad.droid.bleBuildAdvertiseSettings() + advertise_callback = self.adv_ad.droid.bleGenBleAdvertiseCallback() + self.adv_ad.droid.bleStartBleAdvertising( + advertise_callback, advertise_data, advertise_settings) + self.adv_ad.ed.pop_event( + adv_succ.format(advertise_callback), self.default_timeout) + self.active_adv_callback_list.append(advertise_callback) + return advertise_callback + + def _verify_no_events_found(self, event_name): + try: + self.scn_ad.ed.pop_event(event_name, self.default_timeout) + self.log.error("Found an event when none was expected.") + return False + except Empty: + self.log.info("No scan result found as expected.") + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='9bd7fd09-71c9-4623-90f0-9a895eb37409') + def test_onlost_onfound_defaults(self): + """Test generic onlost/onfound defaults. + + Tests basic onFound/onLost functionality. + + Steps: + 1. Setup dut0 scanner and start scan with this setup: + Scan Mode: SCAN_MODE_LOW_LATENCY + Callback Type: CALLBACK_TYPE_FOUND_AND_LOST + Match Mode: AGGRESSIVE + Num of Matches: MATCH_NUM_ONE_ADVERTISEMENT + Filter: Device name of dut1 + 2. Start an advertisement on dut1, include device name + 3. Find an onFound event + 4. Stop the advertisement on dut1 + 5. Find an onLost event + + Expected Result: + Find an onLost and an onFound event successfully. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Scanning, onLost, onFound + Priority: 0 + """ + filter_list = self.scn_ad.droid.bleGenFilterList() + self.scn_ad.droid.bleSetScanFilterDeviceName( + self.adv_ad.droid.bluetoothGetLocalName()) + self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ + 'low_latency']) + self.scn_ad.droid.bleSetScanSettingsCallbackType( + ble_scan_settings_callback_types['found_and_lost']) + self.scn_ad.droid.bleSetScanSettingsMatchMode( + ble_scan_settings_match_modes['aggresive']) + self.scn_ad.droid.bleSetScanSettingsNumOfMatches( + ble_scan_settings_match_nums['one']) + scan_settings = self.scn_ad.droid.bleBuildScanSetting() + scan_callback = self.scn_ad.droid.bleGenScanCallback() + self.scn_ad.droid.bleBuildScanFilter(filter_list) + self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, + scan_callback) + self.active_scan_callback_list.append(scan_callback) + adv_callback = self._start_generic_advertisement_include_device_name() + event = self.scn_ad.ed.pop_event( + scan_result.format(scan_callback), self.default_timeout * 3) + found_callback_type = event['data']['CallbackType'] + if event['data']['CallbackType'] != ble_scan_settings_callback_types[ + 'first_match']: + self.log.info( + "Found Callbacreset_bluetoothkType:{}, Expected CallbackType:{}". + format(found_callback_type, ble_scan_settings_callback_types[ + 'first_match'])) + return False + self.adv_ad.droid.bleStopBleAdvertising(adv_callback) + event = self.scn_ad.ed.pop_event( + scan_result.format(scan_callback), self.default_timeout * 4) + found_callback_type = event['data']['CallbackType'] + if found_callback_type != ble_scan_settings_callback_types[ + 'match_lost']: + self.log.info( + "Found CallbackType:{}, Expected CallbackType:{}".format( + found_callback_type, ble_scan_settings_callback_types[ + 'match_lost'])) + return False + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='10b48dc9-0c2a-46a3-8890-5cde3004a996') + def test_onlost_onfound_match_mode_sticky(self): + """Test generic onlost/onfound in sticky mode. + + Tests basic onFound/onLost functionality. + + Steps: + 1. Setup dut0 scanner and start scan with this setup: + Scan Mode: SCAN_MODE_LOW_LATENCY + Callback Type: CALLBACK_TYPE_FOUND_AND_LOST + Match Mode: STICKY + Num of Matches: MATCH_NUM_ONE_ADVERTISEMENT + Filter: Device name of dut1 + 2. Start an advertisement on dut1, include device name + 3. Find an onFound event + 4. Stop the advertisement on dut1 + 5. Find an onLost event + + Expected Result: + Find an onLost and an onFound event successfully. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Scanning, onLost, onFound + Priority: 1 + """ + filter_list = self.scn_ad.droid.bleGenFilterList() + self.scn_ad.droid.bleSetScanFilterDeviceName( + self.adv_ad.droid.bluetoothGetLocalName()) + self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ + 'low_latency']) + self.scn_ad.droid.bleSetScanSettingsCallbackType( + ble_scan_settings_callback_types['found_and_lost']) + self.scn_ad.droid.bleSetScanSettingsMatchMode( + ble_scan_settings_match_modes['sticky']) + self.scn_ad.droid.bleSetScanSettingsNumOfMatches( + ble_scan_settings_match_nums['one']) + scan_settings = self.scn_ad.droid.bleBuildScanSetting() + scan_callback = self.scn_ad.droid.bleGenScanCallback() + self.scn_ad.droid.bleBuildScanFilter(filter_list) + self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, + scan_callback) + self.active_scan_callback_list.append(scan_callback) + adv_callback = self._start_generic_advertisement_include_device_name() + event = self.scn_ad.ed.pop_event( + scan_result.format(scan_callback), self.default_timeout * 3) + found_callback_type = event['data']['CallbackType'] + if event['data']['CallbackType'] != ble_scan_settings_callback_types[ + 'first_match']: + self.log.info( + "Found CallbackType:{}, Expected CallbackType:{}".format( + found_callback_type, ble_scan_settings_callback_types[ + 'first_match'])) + return False + self.adv_ad.droid.bleStopBleAdvertising(adv_callback) + event = self.scn_ad.ed.pop_event( + scan_result.format(scan_callback), self.default_timeout * 4) + found_callback_type = event['data']['CallbackType'] + if found_callback_type != ble_scan_settings_callback_types[ + 'match_lost']: + self.log.info( + "Found CallbackType:{}, Expected CallbackType:{}".format( + found_callback_type, ble_scan_settings_callback_types[ + 'match_lost'])) + return False + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='4fefed82-7800-41be-8272-aac076640fed') + def test_onlost_onfound_match_num_few(self): + """Test generic onlost/onfound num few. + + Tests basic onFound/onLost functionality. + + Steps: + 1. Setup dut0 scanner and start scan with this setup: + Scan Mode: SCAN_MODE_LOW_LATENCY + Callback Type: CALLBACK_TYPE_FOUND_AND_LOST + Match Mode: AGGRESSIVE + Num of Matches: MATCH_NUM_FEW_ADVERTISEMENT + Filter: Device name of dut1 + 2. Start an advertisement on dut1, include device name + 3. Find an onFound event + 4. Stop the advertisement on dut1 + 5. Find an onLost event + + Expected Result: + Find an onLost and an onFound event successfully. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Scanning, onLost, onFound + Priority: 1 + """ + filter_list = self.scn_ad.droid.bleGenFilterList() + self.scn_ad.droid.bleSetScanFilterDeviceName( + self.adv_ad.droid.bluetoothGetLocalName()) + self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ + 'low_latency']) + self.scn_ad.droid.bleSetScanSettingsCallbackType( + ble_scan_settings_callback_types['found_and_lost']) + self.scn_ad.droid.bleSetScanSettingsMatchMode( + ble_scan_settings_match_modes['aggresive']) + self.scn_ad.droid.bleSetScanSettingsNumOfMatches( + ble_scan_settings_match_nums['few']) + scan_settings = self.scn_ad.droid.bleBuildScanSetting() + scan_callback = self.scn_ad.droid.bleGenScanCallback() + self.scn_ad.droid.bleBuildScanFilter(filter_list) + self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, + scan_callback) + self.active_scan_callback_list.append(scan_callback) + adv_callback = self._start_generic_advertisement_include_device_name() + event = self.scn_ad.ed.pop_event( + scan_result.format(scan_callback), self.default_timeout * 3) + found_callback_type = event['data']['CallbackType'] + if event['data']['CallbackType'] != ble_scan_settings_callback_types[ + 'first_match']: + self.log.info( + "Found CallbackType:{}, Expected CallbackType:{}".format( + found_callback_type, ble_scan_settings_callback_types[ + 'first_match'])) + return False + self.adv_ad.droid.bleStopBleAdvertising(adv_callback) + event = self.scn_ad.ed.pop_event( + scan_result.format(scan_callback), self.default_timeout * 4) + found_callback_type = event['data']['CallbackType'] + if found_callback_type != ble_scan_settings_callback_types[ + 'match_lost']: + self.log.info( + "Found CallbackType:{}, Expected CallbackType:{}".format( + found_callback_type, ble_scan_settings_callback_types[ + 'match_lost'])) + return False + return True diff --git a/acts_tests/tests/google/ble/scan/BleOpportunisticScanTest.py b/acts_tests/tests/google/ble/scan/BleOpportunisticScanTest.py index e69de29bb2..9e591281b1 100644 --- a/acts_tests/tests/google/ble/scan/BleOpportunisticScanTest.py +++ b/acts_tests/tests/google/ble/scan/BleOpportunisticScanTest.py @@ -0,0 +1,702 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2016 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +""" +This test script exercises different opportunistic scan scenarios. +It is expected that the second AndroidDevice is able to advertise. + +This test script was designed with this setup in mind: +Shield box one: Android Device, Android Device +""" + +from queue import Empty + +from acts import utils +from acts.test_decorators import test_tracker_info +from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest +from acts.test_utils.bt.bt_constants import ble_scan_settings_modes +from acts.test_utils.bt.bt_constants import ble_scan_settings_modes +from acts.test_utils.bt.bt_constants import batch_scan_result +from acts.test_utils.bt.bt_test_utils import cleanup_scanners_and_advertisers +from acts.test_utils.bt.bt_test_utils import generate_ble_advertise_objects +from acts.test_utils.bt.bt_test_utils import generate_ble_scan_objects +from acts.test_utils.bt.bt_test_utils import reset_bluetooth +from acts.test_utils.bt.bt_constants import scan_result + + +class BleOpportunisticScanTest(BluetoothBaseTest): + default_timeout = 10 + max_scan_instances = 25 + report_delay = 2000 + scan_callbacks = [] + adv_callbacks = [] + active_scan_callback_list = [] + active_adv_callback_list = [] + + def setup_class(self): + super(BluetoothBaseTest, self).setup_class() + self.scn_ad = self.android_devices[0] + self.adv_ad = self.android_devices[1] + + utils.set_location_service(self.scn_ad, True) + utils.set_location_service(self.adv_ad, True) + return True + + def teardown_test(self): + cleanup_scanners_and_advertisers( + self.scn_ad, self.active_scan_callback_list, self.adv_ad, + self.active_adv_callback_list) + self.active_adv_callback_list = [] + self.active_scan_callback_list = [] + + def on_exception(self, test_name, begin_time): + reset_bluetooth(self.android_devices) + + def _setup_generic_advertisement(self): + adv_callback, adv_data, adv_settings = generate_ble_advertise_objects( + self.adv_ad.droid) + self.adv_ad.droid.bleStartBleAdvertising(adv_callback, adv_data, + adv_settings) + self.active_adv_callback_list.append(adv_callback) + + def _verify_no_events_found(self, event_name): + try: + event = self.scn_ad.ed.pop_event(event_name, self.default_timeout) + self.log.error("Found an event when none was expected: {}".format( + event)) + return False + except Empty: + self.log.info("No scan result found as expected.") + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='6bccfbea-3734-4504-8ea9-3511ad17a3e0') + def test_scan_result_no_advertisement(self): + """Test opportunistic scan with no advertisement. + + Tests opportunistic scan where there are no advertisements. This should + not find any onScanResults. + + Steps: + 1. Initialize scanner with scan mode set to opportunistic mode. + 2. Start scanning on dut 0 + 3. Pop onScanResults event on the scanner + + Expected Result: + Find no advertisements with the opportunistic scan instance. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Scanning, Opportunistic Scan + Priority: 1 + """ + self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ + 'opportunistic']) + filter_list, scan_settings, scan_callback = generate_ble_scan_objects( + self.scn_ad.droid) + self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, + scan_callback) + self.active_scan_callback_list.append(scan_callback) + if not self._verify_no_events_found(scan_result.format(scan_callback)): + return False + self.scn_ad.droid.bleStopBleScan(scan_callback) + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='8430bc57-925c-4b70-a62e-cd34df264ca1') + def test_batch_scan_result_no_advertisement(self): + """Test batch opportunistic scan without an advertisement. + + Tests opportunistic scan where there are no advertisements. This should + not find any onBatchScanResult. + + Steps: + 1. Initialize scanner with scan mode set to opportunistic mode. + 2. Set report delay seconds such that onBatchScanResult events are + expected + 2. Start scanning on dut 0 + 3. Pop onBatchScanResult event on the scanner + + Expected Result: + Find no advertisements with the opportunistic scan instance. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Scanning, Opportunistic Scan, Batch Scanning + Priority: 1 + """ + self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ + 'opportunistic']) + self.scn_ad.droid.bleSetScanSettingsReportDelayMillis( + self.report_delay) + filter_list, scan_settings, scan_callback = generate_ble_scan_objects( + self.scn_ad.droid) + self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, + scan_callback) + self.active_scan_callback_list.append(scan_callback) + if not self._verify_no_events_found( + batch_scan_result.format(scan_callback)): + return False + self.scn_ad.droid.bleStopBleScan(scan_callback) + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='4613cb67-0f54-494e-8a56-2e8ce56fad41') + def test_scan_result(self): + """Test opportunistic scan with an advertisement. + + Tests opportunistic scan where it will only report scan results when + other registered scanners find results. + + Steps: + 1. Initialize advertiser and start advertisement on dut1 + 2. Initialize scanner with scan mode set to opportunistic mode on dut0 + and start scanning + 3. Try to find an event, expect none. + 4. Start a second scanner on dut0, with any other mode set + 5. Pop onScanResults event on the second scanner + 6. Pop onScanResults event on the first scanner + + Expected Result: + Scan result is found on the opportunistic scan instance. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Scanning, Opportunistic Scan + Priority: 1 + """ + self._setup_generic_advertisement() + self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ + 'opportunistic']) + filter_list, scan_settings, scan_callback = generate_ble_scan_objects( + self.scn_ad.droid) + + self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, + scan_callback) + self.active_scan_callback_list.append(scan_callback) + if not self._verify_no_events_found(scan_result.format(scan_callback)): + return False + self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ + 'low_latency']) + filter_list2, scan_settings2, scan_callback2 = ( + generate_ble_scan_objects(self.scn_ad.droid)) + self.scn_ad.droid.bleStartBleScan(filter_list2, scan_settings2, + scan_callback2) + self.active_scan_callback_list.append(scan_callback2) + try: + self.scn_ad.ed.pop_event( + scan_result.format(scan_callback2), self.default_timeout) + except Empty: + self.log.error("Non-Opportunistic scan found no scan results.") + return False + try: + self.scn_ad.ed.pop_event( + scan_result.format(scan_callback), self.default_timeout) + except Empty: + self.log.error("Opportunistic scan found no scan results.") + return False + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='5b46fefc-70ef-48a0-acf4-35077cd72202') + def test_batch_scan_result(self): + """Test batch opportunistic scan with advertisement. + + Tests opportunistic scan where it will only report scan results when + other registered scanners find results. Set the report delay millis such + that an onBatchScanResult is expected. + + Steps: + 1. Initialize advertiser and start advertisement on dut1 + 2. Initialize scanner with scan mode set to opportunistic mode and + set scan settings report delay seconds such that a batch scan is + expected + 3. Start scanning on dut 0 + 4. Try to find an event, expect none. + 5. Start a second scanner on dut0, with any other mode set and set scan + settings report delay millis such that an onBatchScanResult is expected + 6. Pop onBatchScanResult event on the second scanner + 7. Pop onBatchScanResult event on the first scanner + + Expected Result: + Find a batch scan result on both opportunistic scan instances. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Scanning, Opportunistic Scan, Batch Scanning + Priority: 1 + """ + self._setup_generic_advertisement() + self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ + 'opportunistic']) + self.scn_ad.droid.bleSetScanSettingsReportDelayMillis( + self.report_delay) + filter_list, scan_settings, scan_callback = generate_ble_scan_objects( + self.scn_ad.droid) + self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, + scan_callback) + self.active_scan_callback_list.append(scan_callback) + if not self._verify_no_events_found( + batch_scan_result.format(scan_callback)): + return False + self.scn_ad.droid.bleSetScanSettingsReportDelayMillis( + self.report_delay) + self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ + 'low_latency']) + filter_list2, scan_settings2, scan_callback2 = generate_ble_scan_objects( + self.scn_ad.droid) + self.scn_ad.droid.bleStartBleScan(filter_list2, scan_settings2, + scan_callback2) + self.active_scan_callback_list.append(scan_callback2) + try: + self.scn_ad.ed.pop_event( + batch_scan_result.format(scan_callback2), self.default_timeout) + except Empty: + self.log.error("Non-Opportunistic scan found no scan results.") + return False + try: + self.scn_ad.ed.pop_event( + batch_scan_result.format(scan_callback), self.default_timeout) + except Empty: + self.log.error("Opportunistic scan found no scan results.") + return False + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='fd85d95e-dc8c-48c1-8d8a-83c3475755ff') + def test_batch_scan_result_not_expected(self): + """Test opportunistic batch scan without expecting an event. + + Tests opportunistic scan where it will only report scan results when + other registered scanners find results. Set the report delay millis such + that a batch scan is not expected. + + Steps: + 1. Initialize advertiser and start advertisement on dut1 + 2. Initialize scanner with scan mode set to opportunistic mode and + set scan settings report delay seconds such that a batch scan is + expected. + 3. Start scanning on dut 0 + 4. Try to find an event, expect none. + 5. Start a second scanner on dut0, with any other mode set and set scan + settings report delay millis to 0 such that an onBatchScanResult is not + expected. + 6. Pop onScanResults event on the second scanner + 7. Pop onBatchScanResult event on the first scanner + + Expected Result: + Batch scan result is not expected on opportunistic scan instance. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Scanning, Opportunistic Scan, Batch Scanning + Priority: 1 + """ + self._setup_generic_advertisement() + self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ + 'opportunistic']) + self.scn_ad.droid.bleSetScanSettingsReportDelayMillis( + self.report_delay) + filter_list, scan_settings, scan_callback = generate_ble_scan_objects( + self.scn_ad.droid) + self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, + scan_callback) + self.active_scan_callback_list.append(scan_callback) + if not self._verify_no_events_found( + batch_scan_result.format(scan_callback)): + + return False + self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ + 'low_latency']) + filter_list2, scan_settings2, scan_callback2 = ( + generate_ble_scan_objects(self.scn_ad.droid)) + self.scn_ad.droid.bleStartBleScan(filter_list2, scan_settings2, + scan_callback2) + self.active_scan_callback_list.append(scan_callback2) + try: + self.scn_ad.ed.pop_event( + scan_result.format(scan_callback2), self.default_timeout) + except Empty: + self.log.error("Non-Opportunistic scan found no scan results.") + return False + return self._verify_no_events_found( + batch_scan_result.format(scan_callback)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='6138592e-8fd5-444f-9a7c-25cd9695644a') + def test_scan_result_not_expected(self): + """Test opportunistic scan without expecting an event. + + Tests opportunistic scan where it will only report batch scan results + when other registered scanners find results. + + Steps: + 1. Initialize advertiser and start advertisement on dut1 + 2. Initialize scanner with scan mode set to opportunistic mode. + 3. Start scanning on dut 0 + 4. Try to find an event, expect none. + 5. Start a second scanner on dut0, with any other mode set and set scan + settings + report delay millis such that an onBatchScanResult is expected + 6. Pop onBatchScanResult event on the second scanner + 7. Pop onScanResults event on the first scanner + + Expected Result: + Scan result is not expected on opportunistic scan instance. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Scanning, Opportunistic Scan + Priority: 1 + """ + self._setup_generic_advertisement() + self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ + 'opportunistic']) + filter_list, scan_settings, scan_callback = generate_ble_scan_objects( + self.scn_ad.droid) + self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, + scan_callback) + self.active_scan_callback_list.append(scan_callback) + if not self._verify_no_events_found(scan_result.format(scan_callback)): + return False + self.scn_ad.droid.bleSetScanSettingsReportDelayMillis( + self.report_delay) + self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ + 'low_latency']) + filter_list2, scan_settings2, scan_callback2 = ( + generate_ble_scan_objects(self.scn_ad.droid)) + self.scn_ad.droid.bleStartBleScan(filter_list2, scan_settings2, + scan_callback2) + self.active_scan_callback_list.append(scan_callback2) + try: + self.scn_ad.ed.pop_event( + batch_scan_result.format(scan_callback2), self.default_timeout) + except Empty: + self.log.error("Non-Opportunistic scan found no scan results.") + return False + return self._verify_no_events_found(scan_result.format(scan_callback)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='f7aba3d9-d3f7-4b2f-976e-441772705613') + def test_max_opportunistic_scan_instances(self): + """Test max number of opportunistic scan instances. + + Tests max instances of opportunistic scans. Each instances should + find an onScanResults event. + + Steps: + 1. Initialize advertiser and start advertisement on dut1 + 2. Set scan settings to opportunistic scan on dut0 scan instance + 3. Start scan scan from step 2 + 4. Repeat step two and three until there are max_scan_instances-1 scan + instances + 5. Start a regular ble scan on dut0 with the last available scan + instance + 6. Pop onScanResults event on all scan instances + + Expected Result: + Each opportunistic scan instance finds a advertisement. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Scanning, Opportunistic Scan + Priority: 1 + """ + self._setup_generic_advertisement() + for _ in range(self.max_scan_instances - 1): + self.scn_ad.droid.bleSetScanSettingsScanMode( + ble_scan_settings_modes['opportunistic']) + filter_list, scan_settings, scan_callback = generate_ble_scan_objects( + self.scn_ad.droid) + self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, + scan_callback) + self.active_scan_callback_list.append(scan_callback) + + self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ + 'low_latency']) + filter_list2, scan_settings2, scan_callback2 = ( + generate_ble_scan_objects(self.scn_ad.droid)) + self.scn_ad.droid.bleStartBleScan(filter_list2, scan_settings2, + scan_callback2) + self.active_scan_callback_list.append(scan_callback2) + + for callback in self.active_scan_callback_list: + try: + self.scn_ad.ed.pop_event( + scan_result.format(callback), self.default_timeout) + except Empty: + self.log.error("No scan results found for callback {}".format( + callback)) + return False + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='cf971f08-4d92-4046-bba6-b86a75aa773c') + def test_max_opportunistic_batch_scan_instances(self): + """Test max opportunistic batch scan instances. + + Tests max instances of opportunistic batch scans. Each instances should + find an onBatchScanResult event. + + Steps: + 1. Initialize advertiser and start advertisement on dut1 + 2. Set scan settings to opportunistic scan on dut0 scan instance and + set report delay seconds such that an onBatchScanResult is expected + 3. Start scan scan from step 2 + 4. Repeat step two and three until there are max_scan_instances-1 scan + instances + 5. Start a regular ble scan on dut0 with the last available scan + instance + 6. Pop onBatchScanResult event on all scan instances + + Expected Result: + Each opportunistic scan instance finds an advertisement. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Scanning, Opportunistic Scan, Batch Scanning + Priority: 1 + """ + self._setup_generic_advertisement() + for _ in range(self.max_scan_instances - 1): + self.scn_ad.droid.bleSetScanSettingsScanMode( + ble_scan_settings_modes['opportunistic']) + self.scn_ad.droid.bleSetScanSettingsReportDelayMillis( + self.report_delay) + filter_list, scan_settings, scan_callback = generate_ble_scan_objects( + self.scn_ad.droid) + self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, + scan_callback) + self.active_scan_callback_list.append(scan_callback) + + self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ + 'low_latency']) + self.scn_ad.droid.bleSetScanSettingsReportDelayMillis( + self.report_delay) + filter_list2, scan_settings2, scan_callback2 = ( + generate_ble_scan_objects(self.scn_ad.droid)) + self.scn_ad.droid.bleStartBleScan(filter_list2, scan_settings2, + scan_callback2) + self.active_scan_callback_list.append(scan_callback2) + + for callback in self.active_scan_callback_list: + try: + self.scn_ad.ed.pop_event( + batch_scan_result.format(callback), self.default_timeout) + except Empty: + self.log.error("No scan results found for callback {}".format( + callback)) + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='965d84ef-11a7-418a-97e9-2a441c6de776') + def test_discover_opportunistic_scan_result_off_secondary_scan_filter( + self): + """Test opportunistic scan result from secondary scan filter. + + Tests opportunistic scan where the filtered scan instance does not find + an advertisement and the scan instance with scan mode set to + opportunistic scan will also not find an advertisement. + + Steps: + 1. Initialize advertiser and start advertisement on dut1 (make sure the + advertisement is not advertising the device name) + 2. Set scan settings to opportunistic scan on dut0 scan instance + 3. Start scan scan from step 2 + 4. Try to find an event, expect none + 5. Start a second scanner on dut0, with any other mode set and set the + scan filter device name to "opp_test" + 6. Pop onScanResults from the second scanner + 7. Expect no events + 8. Pop onScanResults from the first scanner + 9. Expect no events + + Expected Result: + Opportunistic scan instance finds an advertisement. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Scanning, Opportunistic Scan + Priority: 1 + """ + self._setup_generic_advertisement() + self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ + 'opportunistic']) + filter_list, scan_settings, scan_callback = generate_ble_scan_objects( + self.scn_ad.droid) + + self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, + scan_callback) + self.active_scan_callback_list.append(scan_callback) + if not self._verify_no_events_found(scan_result.format(scan_callback)): + return False + self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ + 'low_latency']) + self.scn_ad.droid.bleSetScanFilterDeviceName("opp_test") + filter_list2, scan_settings2, scan_callback2 = ( + generate_ble_scan_objects(self.scn_ad.droid)) + self.scn_ad.droid.bleBuildScanFilter(filter_list2) + self.scn_ad.droid.bleStartBleScan(filter_list2, scan_settings2, + scan_callback2) + self.active_scan_callback_list.append(scan_callback2) + if not self._verify_no_events_found( + scan_result.format(scan_callback2)): + return False + if not self._verify_no_events_found(scan_result.format(scan_callback)): + return False + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='13b0a83f-e96e-4d64-84ef-66351ec5054c') + def test_negative_opportunistic_scan_filter_result_off_secondary_scan_result( + self): + """Test opportunistic scan not found scenario. + + Tests opportunistic scan where the secondary scan instance does find an + advertisement but the scan instance with scan mode set to opportunistic + scan does not find an advertisement due to mismatched scan filters. + + Steps: + 1. Initialize advertiser and start advertisement on dut1 (make sure the + advertisement is not advertising the device name) + 2. Set scan settings to opportunistic scan on dut0 scan instance and set + the scan filter device name to "opp_test" + 3. Start scan scan from step 2 + 4. Try to find an event, expect none + 5. Start a second scanner on dut0, with any other mode set + 6. Pop onScanResults from the second scanner + 7. Pop onScanResults from the first scanner + 8. Expect no events + + Expected Result: + Opportunistic scan instance doesn't find any advertisements. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Scanning, Opportunistic Scan + Priority: 1 + """ + self._setup_generic_advertisement() + self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ + 'opportunistic']) + self.scn_ad.droid.bleSetScanFilterDeviceName("opp_test") + filter_list, scan_settings, scan_callback = generate_ble_scan_objects( + self.scn_ad.droid) + self.scn_ad.droid.bleBuildScanFilter(filter_list) + self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, + scan_callback) + self.active_scan_callback_list.append(scan_callback) + if not self._verify_no_events_found(scan_result.format(scan_callback)): + return False + self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ + 'low_latency']) + filter_list2, scan_settings2, scan_callback2 = ( + generate_ble_scan_objects(self.scn_ad.droid)) + self.scn_ad.droid.bleStartBleScan(filter_list2, scan_settings2, + scan_callback2) + self.active_scan_callback_list.append(scan_callback2) + try: + self.scn_ad.ed.pop_event( + scan_result.format(scan_callback2), self.default_timeout) + except Empty: + self.log.error("Non-Opportunistic scan found no scan results.") + return False + return self._verify_no_events_found(scan_result.format(scan_callback)) + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='087f60b2-f6a1-4919-b4c5-cdf3debcfeff') + def test_opportunistic_scan_filter_result_off_secondary_scan_result(self): + """Test opportunistic scan from a secondary scan result. + + Tests opportunistic scan where the scan filters are the same between the + first scan instance with opportunistic scan set and the second instance + with any other mode set. + + Steps: + 1. Initialize advertiser and start advertisement on dut1 + 2. On dut0, set the scan settings mode to opportunistic scan and set + the scan filter device name to the advertiser's device name + 3. Start scan scan from step 2 + 4. Try to find an event, expect none + 5. Start a second scanner on dut0, with any other mode set and set the + scan filter device name to the advertiser's device name + 6. Pop onScanResults from the second scanner + 7. Pop onScanResults from the first scanner + + Expected Result: + Opportunistic scan instance finds a advertisement. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Scanning, Opportunistic Scan + Priority: 1 + """ + self.adv_ad.droid.bleSetAdvertiseDataIncludeDeviceName(True) + self._setup_generic_advertisement() + adv_device_name = self.adv_ad.droid.bluetoothGetLocalName() + self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ + 'opportunistic']) + self.scn_ad.droid.bleSetScanFilterDeviceName(adv_device_name) + filter_list, scan_settings, scan_callback = generate_ble_scan_objects( + self.scn_ad.droid) + self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, + scan_callback) + self.active_scan_callback_list.append(scan_callback) + if not self._verify_no_events_found(scan_result.format(scan_callback)): + return False + self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ + 'low_latency']) + filter_list2, scan_settings2, scan_callback2 = ( + generate_ble_scan_objects(self.scn_ad.droid)) + self.scn_ad.droid.bleSetScanFilterDeviceName(adv_device_name) + self.scn_ad.droid.bleBuildScanFilter(filter_list2) + self.scn_ad.droid.bleStartBleScan(filter_list2, scan_settings2, + scan_callback2) + self.active_scan_callback_list.append(scan_callback2) + try: + self.scn_ad.ed.pop_event( + scan_result.format(scan_callback2), self.default_timeout) + except Empty: + self.log.error("Opportunistic scan found no scan results.") + return False + try: + self.scn_ad.ed.pop_event( + scan_result.format(scan_callback), self.default_timeout) + except Empty: + self.log.error("Non-Opportunistic scan found no scan results.") + return False + return True diff --git a/acts_tests/tests/google/ble/scan/BleScanScreenStateTest.py b/acts_tests/tests/google/ble/scan/BleScanScreenStateTest.py index e69de29bb2..07ae898fbf 100644 --- a/acts_tests/tests/google/ble/scan/BleScanScreenStateTest.py +++ b/acts_tests/tests/google/ble/scan/BleScanScreenStateTest.py @@ -0,0 +1,559 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2017 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +""" +This test script exercises different scan filters with different screen states. +""" + +import concurrent +import json +import pprint +import time + +from queue import Empty +from acts import utils +from acts.test_decorators import test_tracker_info +from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest +from acts.test_utils.bt.bt_constants import adv_succ +from acts.test_utils.bt.bt_constants import ble_advertise_settings_modes +from acts.test_utils.bt.bt_constants import ble_scan_settings_modes +from acts.test_utils.bt.bt_constants import bt_default_timeout +from acts.test_utils.bt.bt_constants import scan_result +from acts.test_utils.bt.bt_test_utils import generate_ble_advertise_objects +from acts.test_utils.bt.bt_test_utils import generate_ble_scan_objects +from acts.test_utils.bt.bt_test_utils import reset_bluetooth + + +class BleScanScreenStateTest(BluetoothBaseTest): + advertise_callback = -1 + max_concurrent_scans = 27 + scan_callback = -1 + shorter_scan_timeout = 4 + + def setup_class(self): + super(BluetoothBaseTest, self).setup_class() + self.scn_ad = self.android_devices[0] + self.adv_ad = self.android_devices[1] + + utils.set_location_service(self.scn_ad, True) + utils.set_location_service(self.adv_ad, True) + return True + + def _setup_generic_advertisement(self): + self.adv_ad.droid.bleSetAdvertiseSettingsAdvertiseMode( + ble_advertise_settings_modes['low_latency']) + self.advertise_callback, advertise_data, advertise_settings = ( + generate_ble_advertise_objects(self.adv_ad.droid)) + self.adv_ad.droid.bleStartBleAdvertising( + self.advertise_callback, advertise_data, advertise_settings) + try: + self.adv_ad.ed.pop_event(adv_succ.format(self.advertise_callback)) + except Empty: + self.log.error("Failed to start advertisement.") + return False + return True + + def _setup_scan_with_no_filters(self): + filter_list, scan_settings, self.scan_callback = \ + generate_ble_scan_objects(self.scn_ad.droid) + self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, + self.scan_callback) + + def _scan_found_results(self): + try: + self.scn_ad.ed.pop_event( + scan_result.format(self.scan_callback), bt_default_timeout) + self.log.info("Found an advertisement.") + except Empty: + self.log.info("Did not find an advertisement.") + return False + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='9b695819-e5a8-48b3-87a0-f90422998bf9') + def test_scan_no_filters_screen_on(self): + """Test LE scanning is successful with no filters and screen on. + + Test LE scanning is successful with no filters and screen on. Scan + results should be found. + + Steps: + 1. Setup advertisement + 2. Turn on screen + 3. Start scanner without filters + 4. Verify scan results are found + 5. Teardown advertisement and scanner + + Expected Result: + Scan results should be found. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning, Screen + Priority: 2 + """ + # Step 1 + if not self._setup_generic_advertisement(): + return False + + # Step 2 + self.scn_ad.droid.wakeUpNow() + + # Step 3 + self._setup_scan_with_no_filters() + + # Step 4 + if not self._scan_found_results(): + return False + + # Step 5 + self.adv_ad.droid.bleStopBleAdvertising(self.advertise_callback) + self.scn_ad.droid.bleStopBleScan(self.scan_callback) + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='38fb6959-f07b-4501-814b-81a498e3efc4') + def test_scan_no_filters_screen_off(self): + """Test LE scanning is successful with no filters and screen off. + + Test LE scanning is successful with no filters and screen off. No scan + results should be found. + + Steps: + 1. Setup advertisement + 2. Turn off screen + 3. Start scanner without filters + 4. Verify no scan results are found + 5. Teardown advertisement and scanner + + Expected Result: + No scan results should be found. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning, Screen + Priority: 1 + """ + # Step 1 + if not self._setup_generic_advertisement(): + return False + + # Step 2 + self.scn_ad.droid.goToSleepNow() + # Give the device time to go to sleep + time.sleep(2) + + # Step 3 + self._setup_scan_with_no_filters() + + # Step 4 + if self._scan_found_results(): + return False + + # Step 5 + self.adv_ad.droid.bleStopBleAdvertising(self.advertise_callback) + self.scn_ad.droid.bleStopBleScan(self.scan_callback) + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='7186ef2f-096a-462e-afde-b0e3d4ecdd83') + def test_scan_filters_works_with_screen_off(self): + """Test LE scanning is successful with filters and screen off. + + Test LE scanning is successful with no filters and screen off. No scan + results should be found. + + Steps: + 1. Setup advertisement + 2. Turn off screen + 3. Start scanner with filters + 4. Verify scan results are found + 5. Teardown advertisement and scanner + + Expected Result: + Scan results should be found. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning, Screen + Priority: 1 + """ + # Step 1 + adv_device_name = self.adv_ad.droid.bluetoothGetLocalName() + print(adv_device_name) + self.adv_ad.droid.bleSetAdvertiseDataIncludeDeviceName(True) + if not self._setup_generic_advertisement(): + return False + + # Step 2 + self.scn_ad.droid.goToSleepNow() + + # Step 3 + self.scn_ad.droid.bleSetScanFilterDeviceName(adv_device_name) + filter_list, scan_settings, self.scan_callback = generate_ble_scan_objects( + self.scn_ad.droid) + self.scn_ad.droid.bleBuildScanFilter(filter_list) + self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, + self.scan_callback) + + # Step 4 + if not self._scan_found_results(): + return False + + # Step 5 + self.adv_ad.droid.bleStopBleAdvertising(self.advertise_callback) + self.scn_ad.droid.bleStopBleScan(self.scan_callback) + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='02cd6dca-149e-439b-8427-a2edc7864265') + def test_scan_no_filters_screen_off_then_turn_on(self): + """Test start LE scan with no filters while screen is off then turn on. + + Test that a scan without filters will not return results while the + screen is off but will return results when the screen turns on. + + Steps: + 1. Setup advertisement + 2. Turn off screen + 3. Start scanner without filters + 4. Verify no scan results are found + 5. Turn screen on + 6. Verify scan results are found + 7. Teardown advertisement and scanner + + Expected Result: + Scan results should only come in when the screen is on. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning, Screen + Priority: 2 + """ + # Step 1 + if not self._setup_generic_advertisement(): + return False + + # Step 2 + self.scn_ad.droid.goToSleepNow() + # Give the device time to go to sleep + time.sleep(2) + + # Step 3 + self._setup_scan_with_no_filters() + + # Step 4 + if self._scan_found_results(): + return False + + # Step 5 + self.scn_ad.droid.wakeUpNow() + + # Step 6 + if not self._scan_found_results(): + return False + + # Step 7 + self.adv_ad.droid.bleStopBleAdvertising(self.advertise_callback) + self.scn_ad.droid.bleStopBleScan(self.scan_callback) + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='eb9fc373-f5e8-4a55-9750-02b7a11893d1') + def test_scan_no_filters_screen_on_then_turn_off(self): + """Test start LE scan with no filters while screen is on then turn off. + + Test that a scan without filters will not return results while the + screen is off but will return results when the screen turns on. + + Steps: + 1. Setup advertisement + 2. Turn off screen + 3. Start scanner without filters + 4. Verify no scan results are found + 5. Turn screen on + 6. Verify scan results are found + 7. Teardown advertisement and scanner + + Expected Result: + Scan results should only come in when the screen is on. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning, Screen + Priority: 2 + """ + # Step 1 + if not self._setup_generic_advertisement(): + return False + + # Step 2 + self.scn_ad.droid.wakeUpNow() + + # Step 3 + self._setup_scan_with_no_filters() + + # Step 4 + if not self._scan_found_results(): + return False + + # Step 5 + self.scn_ad.droid.goToSleepNow() + # Give the device time to go to sleep + time.sleep(2) + self.scn_ad.ed.clear_all_events() + + # Step 6 + if self._scan_found_results(): + return False + + # Step 7 + self.adv_ad.droid.bleStopBleAdvertising(self.advertise_callback) + self.scn_ad.droid.bleStopBleScan(self.scan_callback) + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='41d90e11-b0a8-4eed-bff1-c19678920762') + def test_scan_no_filters_screen_toggling(self): + """Test start LE scan with no filters and test screen toggling. + + Test that a scan without filters will not return results while the + screen is off and return results while the screen is on. + + Steps: + 1. Setup advertisement + 2. Turn off screen + 3. Start scanner without filters + 4. Verify no scan results are found + 5. Turn screen on + 6. Verify scan results are found + 7. Repeat steps 1-6 10 times + 7. Teardown advertisement and scanner + + Expected Result: + Scan results should only come in when the screen is on. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning, Screen + Priority: 3 + """ + iterations = 10 + # Step 1 + if not self._setup_generic_advertisement(): + return False + + for i in range(iterations): + self.log.info("Starting iteration {}".format(i + 1)) + # Step 2 + self.scn_ad.droid.goToSleepNow() + # Give the device time to go to sleep + time.sleep(2) + self.scn_ad.ed.clear_all_events() + + # Step 3 + self._setup_scan_with_no_filters() + + # Step 4 + if self._scan_found_results(): + return False + + # Step 5 + self.scn_ad.droid.wakeUpNow() + + # Step 6 + if not self._scan_found_results(): + return False + + # Step 7 + self.adv_ad.droid.bleStopBleAdvertising(self.advertise_callback) + self.scn_ad.droid.bleStopBleScan(self.scan_callback) + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='7a2fe7ef-b15f-4e93-a2f0-40e2f7d9cbcb') + def test_opportunistic_scan_no_filters_screen_off_then_on(self): + """Test opportunistic scanning does not find results with screen off. + + Test LE scanning is successful with no filters and screen off. No scan + results should be found. + + Steps: + 1. Setup advertisement + 2. Turn off screen + 3. Start opportunistic scan without filters + 4. Start scan without filters + 5. Verify no scan results are found on either scan instance + 6. Wake up phone + 7. Verify scan results on each scan instance + 8. Teardown advertisement and scanner + + Expected Result: + No scan results should be found. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning, Screen + Priority: 1 + """ + # Step 1 + if not self._setup_generic_advertisement(): + return False + + # Step 2 + self.scn_ad.droid.goToSleepNow() + # Give the device time to go to sleep + time.sleep(2) + + # Step 3 + self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ + 'opportunistic']) + filter_list, scan_settings, scan_callback = generate_ble_scan_objects( + self.scn_ad.droid) + self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, + scan_callback) + + # Step 4 + filter_list2, scan_settings2, scan_callback2 = generate_ble_scan_objects( + self.scn_ad.droid) + self.scn_ad.droid.bleStartBleScan(filter_list2, scan_settings2, + scan_callback2) + + # Step 5 + try: + self.scn_ad.ed.pop_event( + scan_result.format(scan_callback), self.shorter_scan_timeout) + self.log.error("Found an advertisement on opportunistic scan.") + return False + except Empty: + self.log.info("Did not find an advertisement.") + try: + self.scn_ad.ed.pop_event( + scan_result.format(scan_callback2), self.shorter_scan_timeout) + self.log.error("Found an advertisement on scan instance.") + return False + except Empty: + self.log.info("Did not find an advertisement.") + + # Step 6 + self.scn_ad.droid.wakeUpNow() + + # Step 7 + try: + self.scn_ad.ed.pop_event( + scan_result.format(scan_callback), self.shorter_scan_timeout) + self.log.info("Found an advertisement on opportunistic scan.") + except Empty: + self.log.error( + "Did not find an advertisement on opportunistic scan.") + return False + try: + self.scn_ad.ed.pop_event( + scan_result.format(scan_callback2), self.shorter_scan_timeout) + self.log.info("Found an advertisement on scan instance.") + except Empty: + self.log.info("Did not find an advertisement.") + return False + + # Step 8 + self.adv_ad.droid.bleStopBleAdvertising(self.advertise_callback) + self.scn_ad.droid.bleStopBleScan(scan_callback) + self.scn_ad.droid.bleStopBleScan(scan_callback2) + return True + + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='406f1a2e-160f-4fb2-8a87-6403996df36e') + def test_max_scan_no_filters_screen_off_then_turn_on(self): + """Test start max scans with no filters while screen is off then turn on + + Test that max LE scan without filters will not return results while the + screen is off but will return results when the screen turns on. + + Steps: + 1. Setup advertisement + 2. Turn off screen + 3. Start scanner without filters and verify no scan results + 4. Turn screen on + 5. Verify scan results are found on each scan callback + 6. Teardown advertisement and all scanner + + Expected Result: + Scan results should only come in when the screen is on. + + Returns: + Pass if True + Fail if False + + TAGS: LE, Advertising, Filtering, Scanning, Screen + Priority: 2 + """ + # Step 1 + if not self._setup_generic_advertisement(): + return False + + # Step 2 + self.scn_ad.droid.goToSleepNow() + # Give the device time to go to sleep + time.sleep(2) + + # Step 3 + scan_callback_list = [] + for _ in range(self.max_concurrent_scans): + filter_list, scan_settings, scan_callback = \ + generate_ble_scan_objects(self.scn_ad.droid) + self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, + scan_callback) + scan_callback_list.append(scan_callback) + try: + self.scn_ad.ed.pop_event( + scan_result.format(self.scan_callback), + self.shorter_scan_timeout) + self.log.info("Found an advertisement.") + return False + except Empty: + self.log.info("Did not find an advertisement.") + + # Step 4 + self.scn_ad.droid.wakeUpNow() + + # Step 5 + for callback in scan_callback_list: + try: + self.scn_ad.ed.pop_event( + scan_result.format(callback), self.shorter_scan_timeout) + self.log.info("Found an advertisement.") + except Empty: + self.log.info("Did not find an advertisement.") + return False + + # Step 7 + self.adv_ad.droid.bleStopBleAdvertising(self.advertise_callback) + for callback in scan_callback_list: + self.scn_ad.droid.bleStopBleScan(callback) + return True diff --git a/acts_tests/tests/google/ble/system_tests/BleStressTest.py b/acts_tests/tests/google/ble/system_tests/BleStressTest.py index f97907ff0e..afbb67a1cd 100644 --- a/acts_tests/tests/google/ble/system_tests/BleStressTest.py +++ b/acts_tests/tests/google/ble/system_tests/BleStressTest.py @@ -37,6 +37,7 @@ from acts.test_utils.bt.bt_constants import scan_result class BleStressTest(BluetoothBaseTest): default_timeout = 10 PAIRING_TIMEOUT = 20 + droid_list = [] def setup_class(self): super().setup_class() @@ -45,7 +46,7 @@ class BleStressTest(BluetoothBaseTest): self.adv_ad = self.android_devices[1] def teardown_test(self): - super(BluetoothBaseTest, self).teardown_test() + super().teardown_test() self.log_stats() def bleadvertise_verify_onsuccess_handler(self, event): diff --git a/acts_tests/tests/google/ble/system_tests/GattLongevityTest.py b/acts_tests/tests/google/ble/system_tests/GattLongevityTest.py index e69de29bb2..bb13646625 100644 --- a/acts_tests/tests/google/ble/system_tests/GattLongevityTest.py +++ b/acts_tests/tests/google/ble/system_tests/GattLongevityTest.py @@ -0,0 +1,102 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2016 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +""" +This test script for GATT longevity tests. +""" + +from acts.test_decorators import test_tracker_info +from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest +from acts.test_utils.bt.GattConnectedBaseTest import GattConnectedBaseTest +from acts.test_utils.bt.bt_constants import gatt_characteristic +from acts.test_utils.bt.bt_constants import gatt_descriptor +from acts.test_utils.bt.bt_constants import gatt_event +from acts.test_utils.bt.bt_constants import gatt_cb_strings +from acts.test_utils.bt.bt_constants import gatt_connection_priority +from acts.test_utils.bt.bt_constants import gatt_characteristic_attr_length +from acts.test_utils.bt.GattEnum import MtuSize +from acts.test_utils.bt.bt_gatt_utils import setup_gatt_mtu + + +class GattLongevityTest(GattConnectedBaseTest): + longevity_iterations = 1100000 + + @test_tracker_info(uuid='d7d378f4-89d8-4330-bb80-0054b92020bb') + def test_write_characteristic_no_resp_longevity(self): + """Longevity test write characteristic value + + Longevity test to write characteristic value for + self.longevity_iteration times. This is to test the + integrity of written data and the robustness of central + and peripheral mode of the Android devices under test. + + 1. Central: write WRITABLE_CHAR_UUID characteristic with char_value + using write command. + 2. Central: make sure write callback is called. + 3. Peripheral: receive the written data. + 4. Verify data written matches data received. + 5. Repeat steps 1-4 self.longevity_iterations times. + + Expected Result: + Verify that write command is properly delivered. + + Returns: + Pass if True + Fail if False + + TAGS: LE, GATT, Characteristic, Longevity + Priority: 0 + """ + self.cen_ad.droid.gattClientRequestConnectionPriority( + self.bluetooth_gatt, gatt_connection_priority['high']) + + self.cen_ad.droid.gattClientCharacteristicSetWriteType( + self.bluetooth_gatt, self.discovered_services_index, + self.test_service_index, self.WRITABLE_CHAR_UUID, + gatt_characteristic['write_type_no_response']) + + for i in range(self.longevity_iterations): + self.log.debug("Iteration {} started.".format(i + 1)) + char_value = [] + for j in range(i, i + self.mtu - 3): + char_value.append(j % 256) + + self.cen_ad.droid.gattClientCharacteristicSetValue( + self.bluetooth_gatt, self.discovered_services_index, + self.test_service_index, self.WRITABLE_CHAR_UUID, char_value) + + self.cen_ad.droid.gattClientWriteCharacteristic( + self.bluetooth_gatt, self.discovered_services_index, + self.test_service_index, self.WRITABLE_CHAR_UUID) + + # client shall not wait for server, get complete event right away + event = self._client_wait(gatt_event['char_write']) + if event["data"]["Status"] != 0: + self.log.error("Write status should be 0") + return False + + event = self._server_wait(gatt_event['char_write_req']) + + self.log.info("{} event found: {}".format(gatt_cb_strings[ + 'char_write_req'].format(self.gatt_server_callback), event[ + 'data']['value'])) + request_id = event['data']['requestId'] + found_value = event['data']['value'] + if found_value != char_value: + self.log.info("Values didn't match. Found: {}, " + "Expected: {}".format(found_value, char_value)) + return False + + return True diff --git a/acts_tests/tests/google/experimental/BluetoothLatencyTest.py b/acts_tests/tests/google/experimental/BluetoothLatencyTest.py index 811a41cca0..ea6ed4a24d 100644 --- a/acts_tests/tests/google/experimental/BluetoothLatencyTest.py +++ b/acts_tests/tests/google/experimental/BluetoothLatencyTest.py @@ -21,6 +21,7 @@ import time from acts import asserts from acts.base_test import BaseTestClass from acts.signals import TestPass +from acts.test_decorators import test_tracker_info from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest from acts.test_utils.bt.bt_test_utils import orchestrate_rfcomm_connection from acts.test_utils.bt.bt_test_utils import setup_multiple_devices_for_bt_test @@ -112,6 +113,7 @@ class BluetoothLatencyTest(BaseTestClass): return (end_time - start_time) * 1000 @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='7748295d-204e-4ad0-adf5-7591380b940a') def test_bluetooth_latency(self): """Tests the latency for a data transfer over RFCOMM""" diff --git a/acts_tests/tests/google/experimental/BluetoothPairAndConnectTest.py b/acts_tests/tests/google/experimental/BluetoothPairAndConnectTest.py index e54e4e7417..2402fb5444 100644 --- a/acts_tests/tests/google/experimental/BluetoothPairAndConnectTest.py +++ b/acts_tests/tests/google/experimental/BluetoothPairAndConnectTest.py @@ -27,8 +27,11 @@ from acts.controllers.buds_lib.test_actions.bt_utils import BTUtilsError from acts.controllers.buds_lib.test_actions.apollo_acts import ApolloTestActions from acts.signals import TestFailure from acts.signals import TestPass +from acts.test_decorators import test_tracker_info +from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest from acts.test_utils.bt.bt_test_utils import factory_reset_bluetooth from acts.test_utils.bt.bt_test_utils import enable_bluetooth +from acts.test_utils.bt.bt_test_utils import setup_multiple_devices_for_bt_test from acts.test_utils.bt.loggers.bluetooth_metric_logger import BluetoothMetricLogger from acts.utils import set_location_service @@ -74,10 +77,10 @@ class BluetoothPairAndConnectTest(BaseTestClass): self.bt_logger = BluetoothMetricLogger.for_test_case() def setup_test(self): + setup_multiple_devices_for_bt_test(self.android_devices) # Make sure Bluetooth is on enable_bluetooth(self.phone.droid, self.phone.ed) set_location_service(self.phone, True) - factory_reset_bluetooth([self.phone]) self.apollo_act.factory_reset() self.log.info('===== START BLUETOOTH PAIR AND CONNECT TEST =====') @@ -116,6 +119,8 @@ class BluetoothPairAndConnectTest(BaseTestClass): return pair_time, connection_time + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='c914fd08-350d-465a-96cf-970d40e71060') def test_bluetooth_connect(self): # Store metrics metrics = {} diff --git a/acts_tests/tests/google/experimental/BluetoothReconnectTest.py b/acts_tests/tests/google/experimental/BluetoothReconnectTest.py index a03ec7b14b..5339e517eb 100644 --- a/acts_tests/tests/google/experimental/BluetoothReconnectTest.py +++ b/acts_tests/tests/google/experimental/BluetoothReconnectTest.py @@ -22,9 +22,12 @@ import time from acts import asserts from acts.base_test import BaseTestClass from acts.controllers.buds_lib.test_actions.apollo_acts import ApolloTestActions -from acts.signals import TestPass, TestFailure +from acts.signals import TestFailure +from acts.signals import TestPass +from acts.test_decorators import test_tracker_info +from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest from acts.test_utils.bt.bt_test_utils import enable_bluetooth -from acts.test_utils.bt.bt_test_utils import factory_reset_bluetooth +from acts.test_utils.bt.bt_test_utils import setup_multiple_devices_for_bt_test from acts.test_utils.bt.loggers.bluetooth_metric_logger import BluetoothMetricLogger from acts.utils import set_location_service @@ -67,10 +70,10 @@ class BluetoothReconnectTest(BaseTestClass): self.bt_logger = BluetoothMetricLogger.for_test_case() def setup_test(self): + setup_multiple_devices_for_bt_test(self.android_devices) # Make sure Bluetooth is on enable_bluetooth(self.phone.droid, self.phone.ed) set_location_service(self.phone, True) - factory_reset_bluetooth([self.phone]) self.apollo_act.factory_reset() # Initial pairing and connection of devices @@ -119,6 +122,8 @@ class BluetoothReconnectTest(BaseTestClass): end_time = time.perf_counter() return (end_time - start_time) * 1000 + @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='da921903-92d0-471d-ae01-456058cc1297') def test_bluetooth_reconnect(self): """Reconnects Bluetooth between a phone and Apollo device a specified number of times and reports connection time statistics.""" diff --git a/acts_tests/tests/google/experimental/BluetoothThroughputTest.py b/acts_tests/tests/google/experimental/BluetoothThroughputTest.py index 3403ded238..1f53172d8e 100644 --- a/acts_tests/tests/google/experimental/BluetoothThroughputTest.py +++ b/acts_tests/tests/google/experimental/BluetoothThroughputTest.py @@ -18,6 +18,7 @@ import statistics from acts import asserts from acts.base_test import BaseTestClass from acts.signals import TestPass +from acts.test_decorators import test_tracker_info from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest from acts.test_utils.bt.bt_test_utils import orchestrate_rfcomm_connection from acts.test_utils.bt.bt_test_utils import setup_multiple_devices_for_bt_test @@ -109,6 +110,7 @@ class BluetoothThroughputTest(BaseTestClass): return throughput @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='23afba5b-5801-42c2-8d7a-41510e91a605') def test_bluetooth_throughput_large_buffer(self): """Tests the throughput over a series of data transfers with large buffer size. @@ -143,6 +145,7 @@ class BluetoothThroughputTest(BaseTestClass): extras=proto) @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='5472fe33-891e-4fa1-ba84-78fc6f6a2327') def test_bluetooth_throughput_medium_buffer(self): """Tests the throughput over a series of data transfers with medium buffer size. @@ -177,6 +180,7 @@ class BluetoothThroughputTest(BaseTestClass): extras=proto) @BluetoothBaseTest.bt_test_wrap + @test_tracker_info(uuid='97589280-cefa-4ae4-b3fd-94ec9c1f4104') def test_bluetooth_throughput_small_buffer(self): """Tests the throughput over a series of data transfers with small buffer size. diff --git a/acts_tests/tests/google/fugu/AndroidFuguRemotePairingTest.py b/acts_tests/tests/google/fugu/AndroidFuguRemotePairingTest.py index e69de29bb2..a41f9fce79 100644 --- a/acts_tests/tests/google/fugu/AndroidFuguRemotePairingTest.py +++ b/acts_tests/tests/google/fugu/AndroidFuguRemotePairingTest.py @@ -0,0 +1,81 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2017 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +""" +Test script to test pairing of an Android Device to a Fugu Remote +""" +import time + +from acts.controllers.relay_lib.relay import SynchronizeRelays +from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest + +class AndroidFuguRemotePairingTest(BluetoothBaseTest): + def setup_class(self): + super().setup_class() + self.dut = self.android_devices[0] + self.fugu_remote = self.relay_devices[0] + + def setup_test(self): + super(BluetoothBaseTest, self).setup_test() + self.fugu_remote.setup() + return True + + def teardown_test(self): + super(BluetoothBaseTest, self).teardown_test() + self.fugu_remote.clean_up() + return True + + @BluetoothBaseTest.bt_test_wrap + def test_pairing(self): + """Test pairing between a fugu device and a remote controller. + + Test the remote controller can be paired to fugu. + + Steps: + 1. Find the MAC address of remote controller from relay config file. + 2. Start the device paring process. + 3. Enable remote controller in pairing mode. + 4. Verify the remote is paired. + + Expected Result: + Remote controller is paired. + + Returns: + Pass if True + Fail if False + + TAGS: fugu + Priority: 1 + """ + + self.dut.droid.bluetoothStartPairingHelper(False) + self.fugu_remote.enter_pairing_mode() + self.dut.droid.bluetoothDiscoverAndBond(self.fugu_remote.mac_address) + + end_time = time.time() + 20 + self.dut.log.info("Verifying devices are bonded") + while time.time() < end_time: + bonded_devices = self.dut.droid.bluetoothGetBondedDevices() + + for d in bonded_devices: + if d['address'] == self.fugu_remote.mac_address: + self.dut.log.info("Successfully bonded to device.") + self.log.info("Fugu Bonded devices:\n{}".format( + bonded_devices)) + return True + # Timed out trying to bond. + self.dut.log.info("Failed to bond devices.") + + return False diff --git a/acts_tests/tests/google/fugu/fugu_pairing_test.json b/acts_tests/tests/google/fugu/fugu_pairing_test.json index e69de29bb2..59f45e35af 100644 --- a/acts_tests/tests/google/fugu/fugu_pairing_test.json +++ b/acts_tests/tests/google/fugu/fugu_pairing_test.json @@ -0,0 +1,39 @@ +{ + "_description": "Test configuration for Fugu pairing the remote controller", + "logpath": "/tmp/logs", + "testpaths": ["."], + "no_bug_report_on_fail": "True", + + "testbed": [ + { + "_description": "A testbed for RelayDevices", + "name": "7A18F48B", + "AndroidDevice": ["7A18F48B"], + "RelayDevice": "tests/google/fugu/relay.json" + }, + { + "_description": "A testbed for RelayDevices", + "name": "164FE498", + "AndroidDevice": ["164FE498"], + "RelayDevice": "tests/google/fugu/relay.json" + }, + { + "_description": "A testbed for RelayDevices", + "name": "B8B20856", + "AndroidDevice": ["B8B20856"], + "RelayDevice": "tests/google/fugu/relay.json" + }, + { + "_description": "A testbed for RelayDevices", + "name": "121A69F0", + "AndroidDevice": ["121A69F0"], + "RelayDevice": "tests/google/fugu/relay.json" + }, + { + "_description": "A testbed for RelayDevices", + "name": "BBDAC5ED", + "AndroidDevice": ["BBDAC5ED"], + "RelayDevice": "tests/google/fugu/relay.json" + } + ] +} diff --git a/acts_tests/tests/google/fugu/relay.json b/acts_tests/tests/google/fugu/relay.json index e69de29bb2..c3ab9db3d1 100644 --- a/acts_tests/tests/google/fugu/relay.json +++ b/acts_tests/tests/google/fugu/relay.json @@ -0,0 +1,21 @@ +{ + "boards": [ + { + "type": "SainSmartBoard", + "name": "ss0", + "base_url": "http://192.168.1.4/30000/" + } + ], + "devices": [ + { + "type": "FuguRemote", + "name": "Fugu0", + "mac_address" : "AC:9E:17:53:AC:3A", + "relays": { + "Play": "ss0/1", + "Home": "ss0/2", + "Back": "ss0/3" + } + } + ] +} diff --git a/acts_tests/tests/google/gnss/GnssFunctionTest.py b/acts_tests/tests/google/gnss/GnssFunctionTest.py index 91293a3367..eb8d23ec07 100644 --- a/acts_tests/tests/google/gnss/GnssFunctionTest.py +++ b/acts_tests/tests/google/gnss/GnssFunctionTest.py @@ -419,7 +419,7 @@ class GnssFunctionTest(BaseTestClass): sap_state = str(self.ad.adb.shell("cat vendor/etc/izat.conf | grep " "SAP=")) self.ad.log.info("SAP Valid Modes - %s" % sap_state) - asserts.assert_true(sap_state == "SAP=PREMIUM", + asserts.assert_true("SAP=PREMIUM" in sap_state, "Wrong SAP Valid Modes is set") @test_tracker_info(uuid="14daaaba-35b4-42d9-8d2c-2a803dd746a6") diff --git a/acts_tests/tests/google/native/NativeTest.py b/acts_tests/tests/google/native/NativeTest.py index e69de29bb2..90ebceb28c 100644 --- a/acts_tests/tests/google/native/NativeTest.py +++ b/acts_tests/tests/google/native/NativeTest.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2016 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + +import time +from acts.base_test import BaseTestClass +from acts.test_utils.bt.native_bt_test_utils import setup_native_bluetooth +from acts.test_utils.bt.bt_test_utils import generate_id_by_size + +class NativeTest(BaseTestClass): + tests = None + + def __init__(self, controllers): + BaseTestClass.__init__(self, controllers) + self.tests = ( + "test_bool_return_true", + "test_bool_return_false", + "test_null_return", + "test_string_empty_return", + "test_max_param_size", + ) + + def setup_class(self): + super().setup_class() + self.droid = self.native_android_devices[0].droid + + def test_bool_return_true(self): + return self.droid.TestBoolTrueReturn() + + def test_bool_return_false(self): + return not self.droid.TestBoolFalseReturn() + + def test_null_return(self): + return not self.droid.TestNullReturn() + + def test_string_empty_return(self): + return self.droid.TestStringEmptyReturn() == "" + + def test_max_param_size(self): + json_buffer_size = 64 + max_sl4n_buffer_size = 4096 + test_string = "x" * (max_sl4n_buffer_size - json_buffer_size) + return test_string == self.droid.TestStringMaxReturn(test_string) + + def test_specific_param_naming(self): + a = [{"string_test":"test", "int_test":1}] + return self.droid.TestSpecificParamNaming(a) + diff --git a/acts_tests/tests/google/native/bt/BtNativeTest.py b/acts_tests/tests/google/native/bt/BtNativeTest.py index e69de29bb2..55674bcb42 100644 --- a/acts_tests/tests/google/native/bt/BtNativeTest.py +++ b/acts_tests/tests/google/native/bt/BtNativeTest.py @@ -0,0 +1,63 @@ +from acts.base_test import BaseTestClass +from acts.controllers import native_android_device +from acts.test_utils.bt.native_bt_test_utils import setup_native_bluetooth +from acts.test_utils.bt.bt_test_utils import generate_id_by_size + + +class BtNativeTest(BaseTestClass): + tests = None + + def __init__(self, controllers): + BaseTestClass.__init__(self, controllers) + self.tests = ( + "test_binder_get_name", + "test_binder_get_name_invalid_parameter", + "test_binder_set_name_get_name", + "test_binder_get_address", ) + + def setup_class(self): + setup_native_bluetooth(self.native_android_devices) + self.droid = self.native_android_devices[0].droid + if len(self.native_android_devices) > 1: + self.droid1 = self.native_android_devices[1].droid + self.tests = self.tests + ("test_two_devices_set_get_name", ) + + def test_binder_get_name(self): + result = self.droid.BtBinderGetName() + self.log.info("Bluetooth device name: {}".format(result)) + return True + + def test_binder_get_name_invalid_parameter(self): + try: + self.droid.BtBinderGetName("unexpected_parameter") + return False + except Exception: + return True + + def test_binder_set_name_get_name(self): + test_name = generate_id_by_size(4) + result = self.droid.BtBinderSetName(test_name) + if not result: + return False + name = self.droid.BtBinderGetName() + if test_name != name: + return False + return True + + def test_binder_get_address(self): + result = self.droid.BtBinderGetAddress() + self.log.info("Found BT address: {}".format(result)) + if not result: + return False + return True + + def test_two_devices_set_get_name(self): + test_name = generate_id_by_size(4) + for n in self.native_android_devices: + d = n.droid + d.BtBinderSetName(test_name) + name = d.BtBinderGetName() + if name != test_name: + return False + return True + diff --git a/acts_tests/tests/google/nfc/NfcBasicFunctionalityTest.py b/acts_tests/tests/google/nfc/NfcBasicFunctionalityTest.py index e69de29bb2..5d531d1931 100644 --- a/acts_tests/tests/google/nfc/NfcBasicFunctionalityTest.py +++ b/acts_tests/tests/google/nfc/NfcBasicFunctionalityTest.py @@ -0,0 +1,111 @@ +#!/usr/bin/env python3.4 +# +# Copyright 2017 - The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import time + +from acts.base_test import BaseTestClass +from acts.test_decorators import test_tracker_info + + +class NfcBasicFunctionalityTest(BaseTestClass): + nfc_on_event = "NfcStateOn" + nfc_off_event = "NfcStateOff" + timeout = 5 + + def setup_class(self): + self.dut = self.android_devices[0] + self._ensure_nfc_enabled(self.dut) + self.dut.droid.nfcStartTrackingStateChange() + self.dut.adb.shell("setprop nfc.app_log_level 255") + self.dut.adb.shell("setprop nfc.enable_protocol_log 255") + self.dut.adb.shell("setprop nfc.nxp_log_level_global 5") + self.dut.adb.shell("setprop nfc.nxp_log_level_extns 5") + self.dut.adb.shell("setprop nfc.nxp_log_level_hal 5") + self.dut.adb.shell("setprop nfc.nxp_log_level_nci 5") + self.dut.adb.shell("setprop nfc.nxp_log_level_tml 5") + self.dut.adb.shell("setprop nfc.nxp_log_level_dnld 5") + self._ensure_nfc_disabled(self.dut) + return True + + def _ensure_nfc_enabled(self, dut): + end_time = time.time() + 10 + while end_time > time.time(): + try: + dut.ed.pop_event(self.nfc_on_event, self.timeout) + self.log.info("Event {} found".format(self.nfc_on_event)) + return True + except Exception as err: + self.log.debug( + "Event {} not yet found".format(self.nfc_on_event)) + return False + + def _ensure_nfc_disabled(self, dut): + end_time = time.time() + 10 + while end_time > time.time(): + try: + dut.ed.pop_event(self.nfc_off_event, self.timeout) + self.log.info("Event {} found".format(self.nfc_off_event)) + return True + except Exception as err: + self.log.debug( + "Event {} not yet found".format(self.nfc_off_event)) + return False + + def setup_test(self): + # Every test starts with the assumption that NFC is enabled + if not self.dut.droid.nfcIsEnabled(): + self.dut.droid.nfcEnable() + else: + return True + if not self._ensure_nfc_enabled(self.dut): + self.log.error("Failed to toggle NFC on") + return False + return True + + def on_fail(self, test_name, begin_time): + self.dut.take_bug_report(test_name, begin_time) + + @test_tracker_info(uuid='d57fcdd8-c56c-4ab0-81fb-e2218b100de9') + def test_nfc_toggle_state_100_iterations(self): + """Test toggling NFC state 100 times. + + Verify that NFC toggling works. Test assums NFC is on. + + Steps: + 1. Toggle NFC off + 2. Toggle NFC on + 3. Repeat steps 1-2 100 times. + + Expected Result: + RFCOMM connection is established then disconnected succcessfully. + + Returns: + Pass if True + Fail if False + + TAGS: NFC + Priority: 1 + """ + iterations = 100 + for i in range(iterations): + self.log.info("Starting iteration {}".format(i + 1)) + self.dut.droid.nfcDisable() + if not self._ensure_nfc_disabled(self.dut): + return False + self.dut.droid.nfcEnable() + if not self._ensure_nfc_enabled(self.dut): + return False + return True diff --git a/acts_tests/tests/google/tel/live/TelLiveGFTDSDSDDSSwitchTest.py b/acts_tests/tests/google/tel/live/TelLiveGFTDSDSDDSSwitchTest.py new file mode 100644 index 0000000000..d188e28a99 --- /dev/null +++ b/acts_tests/tests/google/tel/live/TelLiveGFTDSDSDDSSwitchTest.py @@ -0,0 +1,2367 @@ +#!/usr/bin/env python3 +# +# Copyright 2020 - Google +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import re +import time + +from acts import asserts +from acts import signals +from acts.test_decorators import test_tracker_info +from acts.test_utils.tel.loggers.protos.telephony_metric_pb2 import \ + TelephonyVoiceTestResult +from acts.test_utils.tel.loggers.telephony_metric_logger import \ + TelephonyMetricLogger +from acts.test_utils.tel.TelephonyBaseTest import TelephonyBaseTest +from acts.test_utils.tel.tel_defines import MAX_WAIT_TIME_SMS_RECEIVE +from acts.test_utils.tel.tel_defines import WAIT_TIME_IN_CALL +from acts.test_utils.tel.tel_defines import WAIT_TIME_ANDROID_STATE_SETTLING +from acts.test_utils.tel.tel_defines import INVALID_SUB_ID +from acts.test_utils.tel.tel_defines import WFC_MODE_DISABLED +from acts.test_utils.tel.tel_defines import WFC_MODE_CELLULAR_PREFERRED +from acts.test_utils.tel.tel_defines import WFC_MODE_WIFI_ONLY +from acts.test_utils.tel.tel_defines import WFC_MODE_WIFI_PREFERRED +from acts.test_utils.tel.tel_data_utils import reboot_test +from acts.test_utils.tel.tel_subscription_utils import get_subid_from_slot_index +from acts.test_utils.tel.tel_subscription_utils import get_default_data_sub_id +from acts.test_utils.tel.tel_subscription_utils import set_subid_for_message +from acts.test_utils.tel.tel_subscription_utils import set_subid_for_data +from acts.test_utils.tel.tel_subscription_utils import set_incoming_voice_sub_id +from acts.test_utils.tel.tel_subscription_utils import set_dds_on_slot_0 +from acts.test_utils.tel.tel_subscription_utils import set_dds_on_slot_1 +from acts.test_utils.tel.tel_subscription_utils import \ + get_subid_on_same_network_of_host_ad +from acts.test_utils.tel.tel_test_utils import multithread_func +from acts.test_utils.tel.tel_test_utils import start_youtube_video +from acts.test_utils.tel.tel_test_utils import \ + wait_for_cell_data_connection_for_subscription +from acts.test_utils.tel.tel_test_utils import toggle_volte_for_subscription +from acts.test_utils.tel.tel_test_utils import toggle_wfc_for_subscription +from acts.test_utils.tel.tel_test_utils import set_wfc_mode_for_subscription +from acts.test_utils.tel.tel_test_utils import \ + sms_send_receive_verify_for_subscription +from acts.test_utils.tel.tel_test_utils import mms_send_receive_verify +from acts.test_utils.tel.tel_test_utils import verify_http_connection +from acts.test_utils.tel.tel_test_utils import verify_internet_connection +from acts.test_utils.tel.tel_test_utils import log_messaging_screen_shot +from acts.test_utils.tel.tel_test_utils import ensure_phones_idle +from acts.test_utils.tel.tel_test_utils import get_slot_index_from_subid +from acts.test_utils.tel.tel_test_utils import toggle_airplane_mode +from acts.test_utils.tel.tel_test_utils import is_volte_enabled +from acts.test_utils.tel.tel_test_utils import check_is_wifi_connected +from acts.test_utils.tel.tel_test_utils import ensure_wifi_connected +from acts.test_utils.tel.tel_test_utils import wait_for_wfc_enabled +from acts.test_utils.tel.tel_voice_utils import is_phone_in_call_3g +from acts.test_utils.tel.tel_voice_utils import is_phone_in_call_csfb +from acts.test_utils.tel.tel_voice_utils import is_phone_in_call_volte +from acts.test_utils.tel.tel_voice_utils import is_phone_in_call_iwlan +from acts.test_utils.tel.tel_voice_utils import phone_setup_iwlan_for_subscription +from acts.test_utils.tel.tel_voice_utils import \ + phone_setup_csfb_for_subscription +from acts.test_utils.tel.tel_voice_utils import \ + phone_setup_voice_3g_for_subscription +from acts.test_utils.tel.tel_voice_utils import \ + phone_setup_voice_general_for_subscription +from acts.test_utils.tel.tel_voice_utils import \ + phone_setup_volte_for_subscription +from acts.test_utils.tel.tel_voice_utils import two_phone_call_msim_for_slot +from acts.utils import rand_ascii_str + +CallResult = TelephonyVoiceTestResult.CallResult.Value + +class TelLiveGFTDSDSDDSSwitchTest(TelephonyBaseTest): + def setup_class(self): + TelephonyBaseTest.setup_class(self) + self.message_lengths = (50, 160, 180) + self.tel_logger = TelephonyMetricLogger.for_test_case() + + def teardown_test(self): + ensure_phones_idle(self.log, self.android_devices) + + def _msim_message_test( + self, + ad_mo, + ad_mt, + mo_sub_id, + mt_sub_id, msg="SMS", + max_wait_time=MAX_WAIT_TIME_SMS_RECEIVE, + expected_result=True): + """Make MO/MT SMS/MMS at specific slot. + + Args: + ad_mo: Android object of the device sending SMS/MMS + ad_mt: Android object of the device receiving SMS/MMS + mo_sub_id: Sub ID of MO device + mt_sub_id: Sub ID of MT device + max_wait_time: Max wait time before SMS/MMS is received. + expected_result: True for successful sending/receiving and False on + the contrary + + Returns: + True if the result matches expected_result and False on the + contrary. + """ + + if msg == "SMS": + for length in self.message_lengths: + message_array = [rand_ascii_str(length)] + if not sms_send_receive_verify_for_subscription( + self.log, + ad_mo, + ad_mt, + mo_sub_id, + mt_sub_id, + message_array, + max_wait_time): + ad_mo.log.warning( + "%s of length %s test failed", msg, length) + return False + else: + ad_mo.log.info( + "%s of length %s test succeeded", msg, length) + self.log.info("%s test of length %s characters succeeded.", + msg, self.message_lengths) + + elif msg == "MMS": + for length in self.message_lengths: + message_array = [("Test Message", rand_ascii_str(length), None)] + + if not mms_send_receive_verify( + self.log, + ad_mo, + ad_mt, + message_array, + max_wait_time, + expected_result): + self.log.warning("%s of body length %s test failed", + msg, length) + return False + else: + self.log.info( + "%s of body length %s test succeeded", msg, length) + self.log.info("%s test of body lengths %s succeeded", + msg, self.message_lengths) + return True + + def _test_dds_switch_during_data_transfer( + self, + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=0, + call_direction=None, + call_or_sms_or_mms="call", + streaming=True, + is_airplane_mode=False, + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED]): + """Switch DDS and make voice call (VoLTE/WFC/CS call)/SMS/MMS together + with Youtube playing after each DDS switch at specific slot in specific + RAT. + + Test step: + 1. Get sub ID of each slot of the primary device. + 2. Set up phones in desired RAT. + 3. Switch DDS to slot 0. + 4. Check HTTP connection after DDS switch. + 5. Play Youtube. + 6. Make voice call (VoLTE/WFC/CS call)/SMS/MMS + 7. Switch DDS to slot 1 and repeat step 4-6. + 8. Switch DDS to slot 0 again and repeat step 4-6. + + Args: + 1, slot_0_nw_gen: Network generation of slot 0 on the primary device + 2, slot_1_nw_gen: Network generation of slot 1 on the primary device + 3. call_slot: Slot for making voice call + 4. call_direction: "mo" or "mt" or None to stoping making call. + 5. call_or_sms_or_mms: Voice call or SMS or MMS + 6. streaming: True for playing Youtube after DDS switch and False on + the contrary. + 7. is_airplane_mode: True of False for WFC setup + 8. wfc_mode: Cellular preferred or Wi-Fi preferred. + + Returns: + True or False + """ + ad = self.android_devices[0] + slot_0_subid = get_subid_from_slot_index(self.log, ad, 0) + slot_1_subid = get_subid_from_slot_index(self.log, ad, 1) + + if slot_0_subid == INVALID_SUB_ID or slot_1_subid == INVALID_SUB_ID: + ad.log.error("Not all slots have valid sub ID.") + raise signals.TestFailure("Failed", + extras={"fail_reason": "Not all slots have valid sub ID"}) + + ad.log.info( + "Step 0: Set up phone in desired RAT (slot 0: %s, slot 1: %s)", + slot_0_nw_gen, slot_1_nw_gen) + if slot_0_nw_gen == "volte": + slot0_phone_setup_func = phone_setup_volte_for_subscription + is_slot0_in_call = is_phone_in_call_volte + elif slot_0_nw_gen == "csfb": + slot0_phone_setup_func = phone_setup_csfb_for_subscription + is_slot0_in_call = is_phone_in_call_csfb + elif slot_0_nw_gen == "3g": + slot0_phone_setup_func = phone_setup_voice_3g_for_subscription + is_slot0_in_call = is_phone_in_call_3g + elif slot_0_nw_gen == "wfc": + slot0_phone_setup_func = phone_setup_iwlan_for_subscription + is_slot0_in_call = is_phone_in_call_iwlan + else: + slot0_phone_setup_func = phone_setup_voice_general_for_subscription + is_slot0_in_call = None + + if slot_0_nw_gen == "wfc": + tasks = [(slot0_phone_setup_func,( + self.log, + ad, + slot_0_subid, + is_airplane_mode, + wfc_mode[0], + self.wifi_network_ssid, + self.wifi_network_pass))] + else: + tasks = [(slot0_phone_setup_func, (self.log, ad, slot_0_subid))] + if not multithread_func(self.log, tasks): + self.log.error("Phone Failed to Set Up Properly.") + self.tel_logger.set_result(CallResult("CALL_SETUP_FAILURE")) + raise signals.TestFailure("Failed", + extras={"fail_reason": "Phone Failed to Set Up Properly."}) + + if slot_1_nw_gen == "volte": + slot1_phone_setup_func = phone_setup_volte_for_subscription + is_slot1_in_call = is_phone_in_call_volte + elif slot_1_nw_gen == "csfb": + slot1_phone_setup_func = phone_setup_csfb_for_subscription + is_slot1_in_call = is_phone_in_call_csfb + elif slot_1_nw_gen == "3g": + slot1_phone_setup_func = phone_setup_voice_3g_for_subscription + is_slot1_in_call = is_phone_in_call_3g + elif slot_1_nw_gen == "wfc": + slot1_phone_setup_func = phone_setup_iwlan_for_subscription + is_slot1_in_call = is_phone_in_call_iwlan + else: + slot1_phone_setup_func = phone_setup_voice_general_for_subscription + is_slot1_in_call = None + + if slot_1_nw_gen == "wfc": + tasks = [(slot1_phone_setup_func, ( + self.log, + ad, + slot_1_subid, + is_airplane_mode, + wfc_mode[1], + self.wifi_network_ssid, + self.wifi_network_pass))] + else: + tasks = [(slot1_phone_setup_func, (self.log, ad, slot_1_subid))] + if not multithread_func(self.log, tasks): + self.log.error("Phone Failed to Set Up Properly.") + self.tel_logger.set_result(CallResult("CALL_SETUP_FAILURE")) + raise signals.TestFailure("Failed", + extras={"fail_reason": "Phone Failed to Set Up Properly."}) + + for attempt in range(3): + if attempt != 0: + ad.log.info("Repeat step 1 to 4.") + + ad.log.info("Step 1: Switch DDS.") + if attempt % 2 == 0: + set_dds_on_slot_0(ad) + else: + set_dds_on_slot_1(ad) + + ad.log.info("Step 2: Check HTTP connection after DDS switch.") + if not verify_http_connection(self.log, ad): + ad.log.error("Failed to verify http connection.") + return False + else: + ad.log.info("Verify http connection successfully.") + + if streaming: + ad.log.info("Step 3: Start Youtube streaming.") + if not start_youtube_video(ad): + ad.log.warning("Fail to bring up youtube video") + time.sleep(10) + else: + ad.log.info("Step 3: Skip Youtube streaming.") + + if not call_direction: + return True + else: + expected_result = True + if call_direction == "mo": + ad_mo = self.android_devices[0] + ad_mt = self.android_devices[1] + mo_sub_id = get_subid_from_slot_index(self.log, ad, call_slot) + if call_or_sms_or_mms == "call": + set_incoming_voice_sub_id(ad_mo, mo_sub_id) + _, mt_sub_id, _ = get_subid_on_same_network_of_host_ad( + self.android_devices) + + if call_slot == 0: + is_mo_in_call = is_slot0_in_call + elif call_slot == 1: + is_mo_in_call = is_slot1_in_call + is_mt_in_call = None + + elif call_or_sms_or_mms == "sms": + set_subid_for_message(ad_mo, mo_sub_id) + _, mt_sub_id, _ = get_subid_on_same_network_of_host_ad( + self.android_devices, type="sms") + set_subid_for_message(ad_mt, mt_sub_id) + + elif call_or_sms_or_mms == "mms": + current_data_sub_id = get_default_data_sub_id(ad_mo) + if mo_sub_id != current_data_sub_id: + ad_mo.log.warning( + "Current data sub ID (%s) does not match" + " message sub ID (%s). MMS should NOT be sent.", + current_data_sub_id, mo_sub_id) + expected_result = False + set_subid_for_message(ad_mo, mo_sub_id) + _, mt_sub_id, _ = get_subid_on_same_network_of_host_ad( + self.android_devices, type="sms") + set_subid_for_message(ad_mt, mt_sub_id) + set_subid_for_data(ad_mt, mt_sub_id) + ad_mt.droid.telephonyToggleDataConnection(True) + + elif call_direction == "mt": + ad_mo = self.android_devices[1] + ad_mt = self.android_devices[0] + mt_sub_id = get_subid_from_slot_index(self.log, ad, call_slot) + if call_or_sms_or_mms == "call": + set_incoming_voice_sub_id(ad_mt, mt_sub_id) + _, mo_sub_id, _ = get_subid_on_same_network_of_host_ad( + self.android_devices) + + if call_slot == 0: + is_mt_in_call = is_slot0_in_call + elif call_slot == 1: + is_mt_in_call = is_slot1_in_call + is_mo_in_call = None + + elif call_or_sms_or_mms == "sms": + set_subid_for_message(ad_mt, mt_sub_id) + _, mo_sub_id, _ = get_subid_on_same_network_of_host_ad( + self.android_devices, type="sms") + set_subid_for_message(ad_mo, mo_sub_id) + + elif call_or_sms_or_mms == "mms": + current_data_sub_id = get_default_data_sub_id(ad_mt) + if mt_sub_id != current_data_sub_id: + ad_mt.log.warning( + "Current data sub ID (%s) does not match" + " message sub ID (%s). MMS should NOT be" + " received.", current_data_sub_id, mt_sub_id) + expected_result = False + set_subid_for_message(ad_mt, mt_sub_id) + _, mo_sub_id, _ = get_subid_on_same_network_of_host_ad( + self.android_devices, type="sms") + set_subid_for_message(ad_mo, mo_sub_id) + set_subid_for_data(ad_mo, mo_sub_id) + ad_mo.droid.telephonyToggleDataConnection(True) + + if call_or_sms_or_mms == "call": + self.log.info("Step 4: Make voice call.") + mo_slot = get_slot_index_from_subid( + self.log, ad_mo, mo_sub_id) + mt_slot = get_slot_index_from_subid( + self.log, ad_mt, mt_sub_id) + result = two_phone_call_msim_for_slot( + self.log, + ad_mo, + mo_slot, + None, + is_mo_in_call, + ad_mt, + mt_slot, + None, + is_mt_in_call) + self.tel_logger.set_result(result.result_value) + + if not result: + self.log.error( + "Failed to make MO call from %s slot %s to %s" + " slot %s", ad_mo.serial, mo_slot, ad_mt.serial, + mt_slot) + raise signals.TestFailure("Failed", + extras={"fail_reason": str(result.result_value)}) + else: + self.log.info("Step 4: Send %s.", call_or_sms_or_mms) + if call_or_sms_or_mms == "sms": + result = self._msim_message_test( + ad_mo, + ad_mt, + mo_sub_id, + mt_sub_id, + msg=call_or_sms_or_mms.upper()) + elif call_or_sms_or_mms == "mms": + result = self._msim_message_test( + ad_mo, + ad_mt, + mo_sub_id, + mt_sub_id, + msg=call_or_sms_or_mms.upper(), + expected_result=expected_result) + if not result: + log_messaging_screen_shot( + ad_mo, test_name="%s_tx" % call_or_sms_or_mms) + log_messaging_screen_shot( + ad_mt, test_name="%s_rx" % call_or_sms_or_mms) + + return False + return True + + def _test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + self, + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=0, + call_direction=None, + streaming=True, + airplane_mode_cycling=False, + cellular_data_cycling=False, + wifi_cycling=False, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED], + is_airplane_mode=False, + is_wifi_connected=False): + """Switch DDS and make VoLTE/WFC call together with Youtube playing + after each DDS switch at specific slot in specific RAT. + + Test step: + 1. Get sub ID of each slot of the primary device. + 2. Set up phones in desired RAT. + 3. Toggle on/off VoLTE/WFC and set WFC mode. + 4. Airplane mode or cellular data or Wi-Fi cycling. + 5. Switch DDS to slot 0. + 6. Check HTTP connection after DDS switch. + 7. Play Youtube. + 8. Make VoLTE or WFC call. + 9. Switch DDS to slot 1 and repeat step 6-8. + 10. Switch DDS to slot 0 again and repeat step 6-8. + + Args: + 1, slot_0_nw_gen: Network generation of slot 0 on the primary device + 2, slot_1_nw_gen: Network generation of slot 1 on the primary device + 3. call_slot: Slot for making voice call + 4. call_direction: "mo" or "mt" or None to stoping making call. + 5. streaming: True for playing Youtube after DDS switch and False on + the contrary. + 6. airplane_mode_cycling: True for cycling airplane + 7. cellular_data_cycling: True for cycling cellular data + 8. wifi_cycling: True for cycling Wi-Fi + 9. enable_volte: True for enabling and False for disabling VoLTE for + each slot on the primary device + 10. enable_wfc: True for enabling and False for disabling WFC for + each slot on the primary device + 11. wfc_mode: Cellular preferred or Wi-Fi preferred. + 12. is_airplane_mode: True of False for WFC setup + + Returns: + True or False + """ + ad = self.android_devices[0] + slot_0_subid = get_subid_from_slot_index(self.log, ad, 0) + slot_1_subid = get_subid_from_slot_index(self.log, ad, 1) + + if slot_0_subid == INVALID_SUB_ID or slot_1_subid == INVALID_SUB_ID: + ad.log.error("Not all slots have valid sub ID.") + raise signals.TestFailure("Failed", + extras={"fail_reason": "Not all slots have valid sub ID"}) + + ad.log.info( + "Step 0: Set up phone in desired RAT (slot 0: %s, slot 1: %s)", + slot_0_nw_gen, slot_1_nw_gen) + + if slot_0_nw_gen == "volte": + slot0_phone_setup_func = phone_setup_volte_for_subscription + is_slot0_in_call = is_phone_in_call_volte + elif slot_0_nw_gen == "wfc": + slot0_phone_setup_func = phone_setup_iwlan_for_subscription + is_slot0_in_call = is_phone_in_call_iwlan + else: + slot0_phone_setup_func = phone_setup_voice_general_for_subscription + is_slot0_in_call = None + + if slot_0_nw_gen == "wfc": + tasks = [(slot0_phone_setup_func, ( + self.log, + ad, + slot_0_subid, + is_airplane_mode, + wfc_mode[0], + self.wifi_network_ssid, + self.wifi_network_pass))] + else: + tasks = [(slot0_phone_setup_func, (self.log, ad, slot_0_subid))] + if not multithread_func(self.log, tasks): + self.log.error("Phone Failed to Set Up Properly.") + self.tel_logger.set_result(CallResult("CALL_SETUP_FAILURE")) + raise signals.TestFailure("Failed", + extras={"fail_reason": "Phone Failed to Set Up Properly."}) + + if slot_1_nw_gen == "volte": + slot1_phone_setup_func = phone_setup_volte_for_subscription + is_slot1_in_call = is_phone_in_call_volte + elif slot_1_nw_gen == "wfc": + slot1_phone_setup_func = phone_setup_iwlan_for_subscription + is_slot1_in_call = is_phone_in_call_iwlan + else: + slot1_phone_setup_func = phone_setup_voice_general_for_subscription + is_slot1_in_call = None + + if slot_1_nw_gen == "wfc": + tasks = [(slot1_phone_setup_func, ( + self.log, + ad, + slot_1_subid, + is_airplane_mode, + wfc_mode[1], + self.wifi_network_ssid, + self.wifi_network_pass))] + else: + tasks = [(slot1_phone_setup_func, (self.log, ad, slot_1_subid))] + if not multithread_func(self.log, tasks): + self.log.error("Phone Failed to Set Up Properly.") + self.tel_logger.set_result(CallResult("CALL_SETUP_FAILURE")) + raise signals.TestFailure("Failed", + extras={"fail_reason": "Phone Failed to Set Up Properly."}) + + if is_wifi_connected: + if not ensure_wifi_connected( + self.log, + ad, + self.wifi_network_ssid, + self.wifi_network_pass, + apm=False): + return False + time.sleep(5) + + ad.log.info("Step 1: Enable/disable VoLTE and WFC.") + for sub_id, volte in zip([slot_0_subid, slot_1_subid], enable_volte): + if not toggle_volte_for_subscription( + self.log, + ad, + sub_id, + new_state=volte): + return False + + for sub_id, wfc, mode in \ + zip([slot_0_subid, slot_1_subid], enable_wfc, wfc_mode): + if not toggle_wfc_for_subscription(self.log, ad, new_state=wfc, sub_id=sub_id): + return False + if not set_wfc_mode_for_subscription(ad, mode, sub_id=sub_id): + return False + + if airplane_mode_cycling: + ad.log.info("Step 2: Airplane mode cycling.") + ad.log.info("Step 2-1: Toggle on airplane mode.") + if not toggle_airplane_mode(self.log, ad, True): + ad.log.error("Failed to toggle on airplane mode.") + return False + time.sleep(5) + ad.log.info("Step 2-2: Toggle off airplane mode.") + if not toggle_airplane_mode(self.log, ad, False): + ad.log.error("Failed to toggle off airplane mode.") + return False + + if is_airplane_mode: + time.sleep(5) + ad.log.info("Step 2-3: Toggle on airplane mode again.") + if not toggle_airplane_mode(self.log, ad, True): + ad.log.error("Failed to toggle on airplane mode.") + return False + + if wfc_mode[0] or wfc_mode[1]: + time.sleep(5) + ad.log.info("Step 2-4: Toggle on Wi-Fi again.") + if not ensure_wifi_connected( + self.log, + ad, + self.wifi_network_ssid, + self.wifi_network_pass, + apm=is_airplane_mode): + return False + time.sleep(5) + + if cellular_data_cycling: + if call_slot == 0: + sub_id = slot_0_subid + elif call_slot == 1: + sub_id = slot_1_subid + ad.log.info("Step 2: Cellular data cycling") + ad.log.info("Step 2-1: Toggle off cellular data.") + ad.droid.telephonyToggleDataConnection(False) + if not check_is_wifi_connected( + self.log, + ad, + self.wifi_network_ssid): + if not wait_for_cell_data_connection_for_subscription( + self.log, ad, sub_id, False): + ad.log.error("Failed to disable cellular data") + return False + + if not verify_internet_connection( + self.log, + ad, + expected_state=False): + ad.log.error("Internet still accessible when cellular data" + " is disabled.") + return False + time.sleep(5) + ad.log.info("Step 2-2: Toggle on cellular data.") + ad.droid.telephonyToggleDataConnection(True) + if not check_is_wifi_connected( + self.log, + ad, + self.wifi_network_ssid): + if not wait_for_cell_data_connection_for_subscription( + self.log, ad, sub_id, True): + ad.log.error("Failed to enable cellular data") + return False + if not verify_internet_connection(self.log, ad, retries=3): + ad.log.error( + "Internet inaccessible when cellular data is enabled.") + return False + + if wifi_cycling: + ad.log.info("Step 2: Wi-Fi cycling") + ad.log.info("Step 2-1: Toggle on Wi-Fi.") + if not ensure_wifi_connected( + self.log, + ad, + self.wifi_network_ssid, + self.wifi_network_pass, + apm=is_airplane_mode): + return False + time.sleep(5) + ad.log.info("Step 2-2: Toggle off Wi-Fi.") + ad.droid.wifiToggleState(False) + time.sleep(5) + + if (call_slot == 0 and slot_0_nw_gen == "wfc") or \ + (call_slot == 1 and slot_1_nw_gen == "wfc") or is_wifi_connected: + if not ensure_wifi_connected( + self.log, + ad, + self.wifi_network_ssid, + self.wifi_network_pass, + apm=is_airplane_mode): + return False + + for attempt in range(3): + if attempt != 0: + ad.log.info("Repeat step 1 to 4.") + + ad.log.info("Step 3: Switch DDS.") + if attempt % 2 == 0: + set_dds_on_slot_0(ad) + else: + set_dds_on_slot_1(ad) + + ad.log.info("Step 4: Check HTTP connection after DDS switch.") + if not verify_http_connection(self.log, ad): + ad.log.error("Failed to verify http connection.") + return False + else: + ad.log.info("Verify http connection successfully.") + + if streaming: + ad.log.info("Step 5: Start Youtube streaming.") + if not start_youtube_video(ad): + ad.log.warning("Fail to bring up youtube video") + time.sleep(10) + else: + ad.log.info("Step 5: Skip Youtube streaming.") + + if not call_direction: + return True + else: + expected_result = True + if call_direction == "mo": + ad_mo = self.android_devices[0] + ad_mt = self.android_devices[1] + mo_sub_id = get_subid_from_slot_index(self.log, ad, call_slot) + + set_incoming_voice_sub_id(ad_mo, mo_sub_id) + _, mt_sub_id, _ = get_subid_on_same_network_of_host_ad( + self.android_devices) + + if call_slot == 0: + is_mo_in_call = is_slot0_in_call + elif call_slot == 1: + is_mo_in_call = is_slot1_in_call + is_mt_in_call = None + + elif call_direction == "mt": + ad_mo = self.android_devices[1] + ad_mt = self.android_devices[0] + mt_sub_id = get_subid_from_slot_index(self.log, ad, call_slot) + + set_incoming_voice_sub_id(ad_mt, mt_sub_id) + _, mo_sub_id, _ = get_subid_on_same_network_of_host_ad( + self.android_devices) + + if call_slot == 0: + is_mt_in_call = is_slot0_in_call + elif call_slot == 1: + is_mt_in_call = is_slot1_in_call + is_mo_in_call = None + + if (call_slot == 0 and slot_0_nw_gen == "wfc") or \ + (call_slot == 1 and slot_1_nw_gen == "wfc"): + if not wait_for_wfc_enabled(self.log, ad): + return False + + self.log.info("Step 6: Make voice call.") + mo_slot = get_slot_index_from_subid(self.log, ad_mo, mo_sub_id) + mt_slot = get_slot_index_from_subid(self.log, ad_mt, mt_sub_id) + result = two_phone_call_msim_for_slot( + self.log, + ad_mo, + mo_slot, + None, + is_mo_in_call, + ad_mt, + mt_slot, + None, + is_mt_in_call) + self.tel_logger.set_result(result.result_value) + + if not result: + self.log.error( + "Failed to make MO call from %s slot %s to %s slot %s", + ad_mo.serial, mo_slot, ad_mt.serial, mt_slot) + raise signals.TestFailure("Failed", + extras={"fail_reason": str(result.result_value)}) + + return True + + def _test_dds_switch_volte_cycling(self, slot=0): + """ VoLTE cycling after DDS switch. + + Test steps: + 1. Enable VoLTE. + 2. Disable VoLTE. + 3. Switch DDS to slot 0. + 4. Check HTTP connection after DDS switch. + 5. Enable VoLTE again. + 6. Check if IMS can be registered successfully and if VoLTE is + available. + 7. Repeat steps 2-6 for 2 times and each time DDS should be switched + to another slot. + + Args: + slot: slot to be tested + + Returns: + True or False + """ + ad = self.android_devices[0] + slot_0_subid = get_subid_from_slot_index(self.log, ad, 0) + slot_1_subid = get_subid_from_slot_index(self.log, ad, 1) + + if slot == 0: + sub_id = slot_0_subid + elif slot == 1: + sub_id = slot_1_subid + + ad.log.info("Step 1: Enable VoLTE for sub ID %s.", sub_id) + if not phone_setup_volte_for_subscription(self.log, ad, sub_id): + return False + + for attempt in range(3): + if attempt != 0: + ad.log.info("Repeat step 2 to 4.") + + ad.log.info("Step 2-1: Disable VoLTE for sub ID %s.", sub_id) + if not toggle_volte_for_subscription( + self.log, ad, sub_id, new_state=False): + return False + + ad.log.info( + "Step 2-2: Ensure VoLTE is disabled for sub ID %s.", sub_id) + if is_volte_enabled(self.log, ad, sub_id): + return False + + ad.log.info("Step 3: Switch DDS.") + if attempt % 2 == 0: + set_dds_on_slot_0(ad) + else: + set_dds_on_slot_1(ad) + + ad.log.info("Step 4: Check HTTP connection after DDS switch.") + if not verify_http_connection(self.log, ad): + ad.log.error("Failed to verify http connection.") + return False + else: + ad.log.info("Verify http connection successfully.") + + ad.log.info( + "Step 5: Enable VoLTE again after DDS switch for sub ID %s.", + sub_id) + if not phone_setup_volte_for_subscription(self.log, ad, sub_id): + return False + + return True + + @test_tracker_info(uuid="06908fb0-aaaa-4c95-b073-ea5ba8977050") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_when_volte_enabled(self): + ad = self.android_devices[0] + slot_0_subid = get_subid_from_slot_index(self.log, ad, 0) + slot_1_subid = get_subid_from_slot_index(self.log, ad, 1) + + ad.log.info("Step 0: Ensure VoLTE is enabled as initial condition.") + if not phone_setup_volte_for_subscription(self.log, ad, slot_0_subid): + return False + if not phone_setup_volte_for_subscription(self.log, ad, slot_1_subid): + return False + + for attempt in range(3): + ad.log.info("Step 1: Switch DDS.") + if attempt % 2 == 0: + set_dds_on_slot_0(ad) + else: + set_dds_on_slot_1(ad) + + ad.log.info("Step 2: Check HTTP connection after DDS switch.") + if not verify_http_connection(self.log, ad): + ad.log.error("Failed to verify http connection.") + return False + else: + ad.log.info("Verify http connection successfully.") + + ad.log.info("Step 3: Ensure VoLTE is still enabled after DDS" + " switch.") + if not phone_setup_volte_for_subscription( + self.log, ad, slot_0_subid): + return False + if not phone_setup_volte_for_subscription( + self.log, ad, slot_1_subid): + return False + return True + + @test_tracker_info(uuid="6b41d84c-4485-47b0-a5d8-eac16ed36258") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_and_reboot_when_volte_enabled(self): + ad = self.android_devices[0] + slot_0_subid = get_subid_from_slot_index(self.log, ad, 0) + slot_1_subid = get_subid_from_slot_index(self.log, ad, 1) + + ad.log.info("Step 0: Ensure VoLTE is enabled as initial condition.") + if not phone_setup_volte_for_subscription(self.log, ad, slot_0_subid): + return False + if not phone_setup_volte_for_subscription(self.log, ad, slot_1_subid): + return False + + for attempt in range(3): + ad.log.info("Step 1: Switch DDS.") + if attempt % 2 == 0: + set_dds_on_slot_0(ad) + else: + set_dds_on_slot_1(ad) + + ad.log.info("Step 2: Check HTTP connection after DDS switch.") + if not verify_http_connection(self.log, ad): + ad.log.error("Failed to verify http connection.") + return False + else: + ad.log.info("Verify http connection successfully.") + + ad.log.info("Step 3: Reboot.") + if not reboot_test(self.log, ad): + return False + + ad.log.info("Step 4: Ensure VoLTE is still enabled after DDS" + " switch.") + if not phone_setup_volte_for_subscription( + self.log, ad, slot_0_subid): + return False + if not phone_setup_volte_for_subscription( + self.log, ad, slot_1_subid): + return False + return True + + @test_tracker_info(uuid="bb440f33-ab0d-4999-885c-5c1f933430c4") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_when_volte_cycling_psim(self): + return self._test_dds_switch_volte_cycling(slot=0) + + @test_tracker_info(uuid="cbd5a4ae-be37-4435-b9db-fe58e8fdac5f") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_when_volte_cycling_esim(self): + return self._test_dds_switch_volte_cycling(slot=1) + + + @test_tracker_info(uuid="2df5faf9-8318-4acb-9068-e6ec0481c2ca") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_youtube_volte(self): + return self._test_dds_switch_during_data_transfer( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte") + + @test_tracker_info(uuid="eb73506e-c604-48df-be04-9b602a801afc") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_youtube_and_voice_call_mo_volte_psim(self): + return self._test_dds_switch_during_data_transfer( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=0, + call_direction="mo") + + @test_tracker_info(uuid="2e2feab1-65a8-40a7-8666-0c46cb3411a4") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_youtube_and_voice_call_mo_volte_esim(self): + return self._test_dds_switch_during_data_transfer( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=1, + call_direction="mo") + + @test_tracker_info(uuid="f2a7d62c-1f54-4081-b7bb-4782c5482b41") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_youtube_and_voice_call_mt_volte_psim(self): + return self._test_dds_switch_during_data_transfer( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=0, + call_direction="mt") + + @test_tracker_info(uuid="df211078-b260-499d-8f7e-86cad039c5f5") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_youtube_and_voice_call_mt_volte_esim(self): + return self._test_dds_switch_during_data_transfer( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=1, + call_direction="mt") + + @test_tracker_info(uuid="bd77782d-f43d-40c6-9982-47cd452d980f") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_youtube_and_voice_call_mo_csfb_psim(self): + return self._test_dds_switch_during_data_transfer( + slot_0_nw_gen="csfb", + slot_1_nw_gen="csfb", + call_slot=0, + call_direction="mo") + + @test_tracker_info(uuid="361a6f69-e6ea-4013-960d-732931fcd130") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_youtube_and_voice_call_mo_csfb_esim(self): + return self._test_dds_switch_during_data_transfer( + slot_0_nw_gen="csfb", + slot_1_nw_gen="csfb", + call_slot=1, + call_direction="mo") + + @test_tracker_info(uuid="26186d4f-0b0d-41c5-ab91-04e9851461f0") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_youtube_and_voice_call_mt_csfb_psim(self): + return self._test_dds_switch_during_data_transfer( + slot_0_nw_gen="csfb", + slot_1_nw_gen="csfb", + call_slot=0, + call_direction="mt") + + @test_tracker_info(uuid="7d31c644-a470-4eb9-b272-f0cfc34d23cb") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_youtube_and_voice_call_mt_csfb_esim(self): + return self._test_dds_switch_during_data_transfer( + slot_0_nw_gen="csfb", + slot_1_nw_gen="csfb", + call_slot=1, + call_direction="mt") + + @test_tracker_info(uuid="614076a6-b042-45f3-84fe-c84591e02f78") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_youtube_and_sms_volte(self): + result = True + self.log.info("Scenario 1: MO SMS at slot 0") + if not self._test_dds_switch_during_data_transfer( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=0, + call_direction="mo", + call_or_sms_or_mms="sms"): + result = False + self.log.info("Scenario 2: MO SMS at slot 1") + if not self._test_dds_switch_during_data_transfer( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=1, + call_direction="mo", + call_or_sms_or_mms="sms"): + result = False + self.log.info("Scenario 3: MT SMS at slot 0") + if not self._test_dds_switch_during_data_transfer( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=0, + call_direction="mt", + call_or_sms_or_mms="sms"): + result = False + self.log.info("Scenario 4: MT SMS at slot 1") + if not self._test_dds_switch_during_data_transfer( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=1, + call_direction="mt", + call_or_sms_or_mms="sms"): + result = False + return result + + @test_tracker_info(uuid="5e61f007-7b01-4dee-ac2d-fd2225ac3dbd") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_youtube_and_mms_volte(self): + result = True + self.log.info("Scenario 1: MO MMS at slot 0") + if not self._test_dds_switch_during_data_transfer( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=0, + call_direction="mo", + call_or_sms_or_mms="mms"): + result = False + self.log.info("Scenario 2: MO MMS at slot 1") + if not self._test_dds_switch_during_data_transfer( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=1, + call_direction="mo", + call_or_sms_or_mms="mms"): + result = False + self.log.info("Scenario 3: MT MMS at slot 0") + if not self._test_dds_switch_during_data_transfer( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=0, + call_direction="mt", + call_or_sms_or_mms="mms"): + result = False + self.log.info("Scenario 4: MT MMS at slot 1") + if not self._test_dds_switch_during_data_transfer( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=1, + call_direction="mt", + call_or_sms_or_mms="mms"): + result = False + return result + + @test_tracker_info(uuid="47b9bf08-2c17-4646-b1d3-3d191318bc0d") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mo_volte_psim(self): + return self._test_dds_switch_during_data_transfer( + "volte", "volte", 0, "mo", "call", False) + + @test_tracker_info(uuid="eef31675-f0a3-4086-8474-d67614ede507") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mo_volte_esim(self): + return self._test_dds_switch_during_data_transfer( + "volte", "volte", 1, "mo", "call", False) + + @test_tracker_info(uuid="ce8b6ce8-d314-49ca-bead-391c15809235") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mt_volte_psim(self): + return self._test_dds_switch_during_data_transfer( + "volte", "volte", 0, "mt", "call", False) + + @test_tracker_info(uuid="64c941e0-fcab-43ca-a988-f667398f1997") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mt_volte_esim(self): + return self._test_dds_switch_during_data_transfer( + "volte", "volte", 1, "mt", "call", False) + + @test_tracker_info(uuid="28963e86-f8ce-4324-8ce8-8e6628fd2d99") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_sms_volte(self): + result = True + self.log.info("Scenario 1: MO SMS at slot 0") + if not self._test_dds_switch_during_data_transfer( + "volte", "volte", 0, "mo", "sms", False): + result = False + self.log.info("Scenario 2: MO SMS at slot 1") + if not self._test_dds_switch_during_data_transfer( + "volte", "volte", 1, "mo", "sms", False): + result = False + self.log.info("Scenario 3: MT SMS at slot 0") + if not self._test_dds_switch_during_data_transfer( + "volte", "volte", 0, "mt", "sms", False): + result = False + self.log.info("Scenario 4: MT SMS at slot 1") + if not self._test_dds_switch_during_data_transfer( + "volte", "volte", 1, "mt", "sms", False): + result = False + return result + + @test_tracker_info(uuid="915c0eb3-1a84-4eb0-8cba-cafe32c0d604") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_mms_volte(self): + result = True + self.log.info("Scenario 1: MO MMS at slot 0") + if not self._test_dds_switch_during_data_transfer( + "volte", "volte", 0, "mo", "mms", False): + result = False + self.log.info("Scenario 2: MO MMS at slot 1") + if not self._test_dds_switch_during_data_transfer( + "volte", "volte", 1, "mo", "mms", False): + result = False + self.log.info("Scenario 3: MT MMS at slot 0") + if not self._test_dds_switch_during_data_transfer( + "volte", "volte", 0, "mt", "mms", False): + result = False + self.log.info("Scenario 4: MT MMS at slot 1") + if not self._test_dds_switch_during_data_transfer( + "volte", "volte", 1, "mt", "mms", False): + result = False + return result + + @test_tracker_info(uuid="d58939c0-d246-453e-9eac-54152d6dc70c") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mo_volte_psim_with_wfc_on_apm_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=0, + call_direction="mo", + streaming=True, + airplane_mode_cycling=True, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED]) + + @test_tracker_info(uuid="61dfb957-6349-4190-8e63-973558b1292b") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mo_volte_esim_with_wfc_on_apm_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=1, + call_direction="mo", + streaming=True, + airplane_mode_cycling=True, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED]) + + @test_tracker_info(uuid="127377f2-973f-4758-b138-4c0dd276f893") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mt_volte_psim_with_wfc_on_apm_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=0, + call_direction="mt", + streaming=True, + airplane_mode_cycling=True, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED]) + + @test_tracker_info(uuid="a149d357-27a7-490d-a30b-70f44cd43ac7") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mt_volte_esim_with_wfc_on_apm_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=1, + call_direction="mt", + streaming=True, + airplane_mode_cycling=True, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED]) + + @test_tracker_info(uuid="8823e87c-0e4d-435d-a17f-84e1b65c1012") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mo_volte_psim_with_wfc_on_wifi_on_apm_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=0, + call_direction="mo", + streaming=True, + airplane_mode_cycling=True, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED], + is_wifi_connected=True) + + @test_tracker_info(uuid="bd038a77-baa6-483d-9af0-fe18d50d7f1f") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mo_volte_esim_with_wfc_on_wifi_on_apm_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=1, + call_direction="mo", + streaming=True, + airplane_mode_cycling=True, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED], + is_wifi_connected=True) + + @test_tracker_info(uuid="3f96fb8a-d4ee-49b8-8958-45cd509ed7b8") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mt_volte_psim_with_wfc_on_wifi_on_apm_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=0, + call_direction="mt", + streaming=True, + airplane_mode_cycling=True, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED], + is_wifi_connected=True) + + @test_tracker_info(uuid="1f89da8b-e559-4e96-afc7-0d2127616c56") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mt_volte_esim_with_wfc_on_wifi_on_apm_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=1, + call_direction="mt", + streaming=True, + airplane_mode_cycling=True, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED], + is_wifi_connected=True) + + @test_tracker_info(uuid="bc522b4d-2d26-4b5f-b82c-f92356f103d0") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mo_wfc_psim_cellular_preferred_apm_on_with_volte_on_apm_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="wfc", + slot_1_nw_gen="wfc", + call_slot=0, + call_direction="mo", + streaming=True, + airplane_mode_cycling=True, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED], + is_airplane_mode=True) + + @test_tracker_info(uuid="970ccdb4-c7b3-4b56-b93b-f811407c82cb") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mo_wfc_esim_cellular_preferred_apm_on_with_volte_on_apm_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="wfc", + slot_1_nw_gen="wfc", + call_slot=1, + call_direction="mo", + streaming=True, + airplane_mode_cycling=True, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED], + is_airplane_mode=True) + + @test_tracker_info(uuid="26c8b63e-631c-42d0-868b-03c2db6181b7") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mo_wfc_psim_wifi_preferred_apm_off_with_volte_on_apm_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="wfc", + slot_1_nw_gen="wfc", + call_slot=0, + call_direction="mo", + streaming=True, + airplane_mode_cycling=True, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_WIFI_PREFERRED, WFC_MODE_WIFI_PREFERRED], + is_airplane_mode=False) + + @test_tracker_info(uuid="efd73091-8667-42a3-8551-eafa497fc383") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mo_wfc_esim_wifi_preferred_apm_off_with_volte_on_apm_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="wfc", + slot_1_nw_gen="wfc", + call_slot=1, + call_direction="mo", + streaming=True, + airplane_mode_cycling=True, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_WIFI_PREFERRED, WFC_MODE_WIFI_PREFERRED], + is_airplane_mode=False) + + @test_tracker_info(uuid="618768b9-83c2-4ab7-b1fb-10a4037c5834") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mt_wfc_psim_cellular_preferred_apm_on_with_volte_on_apm_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="wfc", + slot_1_nw_gen="wfc", + call_slot=0, + call_direction="mt", + streaming=True, + airplane_mode_cycling=True, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED], + is_airplane_mode=True) + + @test_tracker_info(uuid="24d695a1-7421-4038-bb07-4d81f3f6d05b") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mt_wfc_esim_cellular_preferred_apm_on_with_volte_on_apm_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="wfc", + slot_1_nw_gen="wfc", + call_slot=1, + call_direction="mt", + streaming=True, + airplane_mode_cycling=True, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED], + is_airplane_mode=True) + + @test_tracker_info(uuid="2f28db8f-c0c3-4cf6-9f6f-439c9e32d9f3") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mt_wfc_psim_wifi_preferred_apm_off_with_volte_on_apm_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="wfc", + slot_1_nw_gen="wfc", + call_slot=0, + call_direction="mt", + streaming=True, + airplane_mode_cycling=True, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_WIFI_PREFERRED, WFC_MODE_WIFI_PREFERRED], + is_airplane_mode=False) + + @test_tracker_info(uuid="60d851c5-f79d-46e7-b921-b510bcdc9024") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mt_wfc_esim_wifi_preferred_apm_off_with_volte_on_apm_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="wfc", + slot_1_nw_gen="wfc", + call_slot=1, + call_direction="mt", + streaming=True, + airplane_mode_cycling=True, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_WIFI_PREFERRED, WFC_MODE_WIFI_PREFERRED], + is_airplane_mode=False) + + @test_tracker_info(uuid="092b1e43-3de4-4b08-b526-4f3f1e71a47a") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mo_volte_psim_with_wfc_on_cellular_data_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=0, + call_direction="mo", + streaming=True, + cellular_data_cycling=True, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED]) + + @test_tracker_info(uuid="3b876b39-1cfb-4adb-a45c-11a02890f8e1") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mo_volte_esim_with_wfc_on_cellular_data_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=1, + call_direction="mo", + streaming=True, + cellular_data_cycling=True, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED]) + + @test_tracker_info(uuid="96c42ffb-5b4e-4ab0-b52a-8b498a25f759") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mt_volte_psim_with_wfc_on_cellular_data_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=0, + call_direction="mt", + streaming=True, + cellular_data_cycling=True, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED]) + + @test_tracker_info(uuid="fbd4c30c-fef9-4100-b704-eb27d3bcb7ae") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mt_volte_esim_with_wfc_on_cellular_data_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=1, + call_direction="mt", + streaming=True, + cellular_data_cycling=True, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED]) + + @test_tracker_info(uuid="fbd88b9d-e27b-4c06-a983-a780d0c00623") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mo_volte_psim_with_wfc_on_wifi_on_cellular_data_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=0, + call_direction="mo", + streaming=True, + cellular_data_cycling=True, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED], + is_wifi_connected=True) + + @test_tracker_info(uuid="0fabca6f-28c4-4843-af70-f33d806d8dc1") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mo_volte_esim_with_wfc_on_wifi_on_cellular_data_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=1, + call_direction="mo", + streaming=True, + cellular_data_cycling=True, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED], + is_wifi_connected=True) + + @test_tracker_info(uuid="9b060264-69d8-437e-9981-b86e213952c5") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mt_volte_psim_with_wfc_on_wifi_on_cellular_data_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=0, + call_direction="mt", + streaming=True, + cellular_data_cycling=True, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED], + is_wifi_connected=True) + + @test_tracker_info(uuid="3a2effa4-728a-4160-9e0c-2aeafc7ba153") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mt_volte_esim_with_wfc_on_wifi_on_cellular_data_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=1, + call_direction="mt", + streaming=True, + cellular_data_cycling=True, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED], + is_wifi_connected=True) + + @test_tracker_info(uuid="ad491362-8bcc-4097-84af-932878002ce6") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mo_wfc_psim_cellular_preferred_apm_on_with_volte_on_cellular_data_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="wfc", + slot_1_nw_gen="wfc", + call_slot=0, + call_direction="mo", + streaming=True, + cellular_data_cycling=True, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED], + is_airplane_mode=True) + + @test_tracker_info(uuid="c137fe4e-380b-4dc5-8996-c8c5654596f7") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mo_wfc_esim_cellular_preferred_apm_on_with_volte_on_cellular_data_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="wfc", + slot_1_nw_gen="wfc", + call_slot=1, + call_direction="mo", + streaming=True, + cellular_data_cycling=True, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED], + is_airplane_mode=True) + + @test_tracker_info(uuid="e7936ce8-1652-4b21-b3f0-5327084b823c") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mo_wfc_psim_wifi_preferred_apm_off_with_volte_on_cellular_data_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="wfc", + slot_1_nw_gen="wfc", + call_slot=0, + call_direction="mo", + streaming=True, + cellular_data_cycling=True, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_WIFI_PREFERRED, WFC_MODE_WIFI_PREFERRED], + is_airplane_mode=False) + + @test_tracker_info(uuid="86db06b4-907f-4085-af8e-75c983831bb0") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mo_wfc_esim_wifi_preferred_apm_off_with_volte_on_cellular_data_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="wfc", + slot_1_nw_gen="wfc", + call_slot=1, + call_direction="mo", + streaming=True, + cellular_data_cycling=True, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_WIFI_PREFERRED, WFC_MODE_WIFI_PREFERRED], + is_airplane_mode=False) + + @test_tracker_info(uuid="e43b23b5-022a-4830-9110-839ece333f6f") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mt_wfc_psim_cellular_preferred_apm_on_with_volte_on_cellular_data_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="wfc", + slot_1_nw_gen="wfc", + call_slot=0, + call_direction="mt", + streaming=True, + cellular_data_cycling=True, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED], + is_airplane_mode=True) + + @test_tracker_info(uuid="00d0bfc2-2121-4ba9-9dd7-72bf78380121") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mt_wfc_esim_cellular_preferred_apm_on_with_volte_on_cellular_data_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="wfc", + slot_1_nw_gen="wfc", + call_slot=1, + call_direction="mt", + streaming=True, + cellular_data_cycling=True, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED], + is_airplane_mode=True) + + @test_tracker_info(uuid="4921a948-54d4-4945-81ea-02893d10b6e6") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mt_wfc_psim_wifi_preferred_apm_off_with_volte_on_cellular_data_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="wfc", + slot_1_nw_gen="wfc", + call_slot=0, + call_direction="mt", + streaming=True, + cellular_data_cycling=True, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_WIFI_PREFERRED, WFC_MODE_WIFI_PREFERRED], + is_airplane_mode=False) + + @test_tracker_info(uuid="ed4b8ba4-1b31-4e3c-9be3-0e184e324523") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mt_wfc_esim_wifi_preferred_apm_off_with_volte_on_cellular_data_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="wfc", + slot_1_nw_gen="wfc", + call_slot=1, + call_direction="mt", + streaming=True, + cellular_data_cycling=True, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_WIFI_PREFERRED, WFC_MODE_WIFI_PREFERRED], + is_airplane_mode=False) + + @test_tracker_info(uuid="1fb43960-51dd-4be9-adf1-51c84cb8d85a") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mo_volte_psim_with_wfc_on_wifi_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=0, + call_direction="mo", + streaming=True, + wifi_cycling=True, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED]) + + @test_tracker_info(uuid="1052e02f-5a4b-4826-9c47-9ab6d142f300") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mo_volte_esim_with_wfc_on_wifi_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=1, + call_direction="mo", + streaming=True, + wifi_cycling=True, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED]) + + @test_tracker_info(uuid="23bb1991-6ff1-4528-aeee-1ec0c7b525be") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mt_volte_psim_with_wfc_on_wifi_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=0, + call_direction="mt", + streaming=True, + wifi_cycling=True, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED]) + + @test_tracker_info(uuid="1d5842c5-91f5-4c87-9f65-67891d255d43") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mt_volte_esim_with_wfc_on_wifi_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=1, + call_direction="mt", + streaming=True, + wifi_cycling=True, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED]) + + @test_tracker_info(uuid="380bd592-5437-4e16-9564-5f47b066cab2") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mo_volte_psim_with_wfc_on_wifi_on_wifi_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=0, + call_direction="mo", + streaming=True, + wifi_cycling=True, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED], + is_wifi_connected=True) + + @test_tracker_info(uuid="90bb2647-71f1-44cd-bff3-5bbb720e59b7") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mo_volte_esim_with_wfc_on_wifi_on_wifi_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=1, + call_direction="mo", + streaming=True, + wifi_cycling=True, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED], + is_wifi_connected=True) + + @test_tracker_info(uuid="5bca72c8-62d0-41bf-8888-310cd235dac4") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mt_volte_psim_with_wfc_on_wifi_on_wifi_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=0, + call_direction="mt", + streaming=True, + wifi_cycling=True, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED], + is_wifi_connected=True) + + @test_tracker_info(uuid="13805ecf-3cf9-44c8-98bc-a099edb36340") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mt_volte_esim_with_wfc_on_wifi_on_wifi_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=1, + call_direction="mt", + streaming=True, + wifi_cycling=True, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED], + is_wifi_connected=True) + + @test_tracker_info(uuid="33ed3dee-581f-4ae8-b236-1317377a6ca1") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mo_wfc_psim_cellular_preferred_apm_on_with_with_volte_on_wifi_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="wfc", + slot_1_nw_gen="wfc", + call_slot=0, + call_direction="mo", + streaming=True, + wifi_cycling=True, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED], + is_airplane_mode=True) + + @test_tracker_info(uuid="88391458-6886-483f-a997-c62fd6dfd0b8") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mo_wfc_esim_cellular_preferred_apm_on_with_with_volte_on_wifi_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="wfc", + slot_1_nw_gen="wfc", + call_slot=1, + call_direction="mo", + streaming=True, + wifi_cycling=True, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED], + is_airplane_mode=True) + + @test_tracker_info(uuid="966bcb75-dd2d-4400-a880-e7407989ee52") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mo_wfc_psim_wifi_preferred_apm_off_with_with_volte_on_wifi_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="wfc", + slot_1_nw_gen="wfc", + call_slot=0, + call_direction="mo", + streaming=True, + wifi_cycling=True, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_WIFI_PREFERRED, WFC_MODE_WIFI_PREFERRED], + is_airplane_mode=False) + + @test_tracker_info(uuid="7ff48189-5b4b-4b2d-a96a-fa66e86d0596") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mo_wfc_esim_wifi_preferred_apm_off_with_with_volte_on_wifi_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="wfc", + slot_1_nw_gen="wfc", + call_slot=1, + call_direction="mo", + streaming=True, + wifi_cycling=True, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_WIFI_PREFERRED, WFC_MODE_WIFI_PREFERRED], + is_airplane_mode=False) + + @test_tracker_info(uuid="ab503377-7150-4a6d-a7c1-b21009a69402") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mt_psim_wfc_cellular_preferred_apm_on_with_with_volte_on_wifi_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="wfc", + slot_1_nw_gen="wfc", + call_slot=0, + call_direction="mt", + streaming=True, + wifi_cycling=True, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED], + is_airplane_mode=True) + + @test_tracker_info(uuid="7f02ee60-19e9-4602-8f6d-a13b976a6bba") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mt_esim_wfc_cellular_preferred_apm_on_with_with_volte_on_wifi_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="wfc", + slot_1_nw_gen="wfc", + call_slot=1, + call_direction="mt", + streaming=True, + wifi_cycling=True, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED], + is_airplane_mode=True) + + @test_tracker_info(uuid="e93fa3ac-c5cd-4e21-b872-5172aa22d030") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mt_wfc_psim_wifi_preferred_apm_off_with_with_volte_on_wifi_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="wfc", + slot_1_nw_gen="wfc", + call_slot=0, + call_direction="mt", + streaming=True, + wifi_cycling=True, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_WIFI_PREFERRED, WFC_MODE_WIFI_PREFERRED], + is_airplane_mode=False) + + @test_tracker_info(uuid="c2af6998-f702-4e36-bbaa-f099a307b21a") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mt_wfc_esim_wifi_preferred_apm_off_with_with_volte_on_wifi_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="wfc", + slot_1_nw_gen="wfc", + call_slot=1, + call_direction="mt", + streaming=True, + wifi_cycling=True, + enable_volte=[True, True], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_WIFI_PREFERRED, WFC_MODE_WIFI_PREFERRED], + is_airplane_mode=False) + + @test_tracker_info(uuid="45ba6e90-bdaa-4dc0-a504-c596bafdfaad") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mo_volte_psim_with_wfc_off_apm_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=0, + call_direction="mo", + streaming=True, + airplane_mode_cycling=True, + enable_volte=[True, True], + enable_wfc=[False, False], + wfc_mode=[WFC_MODE_DISABLED, WFC_MODE_DISABLED]) + + @test_tracker_info(uuid="1b573f40-3eaf-4149-baad-2e73e5bf15f4") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mo_volte_esim_with_wfc_off_apm_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=1, + call_direction="mo", + streaming=True, + airplane_mode_cycling=True, + enable_volte=[True, True], + enable_wfc=[False, False], + wfc_mode=[WFC_MODE_DISABLED, WFC_MODE_DISABLED]) + + @test_tracker_info(uuid="13511fb6-2984-40c3-b1b9-22f27f241c07") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mt_volte_psim_with_wfc_off_apm_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=0, + call_direction="mt", + streaming=True, + airplane_mode_cycling=True, + enable_volte=[True, True], + enable_wfc=[False, False], + wfc_mode=[WFC_MODE_DISABLED, WFC_MODE_DISABLED]) + + @test_tracker_info(uuid="61cf33d1-e1b2-427a-bb38-29a4c7566947") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mt_volte_esim_with_wfc_off_apm_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=1, + call_direction="mt", + streaming=True, + airplane_mode_cycling=True, + enable_volte=[True, True], + enable_wfc=[False, False], + wfc_mode=[WFC_MODE_DISABLED, WFC_MODE_DISABLED]) + + @test_tracker_info(uuid="31a2a741-c825-46f8-8e0a-8487fab9940e") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mo_volte_psim_with_wfc_off_cellular_data_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=0, + call_direction="mo", + streaming=True, + cellular_data_cycling=True, + enable_volte=[True, True], + enable_wfc=[False, False], + wfc_mode=[WFC_MODE_DISABLED, WFC_MODE_DISABLED]) + + @test_tracker_info(uuid="9fb2a85f-08b3-4d5d-9e03-3f7f67039148") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mo_volte_esim_with_wfc_off_cellular_data_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=1, + call_direction="mo", + streaming=True, + cellular_data_cycling=True, + enable_volte=[True, True], + enable_wfc=[False, False], + wfc_mode=[WFC_MODE_DISABLED, WFC_MODE_DISABLED]) + + @test_tracker_info(uuid="30eba519-b349-4a75-9f31-3fea0d1a8447") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mt_volte_psim_with_wfc_off_cellular_data_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=0, + call_direction="mt", + streaming=True, + cellular_data_cycling=True, + enable_volte=[True, True], + enable_wfc=[False, False], + wfc_mode=[WFC_MODE_DISABLED, WFC_MODE_DISABLED]) + + @test_tracker_info(uuid="37240938-3ce1-4ad2-b35a-a8862dc2c70f") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mt_volte_esim_with_wfc_off_cellular_data_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=1, + call_direction="mt", + streaming=True, + cellular_data_cycling=True, + enable_volte=[True, True], + enable_wfc=[False, False], + wfc_mode=[WFC_MODE_DISABLED, WFC_MODE_DISABLED]) + + @test_tracker_info(uuid="a7321b9c-fb2c-4a03-9566-05e4244ae6fd") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mo_volte_psim_with_wfc_off_wifi_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=0, + call_direction="mo", + streaming=True, + wifi_cycling=True, + enable_volte=[True, True], + enable_wfc=[False, False], + wfc_mode=[WFC_MODE_DISABLED, WFC_MODE_DISABLED]) + + @test_tracker_info(uuid="6de8d678-2f72-41ea-9ed9-47b27afee038") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mo_volte_esim_with_wfc_off_wifi_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=1, + call_direction="mo", + streaming=True, + wifi_cycling=True, + enable_volte=[True, True], + enable_wfc=[False, False], + wfc_mode=[WFC_MODE_DISABLED, WFC_MODE_DISABLED]) + + @test_tracker_info(uuid="7bc16dcf-6dab-4eec-931d-9b342caa7a32") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mt_volte_psim_with_wfc_off_wifi_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=0, + call_direction="mt", + streaming=True, + wifi_cycling=True, + enable_volte=[True, True], + enable_wfc=[False, False], + wfc_mode=[WFC_MODE_DISABLED, WFC_MODE_DISABLED]) + + @test_tracker_info(uuid="9c13e51b-385d-4df6-90b7-33b5e185f225") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mt_volte_esim_with_wfc_off_wifi_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="volte", + slot_1_nw_gen="volte", + call_slot=1, + call_direction="mt", + streaming=True, + wifi_cycling=True, + enable_volte=[True, True], + enable_wfc=[False, False], + wfc_mode=[WFC_MODE_DISABLED, WFC_MODE_DISABLED]) + + @test_tracker_info(uuid="161341e7-5c2d-45f9-9b11-4f44d542cd01") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mo_wfc_psim_cellular_preferred_apm_on_with_volte_off_apm_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="wfc", + slot_1_nw_gen="wfc", + call_slot=0, + call_direction="mo", + streaming=True, + airplane_mode_cycling=True, + enable_volte=[False, False], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED], + is_airplane_mode=True) + + @test_tracker_info(uuid="4d43f92f-562f-4bf1-bc25-71410f14425c") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mo_wfc_esim_cellular_preferred_apm_on_with_volte_off_apm_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="wfc", + slot_1_nw_gen="wfc", + call_slot=1, + call_direction="mo", + streaming=True, + airplane_mode_cycling=True, + enable_volte=[False, False], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED], + is_airplane_mode=True) + + @test_tracker_info(uuid="fe83e92d-c554-4f81-a447-d58300426da7") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mo_wfc_psim_wifi_preferred_apm_off_with_volte_off_apm_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="wfc", + slot_1_nw_gen="wfc", + call_slot=0, + call_direction="mo", + streaming=True, + airplane_mode_cycling=True, + enable_volte=[False, False], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_WIFI_PREFERRED, WFC_MODE_WIFI_PREFERRED], + is_airplane_mode=False) + + @test_tracker_info(uuid="76ba6834-1523-4ce8-80b9-079f2428da67") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mo_wfc_esim_wifi_preferred_apm_off_with_volte_off_apm_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="wfc", + slot_1_nw_gen="wfc", + call_slot=1, + call_direction="mo", + streaming=True, + airplane_mode_cycling=True, + enable_volte=[False, False], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_WIFI_PREFERRED, WFC_MODE_WIFI_PREFERRED], + is_airplane_mode=False) + + @test_tracker_info(uuid="15289348-8e09-4997-b5a3-f66bb7e7dca1") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mt_wfc_psim_cellular_preferred_apm_on_with_volte_off_apm_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="wfc", + slot_1_nw_gen="wfc", + call_slot=0, + call_direction="mt", + streaming=True, + airplane_mode_cycling=True, + enable_volte=[False, False], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED], + is_airplane_mode=True) + + @test_tracker_info(uuid="1ae4fa98-1ac3-4194-a483-097b7262415b") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mt_wfc_esim_cellular_preferred_apm_on_with_volte_off_apm_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="wfc", + slot_1_nw_gen="wfc", + call_slot=1, + call_direction="mt", + streaming=True, + airplane_mode_cycling=True, + enable_volte=[False, False], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED], + is_airplane_mode=True) + + @test_tracker_info(uuid="13d0af2c-2870-4cbc-8a38-311f93cd4bd7") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mt_wfc_psim_wifi_preferred_apm_off_with_volte_off_apm_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="wfc", + slot_1_nw_gen="wfc", + call_slot=0, + call_direction="mt", + streaming=True, + airplane_mode_cycling=True, + enable_volte=[False, False], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_WIFI_PREFERRED, WFC_MODE_WIFI_PREFERRED], + is_airplane_mode=False) + + @test_tracker_info(uuid="5fbe2002-a02f-4750-81e5-4a06d7b62740") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mt_wfc_esim_wifi_preferred_apm_off_with_volte_off_apm_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="wfc", + slot_1_nw_gen="wfc", + call_slot=1, + call_direction="mt", + streaming=True, + airplane_mode_cycling=True, + enable_volte=[False, False], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_WIFI_PREFERRED, WFC_MODE_WIFI_PREFERRED], + is_airplane_mode=False) + + @test_tracker_info(uuid="f8f523d2-e432-45d4-a850-469a22894bc7") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mo_wfc_psim_cellular_preferred_apm_on_with_volte_off_cellular_data_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="wfc", + slot_1_nw_gen="wfc", + call_slot=0, + call_direction="mo", + streaming=True, + cellular_data_cycling=True, + enable_volte=[False, False], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED], + is_airplane_mode=True) + + @test_tracker_info(uuid="750a8690-f9dd-4779-b13f-4011f478f194") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mo_wfc_esim_cellular_preferred_apm_on_with_volte_off_cellular_data_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="wfc", + slot_1_nw_gen="wfc", + call_slot=1, + call_direction="mo", + streaming=True, + cellular_data_cycling=True, + enable_volte=[False, False], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED], + is_airplane_mode=True) + + @test_tracker_info(uuid="9fcda7e5-1705-4bbe-8f18-f005437c71f2") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mo_wfc_psim_wifi_preferred_apm_off_with_volte_off_cellular_data_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="wfc", + slot_1_nw_gen="wfc", + call_slot=0, + call_direction="mo", + streaming=True, + cellular_data_cycling=True, + enable_volte=[False, False], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_WIFI_PREFERRED, WFC_MODE_WIFI_PREFERRED], + is_airplane_mode=False) + + @test_tracker_info(uuid="0e054729-945a-4f6f-ad29-4d832f0b11ed") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mo_wfc_esim_wifi_preferred_apm_off_with_volte_off_cellular_data_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="wfc", + slot_1_nw_gen="wfc", + call_slot=1, + call_direction="mo", + streaming=True, + cellular_data_cycling=True, + enable_volte=[False, False], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_WIFI_PREFERRED, WFC_MODE_WIFI_PREFERRED], + is_airplane_mode=False) + + @test_tracker_info(uuid="2e387739-cc4a-4d48-aa56-83bf621835b1") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mt_wfc_psim_cellular_preferred_apm_on_with_volte_off_cellular_data_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="wfc", + slot_1_nw_gen="wfc", + call_slot=0, + call_direction="mt", + streaming=True, + cellular_data_cycling=True, + enable_volte=[False, False], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED], + is_airplane_mode=True) + + @test_tracker_info(uuid="a0e2deda-9148-4665-abc8-7665e3818d06") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mt_wfc_esim_cellular_preferred_apm_on_with_volte_off_cellular_data_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="wfc", + slot_1_nw_gen="wfc", + call_slot=1, + call_direction="mt", + streaming=True, + cellular_data_cycling=True, + enable_volte=[False, False], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED], + is_airplane_mode=True) + + @test_tracker_info(uuid="6a43acef-aaa1-4fe8-ae7e-c8e045bf8814") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mt_wfc_psim_wifi_preferred_apm_off_with_volte_off_cellular_data_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="wfc", + slot_1_nw_gen="wfc", + call_slot=0, + call_direction="mt", + streaming=True, + cellular_data_cycling=True, + enable_volte=[False, False], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_WIFI_PREFERRED, WFC_MODE_WIFI_PREFERRED], + is_airplane_mode=False) + + @test_tracker_info(uuid="95524166-212f-4e82-9e02-2f9b58d92a9f") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mt_wfc_esim_wifi_preferred_apm_off_with_volte_off_cellular_data_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="wfc", + slot_1_nw_gen="wfc", + call_slot=1, + call_direction="mt", + streaming=True, + cellular_data_cycling=True, + enable_volte=[False, False], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_WIFI_PREFERRED, WFC_MODE_WIFI_PREFERRED], + is_airplane_mode=False) + + @test_tracker_info(uuid="828ae64c-41b3-4974-a412-342d3ca16ce3") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mo_wfc_psim_cellular_preferred_apm_on_with_volte_off_wifi_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="wfc", + slot_1_nw_gen="wfc", + call_slot=0, + call_direction="mo", + streaming=True, + wifi_cycling=True, + enable_volte=[False, False], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED], + is_airplane_mode=True) + + @test_tracker_info(uuid="343cf9dc-4f4c-4c0c-bd7b-ba664381f6bd") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mo_wfc_esim_cellular_preferred_apm_on_with_volte_off_wifi_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="wfc", + slot_1_nw_gen="wfc", + call_slot=1, + call_direction="mo", + streaming=True, + wifi_cycling=True, + enable_volte=[False, False], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED], + is_airplane_mode=True) + + @test_tracker_info(uuid="6ef18605-bf4c-43d8-83fd-0bf71311973e") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mo_wfc_psim_wifi_preferred_apm_off_with_volte_off_wifi_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="wfc", + slot_1_nw_gen="wfc", + call_slot=0, + call_direction="mo", + streaming=True, + wifi_cycling=True, + enable_volte=[False, False], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_WIFI_PREFERRED, WFC_MODE_WIFI_PREFERRED], + is_airplane_mode=False) + + @test_tracker_info(uuid="9bddfe69-68e1-4d04-aeaa-75fb0f9ed9aa") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mo_wfc_esim_wifi_preferred_apm_off_with_volte_off_wifi_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="wfc", + slot_1_nw_gen="wfc", + call_slot=1, + call_direction="mo", + streaming=True, + wifi_cycling=True, + enable_volte=[False, False], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_WIFI_PREFERRED, WFC_MODE_WIFI_PREFERRED], + is_airplane_mode=False) + + @test_tracker_info(uuid="81e7d2b6-e3eb-4651-807f-66bf8eeeea93") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mt_wfc_psim_cellular_preferred_apm_on_with_volte_off_wifi_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="wfc", + slot_1_nw_gen="wfc", + call_slot=0, + call_direction="mt", + streaming=True, + wifi_cycling=True, + enable_volte=[False, False], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED], + is_airplane_mode=True) + + @test_tracker_info(uuid="8c6da88b-be3a-4c0c-a239-255faf03a28b") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mt_wfc_esim_cellular_preferred_apm_on_with_volte_off_wifi_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="wfc", + slot_1_nw_gen="wfc", + call_slot=1, + call_direction="mt", + streaming=True, + wifi_cycling=True, + enable_volte=[False, False], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_CELLULAR_PREFERRED], + is_airplane_mode=True) + + @test_tracker_info(uuid="1b9ef6b4-c0c0-4375-b1a5-d569b946491e") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mt_wfc_psim_wifi_preferred_apm_off_with_volte_off_wifi_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="wfc", + slot_1_nw_gen="wfc", + call_slot=0, + call_direction="mt", + streaming=True, + wifi_cycling=True, + enable_volte=[False, False], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_WIFI_PREFERRED, WFC_MODE_WIFI_PREFERRED], + is_airplane_mode=False) + + @test_tracker_info(uuid="5771fedb-5eed-4868-84a3-0d7a01474dcf") + @TelephonyBaseTest.tel_test_wrap + def test_dds_switch_voice_call_mt_wfc_esim_wifi_preferred_apm_off_with_volte_off_wifi_cycling(self): + return self._test_dds_switch_during_data_transfer_with_apm_cycling_and_ims_setting( + slot_0_nw_gen="wfc", + slot_1_nw_gen="wfc", + call_slot=1, + call_direction="mt", + streaming=True, + wifi_cycling=True, + enable_volte=[False, False], + enable_wfc=[True, True], + wfc_mode=[WFC_MODE_WIFI_PREFERRED, WFC_MODE_WIFI_PREFERRED], + is_airplane_mode=False)
\ No newline at end of file diff --git a/acts_tests/tests/google/tel/live/TelLiveSmsTest.py b/acts_tests/tests/google/tel/live/TelLiveSmsTest.py index 95ed75a1b0..43302ede0e 100644 --- a/acts_tests/tests/google/tel/live/TelLiveSmsTest.py +++ b/acts_tests/tests/google/tel/live/TelLiveSmsTest.py @@ -2765,6 +2765,142 @@ class TelLiveSmsTest(TelephonyBaseTest): return self._mms_test_mt(ads) + @test_tracker_info(uuid="68366dd1-d544-43ff-9023-c300b8a19bdd") + @TelephonyBaseTest.tel_test_wrap + def test_sms_mo_mt_iwlan_apm_off_5g_nsa(self): + """ Test MO SMS, Phone in APM off, WiFi connected, WFC WiFi Preferred mode. + + Turn off APM always + Set PhoneA/B are operated at 5G NSA + Make sure PhoneA/B are operated at 5G NSA + Make sure PhoneA/B APM off, WiFi connected, WFC WiFi preferred mode. + Make sure PhoneA/B report iwlan as data rat. + Make sure PhoneA/B is able to make/receive call/sms. + Send SMS on PhoneA. + Make sure PhoneA/B are operated at 5G NSA + + Returns: + True if pass; False if fail. + """ + + ads = self.android_devices + + # Turn off airplane mode + self.log.info("Turn off APM mode before starting testing.") + tasks = [(toggle_airplane_mode, (self.log, ads[0], False)), + (toggle_airplane_mode, (self.log, ads[1], False))] + if not multithread_func(self.log, tasks): + self.log.error("Failed to turn off airplane mode") + return False + + # Mode Pref + tasks = [(set_preferred_mode_for_5g, [ad]) + for ad in self.android_devices] + if not multithread_func(self.log, tasks): + self.log.error("Failed to set preferred network mode.") + return False + + # Attach 5g + tasks = [(is_current_network_5g_nsa, [ad]) + for ad in self.android_devices] + if not multithread_func(self.log, tasks): + self.log.error("Phone not attached on 5G NSA before sending SMS.") + return False + + tasks = [(phone_setup_iwlan, + (self.log, ads[0], False, WFC_MODE_WIFI_PREFERRED, + self.wifi_network_ssid, self.wifi_network_pass)), + (phone_setup_iwlan, + (self.log, ads[1], False, WFC_MODE_WIFI_PREFERRED, + self.wifi_network_ssid, self.wifi_network_pass))] + if not multithread_func(self.log, tasks): + self.log.error("Phone Failed to Set Up Properly.") + return False + time.sleep(WAIT_TIME_ANDROID_STATE_SETTLING) + + if not self._sms_test_mo(ads): + self.log.error("Failed to send receive SMS over 5G NSA.") + return False + + self.log.info("PASS - iwlan SMS test over 5G NSA validated") + + # Attach 5g + tasks = [(is_current_network_5g_nsa, [ad]) + for ad in self.android_devices] + if not multithread_func(self.log, tasks): + self.log.error("Phone not attached on 5G NSA after sending SMS.") + return False + + return True + + @test_tracker_info(uuid="ab393c17-f1b0-47db-84c3-69a0ebdc9fba") + @TelephonyBaseTest.tel_test_wrap + def test_mms_mo_mt_iwlan_apm_off_5g_nsa(self): + """ Test MO MMS, Phone in APM off, WiFi connected, WFC WiFi Preferred mode. + + Turn off APM always + Set PhoneA/B are operated at 5G NSA + Make sure PhoneA/B are operated at 5G NSA + Make sure PhoneA/B APM off, WiFi connected, WFC WiFi preferred mode. + Make sure PhoneA/B report iwlan as data rat. + Make sure PhoneA/B is able to make/receive call/mms. + Send MMS on PhoneA. + Make sure PhoneA/B are operated at 5G NSA + + Returns: + True if pass; False if fail. + """ + + ads = self.android_devices + + # Turn off airplane mode + self.log.info("Turn off APM mode before starting testing.") + tasks = [(toggle_airplane_mode, (self.log, ads[0], False)), + (toggle_airplane_mode, (self.log, ads[1], False))] + if not multithread_func(self.log, tasks): + self.log.error("Failed to turn off airplane mode") + return False + + # Mode Pref + tasks = [(set_preferred_mode_for_5g, [ad]) + for ad in self.android_devices] + if not multithread_func(self.log, tasks): + self.log.error("Failed to set preferred network mode.") + return False + + # Attach 5g + tasks = [(is_current_network_5g_nsa, [ad]) + for ad in self.android_devices] + if not multithread_func(self.log, tasks): + self.log.error("Phone not attached on 5G NSA before sending MMS.") + return False + + tasks = [(phone_setup_iwlan, + (self.log, ads[0], False, WFC_MODE_WIFI_PREFERRED, + self.wifi_network_ssid, self.wifi_network_pass)), + (phone_setup_iwlan, + (self.log, ads[1], False, WFC_MODE_WIFI_PREFERRED, + self.wifi_network_ssid, self.wifi_network_pass))] + if not multithread_func(self.log, tasks): + self.log.error("Phone Failed to Set Up Properly.") + return False + time.sleep(WAIT_TIME_ANDROID_STATE_SETTLING) + + if not self._mms_test_mo(ads): + self.log.error("Failed to send receive MMS over 5G NSA.") + return False + + self.log.info("PASS - iwlan MMS test over 5G NSA validated") + + # Attach 5g + tasks = [(is_current_network_5g_nsa, [ad]) + for ad in self.android_devices] + if not multithread_func(self.log, tasks): + self.log.error("Phone not attached on 5G NSA after sending MMS.") + return False + + return True + @test_tracker_info(uuid="075933a2-df7f-4374-a405-92f96bcc7770") @TelephonyBaseTest.tel_test_wrap def test_sms_mo_apm_wifi_wfc_off(self): @@ -2877,6 +3013,136 @@ class TelLiveSmsTest(TelephonyBaseTest): return self._mms_test_mt(ads) + @test_tracker_info(uuid="27db81bc-10bc-4c75-ad9e-60f746ee148b") + @TelephonyBaseTest.tel_test_wrap + def test_sms_mo_mt_in_call_iwlan_5g_nsa(self): + """ Test MO SMS, Phone in APM, WiFi connected, WFC WiFi Preferred mode. + + Turn off APM always + Set PhoneA/B are operated at 5G NSA + Make sure PhoneA/B are operated at 5G NSA + Make sure PhoneA/B APM, WiFi connected, WFC WiFi preferred mode. + Make sure PhoneA/B report iwlan as data rat. + Make sure PhoneA/B is able to make/receive call/sms. + Call from PhoneA to PhoneB, accept on PhoneB. + Send SMS on PhoneA. + + Returns: + True if pass; False if fail. + """ + + ads = self.android_devices + + # Turn off airplane mode + self.log.info("Turn off APM mode before starting testing.") + tasks = [(toggle_airplane_mode, (self.log, ads[0], False)), + (toggle_airplane_mode, (self.log, ads[1], False))] + if not multithread_func(self.log, tasks): + self.log.error("Failed to turn off airplane mode") + return False + + # Mode Pref + tasks = [(set_preferred_mode_for_5g, [ad]) + for ad in self.android_devices] + if not multithread_func(self.log, tasks): + self.log.error("Failed to set preferred network mode.") + return False + + # Attach 5g + tasks = [(is_current_network_5g_nsa, [ad]) + for ad in self.android_devices] + if not multithread_func(self.log, tasks): + self.log.error("Phone not attached on 5G NSA before sending SMS.") + return False + + tasks = [(phone_setup_iwlan, + (self.log, ads[0], True, WFC_MODE_WIFI_PREFERRED, + self.wifi_network_ssid, self.wifi_network_pass)), + (phone_setup_iwlan, + (self.log, ads[1], True, WFC_MODE_WIFI_PREFERRED, + self.wifi_network_ssid, self.wifi_network_pass))] + if not multithread_func(self.log, tasks): + self.log.error("Phone Failed to Set Up Properly.") + return False + time.sleep(WAIT_TIME_ANDROID_STATE_SETTLING) + + self.log.info("Begin In Call SMS Test.") + if not call_setup_teardown( + self.log, + ads[0], + ads[1], + ad_hangup=None, + verify_caller_func=is_phone_in_call_iwlan, + verify_callee_func=None): + return False + + return self._sms_test_mo(ads) + + @test_tracker_info(uuid="36ce7bd8-f7b7-4c8e-a1a1-bcf8346a1b8e") + @TelephonyBaseTest.tel_test_wrap + def test_mms_mo_mt_in_call_iwlan_5g_nsa(self): + """ Test MO MMS, Phone in APM, WiFi connected, WFC WiFi Preferred mode. + + Turn off APM always + Set PhoneA/B are operated at 5G NSA + Make sure PhoneA/B are operated at 5G NSA + Make sure PhoneA/B APM, WiFi connected, WFC WiFi preferred mode. + Make sure PhoneA/B report iwlan as data rat. + Make sure PhoneA/B is able to make/receive call/sms. + Call from PhoneA to PhoneB, accept on PhoneB. + Send MMS on PhoneA. + + Returns: + True if pass; False if fail. + """ + + ads = self.android_devices + + # Turn off airplane mode + self.log.info("Turn off APM mode before starting testing.") + tasks = [(toggle_airplane_mode, (self.log, ads[0], False)), + (toggle_airplane_mode, (self.log, ads[1], False))] + if not multithread_func(self.log, tasks): + self.log.error("Failed to turn off airplane mode") + return False + + # Mode Pref + tasks = [(set_preferred_mode_for_5g, [ad]) + for ad in self.android_devices] + if not multithread_func(self.log, tasks): + self.log.error("Failed to set preferred network mode.") + return False + + # Attach 5g + tasks = [(is_current_network_5g_nsa, [ad]) + for ad in self.android_devices] + if not multithread_func(self.log, tasks): + self.log.error("Phone not attached on 5G NSA before sending MMS.") + return False + + tasks = [(phone_setup_iwlan, + (self.log, ads[0], True, WFC_MODE_WIFI_PREFERRED, + self.wifi_network_ssid, self.wifi_network_pass)), + (phone_setup_iwlan, + (self.log, ads[1], True, WFC_MODE_WIFI_PREFERRED, + self.wifi_network_ssid, self.wifi_network_pass))] + if not multithread_func(self.log, tasks): + self.log.error("Phone Failed to Set Up Properly.") + return False + time.sleep(WAIT_TIME_ANDROID_STATE_SETTLING) + + self.log.info("Begin In Call MMS Test.") + if not call_setup_teardown( + self.log, + ads[0], + ads[1], + ad_hangup=None, + verify_caller_func=is_phone_in_call_iwlan, + verify_callee_func=None): + return False + + return self._sms_test_mo(ads) + @test_tracker_info(uuid="e5a31b94-1cb6-4770-a2bc-5a0ddba51502") @TelephonyBaseTest.tel_test_wrap def test_sms_mo_in_call_iwlan(self): diff --git a/acts_tests/tests/google/tel/live/TelLiveVoiceTest.py b/acts_tests/tests/google/tel/live/TelLiveVoiceTest.py index 8c72b3f15f..f91f8cc87b 100644 --- a/acts_tests/tests/google/tel/live/TelLiveVoiceTest.py +++ b/acts_tests/tests/google/tel/live/TelLiveVoiceTest.py @@ -2587,6 +2587,146 @@ class TelLiveVoiceTest(TelephonyBaseTest): return True + @test_tracker_info(uuid="b5475061-30b4-4543-85c4-0ef2ecb2c0ef") + @TelephonyBaseTest.tel_test_wrap + def test_call_volte_mo_hold_unhold_5g_nsa(self): + """ VoLTE MO call hold/unhold test in 5G NSA network. + + 1. Attach PhoneA/B to 5G NSA. + 2. Make Sure PhoneA/B is in 5G NSA (with VoLTE). + 3. Make Sure PhoneA/B is able to make/receive call. + 4. Call from PhoneA to PhoneB, accept on PhoneB. + 5. Make sure PhoneA/B are in call. + 6. Hold and unhold on PhoneA. + 7. Make sure PhoneA/B are in 5G NSA. + + Returns: + True if pass; False if fail. + """ + ads = self.android_devices + + tasks = [(phone_setup_volte, (self.log, ads[0])), + (phone_setup_volte, (self.log, ads[1]))] + if not multithread_func(self.log, tasks): + self.log.error("Phone Failed to Set Up Properly.") + return False + + # Mode Pref + tasks = [(set_preferred_mode_for_5g, [ad]) + for ad in self.android_devices] + if not multithread_func(self.log, tasks): + self.log.error("Failed to set preferred network mode.") + return False + + # Attach 5g + tasks = [(is_current_network_5g_nsa, [ad]) + for ad in self.android_devices] + if not multithread_func(self.log, tasks): + self.log.error("Phone not attached on 5G NSA before call.") + return False + + ads[0].droid.telecomCallClearCallList() + if num_active_calls(self.log, ads[0]) != 0: + ads[0].log.error("Call List is not empty.") + return False + + self.log.info("Begin MO Call Hold/Unhold Test.") + if not call_setup_teardown( + self.log, + ads[0], + ads[1], + ad_hangup=None, + verify_caller_func=is_phone_in_call_volte, + verify_callee_func=None): + return False + + if not self._hold_unhold_test(ads): + self.log.error("Hold/Unhold test fail.") + return False + + if not hangup_call(self.log, ads[0]): + self.log.error("Call Hangup Failed") + return False + + # Check if phoneA are attached to 5g after Hold/Unhold test. + tasks = [(is_current_network_5g_nsa, [ad]) + for ad in self.android_devices] + if not multithread_func(self.log, tasks): + self.log.error("Phone not attached on 5G NSA after call.") + return False + + return True + + @test_tracker_info(uuid="ecbc7ea3-a591-4b81-930e-39598c7ee5b8") + @TelephonyBaseTest.tel_test_wrap + def test_call_volte_mt_hold_unhold_5g_nsa(self): + """ VoLTE MT call hold/unhold test in 5G NSA network. + + 1. Attach PhoneA/B to 5G NSA. + 2. Make Sure PhoneA/B is in 5G NSA (with VoLTE). + 3. Make Sure PhoneB/A is able to make/receive call. + 4. Call from PhoneB to PhoneA, accept on PhoneA. + 5. Make sure PhoneA/B are in call. + 6. Hold and unhold on PhoneA. + 7. Make sure PhoneA/B are in 5G NSA. + + Returns: + True if pass; False if fail. + """ + ads = self.android_devices + + tasks = [(phone_setup_volte, (self.log, ads[0])), + (phone_setup_volte, (self.log, ads[1]))] + if not multithread_func(self.log, tasks): + self.log.error("Phone Failed to Set Up Properly.") + return False + + # Mode Pref + tasks = [(set_preferred_mode_for_5g, [ad]) + for ad in self.android_devices] + if not multithread_func(self.log, tasks): + self.log.error("Failed to set preferred network mode.") + return False + + # Attach 5g + tasks = [(is_current_network_5g_nsa, [ad]) + for ad in self.android_devices] + if not multithread_func(self.log, tasks): + self.log.error("Phone not attached on 5G NSA before call.") + return False + + ads[0].droid.telecomCallClearCallList() + if num_active_calls(self.log, ads[0]) != 0: + ads[0].log.error("Call List is not empty.") + return False + + self.log.info("Begin MT Call Hold/Unhold Test.") + if not call_setup_teardown( + self.log, + ads[1], + ads[0], + ad_hangup=None, + verify_caller_func=None, + verify_callee_func=is_phone_in_call_volte): + return False + + if not self._hold_unhold_test(ads): + self.log.error("Hold/Unhold test fail.") + return False + + if not hangup_call(self.log, ads[0]): + self.log.error("Call Hangup Failed") + return False + + # Check if phoneA are attached to 5g after Hold/Unhold test. + tasks = [(is_current_network_5g_nsa, [ad]) + for ad in self.android_devices] + if not multithread_func(self.log, tasks): + self.log.error("Phone not attached on 5G NSA after call.") + return False + + return True + @test_tracker_info(uuid="ffe724ae-4223-4c15-9fed-9aba17de9a63") @TelephonyBaseTest.tel_test_wrap def test_call_wcdma_mo_hold_unhold(self): diff --git a/acts_tests/tests/google/tel/live/TelWifiVoiceTest.py b/acts_tests/tests/google/tel/live/TelWifiVoiceTest.py index b254f865bb..9d0e4c53fe 100644 --- a/acts_tests/tests/google/tel/live/TelWifiVoiceTest.py +++ b/acts_tests/tests/google/tel/live/TelWifiVoiceTest.py @@ -3248,6 +3248,45 @@ class TelWifiVoiceTest(TelephonyBaseTest): self._is_phone_in_call_iwlan, self._increase_lte_decrease_wifi_rssi_check_phone_hand_out, True) + def _decrease_then_increase_cellular_rssi_check_phone_hand_out(self): + """Private Test utility for hand_out test. + Step1 + Decrease Cellular RSSI to MIN_RSSI_RESERVED_VALUE 5db per sec + PhoneA should still be in call. PhoneA should hand-out to iWLAN. + Step2 + Increase Cellular RSSI to MAX_RSSI_RESERVED_VALUE + PhoneA should still be in call. PhoneA should hand-out to LTE. + """ + self._decrease_cellular_rssi_check_phone_hand_out() + self._increase_lte_decrease_wifi_rssi_check_phone_hand_out() + + return True + + @TelephonyBaseTest.tel_test_wrap + def test_lte_iwlan_lte_handoff_cellular_preferred(self): + """VoLET to VoWiFi then back to VoLTE In Call Handover Test + Step1 + VoLTE to VoWiFi in call handover + PhoneA on LTE, VoLTE enabled, WFC WiFi preferred, WiFi associated. + Cellular strong, WiFi signal strong. + Call from PhoneA to PhoneB, PhoneA should be on LTE. + Attenuate LTE + PhoneA should still be in call. PhoneA should handover to iWLAN. + + Step2 + PhoneA on LTE, VoLTE enabled, WFC Cellular preferred, WiFi associated. + Cellular absent, WiFi signal strong. + Call from PhoneA to PhoneB, PhoneA should be on iwlan. + Attenuate WiFi and Bring up LTE + PhoneA should still be in call. PhoneA should handover to LTE. + """ + return self._wfc_call_sequence( + [self.android_devices[0], self.android_devices[1]], + DIRECTION_MOBILE_ORIGINATED, self._wfc_set_wifi_strong_cell_strong, + self._wfc_phone_setup_cellular_preferred, self._phone_idle_volte, + self._is_phone_in_call_volte, + self._decrease_then_increase_cellular_rssi_check_phone_hand_out, True) + def _decrease_wifi_rssi_hand_out_and_increase_wifi_rssi_hand_in(self): if not self._decrease_wifi_rssi_check_phone_hand_out(): return False diff --git a/acts_tests/tests/google/usb/UsbTetheringFunctionsTest.py b/acts_tests/tests/google/usb/UsbTetheringFunctionsTest.py index e69de29bb2..3f0393ba01 100644 --- a/acts_tests/tests/google/usb/UsbTetheringFunctionsTest.py +++ b/acts_tests/tests/google/usb/UsbTetheringFunctionsTest.py @@ -0,0 +1,419 @@ +#!/usr/bin/env python3 +# +# Copyright 2019 - The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import re +import time +from queue import Empty + +from acts import utils +from acts import base_test +from acts.libs.proc import job +from acts import signals +from acts.test_decorators import test_tracker_info +from acts.test_utils.wifi import wifi_test_utils as wutils +from acts.test_utils.tel import tel_test_utils as tutils +from acts.test_utils.tel import tel_defines +from acts.test_utils.tel.anritsu_utils import wait_for_sms_sent_success +from acts.test_utils.tel.tel_defines import EventMmsSentSuccess + +# Time it takes for the usb tethering IP to +# show up in ifconfig and function waiting. +DEFAULT_SETTLE_TIME = 5 +WifiEnums = wutils.WifiEnums +USB_CHARGE_MODE = 'svc usb setFunctions' +USB_TETHERING_MODE = 'svc usb setFunctions rndis' +USB_MTP_MODE = 'svc usb setFunctions mtp' +DEVICE_IP_ADDRESS = 'ip address' + + +class UsbTetheringFunctionsTest(base_test.BaseTestClass): + """Tests for usb tethering throughput test. + + Test Bed Requirement: + * One Android device. + * Wi-Fi networks visible to the device. + * Sim card with data call. + """ + + def setup_class(self): + self.dut = self.android_devices[0] + req_params = ['wifi_network', 'receiver_number', 'ping_count'] + self.unpack_userparams(req_param_names=req_params) + + self.ssid_map = {} + for network in self.wifi_network: + SSID = network['SSID'].replace('-', '_') + self.ssid_map[SSID] = network + self.dut.droid.setMobileDataEnabled() + if not tutils.verify_internet_connection( + self.dut.log, self.dut, retries=3): + tutils.abort_all_tests(self.dut.log, 'Internet connection Failed.') + + def setup_test(self): + self.dut.droid.wakeLockAcquireBright() + self.dut.droid.wakeUpNow() + self.dut.unlock_screen() + + def teardown_test(self): + wutils.wifi_toggle_state(self.dut, False) + self.dut.droid.wakeLockRelease() + self.dut.droid.goToSleepNow() + self.dut.droid.setMobileDataEnabled() + self.dut.droid.connectivityStopTethering(tel_defines.TETHERING_WIFI) + self.dut.stop_services() + # Set usb function back to charge mode. + self.dut.adb.shell(USB_CHARGE_MODE) + self.dut.adb.wait_for_device() + self.dut.start_services() + + def teardown_class(self): + wutils.reset_wifi(self.dut) + + def on_fail(self, test_name, begin_time): + self.dut.take_bug_report(test_name, begin_time) + self.dut.cat_adb_log(test_name, begin_time) + + def enable_usb_tethering(self, attempts=3): + """Stop SL4A service and enable usb tethering. + + Logic steps are + 1. Stop SL4A service. + 2. Enable usb tethering. + 3. Restart SL4A service. + 4. Check usb tethering enabled. + 5. Attempt if fail to enable usb tethering. + + Args: + attempts: number of times for enable usb tethering. + + Raises: + TestFailure when unable to find rndis string. + """ + for i in range(attempts): + self.dut.stop_services() + self.dut.adb.shell(USB_TETHERING_MODE, ignore_status=True) + self.dut.adb.wait_for_device() + self.dut.start_services() + if 'rndis' in self.dut.adb.shell(DEVICE_IP_ADDRESS): + self.log.info('Usb tethering is enabled.') + return + else: + self.log.info('Enable usb tethering - attempt %d' % (i + 1)) + raise signals.TestFailure('Unable to enable USB tethering.') + + def connect_to_wifi_network(self, network): + """Connection logic for wifi network. + + Args: + network: Dictionary with network info. + """ + SSID = network[WifiEnums.SSID_KEY] + self.dut.ed.clear_all_events() + wutils.start_wifi_connection_scan(self.dut) + scan_results = self.dut.droid.wifiGetScanResults() + wutils.assert_network_in_list({WifiEnums.SSID_KEY: SSID}, scan_results) + wutils.wifi_connect(self.dut, network, num_of_tries=3) + + def enable_wifi_hotspot(self): + """Enable wifi hotspot.""" + sap_config = wutils.create_softap_config() + wutils.start_wifi_tethering(self.dut, + sap_config[wutils.WifiEnums.SSID_KEY], + sap_config[wutils.WifiEnums.PWD_KEY], + wutils.WifiEnums.WIFI_CONFIG_APBAND_2G) + + def get_rndis_interface(self): + """Check rndis interface after usb tethering enable. + + Returns: + Usb tethering interface from Android device. + + Raises: + TestFailure when unable to find correct usb tethering interface. + """ + time.sleep(DEFAULT_SETTLE_TIME) + check_usb_tethering = job.run('ifconfig').stdout + # A regex that stores the tethering interface in group 1. + tethered_interface_regex = r'^(enp.*?):.*?broadcast 192.168.42.255' + match = re.search(tethered_interface_regex, check_usb_tethering, + re.DOTALL + re.MULTILINE) + if match: + return match.group(1) + else: + raise signals.TestFailure( + 'Unable to find tethering interface. The device may not be tethered.' + ) + + def can_ping(self, ip, extra_params='', count=10): + """Run ping test and check and check ping lost rate. + + Args: + ip: ip address for ping. + extra_params: params for ping test. + count: default ping count. + + Returns: + True: If no packet loss. + False: Otherwise. + """ + out = job.run( + 'ping -c {} {} {}'.format(count, extra_params, ip), + ignore_status=True).stdout + self.log.info(out) + return '0%' in out.split(' ') + + def can_ping_through_usb_interface(self): + """Run ping test and check result after usb tethering enabled. + + Raises: + TestFailure when unable to ping through usb tethering interface. + """ + ip = '8.8.8.8' + interface = self.get_rndis_interface() + if not self.can_ping( + ip, '-I {}'.format(interface), count=self.ping_count): + raise signals.TestFailure( + 'Fail to ping through usb tethering interface.') + + def enable_usb_mtp(self): + """Enable usb mtp mode. + + Raises: + TestFailure when unable to set mtp mode. + """ + try: + self.dut.stop_services() + self.dut.adb.shell(USB_MTP_MODE, ignore_status=True) + self.dut.adb.wait_for_device() + self.dut.start_services() + except: + raise signals.TestFailure('Device can not enable mtp mode.') + + def check_sms_send_status(self, message='usb_sms_test'): + """Send a SMS and check send status. + + Args: + message: SMS string. + + Raises: + Exception when unable to send SMS. + """ + self.dut.droid.smsSendTextMessage(self.receiver_number, message, False) + self.log.info('Waiting for SMS sent event') + test_status = wait_for_sms_sent_success(self.log, self.dut) + if not test_status: + raise Exception('Failed to send SMS') + + def check_mms_send_status(self, + subject='usb_subject', + message='usb_mms_test'): + """Send a MMS and check send status. + + Args: + subject: MMS subject. + message: MMS string. + + Raises: + Exception when unable to send MMS. + """ + # Permission require for send MMS. + self.dut.adb.shell('su root setenforce 0') + self.dut.droid.smsSendMultimediaMessage(self.receiver_number, subject, + message) + self.log.info('Waiting for MMS sent event') + test_status = self.wait_for_mms_sent_success() + if not test_status: + raise Exception('Failed to send MMS') + + def wait_for_mms_sent_success(self, time_to_wait=60): + """Check MMS send status. + + Args: + time_to_wait: Time out for check MMS. + + Returns: + status = MMS send status. + """ + mms_sent_event = EventMmsSentSuccess + try: + event = self.dut.ed.pop_event(mms_sent_event, time_to_wait) + self.log.info(event) + except Empty: + self.log.error('Timeout: Expected event is not received.') + return False + return True + + @test_tracker_info(uuid="7c2ae85e-32a2-416e-a65e-c15a15e76f86") + def test_usb_tethering_wifi_only(self): + """Enable usb tethering with wifi only then executing ping test. + + Steps: + 1. Stop SL4A services. + 2. Enable usb tethering. + 3. Restart SL4A services. + 4. Mobile data disable and wifi enable. + 5. Run ping test through usb tethering interface. + """ + self.enable_usb_tethering() + self.log.info('Disable mobile data.') + self.dut.droid.setMobileDataEnabled(False) + self.log.info('Enable wifi.') + wutils.wifi_toggle_state(self.dut, True) + self.connect_to_wifi_network( + self.ssid_map[self.wifi_network[0]['SSID']]) + self.can_ping_through_usb_interface() + + @test_tracker_info(uuid="8910b07b-0beb-4d9d-b901-c4195b4e0930") + def test_usb_tethering_data_only(self): + """Enable usb tethering with data only then executing ping test. + + Steps: + 1. Stop SL4A services. + 2. Enable usb tethering. + 3. Restart SL4A services. + 4. Wifi disable and mobile data enable. + 5. Run ping test through usb tethering interface. + """ + self.enable_usb_tethering() + wutils.wifi_toggle_state(self.dut, False) + self.dut.droid.setMobileDataEnabled() + time.sleep(DEFAULT_SETTLE_TIME) + self.can_ping_through_usb_interface() + + @test_tracker_info(uuid="f971806e-e003-430a-bc80-321f128d31cb") + def test_usb_tethering_after_airplane_mode(self): + """Enable usb tethering after airplane mode then executing ping test. + + Steps: + 1. Stop SL4A services. + 2. Enable usb tethering. + 3. Restart SL4A services. + 4. Wifi disable and mobile data enable. + 5. Enable/disable airplane mode. + 6. Run ping test through usb tethering interface. + """ + self.enable_usb_tethering() + wutils.wifi_toggle_state(self.dut, False) + self.log.info('Enable airplane mode.') + utils.force_airplane_mode(self.dut, True) + self.log.info('Disable airplane mode.') + utils.force_airplane_mode(self.dut, False) + time.sleep(DEFAULT_SETTLE_TIME) + self.can_ping_through_usb_interface() + + @test_tracker_info(uuid="db1c561d-67bd-47d7-b65e-d882f0e2641e") + def test_usb_tethering_coexist_wifi_hotspot(self): + """Enable usb tethering with hotspot then executing ping test. + + Steps: + 1. Enable hotspot + 2. Stop SL4A services. + 3. Enable usb tethering. + 4. Restart SL4A services. + 5. Run ping test through tethering interface during hotspot enable. + 6. Run ping test through tethering interface during hotspot disable. + """ + self.log.info('Enable wifi hotspot.') + self.enable_wifi_hotspot() + self.enable_usb_tethering() + self.log.info('Ping test with hotspot enable.') + self.can_ping_through_usb_interface() + self.log.info('Disable wifi hotspot.') + self.dut.droid.connectivityStopTethering(tel_defines.TETHERING_WIFI) + self.log.info('Ping test with hotspot disable.') + self.can_ping_through_usb_interface() + + @test_tracker_info(uuid="7018abdb-049e-41aa-a4f9-e11012369d9b") + def test_usb_tethering_after_mtp(self): + """Enable usb tethering after mtp enable then executing ping test. + + Steps: + 1. Stop SL4A services. + 2. Enable usb tethering. + 3. Restart SL4A services. + 4. Enable usb mtp mode. + 5. Enable usb tethering and mtp will disable. + 6. Run ping test through usb tethering interface. + """ + self.enable_usb_tethering() + self.log.info('Enable usb mtp mode.') + self.enable_usb_mtp() + # Turn on mtp mode for 5 sec. + time.sleep(DEFAULT_SETTLE_TIME) + self.enable_usb_tethering() + self.log.info('Usb tethering enable, usb mtp mode disabled.') + self.can_ping_through_usb_interface() + + @test_tracker_info(uuid="f1ba2cbc-1cb2-4b8a-92eb-9b366c3f4c37") + def test_usb_tethering_after_sms_mms(self): + """Enable usb tethering after send sms and mms then executing ping test. + + Steps: + 1. Stop SL4A services. + 2. Enable usb tethering. + 3. Restart SL4A services. + 4. Send a sms and mms. + 5. Run ping test through usb tethering interface. + """ + self.enable_usb_tethering() + self.log.info('Start send SMS and check status.') + self.check_sms_send_status() + time.sleep(DEFAULT_SETTLE_TIME) + self.log.info('Start send MMS and check status.') + self.check_mms_send_status() + self.can_ping_through_usb_interface() + + @test_tracker_info(uuid="e6586b30-4886-4c3e-8225-633aa9333968") + def test_usb_tethering_after_reboot(self): + """Enable usb tethering after reboot then executing ping test. + + Steps: + 1. Reboot device. + 2. Stop SL4A services. + 3. Enable usb tethering. + 4. Restart SL4A services. + 5. Run ping test through usb tethering interface. + """ + self.enable_usb_tethering() + self.log.info('Reboot device.') + self.dut.reboot() + self.dut.droid.setMobileDataEnabled() + self.log.info('Start usb tethering and ping test.') + self.enable_usb_tethering() + self.can_ping_through_usb_interface() + + @test_tracker_info(uuid="40093ab8-6db4-4af4-97ae-9467bf33bf23") + def test_usb_tethering_after_wipe(self): + """Enable usb tethering after wipe. + + Steps: + 1. Enable usb tethering. + 2. Wipe device. + 3. Wake up device and unlock screen. + 4. Enable usb tethering. + 5. Run ping test through usb tethering interface. + """ + self.enable_usb_tethering() + tutils.fastboot_wipe(self.dut) + time.sleep(DEFAULT_SETTLE_TIME) + # Skip setup wizard after wipe. + self.dut.adb.shell( + 'am start -a com.android.setupwizard.EXIT', ignore_status=True) + self.dut.droid.setMobileDataEnabled() + self.dut.droid.wakeUpNow() + self.dut.unlock_screen() + self.enable_usb_tethering() + self.can_ping_through_usb_interface()
\ No newline at end of file diff --git a/acts_tests/tests/google/usb/UsbTetheringThroughputTest.py b/acts_tests/tests/google/usb/UsbTetheringThroughputTest.py index e69de29bb2..ebe13b8529 100644 --- a/acts_tests/tests/google/usb/UsbTetheringThroughputTest.py +++ b/acts_tests/tests/google/usb/UsbTetheringThroughputTest.py @@ -0,0 +1,292 @@ +#!/usr/bin/env python3 +# +# Copyright 2019 - The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import re +import time + +from acts import base_test +from acts.libs.proc import job +from acts import signals +from acts.test_decorators import test_tracker_info + +# Time it takes for the usb tethering IP to show up in ifconfig. +IFCONFIG_SETTLE_TIME = 5 +USB_CHARGE_MODE = 'svc usb setFunctions' +USB_TETHERING_MODE = 'svc usb setFunctions rndis' +DEVICE_IP_ADDRESS = 'ip address' + + +class UsbTetheringThroughputTest(base_test.BaseTestClass): + """Tests for usb tethering throughput test. + + Test Bed Requirement: + * One Android device. + * Sim card with data call. + """ + + def setup_class(self): + """ Setup devices for usb tethering """ + self.dut = self.android_devices[0] + self.ip_server = self.iperf_servers[0] + self.port_num = self.ip_server.port + req_params = [ + 'iperf_usb_3_criteria', 'iperf_usb_2_criteria', 'controller_path', + 'iperf_test_sec' + ] + self.unpack_userparams(req_param_names=req_params) + if self.dut.model in self.user_params.get('legacy_projects', []): + self.usb_controller_path = self.user_params[ + 'legacy_controller_path'] + else: + self.usb_controller_path = self.controller_path + + def setup_test(self): + self.dut.adb.wait_for_device() + self.dut.droid.wakeLockAcquireBright() + self.dut.droid.wakeUpNow() + self.dut.unlock_screen() + + def teardown_test(self): + self.dut.droid.wakeLockRelease() + self.dut.droid.goToSleepNow() + # Reboot device to avoid the side effect that cause adb missing after echo usb speed. + self.dut.reboot() + + def on_fail(self, test_name, begin_time): + self.dut.take_bug_report(test_name, begin_time) + self.dut.cat_adb_log(test_name, begin_time) + + def enable_usb_tethering(self): + """Stop SL4A service and enable usb tethering. + + Logic steps are + 1. Stop SL4A service. + 2. Enable usb tethering. + 3. Restart SL4A service. + 4. Check usb tethering enabled. + + Raises: + Signals.TestFailure is raised by not find rndis string. + """ + self.dut.stop_services() + self.dut.adb.shell(USB_TETHERING_MODE, ignore_status=True) + self.dut.adb.wait_for_device() + self.dut.start_services() + if 'rndis' not in self.dut.adb.shell(DEVICE_IP_ADDRESS): + raise signals.TestFailure('Unable to enable USB tethering.') + + def get_pc_tethering_ip(self): + """Check usb tethering IP from PC. + + Returns: + Usb tethering IP from PC. + + Raises: + Signals.TestFailure is raised by not find usb tethering IP. + """ + time.sleep(IFCONFIG_SETTLE_TIME) + check_usb_tethering = job.run('ifconfig').stdout + matches = re.findall('inet (\d+.\d+.42.\d+)', check_usb_tethering) + if not matches: + raise signals.TestFailure( + 'Unable to find tethering IP. The device may not be tethered.') + else: + return matches[0] + + def get_dut_tethering_ip(self): + """Check usb tethering IP from Android device. + + Returns: + Usb tethering IP from Android device. + + Raises: + Signals.TestFailure is raised by not find usb tethering IP. + """ + time.sleep(IFCONFIG_SETTLE_TIME) + check_usb_tethering = self.dut.adb.shell('ifconfig') + matches = re.findall('addr:(\d+.\d+.42.\d+)', check_usb_tethering) + if not matches: + raise signals.TestFailure( + 'Unable to find tethering IP. The device may not be tethered.') + else: + return matches[0] + + def pc_can_ping(self, count=3): + """Run ping traffic from PC side. + + Logic steps are + 1. PC ping the usb server ip. + 2. Check the packet loss rate. + + Args: + count : count for ping test. + + Returns: + True: If no packet loss. + False: Otherwise. + """ + ip = self.get_dut_tethering_ip() + ping = job.run( + 'ping -c {} {}'.format(count, ip), ignore_status=True).stdout + self.log.info(ping) + return '0% packet loss' in ping + + def dut_can_ping(self, count=3): + """Run ping traffic from Android device side. + + Logic steps are + 1. Android device ping the 8.8.8.8. + 2. Check the packet loss rate. + + Args: + count : count for ping test. + + Returns: + True: If no packet loss. + False: Otherwise. + """ + ip = '8.8.8.8' + ping = self.dut.adb.shell( + 'ping -c {} {}'.format(count, ip), ignore_status=True) + self.log.info(ping) + return '0% packet loss' in ping + + def run_iperf_client(self, dut_ip, extra_params=''): + """Run iperf client command after iperf server enabled. + + Args: + dut_ip: string which contains the ip address. + extra_params: params to be added to the iperf client. + + Returns: + Success: True if the iperf execute. False otherwise. + Rate: throughput data. + """ + self.log.info('Run iperf process.') + cmd = "iperf3 -c {} {} -p {}".format(dut_ip, extra_params, + self.port_num) + self.log.info(cmd) + try: + result = self.dut.adb.shell(cmd, ignore_status=True) + self.log.info(result) + except: + self.log.error('Fail to execute iperf client.') + return False, 0 + rate = re.findall('(\d+.\d+) (.)bits/sec.*receiver', result) + return True, rate[0][0], rate[0][1] + + def run_iperf_tx_rx(self, usb_speed, criteria): + """Run iperf tx and rx. + + Args: + usb_speed: string which contains the speed info. + criteria: usb performance criteria. + + Raises: + Signals.TestFailure is raised by usb tethering under criteria. + """ + self.enable_usb_tethering() + self.dut.adb.wait_for_device() + self.ip_server.start() + pc_ip = self.get_pc_tethering_ip() + tx_success, tx_rate, tx_unit = self.run_iperf_client( + pc_ip, '-t{} -i1 -w2M'.format(self.iperf_test_sec)) + rx_success, rx_rate, rx_unit = self.run_iperf_client( + pc_ip, '-t{} -i1 -w2M -R'.format(self.iperf_test_sec)) + self.log.info('TestResult iperf_{}_rx'.format(usb_speed) + rx_rate + + ' ' + rx_unit + 'bits/sec') + self.log.info('TestResult iperf_{}_tx'.format(usb_speed) + tx_rate + + ' ' + tx_unit + 'bits/sec') + self.ip_server.stop() + if not tx_success or (float(tx_rate) < criteria and tx_unit != "G"): + raise signals.TestFailure('Iperf {}_tx test is {} {}bits/sec, ' + 'the throughput result failed.'.format( + usb_speed, tx_rate, tx_unit)) + if not rx_success or (float(rx_rate) < criteria and rx_unit != "G"): + raise signals.TestFailure('Iperf {}_rx test is {} {}bits/sec, ' + 'the throughput result failed.'.format( + usb_speed, rx_rate, rx_unit)) + + def get_usb_speed(self): + """Get current usb speed.""" + usb_controller_address = self.dut.adb.shell( + 'getprop sys.usb.controller', ignore_status=True) + usb_speed = self.dut.adb.shell( + 'cat sys/class/udc/{}/current_speed'.format( + usb_controller_address)) + return usb_speed, usb_controller_address + + @test_tracker_info(uuid="e7e0dfdc-3d1c-4642-a468-27326c49e4cb") + def test_tethering_ping(self): + """Enable usb tethering then executing ping test. + + Steps: + 1. Stop SL4A service. + 2. Enable usb tethering. + 3. Restart SL4A service. + 4. Execute ping test from PC and Android Device. + 5. Check the ping lost rate. + """ + self.enable_usb_tethering() + if self.pc_can_ping() and self.dut_can_ping(): + raise signals.TestPass( + 'Ping test is passed. Network is reachable.') + raise signals.TestFailure( + 'Ping test failed. Maybe network is unreachable.') + + @test_tracker_info(uuid="8263c880-8a7e-4a68-b47f-e7caba3e9968") + def test_usb_tethering_iperf_super_speed(self): + """Enable usb tethering then executing iperf test. + + Steps: + 1. Stop SL4A service. + 2. Enable usb tethering. + 3. Restart SL4A service. + 4. Skip test if device not support super-speed. + 5. Execute iperf test for usb tethering and get the throughput result. + 6. Check the iperf throughput result. + """ + if (self.get_usb_speed()[0] != 'super-speed'): + raise signals.TestSkip( + 'USB 3 not available for the device, skip super-speed performance test.' + ) + self.run_iperf_tx_rx('usb_3', self.iperf_usb_3_criteria) + + @test_tracker_info(uuid="5d8a22fd-1f9b-4758-a6b4-855d134b348a") + def test_usb_tethering_iperf_high_speed(self): + """Enable usb tethering then executing iperf test. + + Steps: + 1. Stop SL4A service. + 2. Enable usb tethering. + 3. Restart SL4A service. + 4. Force set usb speed to high-speed if default is super-speed. + 5. Execute iperf test for usb tethering and get the throughput result. + 6. Check the iperf throughput result. + """ + if (self.get_usb_speed()[0] != 'high-speed'): + self.log.info( + 'Default usb speed is USB 3,Force set usb to high-speed.') + self.dut.stop_services() + self.dut.adb.wait_for_device() + self.dut.adb.shell( + 'echo high > {}{}.ssusb/speed'.format( + self.usb_controller_path, + self.get_usb_speed()[1].strip('.dwc3')), + ignore_status=True) + self.dut.adb.wait_for_device() + self.dut.start_services() + self.run_iperf_tx_rx('usb_2', self.iperf_usb_2_criteria) diff --git a/acts/tests/google/wifi/p2p/functional/WifiP2pMultiPeersTest.py b/acts_tests/tests/google/wifi/p2p/functional/WifiP2pMultiPeersTest.py index 2951be6355..2951be6355 100644 --- a/acts/tests/google/wifi/p2p/functional/WifiP2pMultiPeersTest.py +++ b/acts_tests/tests/google/wifi/p2p/functional/WifiP2pMultiPeersTest.py |