Skip to content

Commit

Permalink
Merge branch 'master' into granbery/preset_scenario_count
Browse files Browse the repository at this point in the history
  • Loading branch information
hasty authored Aug 31, 2024
2 parents 82a86a5 + 815195b commit edc0cf8
Show file tree
Hide file tree
Showing 44 changed files with 11,936 additions and 513 deletions.
2 changes: 2 additions & 0 deletions .github/.wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,7 @@ forkpty
FOTA
FreeRTOS
FreeRTOSConfig
FS
fsl
fstab
fsync
Expand Down Expand Up @@ -855,6 +856,7 @@ MbedNewTarget
mbedos
mbedTarget
mbedTLS
MCORE
mcu
MCUboot
mcumgr
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ jobs:
if [ "$idl_file" = './examples/placeholder/linux/apps/app2/config.matter' ]; then continue; fi
if [ "$idl_file" = './examples/thermostat/thermostat-common/thermostat.matter' ]; then continue; fi
if [ "$idl_file" = './examples/window-app/common/window-app.matter' ]; then continue; fi
# Example is intentionally not spe compliant for use in cert testing
if [ "$idl_file" = './examples/lighting-app-data-mode-no-unique-id/lighting-common/lighting-app.matter' ]; then continue; fi
# Test files are intentionally small and not spec-compilant, just parse-compliant
if [ "$idl_file" = "./scripts/py_matter_idl/matter_idl/tests/inputs/cluster_struct_attribute.matter" ]; then continue; fi
Expand Down
9 changes: 9 additions & 0 deletions docs/examples/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,15 @@ lighting-app/**/README
lighting-app/qpg/APPLICATION
```

## Lighting example without unique id

```{toctree}
:glob:
:maxdepth: 1
lighting-app-data-mode-no-unique-id/**/README
```

## Light switch example

```{toctree}
Expand Down
32 changes: 32 additions & 0 deletions examples/all-clusters-app/linux/AllClustersCommandDelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,34 @@ void HandleSimulateLatchPosition(Json::Value & jsonValue)
}
}

/**
* Named pipe handler for simulating switch is idle
*
* Usage example:
* echo '{"Name": "SimulateSwitchIdle", "EndpointId": 3}' > /tmp/chip_all_clusters_fifo_1146610
*
* JSON Arguments:
* - "Name": Must be "SimulateSwitchIdle"
* - "EndpointId": ID of endpoint having a switch cluster
*
* @param jsonValue - JSON payload from named pipe
*/

void HandleSimulateSwitchIdle(Json::Value & jsonValue)
{
bool hasEndpointId = HasNumericField(jsonValue, "EndpointId");

if (!hasEndpointId)
{
std::string inputJson = jsonValue.toStyledString();
ChipLogError(NotSpecified, "Missing or invalid value for one of EndpointId in %s", inputJson.c_str());
return;
}

EndpointId endpointId = static_cast<EndpointId>(jsonValue["EndpointId"].asUInt());
(void) Switch::Attributes::CurrentPosition::Set(endpointId, 0);
}

void EmitOccupancyChangedEvent(EndpointId endpointId, uint8_t occupancyValue)
{
Clusters::OccupancySensing::Events::OccupancyChanged::Type event{};
Expand Down Expand Up @@ -427,6 +455,10 @@ void AllClustersAppCommandHandler::HandleCommand(intptr_t context)
{
HandleSimulateLatchPosition(self->mJsonValue);
}
else if (name == "SimulateSwitchIdle")
{
HandleSimulateSwitchIdle(self->mJsonValue);
}
else if (name == "SetOccupancy")
{
uint8_t occupancy = static_cast<uint8_t>(self->mJsonValue["Occupancy"].asUInt());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ class WaterHeaterManagementDelegate : public WaterHeaterManagement::Delegate
* SHALL be rejected with appropriate error.
*/
Protocols::InteractionModel::Status HandleBoost(uint32_t duration, Optional<bool> oneShot, Optional<bool> emergencyBoost,
Optional<int16_t> temporarySetpoint, Optional<chip::Percent> targetPercentage,
Optional<chip::Percent> targetReheat) override;
Optional<int16_t> temporarySetpoint, Optional<Percent> targetPercentage,
Optional<Percent> targetReheat) override;

/**
* @brief Delegate should implement a handler to cancel a boost command.
Expand All @@ -121,7 +121,7 @@ class WaterHeaterManagementDelegate : public WaterHeaterManagement::Delegate
BitMask<WaterHeaterHeatSourceBitmap> GetHeaterTypes() override;
BitMask<WaterHeaterHeatSourceBitmap> GetHeatDemand() override;
uint16_t GetTankVolume() override;
int64_t GetEstimatedHeatRequired() override;
Energy_mWh GetEstimatedHeatRequired() override;
Percent GetTankPercentage() override;
BoostStateEnum GetBoostState() override;

Expand All @@ -130,7 +130,7 @@ class WaterHeaterManagementDelegate : public WaterHeaterManagement::Delegate
void SetHeaterTypes(BitMask<WaterHeaterHeatSourceBitmap> heaterTypes);
void SetHeatDemand(BitMask<WaterHeaterHeatSourceBitmap> heatDemand);
void SetTankVolume(uint16_t tankVolume);
void SetEstimatedHeatRequired(int64_t estimatedHeatRequired);
void SetEstimatedHeatRequired(Energy_mWh estimatedHeatRequired);
void SetTankPercentage(Percent tankPercentage);
void SetBoostState(BoostStateEnum boostState);

Expand All @@ -152,19 +152,22 @@ class WaterHeaterManagementDelegate : public WaterHeaterManagement::Delegate
*
* @param waterTemperature The water temperature in 100th's Celsius
*/
void SetWaterTemperature(uint16_t waterTemperature);
void SetWaterTemperature(int16_t waterTemperature);

/**
* @brief Set the target water temperature of the tank
*
* @param targetWaterTemperature The water temperature in 100th's Celsius
*/
void SetTargetWaterTemperature(uint16_t targetWaterTemperature);
void SetTargetWaterTemperature(int16_t targetWaterTemperature);

/**
* @brief Determine whether the heating sources need to be turned on or off
* @brief Determine whether the heating sources need to be turned on or off or left unchanged.
*
* @return Success if the heating was successfully turned on or off or left unchanged otherwise an error
* code is returned if turning the heating on or off failed.
*/
Protocols::InteractionModel::Status CheckIfHeatNeedsToBeTurnedOnOrOff();
Protocols::InteractionModel::Status ChangeHeatingIfNecessary();

/**
* @brief Static timer callback for when Boost timer expires.
Expand Down Expand Up @@ -194,9 +197,34 @@ class WaterHeaterManagementDelegate : public WaterHeaterManagement::Delegate
* @param replacedWaterTemperature The temperature of the
* percentageReplaced water.
*/
void DrawOffHotWater(chip::Percent percentageReplaced, uint16_t replacedWaterTemperature);
void DrawOffHotWater(Percent percentageReplaced, int16_t replacedWaterTemperature);

/**
* Set the temperature of the cold water that fills the tank as the hot water
* is drawn off.
*
* @param coldWaterTemperature The cold water temperature in 100th of a C
*/
void SetColdWaterTemperature(int16_t coldWaterTemperature);

private:
/**
* Return the target temperature.
* If a boost command is in progress and has a mBoostTemporarySetpoint value use that as the
* target temperature otherwise use the temperature set via SetTargetWaterTemperature().
*
* @return the target temperature
*/
int16_t GetActiveTargetWaterTemperature() const;

/**
* @brief Calculate the percentage of the water in the tank at the target
* temperature.
*
* @return Percentage of water at the target temperature
*/
uint8_t CalculateTankPercentage() const;

/**
* @brief Determine whether heating needs to be turned on or off or left as
* is.
Expand All @@ -223,13 +251,13 @@ class WaterHeaterManagementDelegate : public WaterHeaterManagement::Delegate
WhmManufacturer * mpWhmManufacturer;

// Target water temperature in 100ths of a C
uint16_t mTargetWaterTemperature;
int16_t mTargetWaterTemperature;

// Actual water temperature in 100ths of a C
uint16_t mWaterTemperature;
int16_t mWaterTemperature;

// The % of water at temperature mReplacedWaterTemperature
uint16_t mReplacedWaterTemperature;
// The cold water temperature in 100ths of a C
int16_t mColdWaterTemperature;

// Boost command parameters

Expand All @@ -253,7 +281,7 @@ class WaterHeaterManagementDelegate : public WaterHeaterManagement::Delegate
// amount of water that SHALL be heated by this Boost command before the
// heater is switched off. This field is optional, however it SHALL be
// included if the TargetReheat field is included.
Optional<chip::Percent> mBoostTargetPercentage;
Optional<Percent> mBoostTargetPercentage;

// If the tank supports the TankPercent feature, and the heating by this
// Boost command has ceased because the TargetPercentage of the water in the
Expand All @@ -266,7 +294,7 @@ class WaterHeaterManagementDelegate : public WaterHeaterManagement::Delegate
// heat back up to 80% of hot water. If this field and the OneShot field
// were both omitted, heating would begin again after any water draw which
// reduced the TankPercentage below 80%.
Optional<chip::Percent> mBoostTargetReheat;
Optional<Percent> mBoostTargetReheat;

// Track whether the water temperature has reached the water temperature
// specified in the boost command. Used in conjunction with the boost
Expand Down Expand Up @@ -299,7 +327,7 @@ class WaterHeaterManagementDelegate : public WaterHeaterManagement::Delegate
// taking the specific heat capacity of water (4182 J/kg °C) and by knowing
// the current temperature of the water, the tank volume and target
// temperature.
int64_t mEstimatedHeatRequired;
Energy_mWh mEstimatedHeatRequired;

// This attribute SHALL indicate an approximate level of hot water stored in
// the tank, which may help consumers understand the amount of hot water
Expand Down
Loading

0 comments on commit edc0cf8

Please sign in to comment.