Task¶
- class hive.implementation.task.Task(call_action, triggers)¶
Bases:
QObjectBase class for automatic mode inherited from the listenCommunication class taking care of receiving event from the maze.
- Parameters
call_action (
fklab.hive.registry.CallAction) – Registry class with all call_action methods listed no matter their categories (servor, arduino… etc.)triggers (
Trigger) – Any class derive from Trigger. It emits the peira_event signal through peira_event (pyqtsignal) and will trigger the process_detection method.
See also
Usefklab.hive.registry.CallAction.get_action to call an call_action with the call_action object.
Attributes Summary
Count the score.
display log in the view + log file.
Manage the maximal number of successive trials.
Give the state of the automatic mode.
update the score - True = success or False = Fail
List every successful sequence.
Manage the time where successive events in the same zone are ignored.
Methods Summary
filter_event(event_type, event_data)filter the incoming event.
process_command(command)Process the detect keyboard event.
process_detection(device_id)process_event(event)process_low_battery(element_id, percentage)process_user_event(command)setup(config)setup this Task from config.
setup_devices(hardware, element_id)trigger_command(action[, target])trigger a user defined command.
Attributes Documentation
- log¶
display log in the view + log file.
string is send to the view with the emit function.
log.emit("this sentence will be display in the app")
- Type
- max_trial¶
Manage the maximal number of successive trials.
Automatically turn off the auto mode when this number is reach.
Note
To enable the feature, set the parameter to “inf” (it will be transformed as None in the setter).
- Type
- running¶
Give the state of the automatic mode.
In this task, we only have the manual mode and no automatic mode. It stay set to None to enable this mode.
- Type
- sequence¶
List every successful sequence.
sequence =[[start,stop],[start,stop]]
The list of all used devices is also updated each time.
Methods Documentation
- filter_event(event_type, event_data)¶
filter the incoming event.
event type
there are common used event types/groups in hive.
detection DEVICE
detection event from trigger like the keyboard or tracking
battery level DEVICE,LEVEL
device battery level callback event
- Parameters
event_type – event type or group
event_data – event data
- process_command(command)¶
Process the detect keyboard event.
- process_detection(device_id)¶
- process_event(event)¶
- process_low_battery(element_id, percentage)¶
- process_user_event(command)¶
- setup(config)¶
setup this Task from config.
- Parameters
config – section of Task.options in config file
- setup_devices(hardware, element_id)¶
- trigger_command(action, target=None, *options)¶
trigger a user defined command.
- Parameters
action (str) – action/command name which is defined at Command part of the config file.
target (str or list of str, optional) – a device ID or a list of device IDs of output targets. The device ID could be virtual device ID which are defined at Hardware part of the config file.
options (any) – action options