diff --git a/examples/dishwasher-app/linux/include/DishwasherManager.h b/examples/dishwasher-app/linux/include/DishwasherManager.h new file mode 100644 index 00000000000000..7fbac001031232 --- /dev/null +++ b/examples/dishwasher-app/linux/include/DishwasherManager.h @@ -0,0 +1,94 @@ +/* + * + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once +#include "AppEvent.h" +#include +#include +#include +// https://github.com/project-chip/connectedhomeip/tree/master/src/app/clusters/dishwasher-alarm-server +#include +#include +#include +#include +#include +#include + +using namespace chip; +using namespace chip::app; +using namespace chip::app::Clusters::DishwasherAlarm; +using namespace chip::app::Clusters::DishwasherAlarm::Attributes; +/* +using namespace chip::app::Clusters::TemperatureControl; +using namespace chip::app::Clusters::TemperatureControl::Attributes; +using namespace chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode; +*/ +using namespace chip::DeviceLayer; +using chip::Protocols::InteractionModel::Status; + +// AppCluster Spec Table 85. +enum SUPPORTED_MODES +{ + NORMAL = 0x0000, + ENERGY_SAVE = 0x0004, + RAPID_COOL = 0x4000, + RAPID_FREEZE = 0x4001, +}; + +class DishwasherManager +{ +public: + CHIP_ERROR Init(); + /* + void RefAndTempCtrlAttributeChangeHandler(EndpointId endpointId, AttributeId attributeId, uint8_t * value, uint16_t size); + void TempCtrlAttributeChangeHandler(EndpointId endpointId, AttributeId attributeId, uint8_t * value, uint16_t size); + */ + void RefAlaramAttributeChangeHandler(EndpointId endpointId, AttributeId attributeId, uint8_t * value, uint16_t size); + uint8_t GetMode(); + int8_t GetCurrentTemp(); + int8_t SetMode(); + +private: + friend DishwasherManager & DishwasherMgr(); + + int16_t mCurrentMode; + int16_t mStartUpMode; + int16_t mOnMode; + + /* + int16_t mTemperatureSetpoint; + int16_t mMinTemperature; + int16_t mMaxTemperature; + int16_t mStep; + int16_t mSelectedTemperatureLevel; + int16_t mSupportedTemperatureLevels; + */ + + chip::app::Clusters::DishwasherAlarm::AlarmBitmap mMask; + chip::app::Clusters::DishwasherAlarm::AlarmBitmap mState; + chip::app::Clusters::DishwasherAlarm::AlarmBitmap mSupported; + + int8_t ConvertToPrintableTemp(int16_t temperature); + static DishwasherManager sDishwasherMgr; +}; + +inline DishwasherManager & DishwasherMgr() +{ + return DishwasherManager::sDishwasherMgr; +}