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()