Skip to content

Commit

Permalink
Revert "[android] replace VendorServer with OtDaemonServer (#1967)" (#…
Browse files Browse the repository at this point in the history
…1995)

This reverts commit 300cfed.

Change-Id: Ic8694b97ddb4125599314769361ea10d483b01cc
  • Loading branch information
wgtdkp committed Sep 4, 2023
1 parent 869d62c commit 19cca1b
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/agent/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ add_executable(otbr-agent
application.cpp
main.cpp
uris.hpp
vendor.hpp
)

target_link_libraries(otbr-agent PRIVATE
Expand Down
8 changes: 4 additions & 4 deletions src/agent/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ Application::Application(const std::string &aInterfaceName,
#if OTBR_ENABLE_DBUS_SERVER && OTBR_ENABLE_BORDER_AGENT
, mDBusAgent(mNcp, mBorderAgent.GetPublisher())
#endif
#if OTBR_ENABLE_ANDROID_OTDAEMON_SERVER
, mOtDaemonServer(ndk::SharedRefBase::make<Android::OtDaemonServer>())
#if OTBR_ENABLE_VENDOR_SERVER
, mVendorServer(mNcp)
#endif
{
OTBR_UNUSED_VARIABLE(aRestListenAddress);
Expand All @@ -103,8 +103,8 @@ void Application::Init(void)
#if OTBR_ENABLE_DBUS_SERVER
mDBusAgent.Init();
#endif
#if OTBR_ENABLE_ANDROID_OTDAEMON_SERVER
mOtDaemonServer->InitOrDie(&mNcp);
#if OTBR_ENABLE_VENDOR_SERVER
mVendorServer.Init();
#endif
}

Expand Down
8 changes: 4 additions & 4 deletions src/agent/application.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@
#if OTBR_ENABLE_OPENWRT
#include "openwrt/ubus/otubus.hpp"
#endif
#if OTBR_ENABLE_ANDROID_OTDAEMON_SERVER
#include "android/otdaemon_server.hpp"
#if OTBR_ENABLE_VENDOR_SERVER
#include "agent/vendor.hpp"
#endif
#include "utils/infra_link_selector.hpp"

Expand Down Expand Up @@ -146,8 +146,8 @@ class Application : private NonCopyable
#if OTBR_ENABLE_DBUS_SERVER
DBus::DBusAgent mDBusAgent;
#endif
#if OTBR_ENABLE_ANDROID_OTDAEMON_SERVER
std::shared_ptr<Android::OtDaemonServer> mOtDaemonServer;
#if OTBR_ENABLE_VENDOR_SERVER
vendor::VendorServer mVendorServer;
#endif

static std::atomic_bool sShouldTerminate;
Expand Down
69 changes: 69 additions & 0 deletions src/agent/vendor.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
* Copyright (c) 2021, The OpenThread Authors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/

/**
* @file
* This file includes definitions of the vendor server. The implementation of the
* vendor server should be implemented by users.
*/
#ifndef OTBR_AGENT_VENDOR_HPP_
#define OTBR_AGENT_VENDOR_HPP_

#include "openthread-br/config.h"

#include "ncp/ncp_openthread.hpp"

namespace otbr {
namespace vendor {

class VendorServer
{
public:
/**
* The constructor of vendor server.
*
* @param[in] aNcp A reference to the NCP controller.
*
*/
VendorServer(otbr::Ncp::ControllerOpenThread &aNcp)
: mNcp(aNcp)
{
}

/**
* This method initializes the vendor server.
*
*/
void Init(void);

private:
otbr::Ncp::ControllerOpenThread &mNcp;
};
} // namespace vendor
} // namespace otbr
#endif // OTBR_AGENT_VENDOR_HPP_

0 comments on commit 19cca1b

Please sign in to comment.