Skip to content

Commit 53172e0

Browse files
Added bool to onUnsolicitedRegistrationChanged: triggeredByEntity
1 parent ecf9fe3 commit 53172e0

File tree

6 files changed

+9
-8
lines changed

6 files changed

+9
-8
lines changed

CHANGELOG-controller.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
2424
### Changed
2525
- [StreamOutputNode has a new field: `presentationTimeOffset` to replace the `msrpAccumulatedLatency` field (which was in StreamDynamicInfo struct)](https://github.com/L-Acoustics/avdecc/issues/147)
2626
- StreamDynamicInfo.hasSrpRegistrationFailed replaces the deprecated hasTalkerFailed field
27+
- New boolean parameter _triggeredByEntity_ in onUnsolicitedRegistrationChanged event to know if the change was triggered by the entity itself or by the controller
2728

2829
### Fixed
2930
- `computeEntityModelChecksum` not returning a deterministic value for all OSes

include/la/avdecc/controller/avdeccController.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ class Controller : public la::avdecc::utils::Subject<Controller, std::recursive_
258258
virtual void onGptpChanged(la::avdecc::controller::Controller const* const controller, la::avdecc::controller::ControlledEntity const* const entity, la::avdecc::entity::model::AvbInterfaceIndex const avbInterfaceIndex, la::avdecc::UniqueIdentifier const grandMasterID, std::uint8_t const grandMasterDomain) noexcept = 0;
259259

260260
// Global entity notifications
261-
virtual void onUnsolicitedRegistrationChanged(la::avdecc::controller::Controller const* const controller, la::avdecc::controller::ControlledEntity const* const entity, bool const isSubscribed) noexcept = 0;
261+
virtual void onUnsolicitedRegistrationChanged(la::avdecc::controller::Controller const* const controller, la::avdecc::controller::ControlledEntity const* const entity, bool const isSubscribed, bool const triggeredByEntity) noexcept = 0;
262262
virtual void onCompatibilityChanged(la::avdecc::controller::Controller const* const controller, la::avdecc::controller::ControlledEntity const* const entity, la::avdecc::controller::ControlledEntity::CompatibilityFlags const compatibilityFlags, la::avdecc::entity::model::MilanVersion const& milanCompatibleVersion) noexcept = 0;
263263
virtual void onIdentificationStarted(la::avdecc::controller::Controller const* const controller, la::avdecc::controller::ControlledEntity const* const entity) noexcept = 0;
264264
virtual void onIdentificationStopped(la::avdecc::controller::Controller const* const controller, la::avdecc::controller::ControlledEntity const* const entity) noexcept = 0;
@@ -359,7 +359,7 @@ class Controller : public la::avdecc::utils::Subject<Controller, std::recursive_
359359
virtual void onGptpChanged(la::avdecc::controller::Controller const* const /*controller*/, la::avdecc::controller::ControlledEntity const* const /*entity*/, la::avdecc::entity::model::AvbInterfaceIndex const /*avbInterfaceIndex*/, la::avdecc::UniqueIdentifier const /*grandMasterID*/, std::uint8_t const /*grandMasterDomain*/) noexcept override {}
360360

361361
// Global entity notifications
362-
virtual void onUnsolicitedRegistrationChanged(la::avdecc::controller::Controller const* const /*controller*/, la::avdecc::controller::ControlledEntity const* const /*entity*/, bool const /*isSubscribed*/) noexcept override {}
362+
virtual void onUnsolicitedRegistrationChanged(la::avdecc::controller::Controller const* const /*controller*/, la::avdecc::controller::ControlledEntity const* const /*entity*/, bool const /*isSubscribed*/, bool const /*triggeredByEntity*/) noexcept override {}
363363
virtual void onCompatibilityChanged(la::avdecc::controller::Controller const* const /*controller*/, la::avdecc::controller::ControlledEntity const* const /*entity*/, la::avdecc::controller::ControlledEntity::CompatibilityFlags const /*compatibilityFlags*/, la::avdecc::entity::model::MilanVersion const& /*milanCompatibleVersion*/) noexcept override {}
364364
virtual void onIdentificationStarted(la::avdecc::controller::Controller const* const /*controller*/, la::avdecc::controller::ControlledEntity const* const /*entity*/) noexcept override {}
365365
virtual void onIdentificationStopped(la::avdecc::controller::Controller const* const /*controller*/, la::avdecc::controller::ControlledEntity const* const /*entity*/) noexcept override {}

src/controller/avdeccControllerImpl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ void ControllerImpl::decreaseMilanCompatibilityVersion(ControllerImpl const* con
381381
}
382382
}
383383

384-
void ControllerImpl::updateUnsolicitedNotificationsSubscription(ControlledEntityImpl& controlledEntity, bool const isSubscribed) const noexcept
384+
void ControllerImpl::updateUnsolicitedNotificationsSubscription(ControlledEntityImpl& controlledEntity, bool const isSubscribed, bool const triggeredByEntity) const noexcept
385385
{
386386
AVDECC_ASSERT(_controller->isSelfLocked(), "Should only be called from the network thread (where ProtocolInterface is locked)");
387387

@@ -394,7 +394,7 @@ void ControllerImpl::updateUnsolicitedNotificationsSubscription(ControlledEntity
394394
// Entity was advertised to the user, notify observers
395395
if (controlledEntity.wasAdvertised())
396396
{
397-
notifyObserversMethod<Controller::Observer>(&Controller::Observer::onUnsolicitedRegistrationChanged, this, &controlledEntity, isSubscribed);
397+
notifyObserversMethod<Controller::Observer>(&Controller::Observer::onUnsolicitedRegistrationChanged, this, &controlledEntity, isSubscribed, triggeredByEntity);
398398
}
399399
}
400400
}

src/controller/avdeccControllerImpl.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ class ControllerImpl final : public Controller, private entity::controller::Dele
361361
static void setMilanWarningCompatibilityFlag(ControllerImpl const* const controller, ControlledEntityImpl& controlledEntity, std::string const& specClause, std::string const& message) noexcept;
362362
static void removeCompatibilityFlag(ControllerImpl const* const controller, ControlledEntityImpl& controlledEntity, ControlledEntity::CompatibilityFlag const flag, std::string const& specClause, std::string const& message) noexcept;
363363
static void decreaseMilanCompatibilityVersion(ControllerImpl const* const controller, ControlledEntityImpl& controlledEntity, entity::model::MilanVersion const& version, std::string const& specClause, std::string const& message) noexcept;
364-
void updateUnsolicitedNotificationsSubscription(ControlledEntityImpl& controlledEntity, bool const isSubscribed) const noexcept;
364+
void updateUnsolicitedNotificationsSubscription(ControlledEntityImpl& controlledEntity, bool const isSubscribed, bool const triggeredByEntity) const noexcept;
365365
void updateAcquiredState(ControlledEntityImpl& controlledEntity, model::AcquireState const acquireState, UniqueIdentifier const owningEntity) const noexcept;
366366
void updateLockedState(ControlledEntityImpl& controlledEntity, model::LockState const lockState, UniqueIdentifier const lockingEntity) const noexcept;
367367
void updateConfiguration(entity::controller::Interface const* const controller, ControlledEntityImpl& controlledEntity, entity::model::ConfigurationIndex const configurationIndex, TreeModelAccessStrategy::NotFoundBehavior const notFoundBehavior) const noexcept;

src/controller/avdeccControllerImplDelegateOverrides.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ void ControllerImpl::onDeregisteredFromUnsolicitedNotifications(entity::controll
236236
if (controlledEntity)
237237
{
238238
auto& entity = *controlledEntity;
239-
updateUnsolicitedNotificationsSubscription(entity, false);
239+
updateUnsolicitedNotificationsSubscription(entity, false, true);
240240
}
241241
}
242242

@@ -1081,7 +1081,7 @@ void ControllerImpl::handleAecpUnsolicitedReceived(UniqueIdentifier const& entit
10811081
// As part of #50 (for now), just unsubscribe from unsolicited notifications
10821082
{
10831083
// Immediately set as unsubscribed, we are already loosing packets we don't want to miss the response to our unsubscribe
1084-
updateUnsolicitedNotificationsSubscription(entity, false);
1084+
updateUnsolicitedNotificationsSubscription(entity, false, false);
10851085

10861086
// Properly (try to) unregister from unsol
10871087
unregisterUnsol(&entity);

src/controller/avdeccControllerImplHandlers.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ void ControllerImpl::onUnregisterUnsolicitedNotificationsResult(entity::controll
691691

692692
if (!!status)
693693
{
694-
entity.setSubscribedToUnsolicitedNotifications(false);
694+
updateUnsolicitedNotificationsSubscription(entity, false, false);
695695
}
696696
}
697697
}

0 commit comments

Comments
 (0)