Skip to content

Commit

Permalink
[chip-tool] Move WebSocketServer code to src/app/tests/suites/server …
Browse files Browse the repository at this point in the history
…so it can be reused (#24617)
  • Loading branch information
vivien-apple authored and pull[bot] committed Oct 31, 2023
1 parent cf2a86b commit 4967602
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 9 deletions.
12 changes: 5 additions & 7 deletions examples/chip-tool/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ assert(chip_build_tools)
config("config") {
include_dirs = [
".",
"${chip_root}/examples/common",
"${chip_root}/zzz_generated/app-common/app-common",
"${chip_root}/zzz_generated/chip-tool",
"${chip_root}/src/lib",
Expand Down Expand Up @@ -87,13 +88,11 @@ static_library("chip-tool-utils") {
deps = []

if (config_use_interactive_mode) {
sources += [
"commands/interactive/InteractiveCommands.cpp",
"commands/interactive/WebSocketServer.cpp",
"commands/interactive/WebSocketServer.h",
"commands/interactive/WebSocketServerDelegate.h",
sources += [ "commands/interactive/InteractiveCommands.cpp" ]
deps += [
"${chip_root}/examples/common/websocket-server",
"${editline_root}:editline",
]
deps += [ "${editline_root}:editline" ]
}

if (config_enable_yaml_tests) {
Expand All @@ -116,7 +115,6 @@ static_library("chip-tool-utils") {
"${chip_root}/src/platform",
"${chip_root}/third_party/inipp",
"${chip_root}/third_party/jsoncpp",
"${chip_root}/third_party/libwebsockets",
]

public_configs = [ ":config" ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "../common/CHIPCommand.h"
#include "../common/Commands.h"

#include "WebSocketServer.h"
#include <websocket-server/WebSocketServer.h>

class Commands;

Expand Down
31 changes: 31 additions & 0 deletions examples/common/websocket-server/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright (c) 2023 Project CHIP Authors
#
# 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.

import("//build_overrides/build.gni")
import("//build_overrides/chip.gni")

static_library("websocket-server") {
output_name = "libWebSocketServer"

sources = [
"WebSocketServer.cpp",
"WebSocketServer.h",
"WebSocketServerDelegate.h",
]

public_deps = [
"${chip_root}/src/lib/support",
"${chip_root}/third_party/libwebsockets",
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "WebSocketServer.h"

#include <lib/support/ScopedBuffer.h>
#include <libwebsockets.h>

constexpr uint16_t kDefaultWebSocketServerPort = 9002;
constexpr uint16_t kMaxMessageBufferLen = 8192;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

#include <lib/core/Optional.h>
#include <lib/support/CHIPMem.h>
#include <libwebsockets.h>

class WebSocketServer
{
Expand Down

0 comments on commit 4967602

Please sign in to comment.