Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangzp committed Mar 16, 2022
1 parent 3245c2a commit a8e8514
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
Binary file removed libPDK-PhasedCOTSArray.so
Binary file not shown.
21 changes: 13 additions & 8 deletions plugin-forwarder/UDPForwarderPlugin.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,25 @@
#include "boost/algorithm/string.hpp"

std::string UDPForwarderPlugin::getPluginName() {
return "Forwarder";
return "UDPForwarder";
}

std::string UDPForwarderPlugin::getPluginDescription() {
return "forward all received packets to the specified destination.";
}

std::vector<PicoScenesDeviceType> UDPForwarderPlugin::getSupportedDeviceTypes() {
static auto supportedDevices = std::vector<PicoScenesDeviceType>{PicoScenesDeviceType::IWL5300, PicoScenesDeviceType::QCA9300, PicoScenesDeviceType::IWLMVM_AX200, PicoScenesDeviceType::IWLMVM_AX210, PicoScenesDeviceType::VirtualSDR, PicoScenesDeviceType::USRP};
return supportedDevices;
}

void UDPForwarderPlugin::initialization() {
options = std::make_shared<po::options_description>("UDPForward Options");
options->add_options()
("forward-to", po::value<std::string>(), "Destination address and port, e.g., 192.168.10.1:50000");
}

std::shared_ptr<boost::program_options::options_description> UDPForwarderPlugin::pluginOptionsDescription() {
static auto options = std::make_shared<po::options_description>("Options for plugin " + this->getPluginName());
static std::once_flag onceFlag;
std::call_once(onceFlag, [&] {
options->add_options()
("forward-to", po::value<std::string>(), "Destination address and port, e.g., 192.168.10.1:50000");
});
return options;
}

Expand Down Expand Up @@ -48,4 +53,4 @@ void UDPForwarderPlugin::parseAndExecuteCommands(const std::string &commandStrin
void UDPForwarderPlugin::rxHandle(const ModularPicoScenesRxFrame &rxframe) {
auto frameBuffer = rxframe.toBuffer();
UDPService::getInstance("Forwarder" + destinationIP + std::to_string(destinationPort))->sendData(frameBuffer.data(), frameBuffer.size(), destinationIP, destinationPort);
}
}
5 changes: 5 additions & 0 deletions plugin-forwarder/UDPForwarderPlugin.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ public:

std::string pluginStatus() override;

std::vector<PicoScenesDeviceType> getSupportedDeviceTypes() override;

void initialization() override;

std::shared_ptr<boost::program_options::options_description> pluginOptionsDescription() override;

void parseAndExecuteCommands(const std::string &commandString) override;
Expand All @@ -30,6 +34,7 @@ public:
private:
std::string destinationIP{};
uint16_t destinationPort{0};
std::shared_ptr<po::options_description> options;
};

BOOST_DLL_ALIAS(UDPForwarderPlugin::create, initPicoScenesPlugin)
Expand Down

0 comments on commit a8e8514

Please sign in to comment.