-
Notifications
You must be signed in to change notification settings - Fork 0
fix(device): restore Clone WINC flag + surface health telemetry (closes #331, #335) #348
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
85b0303
fix(device): restore Clone WINC flag + surface health telemetry (clos…
tylerkron 0d94a63
fix(device): address Qodo review — null-safe Health/Capabilities, bou…
tylerkron 44b4ff0
docs(device): clarify DeviceHealth values are sticky/last-known (Qodo…
tylerkron File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| namespace Daqifi.Core.Device; | ||
|
|
||
| /// <summary> | ||
| /// Health/telemetry values decoded from a device status message: battery charge, | ||
| /// board temperature, and the raw power/device status codes. These update as new | ||
| /// status messages arrive (including the periodic ones emitted during streaming), | ||
| /// so a snapshot reflects the most recent reading Core has seen. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// The underlying protobuf fields are proto3 scalars with no explicit presence, so a | ||
| /// value of <c>0</c> is indistinguishable from "not reported". To avoid dropping a known | ||
| /// reading when a partial status frame omits a field, each value is <b>sticky</b>: it holds | ||
| /// the last value the device actually reported until a new in-contract reading replaces it. | ||
| /// <see cref="BatteryPercent"/> and <see cref="BoardTemperatureCelsius"/> are therefore | ||
| /// nullable — <c>null</c> means "never reported since this instance was created" — and the raw | ||
| /// <see cref="PowerStatus"/> and <see cref="DeviceStatus"/> codes default to <c>0</c>. | ||
| /// </remarks> | ||
| public class DeviceHealth | ||
| { | ||
| /// <summary> | ||
| /// Gets or sets the battery charge as a percentage (1-100). This is the last in-contract | ||
| /// reading the device reported (a value may therefore be older than the most recent status | ||
| /// message, which can omit the field), or <c>null</c> if the device has not reported a valid | ||
| /// battery level since this instance was created. Out-of-range readings are ignored rather | ||
| /// than surfaced. | ||
| /// </summary> | ||
| public int? BatteryPercent { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the board temperature in degrees Celsius. This is the last value the device | ||
| /// reported (which may be older than the most recent status message, since a frame can omit | ||
| /// the field), or <c>null</c> if the device has not reported a temperature since this instance | ||
| /// was created. | ||
| /// </summary> | ||
| public int? BoardTemperatureCelsius { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the raw power/charging status code as reported by the device | ||
| /// (<c>PwrStatus</c>). Semantics are firmware-defined; <c>0</c> is the default/unreported value. | ||
| /// </summary> | ||
| public uint PowerStatus { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the raw device status code as reported by the device | ||
| /// (<c>DeviceStatus</c>). Semantics are firmware-defined; <c>0</c> is the default/unreported value. | ||
| /// </summary> | ||
| public uint DeviceStatus { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Creates a deep copy of this <see cref="DeviceHealth"/> instance. | ||
| /// </summary> | ||
| /// <returns>A new <see cref="DeviceHealth"/> instance with the same values.</returns> | ||
| public DeviceHealth Clone() | ||
| { | ||
| return new DeviceHealth | ||
| { | ||
| BatteryPercent = BatteryPercent, | ||
| BoardTemperatureCelsius = BoardTemperatureCelsius, | ||
| PowerStatus = PowerStatus, | ||
| DeviceStatus = DeviceStatus | ||
| }; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.