def update(self, action: Action): Logger.info("Update in RoundController with action {action}".format(action=action)) if action is Action.EMPTY: with Storage.update('game') as game: round_ = RoundHelper.get_ready(game) round_.state = RoundState.IN_PROGRESS round_.start_time = time.time() # Start round self.start_clock() self.render_new() return if action is Action.SKIP: with Storage.update('game') as game: val = self.view.ids.val.val identifier = self.view.ids.identifier.val word_name = self.view.ids.word.text round_ = RoundHelper.get_active_round(game) round_.items.append( { "identifier": identifier, "word": word_name, "val": val, "val_received": 0 } ) self.render_new(list(map(lambda item: item['identifier'], round_.items))) return if action is Action.ACCEPT: with Storage.update('game') as game: val = self.view.ids.val.val identifier = self.view.ids.identifier.val word_name = self.view.ids.word.text round_ = RoundHelper.get_active_round(game) round_.items.append( { "identifier": identifier, "word": word_name, "val": val, "val_received": val } ) self.render_new(list(map(lambda item: item['identifier'], round_.items))) return Logger.error( "Action {action} is not implemented in controller {controller}" .format(action=action, controller=self) ) raise NotImplemented
def peripheral_adv(self, error=None): if error: Logger.error('Peripheral: advertisement failed: {}'.format(error)) else: Logger.info('Peripheral: advertising started') self.advertising = ble_peripheral.is_advertising
def peripheral_service_error(self, service, error): Logger.error('Peripheral: service error: {}: {}'.format(error, service))