diff options
author | bobwzy <35530184+bobwzy@users.noreply.github.com> | 2024-06-05 07:56:44 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-05 07:56:44 -0700 |
commit | 94bd2735d1ce7539ff799e513f1408e18d740ca9 (patch) | |
tree | 97933f3c0428259a88567d2915e604e132574c66 | |
parent | a31d254bd7d83817ca72f5649fb01d7c672054bd (diff) | |
download | pica-94bd2735d1ce7539ff799e513f1408e18d740ca9.tar.gz |
Only send multicastNtf back in delete action. (#90)
* Only send multicastNtf back in delete action.
* Add document for sending multicast notification.
* document formatting
-rw-r--r-- | src/device.rs | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/src/device.rs b/src/device.rs index 62f3ffc..0558dbc 100644 --- a/src/device.rs +++ b/src/device.rs @@ -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; @@ -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() } |