Listen_event not trigger

Hi, I am trying to use the listen_event to get the camera capabilities when the app connect to the drone. however, the listener is never trigger. below is my code snippet, could you help to take a look? thanks!!

import time
import os
import olympe
from olympe.messages import camera

olympe.log.update_config({"loggers": {"olympe": {"level": "INFO"}}})
DRONE_IP = os.environ.get("DRONE_IP", "192.168.53.1")

def print_event(event):
    if isinstance(event, olympe.ArsdkMessageEvent):
        max_args_size = 60
        args = str(event.args)
        args = (args[: max_args_size - 3] + "...") if len(args) > max_args_size else args
        print(f"{event.message.fullName}({args})")
    else:
        print(str(event))


class CameraCapabilitiesListener(olympe.EventListener):
    @olympe.listen_event(camera.camera_capabilities())
    def onCameraCapabilities(self, event, scheduler):
        print_event(event)

def test_listener():
    drone = olympe.Drone(DRONE_IP)
    

    with CameraCapabilitiesListener(drone) as listener:
        drone.connect()
        time.sleep(100)

if __name__ == "__main__":
    test_listener()

Hi,

Only event messages may be monitored with a listener. The camera.capabilities message you are using here is part of the camera2.Event.State event message that you should be using instead.

Thank you for your reply. Do you mean I should use camera2.Event.State instead? however, we are using anafi and anafi thermal, does camera2 feature also support these two models?

This topic was automatically closed after 30 days. New replies are no longer allowed.