Skip to content

Commit 8e6f3eb

Browse files
Handle sequence item removed
1 parent 530bfce commit 8e6f3eb

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

Development/nmos-cpp-node/node_implementation.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -1706,11 +1706,16 @@ nmos::control_protocol_property_changed_handler make_node_implementation_control
17061706
// sequence property
17071707
slog::log<slog::severities::info>(gate, SLOG_FLF) << nmos::stash_category(impl::categories::node_implementation) << "Property: " << property_name << " index " << index << " has value changed to " << resource.data.at(property_name).at(index).serialize();
17081708
}
1709-
else
1709+
else if (index == -1)
17101710
{
17111711
// non-sequence property
17121712
slog::log<slog::severities::info>(gate, SLOG_FLF) << nmos::stash_category(impl::categories::node_implementation) << "Property: " << property_name << " has value changed to " << resource.data.at(property_name).serialize();
17131713
}
1714+
else if (index == -2)
1715+
{
1716+
// sequence property removed
1717+
slog::log<slog::severities::info>(gate, SLOG_FLF) << nmos::stash_category(impl::categories::node_implementation) << "Property: " << property_name << " has sequence item removed. Value changed to " << resource.data.at(property_name).serialize();
1718+
}
17141719
};
17151720
}
17161721

Development/nmos/control_protocol_handlers.h

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ namespace nmos
3333

3434
// a control_protocol_property_changed_handler is a notification that the specified (IS-12) property has changed
3535
// index is set to -1 for non-sequence property
36+
// index is set to -2 when a sequence item had been removed
3637
// this callback should not throw exceptions, as the relevant property will already has been changed and those changes will not be rolled back
3738
typedef std::function<void(const nmos::resource& resource, const utility::string_t& property_name, int index)> control_protocol_property_changed_handler;
3839

Development/nmos/control_protocol_methods.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ namespace nmos
335335
// do notification that the specified property has changed
336336
if (property_changed)
337337
{
338-
property_changed(resource, nmos::fields::nc::name(property), index);
338+
property_changed(resource, nmos::fields::nc::name(property), -2);
339339
}
340340

341341
}, make_property_changed_event(nmos::fields::nc::oid(resource.data), { { details::parse_nc_property_id(property_id), nc_property_change_type::type::sequence_item_removed, nc_id(index) } }));

0 commit comments

Comments
 (0)