Skip to content
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

Air Quality API #464

Merged
merged 10 commits into from
May 19, 2023
Merged

Air Quality API #464

merged 10 commits into from
May 19, 2023

Conversation

RaresCon
Copy link
Contributor

Pull Request Overview

This PR adds an Air Quality API, which includes:

  • function for checking the existence of the driver
  • functions for initating readings for CO2 and TVOC levels
  • a private function and enum for synchronous reading of values for CO2 and TVOC levels and 3 public functions for easier use of the API
  • unit tests

Alongside the API, this PR adds a fake driver (and unit tests for it) for testing the API.

Testing Strategy

This pull request was tested using unit tests made specifically for this API and fake driver.

TODO or Help Wanted

This pull request still needs feedback / code review.
I will add documentation in the files and an example application using this API.

Documentation Updated

  • No updates required.

I've written the base of air_quality API, next I will add a fake sensor for
testing the API, including unit testing for the fake sensor
I've removed the `AirQualityListener` and used a `Cell<Option<(u32,)>>`
instead. I've added a private Enum for choosing what kind of data reading
to execute, a private method that uses this Enum and two other public
functions as wrappers.
I've added a fake `AirQuality` driver and some integration tests for it.
Every test is passed and should reflect the behaviour of the real driver.
I've added unittests for each function of the AirQuality API, all pass
as expected. Documentation for the API will be part of the next commit.
Added the suggested changes, including the `read_sync` function that
return a tuple of both CO2 and TVOC values. Improved the unittests for the
fake driver and added a unittest for the new function.
src/lib.rs Outdated Show resolved Hide resolved
Cargo.toml Outdated Show resolved Hide resolved
@jrvanwhy jrvanwhy added the upkeep Indicates a PR is upkeep as defined by the code review policy. label Apr 19, 2023
apis/air_quality/src/lib.rs Outdated Show resolved Hide resolved
apis/air_quality/src/lib.rs Outdated Show resolved Hide resolved
apis/air_quality/src/lib.rs Outdated Show resolved Hide resolved
apis/air_quality/src/lib.rs Outdated Show resolved Hide resolved
RaresCon and others added 2 commits May 11, 2023 22:11
I've added back the dedicated listener for this API
and rewritten the returning errors of some functions.
Copy link
Collaborator

@jrvanwhy jrvanwhy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bors r+

bors bot added a commit that referenced this pull request May 16, 2023
464: Air Quality API r=jrvanwhy a=RaresCon

### Pull Request Overview

This PR adds an Air Quality API, which includes:

- function for checking the existence of the driver
- functions for initating readings for CO2 and TVOC levels
- a private function and enum for synchronous reading of values for CO2 and TVOC levels and 3 public functions for easier use of the API
- unit tests

Alongside the API, this PR adds a fake driver (and unit tests for it) for testing the API.

### Testing Strategy

This pull request was tested using unit tests made specifically for this API and fake driver.

### TODO or Help Wanted

This pull request still needs feedback / code review.
I will add documentation in the files and an example application using this API.

### Documentation Updated

- [x] No updates required.


Co-authored-by: RaresCon <rares.constantin2002@gmail.com>
Co-authored-by: Rareș Constantin <95525840+RaresCon@users.noreply.github.com>
@bors
Copy link
Contributor

bors bot commented May 16, 2023

Build failed:

apis/air_quality/src/tests.rs Outdated Show resolved Hide resolved
RaresCon and others added 2 commits May 18, 2023 11:32
I've added some documentation for the functions of the API
and fixed an inclusion bug of the API in `tests.rs` that
made the CI fail.
Copy link
Collaborator

@jrvanwhy jrvanwhy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bors r+

@bors
Copy link
Contributor

bors bot commented May 19, 2023

Build succeeded!

The publicly hosted instance of bors-ng is deprecated and will go away soon.

If you want to self-host your own instance, instructions are here.
For more help, visit the forum.

If you want to switch to GitHub's built-in merge queue, visit their help page.

@bors bors bot merged commit 0f7c976 into tock:master May 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upkeep Indicates a PR is upkeep as defined by the code review policy.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants