| /* |
| * |
| * Copyright (c) 2020 Project CHIP Authors |
| * Copyright (c) 2019 Google LLC. |
| * 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. |
| */ |
| |
| #include <AppTask.h> |
| |
| #include "AppConfig.h" |
| #include "init_ccpPlatform.h" |
| |
| #include <DeviceInfoProviderImpl.h> |
| #include <app/server/Server.h> |
| #include <credentials/DeviceAttestationCredsProvider.h> |
| #include <matter_config.h> |
| #ifdef SI917_ATTESTATION_CREDENTIALS |
| #include <examples/platform/silabs/SilabsDeviceAttestationCreds.h> |
| #else |
| #include <credentials/examples/DeviceAttestationCredsExample.h> |
| #endif |
| |
| #define BLE_DEV_NAME "SiLabs-Light" |
| using namespace ::chip; |
| using namespace ::chip::Inet; |
| using namespace ::chip::DeviceLayer; |
| using namespace ::chip::Credentials; |
| |
| #define UNUSED_PARAMETER(a) (a = a) |
| |
| volatile int apperror_cnt; |
| static chip::DeviceLayer::DeviceInfoProviderImpl gExampleDeviceInfoProvider; |
| |
| // ================================================================================ |
| // Main Code |
| // ================================================================================ |
| int main(void) |
| { |
| init_ccpPlatform(); |
| if (SI917MatterConfig::InitMatter(BLE_DEV_NAME) != CHIP_NO_ERROR) |
| { |
| appError(CHIP_ERROR_INTERNAL); |
| } |
| |
| gExampleDeviceInfoProvider.SetStorageDelegate(&chip::Server::GetInstance().GetPersistentStorage()); |
| chip::DeviceLayer::SetDeviceInfoProvider(&gExampleDeviceInfoProvider); |
| |
| chip::DeviceLayer::PlatformMgr().LockChipStack(); |
| // Initialize device attestation config |
| #ifdef SI917_ATTESTATION_CREDENTIALS |
| SetDeviceAttestationCredentialsProvider(Silabs::GetSilabsDacProvider()); |
| #else |
| SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider()); |
| #endif |
| chip::DeviceLayer::PlatformMgr().UnlockChipStack(); |
| |
| SILABS_LOG("Starting App Task"); |
| if (AppTask::GetAppTask().StartAppTask() != CHIP_NO_ERROR) |
| { |
| appError(CHIP_ERROR_INTERNAL); |
| } |
| |
| SILABS_LOG("Starting FreeRTOS scheduler"); |
| vTaskStartScheduler(); |
| |
| // Should never get here. |
| chip::Platform::MemoryShutdown(); |
| SILABS_LOG("vTaskStartScheduler() failed"); |
| appError(CHIP_ERROR_INTERNAL); |
| } |