Skip to content

Commit

Permalink
Bug/air quality sensor app leak (#28619)
Browse files Browse the repository at this point in the history
* free handle on error

* corrected README.md

* Restyled by prettier-markdown

* updated readme

* Restyled by prettier-markdown

---------

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Oct 24, 2023
1 parent 2a617a6 commit 1031936
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ void AirQualitySensorAttrUpdateHandler::HandleCommand(intptr_t context)
auto * self = reinterpret_cast<AirQualitySensorAttrUpdateHandler *>(context);
std::string clusterName = self->mJsonValue["Name"].asString();

VerifyOrReturn(!self->mJsonValue.empty(), ChipLogError(NotSpecified, "Invalid JSON event command received"));
VerifyOrReturn(!self->mJsonValue.empty(), {
ChipLogError(NotSpecified, "Invalid JSON event command received");
Platform::Delete(self);
});

if (clusterName == "AirQuality")
{
Expand Down
10 changes: 5 additions & 5 deletions examples/air-quality-sensor-app/linux/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,30 +116,30 @@ To cross-compile this example on x64 host and run on **NXP i.MX 8M Mini**
## Trigger event using air-quality-sensor-app event named pipe

You can send a command to air-quality-sensor-app to trigger specific event via
air-quality-sensor-app event named pipe /tmp/chip_air_quality_fifo-<PID>.
air-quality-sensor-app event named pipe /tmp/chip_air_quality_fifo\*<PID>.

### Trigger air quality change event

Generate event `AirQuality`, to change the air quality value.

```
$ echo '{"Name":"AirQuality","NewValue":3}' > /tmp/chip_air_quality_fifo-<PID>
$ echo '{"Name":"AirQuality","NewValue":3}' > /tmp/chip_air_quality_fifo_<PID>
```

### Trigger Temperature change event

Generate event `TemperatureMeasurement`, to change the temperate value.

```
$ echo '{"Name":"TemperatureMeasurement","NewValue":18}' > /tmp/chip_air_quality_fifo-<PID>
$ echo '{"Name":"TemperatureMeasurement","NewValue":18}' > /tmp/chip_air_quality_fifo_<PID>
```

### Trigger Humidity change event

Generate event `RelativeHumidityMeasurement`, to change the temperate value.

```
$ echo '{"Name":"RelativeHumidityMeasurement","NewValue":60}' > /tmp/chip_air_quality_fifo-<PID>
$ echo '{"Name":"RelativeHumidityMeasurement","NewValue":60}' > /tmp/chip_air_quality_fifo_<PID>
```

### Trigger concentration change event
Expand All @@ -150,5 +150,5 @@ clusters.
Generate event `CarbonDioxideConcentrationMeasurement`, to change the CO2 value.

```
$ echo '{"Name":"CarbonDioxideConcentrationMeasurement","NewValue":400}' > /tmp/chip_air_quality_fifo-<PID>
$ echo '{"Name":"CarbonDioxideConcentrationMeasurement","NewValue":400}' > /tmp/chip_air_quality_fifo_<PID>
```

0 comments on commit 1031936

Please sign in to comment.