Skip to content

Commit

Permalink
Update Mbed shell application to update ongoing refactoring on master.
Browse files Browse the repository at this point in the history
Update according to changes to project-chip#6765 .
  • Loading branch information
pan- committed Jun 17, 2021
1 parent c598b1a commit 41ccb82
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
3 changes: 0 additions & 3 deletions examples/shell/mbed/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,8 @@ target_include_directories(${APP_TARGET} PRIVATE
${APP_ROOT}/shell_common/include)

target_sources(${APP_TARGET} PRIVATE
${APP_ROOT}/shell_common/cmd_base64.cpp
${APP_ROOT}/shell_common/cmd_device.cpp
${APP_ROOT}/shell_common/cmd_misc.cpp
${APP_ROOT}/shell_common/cmd_otcli.cpp
${APP_ROOT}/shell_common/cmd_btp.cpp
${CMAKE_CURRENT_SOURCE_DIR}/cmd_mbed_utils.cpp
${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
)
Expand Down
16 changes: 11 additions & 5 deletions examples/shell/mbed/cmd_mbed_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

#include <lib/shell/shell_core.h>
#include <lib/shell/Engine.h>

#include <lib/core/CHIPCore.h>
#include <lib/support/CHIPArgParser.hpp>
Expand All @@ -38,6 +38,9 @@
#include <transport/raw/TCP.h>
#include <transport/raw/UDP.h>

#include <messaging/ExchangeContext.h>

#include <protocols/secure_channel/MessageCounterManager.h>
#include <protocols/secure_channel/PASESession.h>
#include <rtos/EventFlags.h>

Expand Down Expand Up @@ -800,7 +803,8 @@ int cmd_server_on(int argc, char ** argv)
{
CHIP_ERROR error = CHIP_NO_ERROR;
INET_ERROR err;
const AdminId gAdminId = 0;
const AdminId gAdminId = 0;
secure_channel::MessageCounterManager gMessageCounterManager;
AdminPairingInfo * adminInfo = nullptr;
Optional<Transport::PeerAddress> peer(Transport::Type::kUndefined);

Expand Down Expand Up @@ -860,7 +864,8 @@ int cmd_server_on(int argc, char ** argv)
ExitNow(error = err;);
}

err = gChipServer.sessionManager->Init(chip::kTestDeviceNodeId, &DeviceLayer::SystemLayer, gChipServer.udp, &gAdmin);
err = gChipServer.sessionManager->Init(chip::kTestDeviceNodeId, &DeviceLayer::SystemLayer, gChipServer.udp, &gAdmin,
&gMessageCounterManager);
if (err != INET_NO_ERROR)
{
streamer_printf(sout, "ERROR: Session manager intialization failed\r\n");
Expand All @@ -884,7 +889,8 @@ int cmd_server_on(int argc, char ** argv)
ExitNow(error = err;);
}

err = gChipServer.sessionManager->Init(chip::kTestDeviceNodeId, &DeviceLayer::SystemLayer, gChipServer.tcp, &gAdmin);
err = gChipServer.sessionManager->Init(chip::kTestDeviceNodeId, &DeviceLayer::SystemLayer, gChipServer.tcp, &gAdmin,
&gMessageCounterManager);
if (err != INET_NO_ERROR)
{
streamer_printf(sout, "ERROR: Session manager intialization failed\r\n");
Expand All @@ -895,7 +901,7 @@ int cmd_server_on(int argc, char ** argv)
gChipServer.sessionManager->SetDelegate(&gCallbacks);

err = gChipServer.sessionManager->NewPairing(peer, chip::kTestControllerNodeId, &gTestPairing,
chip::SecureSessionMgr::PairingDirection::kResponder, gAdminId);
chip::SecureSession::SessionRole::kResponder, gAdminId);
if (err != INET_NO_ERROR)
{
streamer_printf(sout, "ERROR: set new pairing failed\r\n");
Expand Down
11 changes: 7 additions & 4 deletions examples/shell/mbed/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

#include <lib/shell/shell_core.h>
#include <lib/shell/Engine.h>

#include <lib/core/CHIPCore.h>
#include <lib/support/Base64.h>
Expand All @@ -30,12 +30,18 @@

#include "ChipShellMbedCollection.h"
#include <ChipShellCollection.h>
#include <lib/support/CHIPMem.h>
#include <platform/CHIPDeviceLayer.h>

using namespace chip;
using namespace chip::Shell;

int main()
{
chip::Platform::MemoryInit();
chip::DeviceLayer::PlatformMgr().InitChipStack();
chip::DeviceLayer::PlatformMgr().StartEventLoopTask();

// Initialize the default streamer that was linked.
const int rc = streamer_init(streamer_get());

Expand All @@ -52,9 +58,6 @@ int main()
#endif

cmd_misc_init();
cmd_base64_init();
cmd_device_init();
cmd_btp_init();
cmd_otcli_init();
cmd_mbed_utils_init();

Expand Down
2 changes: 1 addition & 1 deletion src/lib/shell/streamer_mbed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* Source implementation of an input / output stream for stdio targets.
*/

#include "shell_core.h"
#include <lib/shell/streamer.h>

#include <signal.h>
#include <stdio.h>
Expand Down

0 comments on commit 41ccb82

Please sign in to comment.