| /* | |
| * | |
| * Copyright (c) 2020-2023 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. | |
| */ | |
| /** | |
| * @file DeviceCallbacks.cpp | |
| * | |
| * Implements all the callbacks to the application from the CHIP Stack | |
| * | |
| **/ | |
| #include "DeviceCallbacks.h" | |
| #include <app-common/zap-generated/ids/Attributes.h> | |
| #include <app-common/zap-generated/ids/Clusters.h> | |
| #include <app/server/Dnssd.h> | |
| #include <app/util/attribute-storage.h> | |
| #include <app/util/attribute-table.h> | |
| #include <lib/support/CodeUtils.h> | |
| #if CONFIG_ENABLE_FEEDBACK | |
| #include "UserInterfaceFeedback.h" | |
| #endif | |
| using namespace ::chip; | |
| using namespace ::chip::Inet; | |
| using namespace ::chip::System; | |
| using namespace ::chip::DeviceLayer; | |
| using namespace chip::app; | |
| using namespace chip::app::Clusters; | |
| void LockApp::DeviceCallbacks::PostAttributeChangeCallback(EndpointId endpointId, ClusterId clusterId, AttributeId attributeId, | |
| uint8_t type, uint16_t size, uint8_t * value) | |
| { | |
| ChipLogProgress(DeviceLayer, | |
| "endpointId " ChipLogFormatMEI " clusterId " ChipLogFormatMEI " attribute ID: " ChipLogFormatMEI | |
| " Type: %u Value: %u, length %u", | |
| ChipLogValueMEI(endpointId), ChipLogValueMEI(clusterId), ChipLogValueMEI(attributeId), type, *value, size); | |
| #if CONFIG_ENABLE_FEEDBACK | |
| FeedbackMgr().RestoreState(); | |
| #endif | |
| } | |
| // This returns an instance of this class. | |
| LockApp::DeviceCallbacks & LockApp::DeviceCallbacks::GetDefaultInstance() | |
| { | |
| static DeviceCallbacks sDeviceCallbacks; | |
| return sDeviceCallbacks; | |
| } | |
| #ifndef CONFIG_APP_DEVICE_CALLBACKS_CUSTOM_SINGLETON_IMPL | |
| chip::DeviceManager::CHIPDeviceManagerCallbacks & chip::NXP::App::GetDeviceCallbacks() | |
| { | |
| return LockApp::DeviceCallbacks::GetDefaultInstance(); | |
| } | |
| #endif |