toio.cube.notification_handler_info module

class toio.cube.notification_handler_info.NotificationHandlerInfo(func: Callable[[bytearray], None] | Callable[[bytearray], Awaitable[None]] | Callable[[bytearray, Any], None] | Callable[[bytearray, Any], Awaitable[None]], device: Any, interface: CubeInterface, misc: Any = None)[source]

Bases: object

Information of registered notification handler function.

NotificationHandlerInfo includes several type of information:
  • Unique data given at registration (misc)

  • Information about the device that received the notification (device, interface)

  • Information used for internal use (rest of properties)

__init__(func: Callable[[bytearray], None] | Callable[[bytearray], Awaitable[None]] | Callable[[bytearray, Any], None] | Callable[[bytearray, Any], Awaitable[None]], device: Any, interface: CubeInterface, misc: Any = None)[source]

__init__.

Parameters:
  • func (NotificationHandlerTypes) – notification handler function

  • device (NotificationReceivedDevice) – device to be notified

  • interface (CubeInterface) – interface of device

  • misc (Any) – user data

property misc: Any

User data given when the notification handler function is registered.

property device: Any

The device that received the notification.

property interface: CubeInterface

The interface of the device that received the notification. (equal to device.interface)

property is_async: bool

Whether the notification handler function is async or sync. (for internal use)

property num_of_args: int

Number of arguments received by the registered notification handler function. (for internal use)

get_notified_cube() ToioCoreCube[source]

Return self.device as ToioCoreCube