Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove extra build constructs and update against the latest system AP…
Browse files Browse the repository at this point in the history
…I changes
yufengwangca authored and restyled-io[bot] committed Dec 2, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent ccef55c commit 4156141
Showing 11 changed files with 16 additions and 76 deletions.
2 changes: 2 additions & 0 deletions BUILD.gn
Original file line number Diff line number Diff line change
@@ -64,6 +64,8 @@ if (current_toolchain != "${dir_pw_toolchain}/dummy:dummy") {
if (chip_build_tools) {
deps += [
"${chip_root}/examples/shell/standalone:chip-shell",
"${chip_root}/src/messaging/tests/echo:chip-echo-requester",
"${chip_root}/src/messaging/tests/echo:chip-echo-responder",
"${chip_root}/src/qrcodetool",
"${chip_root}/src/setup_payload",
]
23 changes: 0 additions & 23 deletions src/messaging/tests/echo/.gn

This file was deleted.

5 changes: 2 additions & 3 deletions src/messaging/tests/echo/README.md
Original file line number Diff line number Diff line change
@@ -22,9 +22,8 @@ transport (TCP, UDP, or CRMP).
## Building

```
cd echo
git submodule update --init
source third_party/connectedhomeip/scripts/activate.sh
source scripts/activate.sh
cd src/messaging/tests/echo
gn gen out/debug
ninja -C out/debug
```
17 changes: 0 additions & 17 deletions src/messaging/tests/echo/args.gni

This file was deleted.

1 change: 0 additions & 1 deletion src/messaging/tests/echo/build

This file was deleted.

1 change: 0 additions & 1 deletion src/messaging/tests/echo/build_overrides

This file was deleted.

2 changes: 1 addition & 1 deletion src/messaging/tests/echo/common.cpp
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@
#include <support/ErrorStr.h>

// The ExchangeManager global object.
ExchangeManager gExchangeManager;
Messaging::ExchangeManager gExchangeManager;

void InitializeChip(void)
{
2 changes: 1 addition & 1 deletion src/messaging/tests/echo/common.h
Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@ using namespace chip;
constexpr chip::NodeId kClientDeviceId = 12344321;
constexpr chip::NodeId kServerDeviceId = 12344322;

extern ExchangeManager gExchangeManager;
extern Messaging::ExchangeManager gExchangeManager;

void InitializeChip(void);
void ShutdownChip(void);
36 changes: 9 additions & 27 deletions src/messaging/tests/echo/echo_requester.cpp
Original file line number Diff line number Diff line change
@@ -77,49 +77,31 @@ bool EchoIntervalExpired(void)
return (Now() >= gLastEchoTime + gEchoInterval);
}

System::PacketBuffer * FormulateEchoRequestBuffer()
CHIP_ERROR SendEchoRequest(void)
{
System::PacketBufferHandle buffer = System::PacketBuffer::New();
CHIP_ERROR err = CHIP_NO_ERROR;
System::PacketBufferHandle payloadBuf = System::PacketBuffer::New();

if (buffer.IsNull())
if (payloadBuf.IsNull())
{
printf("Unable to allocate PacketBuffer\n");
return nullptr;
return CHIP_ERROR_NO_MEMORY;
}
else
{
// Add some application payload data in the buffer.
char * p = reinterpret_cast<char *>(buffer->Start());
char * p = reinterpret_cast<char *>(payloadBuf->Start());
int32_t len = snprintf(p, CHIP_SYSTEM_CONFIG_HEADER_RESERVE_SIZE, "Echo Message %" PRIu64 "\n", gEchoCount);

// Set the datalength in the buffer appropriately.
buffer->SetDataLength((uint16_t) len);

return buffer.Release_ForNow();
payloadBuf->SetDataLength((uint16_t) len);
}
}

CHIP_ERROR SendEchoRequest(void)
{
CHIP_ERROR err = CHIP_NO_ERROR;
System::PacketBuffer * payloadBuf = NULL;

gLastEchoTime = Now();

payloadBuf = FormulateEchoRequestBuffer();
if (payloadBuf == NULL)
{
return CHIP_ERROR_NO_MEMORY;
}

printf("\nSend echo request message to Node: %lu\n", kServerDeviceId);

err = gEchoClient.SendEchoRequest(kServerDeviceId, payloadBuf);

// Set the local buffer to NULL after passing it down to
// the lower layers who are now responsible for freeing
// the buffer.
payloadBuf = NULL;
err = gEchoClient.SendEchoRequest(kServerDeviceId, std::move(payloadBuf));

if (err == CHIP_NO_ERROR)
{
@@ -161,7 +143,7 @@ CHIP_ERROR EstablishSecureSession()
return err;
}

void HandleEchoResponseReceived(NodeId nodeId, System::PacketBuffer * payload)
void HandleEchoResponseReceived(NodeId nodeId, System::PacketBufferHandle payload)
{
uint32_t respTime = Now();
uint32_t transitTime = respTime - gLastEchoTime;
2 changes: 1 addition & 1 deletion src/messaging/tests/echo/echo_responder.cpp
Original file line number Diff line number Diff line change
@@ -41,7 +41,7 @@ SecureSessionMgr gSessionManager;
SecurePairingUsingTestSecret gTestPairing;

// Callback handler when a CHIP EchoRequest is received.
void HandleEchoRequestReceived(NodeId nodeId, System::PacketBuffer * payload)
void HandleEchoRequestReceived(NodeId nodeId, System::PacketBufferHandle payload)
{
printf("Echo Request from node %lu, len=%u ... sending response.\n", nodeId, payload->DataLength());
}
1 change: 0 additions & 1 deletion src/messaging/tests/echo/third_party/connectedhomeip

This file was deleted.

0 comments on commit 4156141

Please sign in to comment.