.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/1_integrating_a_device.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_1_integrating_a_device.py: Integrating a device in your own software. ========================================== This example... .. GENERATED FROM PYTHON SOURCE LINES 7-73 .. code-block:: Python from __future__ import annotations from typing import TYPE_CHECKING from PySide6.QtWidgets import QApplication, QMainWindow import sys from biosignal_device_interface.devices import ( OTBQuattrocentoLightWidget, ) if TYPE_CHECKING: import numpy as np class MainWindow(QMainWindow): def __init__(self): super().__init__() # Set the title of the main window self.setWindowTitle("Main Window with One Device") # Instantiate the QuattrocentoLightWidget muovi_widget = OTBQuattrocentoLightWidget(self) # Connect the signals of the widget to the main window muovi_widget.data_arrived.connect(self._update) muovi_widget.biosignal_data_arrived.connect(self._emg_update) muovi_widget.auxiliary_data_arrived.connect(self._aux_update) muovi_widget.connect_toggled.connect(self._device_connection_state) muovi_widget.configure_toggled.connect(self._device_configuration_state) muovi_widget.stream_toggled.connect(self._device_stream_state) # Set the central widget of the main window self.setCentralWidget(muovi_widget) def _update(self, data: np.ndarray): print("Incoming data frome device:", data.shape) def _emg_update(self, data: np.ndarray): print("Incoming emg data from device:", data.shape) def _aux_update(self, data: np.ndarray): print("Incoming auxiliary data from device:", data.shape) def _device_connection_state(self, is_connected: bool): print("Connection state:", is_connected) def _device_configuration_state(self, is_configured: bool): print("Configuration state:", is_configured) def _device_stream_state(self, is_streaming: bool): print("Streaming state:", is_streaming) if __name__ == "__main__": # Create the application object app = QApplication(sys.argv) # Create an instance of the main window window = MainWindow() # Show the main window window.show() # Execute the application sys.exit(app.exec()) **Estimated memory usage:** 0 MB .. _sphx_glr_download_auto_examples_1_integrating_a_device.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 1_integrating_a_device.ipynb <1_integrating_a_device.ipynb>` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 1_integrating_a_device.py <1_integrating_a_device.py>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_