RPC support in the example tool chef linux build (#18294)
Port RPC server enabled logic into example tool chef
the usage example:
$ ./chef.py -zbr -t linux -d lighting-app --pid 0x8000
diff --git a/examples/chef/linux/main.cpp b/examples/chef/linux/main.cpp
index 0335bbb..56b80dd 100644
--- a/examples/chef/linux/main.cpp
+++ b/examples/chef/linux/main.cpp
@@ -1,6 +1,7 @@
/*
*
* Copyright (c) 2020 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.
@@ -15,32 +16,29 @@
* limitations under the License.
*/
-#include <lib/shell/Engine.h>
+#include <AppMain.h>
-#include <lib/core/CHIPCore.h>
-#include <lib/support/Base64.h>
-#include <lib/support/CHIPArgParser.hpp>
-#include <lib/support/CodeUtils.h>
+#include <app-common/zap-generated/ids/Attributes.h>
+#include <app/ConcreteAttributePath.h>
#include <lib/support/logging/CHIPLogging.h>
+#include <lib/shell/Engine.h>
+
#include <ChipShellCollection.h>
-#include <lib/support/CHIPMem.h>
-#include <platform/CHIPDeviceLayer.h>
using namespace chip;
using namespace chip::Shell;
-int main()
+void ApplicationInit() {}
+
+int main(int argc, char * argv[])
{
- chip::Platform::MemoryInit();
- chip::DeviceLayer::PlatformMgr().InitChipStack();
- chip::DeviceLayer::PlatformMgr().StartEventLoopTask();
-#if CHIP_DEVICE_CONFIG_ENABLE_WPA
- chip::DeviceLayer::ConnectivityManagerImpl().StartWiFiManagement();
-#endif
+ if (ChipLinuxAppInit(argc, argv) != 0)
+ {
+ return -1;
+ }
const int rc = Engine::Root().Init();
-
if (rc != 0)
{
ChipLogError(Shell, "Streamer initialization failed: %d", rc);
@@ -55,6 +53,7 @@
cmd_app_server_init();
#endif
- Engine::Root().RunMainLoop();
+ ChipLinuxAppMainLoop();
+
return 0;
}