Skip to content

Commit

Permalink
upo
Browse files Browse the repository at this point in the history
  • Loading branch information
XdoctorwhoZ committed Aug 4, 2024
1 parent febc646 commit 2b345fc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 26 deletions.
4 changes: 2 additions & 2 deletions src/asyncv/attribute/message/ro_inner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub struct MessageAttributeRoInner<TYPE: MessagePayloadManager> {
pub value: Option<TYPE>,

///
change_notifier: Arc<Notify>,
pub change_notifier: Arc<Notify>,
}

impl<TYPE: MessagePayloadManager> MessageAttributeRoInner<TYPE> {
Expand Down Expand Up @@ -115,7 +115,7 @@ impl<TYPE: MessagePayloadManager> Into<Arc<Mutex<MessageAttributeRoInner<TYPE>>>
#[async_trait]
impl<TYPE: MessagePayloadManager> OnMessageHandler for MessageAttributeRoInner<TYPE> {
async fn on_message(&mut self, data: &Bytes) {
println!("ro_inner::on_message");
// println!("ro_inner::on_message");
let new_value = TYPE::from(data.to_vec());
self.value = Some(new_value);
self.change_notifier.notify_waiters();
Expand Down
26 changes: 3 additions & 23 deletions src/asyncv/attribute/message/rw_inner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,28 +109,8 @@ impl<TYPE: MessagePayloadManager> Into<Arc<Mutex<MessageAttributeRwInner<TYPE>>>
#[async_trait]
impl<TYPE: MessagePayloadManager> OnMessageHandler for MessageAttributeRwInner<TYPE> {
async fn on_message(&mut self, data: &Bytes) {
println!("boolean");

// OnChangeHandlerFunction

// if data.len() == 1 {
// match data[0] {
// b'1' => {
// self.value = Some(true);
// // self.set_ensure_update();
// }
// b'0' => {
// self.value = Some(false);
// // self.set_ensure_update();
// }
// _ => {
// println!("unexcpedted payload {:?}", data);
// return;
// }
// };
// // Do something with the value
// } else {
// println!("wierd payload {:?}", data);
// }
let new_value = TYPE::from(data.to_vec());
self.base.value = Some(new_value);
self.base.change_notifier.notify_waiters();
}
}
2 changes: 1 addition & 1 deletion src/asyncv/reactor/message_engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ impl MessageEngine {

pub async fn run(&mut self) {
while let Ok(event) = self.message_event_loop.poll().await {
println!("Notification = {:?}", event);
// println!("Notification = {:?}", event);
// match notification {
// Ok(event) => {
match event {
Expand Down

0 comments on commit 2b345fc

Please sign in to comment.