Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only send multicastNtf back in delete action. #90

Merged
merged 3 commits into from
Jun 5, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 25 additions & 17 deletions src/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,31 @@ impl Device {
status: update_status,
});
});
// Following requirements are applicable when the action is set to Delete (Action field set to 0x01):
// When the command is received while the Session State is SESSION_STATE_ACTIVE,
// For requested Controlees present in the multicast list,
// UWBS shall send the SESSION_UPDATE_CONTROLLER_MULTICAST_LIST_NTF and the
// corresponding Controlee status shall be set to STATUS_OK_MULTICAST_LIST_UPDATE
// in the Status List of SESSION_UPDATE_CONTROLLER_MULTICAST_LIST_NTF.
if session.state == SessionState::SessionStateActive {
let tx = self.tx.clone();
tokio::spawn(async move {
// Sleep for 5ms to make sure the notification is not being
// sent before the response.
// TODO(#84) remove the sleep.
time::sleep(Duration::from_millis(5)).await;
tx.send(
SessionUpdateControllerMulticastListNtfBuilder {
controlee_status,
session_token: session_handle,
}
.build()
.encode_to_vec()
.unwrap(),
)
.unwrap()
});
}
}
}
session.app_config.number_of_controlees = dst_addresses.len() as u8;
Expand All @@ -752,23 +777,6 @@ impl Device {
ReasonCode::ErrorInvalidNumOfControlees,
)
}
let tx = self.tx.clone();
tokio::spawn(async move {
// Sleep for 5ms to make sure the notification is not being
// sent before the response.
// TODO(#84) remove the sleep.
time::sleep(Duration::from_millis(5)).await;
tx.send(
SessionUpdateControllerMulticastListNtfBuilder {
controlee_status,
session_token: session_handle,
}
.build()
.encode_to_vec()
.unwrap(),
)
.unwrap()
});
SessionUpdateControllerMulticastListRspBuilder { status }.build()
}

Expand Down
Loading