def run(self, context): """ This test step will fail if at any point an error occurred and the advertising could not be started or the server was not created properly :param context: :return: """ advertise_mode = BleBase.check_advertise_mode_valid( self, self._pars.advertise_mode) tx_power_level = BleBase.check_tx_power_level_valid( self, self._pars.tx_power_level) gatt_server_type = BleBase.check_gatt_server_type( self, self._pars.gatt_server_type) BleBase.run(self, context) if (advertise_mode is not False) and (tx_power_level is not False) and (gatt_server_type is not False): output = self._api.ble_gatt_advertise_server( tx_power_level, advertise_mode, self._pars.advertise_timeout, gatt_server_type) self._logger.debug(output) else: msg = "You have not provided a valid code for ADVERTISE_MODE and/or TX_POWER_LEVEL and/or GATT_SERVER_TYPE" \ " advertiseMode: %s tx_power_level: %s gatt_server_type: %s" % \ (str(advertise_mode), str(tx_power_level), str(gatt_server_type)) self._logger.error(msg) raise DeviceException(DeviceException.OPERATION_FAILED, msg)
def run(self, context): """ This test step will fail if at any point an error occurred and the advertising could not be started or the server was not created properly :param context: :return: """ gatt_server_type = BleBase.check_gatt_server_type( self, self._pars.gatt_server_type) BleBase.run(self, context) if gatt_server_type is not False: output = self._api.ble_gatt_start_server(gatt_server_type) self._logger.debug(output) else: msg = "You have not provided a valid code for GATT_SERVER_TYPE" \ " gatt_server_type: %s" % str(gatt_server_type) self._logger.error(msg) raise DeviceException(DeviceException.OPERATION_FAILED, msg)