power-policy: Add PSU type to capabilities flags#627
power-policy: Add PSU type to capabilities flags#627RobertZ2011 merged 3 commits intoOpenDevicePartnership:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR enhances the power policy system by adding PSU (Power Supply Unit) type information to capability flags, enabling the system to distinguish between different power source types (Type-C, DC Jack, custom types). The changes also refactor the communication events to use complete power capability structures (ConsumerPowerCapability and ProviderPowerCapability) instead of just the bare PowerCapability, ensuring that flag information is preserved throughout the system.
Key Changes:
- Introduced a new
PsuTypeenum with support for Type-C, DC Jack, and custom application-defined types - Extended both Consumer and Provider flags to include PSU type information via bitfields
- Updated all power policy events and communications to use full capability structs with flags
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| embedded-service/src/power/policy/flags.rs | Added PsuType enum and integrated it into Consumer/Provider flags bitfields; converted Consumer unconstrained_power from u8 to bool; migrated Provider from unit struct to bitfield |
| embedded-service/src/power/policy/mod.rs | Updated CommsData enum variants to carry full ConsumerPowerCapability and ProviderPowerCapability structures |
| embedded-service/src/power/policy/charger.rs | Updated PolicyEvent and ChargeController trait to accept ConsumerPowerCapability instead of PowerCapability |
| type-c-service/src/wrapper/power.rs | Set PsuType::TypeC for all Type-C power capabilities; refactored contract handling to work with full capability structs |
| power-policy-service/src/provider.rs | Updated post_provider_connected to accept ProviderPowerCapability instead of PowerCapability |
| power-policy-service/src/consumer.rs | Updated PolicyEvent calls to pass full ConsumerPowerCapability; constructed proper capability struct for disconnect scenario |
| power-policy-service/src/charger.rs | Updated to access capability field from ConsumerPowerCapability struct |
| battery-service/src/context.rs | Extracted .capability field from ConsumerPowerCapability when storing power info |
| Cargo.toml | Formatting change for rstest dependency declaration |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
0b3a503 to
36baaa6
Compare
36baaa6 to
ab04102
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 9 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
63185f0 to
526f523
Compare
Also update events to use full power capability structs.
Also add embassy time feature that was required for certain tests to build
526f523 to
f85c5a1
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@RobertZ2011 Please announce this breaking change on on Zulip if it has not been done already. |
Also update events to use full power capability structs.
Breaking
Breaking due to replacing usages of
PowerCapabilitywithConsumerPowerCapability. The former is still accessible as a public member within the latter; migration is to use that public member.