Device Coordinator

class octopus_sensing.device_coordinator.DeviceCoordinator[source]

Bases: object

Device coordinator is responsible for coordination, like start recording data from all devices at once, stop recording, triggering (marking data at point), and terminating devices. When a device is added to the device coordinator, it will be initialized and prepared for data recording.

get_devices() List[octopus_sensing.devices.device.Device][source]

Return a list of added devices

Returns

List of device objects

Return type

List[Device]

add_device(device: octopus_sensing.devices.device.Device) None[source]

Adds new device to the coordinator and starts it

Parameters

device (Device) – a device object

Example

>>> my_shimmer = Shimmer3Streaming(name="Shimmer3_sensor", output_path="./output")
>>> device_coordinator.add_device(my_shimmer)

See also

add_devices

Adds a list of new devices to the coordinator and starts them

add_devices(devices: List[octopus_sensing.devices.device.Device]) None[source]

Adds a list of new devices to the coordinator and starts them

Parameters

devices (List[Device]) – a list of device objects

Example

>>> my_shimmer = Shimmer3Streaming(name="Shimmer3_sensor",
                                   output_path="./output")
>>> device_coordinator.add_devices([my_shimmer])

See also

add_device

Adds new device to the coordinator and starts it

dispatch(message: octopus_sensing.common.message.Message) None[source]

dispatches a new message to all devices

Parameters

message (Message) – a message object

Example

>>> device_coordinator.dispatch(start_message(experiment_id,
                                              stimuli_id))
terminate()[source]

sends terminate message to all devices and terminate all processes

Example

>>> device_coordinator.terminate()