Task

class hive.implementation.task.Task(call_action, triggers)

Bases: QObject

Base 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

Use

fklab.hive.registry.CallAction.get_action to call an call_action with the call_action object.

Attributes Summary

count

Count the score.

log

display log in the view + log file.

max_trial

Manage the maximal number of successive trials.

running

Give the state of the automatic mode.

score

update the score - True = success or False = Fail

sequence

List every successful sequence.

time_out

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

count

Count the score.

dictionary with two keys : success, fail

Type

dict of int

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

str

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

int

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

bool

score

update the score - True = success or False = Fail

score.emit(False)
Type

bool

sequence

List every successful sequence.

sequence =[[start,stop],[start,stop]]

The list of all used devices is also updated each time.

Type

list of list of 2

Type

obj`int`

time_out

Manage the time where successive events in the same zone are ignored.

Type

int

Methods Documentation

filter_event(event_type, event_data)

filter the incoming event.

event type

there are common used event types/groups in hive.

  1. detection DEVICE

    detection event from trigger like the keyboard or tracking

  2. 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