-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
36a4fea
commit c9b6e0c
Showing
5 changed files
with
140 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* | ||
* Copyright (c) 2020-2022 Project CHIP Authors | ||
* Copyright (c) 2019-2020 Google LLC. | ||
* Copyright (c) 2013-2018 Nest Labs, Inc. | ||
* 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 | ||
* Implementation of the native methods expected by the Python | ||
* version of Chip Device Manager. | ||
* | ||
*/ | ||
|
||
#include <controller/python/CommonStackInit.h> | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
#include <system/SystemError.h> | ||
#include <system/SystemLayer.h> | ||
|
||
#include <lib/support/CHIPMem.h> | ||
#include <lib/support/CodeUtils.h> | ||
#include <lib/support/ScopedBuffer.h> | ||
#include <lib/support/logging/CHIPLogging.h> | ||
#include <platform/CHIPDeviceLayer.h> | ||
|
||
namespace chip { | ||
namespace Controller { | ||
namespace Python { | ||
|
||
CHIP_ERROR CommonStackInit() | ||
{ | ||
ReturnErrorOnFailure(chip::Platform::MemoryInit()); | ||
ReturnErrorOnFailure(chip::DeviceLayer::PlatformMgr().InitChipStack()); | ||
return CHIP_NO_ERROR; | ||
} | ||
|
||
void CommonStackShutdown() | ||
{ | ||
chip::DeviceLayer::PlatformMgr().Shutdown(); | ||
|
||
#if 0 // | ||
// We cannot actually call this because the destructor for the MdnsContexts singleton on Darwin only gets called | ||
// on termination of the program, and that unfortunately makes a bunch of Platform::MemoryFree calls. | ||
// | ||
chip::Platform::MemoryShutdown(); | ||
#endif | ||
} | ||
|
||
} // namespace Python | ||
} // namespace Controller | ||
} // namespace chip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* | ||
* Copyright (c) 2020-2022 Project CHIP Authors | ||
* Copyright (c) 2019-2020 Google LLC. | ||
* Copyright (c) 2013-2018 Nest Labs, Inc. | ||
* 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 | ||
* Implementation of the native methods expected by the Python | ||
* version of Chip Device Manager. | ||
* | ||
*/ | ||
#include <lib/core/CHIPError.h> | ||
|
||
namespace chip { | ||
namespace Controller { | ||
namespace Python { | ||
|
||
// | ||
// This encapsulates stack initialization logic that is common to both | ||
// controller and server initialization sequences. | ||
// | ||
CHIP_ERROR CommonStackInit(); | ||
|
||
// | ||
// This encapsulates stack shutdown logic that is common to both | ||
// controller and server shutdown sequences. | ||
// | ||
void CommonStackShutdown(); | ||
|
||
} // namespace Python | ||
} // namespace Controller | ||
} // namespace chip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters