-
Notifications
You must be signed in to change notification settings - Fork 5
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
Fix: build: parser: Ping360 transducer return type #55
Fix: build: parser: Ping360 transducer return type #55
Conversation
2610ce0
to
922c9f7
Compare
build/parser.rs
Outdated
quote! { | ||
self.get_common().send_message(package).await?; | ||
// Special case where Ping360's config Transducer method returns a DeviceDataStruct | ||
if self.id == 2601 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe put this number as a const with a descriptive name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the end we added in the ping-protocol repository an return_message variable that defines if a message is expected from the sensor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
922c9f7
to
6b1a7e9
Compare
@patrickelectric @joaoantoniocardoso PR updated with newer PingProtocol field 'returns_message'. |
if let Some(value) = return_struct_name { | ||
return_type = quote! { #value }; | ||
quote! { | ||
let receiver = self.subscribe(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be outside the if/else since both scopes use it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is inside a quote, can't be changed.
4db7718
to
b2569af
Compare
build/parser.rs
Outdated
returns_message: value | ||
.get("returns_message") | ||
.and_then(|v| v.as_str()) | ||
.filter(|s| !s.is_empty()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How can this be empty ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
depends on protocol, removed this checkup
b2569af
to
cb8fef4
Compare
Ping360's transducer method is different from previous methods covered on Ping1D device type.
It's a method from MessageDefinitionCategory::Control that returns a DeviceDataStruct.
The following PR covers this case and open a solution for other Set/Control methods that returns a type like Get methods.