def RequestAuthorization(self, device): if (self.cb_notify_on_authorize): if (not self.cb_notify_on_request_authorization( BTAgent.NOTIFY_ON_REQUEST_AUTHORIZATION, # noqa device)): raise BTRejectedException('Connection not authorized by user') elif (not self.auto_authorize_connections): raise BTRejectedException('Auto authorize is off')
def Authorize(self, device, uuid): if (self.cb_notify_on_authorize): if (not self.cb_notify_on_authorize(BTAgent.NOTIFY_ON_AUTHORIZE, device, uuid)): raise BTRejectedException('Connection not authorized by user') elif (not self.auto_authorize_connections): raise BTRejectedException('Auto authorize is off')
def RequestPinCode(self, device): if (self.cb_notify_on_request_pin_code): pin_code = self.cb_notify_on_request_pin_code(BTAgent.NOTIFY_ON_REQUEST_PIN_CODE, # noqa device) if (pin_code is None): raise BTRejectedException('User did not provide PIN code') elif (self.default_pin_code is None): raise BTRejectedException('No default PIN code set') else: pin_code = self.default_pin_code return dbus.String(pin_code)
def RequestPasskey(self, device): if (self.cb_notify_on_request_pass_key): pass_key = self.cb_notify_on_request_pass_key(BTAgent.NOTIFY_ON_REQUEST_PASS_KEY, # noqa device) if (pass_key is None): raise BTRejectedException('User did not provide pass key') elif (self.default_pass_key is None): raise BTRejectedException('No default pass key set') else: pass_key = self.default_pass_key return dbus.UInt32(pass_key)
def RequestConfirmation(self, device, pass_key): if (self.cb_notify_on_request_confirmation): if (not self.cb_notify_on_request_confirmation( BTAgent.NOTIFY_ON_REQUEST_CONFIRMATION, # noqa device, pass_key)): raise \ BTRejectedException('User confirmation of pass key negative') # noqa
def ConfirmModeChange(self, mode): if (self.cb_notify_on_confirm_mode_change): if (not self.cb_notify_on_confirm_mode_change(BTAgent.NOTIFY_ON_CONFIRM_MODE_CHANGE, # noqa mode)): raise \ BTRejectedException('User mode change confirmation negative') # noqa