Skip to content

Commit

Permalink
[INTEGRATION] prepare 7.7.0-rc3 release
Browse files Browse the repository at this point in the history
  • Loading branch information
ndessart committed Jun 23, 2023
1 parent 114ddd6 commit 9d9bcc2
Show file tree
Hide file tree
Showing 6 changed files with 280 additions and 133 deletions.
24 changes: 17 additions & 7 deletions src/olympe/arsdkng/cmd_itf.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,13 @@
from olympe.messages import connectivity
from olympe.messages import common
from olympe.messages import developer
from olympe.messages import devicemanager
from olympe.messages import drone_manager
from olympe.messages import microhard
from olympe.messages import mission
from olympe.messages import network
from olympe.messages import pointnfly
from olympe.messages import privacy
from olympe.messages import sleepmode
from olympe.scheduler import AbstractScheduler, Scheduler
from collections import OrderedDict
from olympe.utils import py_object_cast, callback_decorator, DEFAULT_FLOAT_TOL
Expand Down Expand Up @@ -461,20 +462,29 @@ def _on_connection_state_changed(self, message_event, _):
all_states_settings_commands = [
common.Common.AllStates,
common.Settings.AllSettings,
]
for all_states_settings_command in all_states_settings_commands:
self._send_command_raw(all_states_settings_command, dict())

# Enable airsdk mission support from the drone
self._send_command_raw(mission.custom_msg_enable, dict())
self._send_command_raw(developer.Command.GetState, dict())

get_state_commands = [
antiflicker.Command.GetState,
camera2.Command.GetState,
connectivity.Command.GetState,
developer.Command.GetState,
devicemanager.Command.GetState,
microhard.Command.GetState,
network.Command.GetState,
pointnfly.Command.GetState,
privacy.Command.GetState,
sleepmode.Command.GetState,
]
for all_states_settings_command in all_states_settings_commands:
self._send_command_raw(all_states_settings_command, dict())

# Enable airsdk mission support from the drone
self._send_command_raw(mission.custom_msg_enable, dict())
for get_state_command in get_state_commands:
self._send_command_raw(
get_state_command, dict(include_default_capabilities=True)
)

@callback_decorator()
def _dispose_cmd_cb(self, _interface, _user_data):
Expand Down
40 changes: 26 additions & 14 deletions src/olympe/arsdkng/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
from olympe.messages import pointnfly
from olympe.messages import privacy
from olympe.messages import skyctrl
from olympe.messages import sleepmode
from olympe.video.pdraw import (PDRAW_LOCAL_STREAM_PORT, PDRAW_LOCAL_CONTROL_PORT)
from tzlocal import get_localzone
from warnings import warn
Expand Down Expand Up @@ -601,23 +600,22 @@ async def _on_connected(self):
not self._ip_addr_str.startswith("127.0")):
self._synchronize_clock()
# We're connected to the device, get all device states and settings if necessary
get_state_commands = []
if not self._is_skyctrl:
all_states_settings_commands = [
common.Common.AllStates(), common.Settings.AllSettings()
]
if self._device_type != od.ARSDK_DEVICE_TYPE_ANAFI4K:
all_states_settings_commands.extend(
[
antiflicker.Command.GetState(),
camera2.Command.GetState(),
connectivity.Command.GetState(),
developer.Command.GetState(),
network.Command.GetState(),
pointnfly.Command.GetState(),
privacy.Command.GetState(),
sleepmode.Command.GetState(),
mission.custom_msg_enable()]
)
get_state_commands = [
antiflicker.Command.GetState(include_default_capabilities=True),
camera2.Command.GetState(include_default_capabilities=True),
connectivity.Command.GetState(include_default_capabilities=True),
developer.Command.GetState(),
network.Command.GetState(include_default_capabilities=True),
pointnfly.Command.GetState(include_default_capabilities=True),
privacy.Command.GetState(include_default_capabilities=True),
mission.custom_msg_enable()
]
else:
all_states_settings_commands = [
skyctrl.Common.AllStates(),
Expand All @@ -631,7 +629,7 @@ async def _on_connected(self):
od.ARSDK_DEVICE_TYPE_SKYCTRL_3,
od.ARSDK_DEVICE_TYPE_SKYCTRL_UA,
]:
all_states_settings_commands.append(controllerNetwork.Command.GetState())
get_state_commands = [controllerNetwork.Command.GetState()]
# Get device specific states and settings
for states_settings_command in all_states_settings_commands:
timeout = self._connection_deadline - time.time()
Expand All @@ -645,6 +643,20 @@ async def _on_connected(self):
if not res:
return False

# Get specific optional states
for state_command in get_state_commands:
timeout = self._connection_deadline - time.time()
try:
res = await self._thread_loop.await_for(
timeout,
self._send_states_settings_cmd, state_command
)
except FutureTimeoutError:
# Protobuf Command.GetState are optional
return True
if not res:
return False

# Process the ConnectedEvent
event = ConnectedEvent()
self.logger.info(str(event))
Expand Down
8 changes: 6 additions & 2 deletions src/olympe/arsdkng/expectations.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,8 +504,10 @@ def _schedule(self, scheduler):
self._command_future = controller._send_command_raw(
self.command_message, self.command_args
)
super()._schedule(scheduler)
self._command_future.add_done_callback(lambda _: self.check(None))
super()._schedule(scheduler)
else:
super()._schedule(scheduler)

def no_expect(self, value):
self._no_expect = value
Expand Down Expand Up @@ -615,10 +617,12 @@ def _schedule(self, scheduler):
self._command_future = controller._send_protobuf_command(
self.command_message, self.command_args
)
super()._schedule(scheduler)
self._command_future.add_done_callback(lambda _: self.check(None))
if self.expectation is not None:
self.expectation._schedule(scheduler)
super()._schedule(scheduler)
else:
super()._schedule(scheduler)

def no_expect(self, value):
self._no_expect = value
Expand Down
2 changes: 1 addition & 1 deletion src/olympe/arsdkng/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def default(self, o):
f"{o.__class__.__name__}.{o.to_upper_str()}"
)
elif issubclass(o.__class__, ArsdkMessageBase):
return f"olympe.messages.{o.feature_name}.{o.name}"
return f"olympe.messages.{o.fullName}"
return super().default(o)


Expand Down
Loading

0 comments on commit 9d9bcc2

Please sign in to comment.