mirror of
https://github.com/30hours/blah2.git
synced 2024-11-08 12:25:42 +00:00
Remove bridge networks for host as per #9 and tidy
This commit is contained in:
parent
f3c71a79f2
commit
1fee2cb4e7
5 changed files with 21 additions and 9 deletions
|
@ -25,7 +25,7 @@ services:
|
||||||
sh -c "/blah2/bin/blah2 -c config/config.yml"
|
sh -c "/blah2/bin/blah2 -c config/config.yml"
|
||||||
container_name: blah2
|
container_name: blah2
|
||||||
|
|
||||||
blah2_frontend:
|
blah2_web:
|
||||||
restart: always
|
restart: always
|
||||||
image: httpd:2.4
|
image: httpd:2.4
|
||||||
ports:
|
ports:
|
||||||
|
@ -40,7 +40,5 @@ services:
|
||||||
restart: always
|
restart: always
|
||||||
build: ./api
|
build: ./api
|
||||||
image: blah2_api
|
image: blah2_api
|
||||||
ports:
|
|
||||||
- 3000:8080
|
|
||||||
network_mode: host
|
network_mode: host
|
||||||
container_name: blah2-api
|
container_name: blah2-api
|
||||||
|
|
|
@ -61,7 +61,8 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
// setup capture
|
// setup capture
|
||||||
uint32_t fs, fc;
|
uint32_t fs, fc;
|
||||||
std::string type, path, replayFile;
|
uint16_t port_capture;
|
||||||
|
std::string type, path, replayFile, ip_capture;
|
||||||
bool saveIq, state, loop;
|
bool saveIq, state, loop;
|
||||||
tree["capture"]["fs"] >> fs;
|
tree["capture"]["fs"] >> fs;
|
||||||
tree["capture"]["fc"] >> fc;
|
tree["capture"]["fc"] >> fc;
|
||||||
|
@ -71,6 +72,8 @@ int main(int argc, char **argv)
|
||||||
tree["capture"]["replay"]["state"] >> state;
|
tree["capture"]["replay"]["state"] >> state;
|
||||||
tree["capture"]["replay"]["loop"] >> loop;
|
tree["capture"]["replay"]["loop"] >> loop;
|
||||||
tree["capture"]["replay"]["file"] >> replayFile;
|
tree["capture"]["replay"]["file"] >> replayFile;
|
||||||
|
tree["network"]["ip"] >> ip_capture;
|
||||||
|
tree["network"]["ports"]["api"] >> port_capture;
|
||||||
Capture *capture = new Capture(type, fs, fc, path);
|
Capture *capture = new Capture(type, fs, fc, path);
|
||||||
if (state)
|
if (state)
|
||||||
{
|
{
|
||||||
|
@ -85,7 +88,8 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
// run capture
|
// run capture
|
||||||
std::thread t1([&]{capture->process(buffer1, buffer2,
|
std::thread t1([&]{capture->process(buffer1, buffer2,
|
||||||
tree["capture"]["device"]);});
|
tree["capture"]["device"], ip_capture, port_capture);
|
||||||
|
});
|
||||||
|
|
||||||
// setup process CPI
|
// setup process CPI
|
||||||
double tCpi;
|
double tCpi;
|
||||||
|
|
|
@ -19,7 +19,8 @@ Capture::Capture(std::string _type, uint32_t _fs, uint32_t _fc, std::string _pat
|
||||||
saveIq = false;
|
saveIq = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Capture::process(IqData *buffer1, IqData *buffer2, c4::yml::NodeRef config)
|
void Capture::process(IqData *buffer1, IqData *buffer2, c4::yml::NodeRef config,
|
||||||
|
std::string ip_capture, uint16_t port_capture)
|
||||||
{
|
{
|
||||||
std::cout << "Setting up device " + type << std::endl;
|
std::cout << "Setting up device " + type << std::endl;
|
||||||
|
|
||||||
|
@ -29,7 +30,8 @@ void Capture::process(IqData *buffer1, IqData *buffer2, c4::yml::NodeRef config)
|
||||||
std::thread t1([&]{
|
std::thread t1([&]{
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
httplib::Client cli("http://127.0.0.1:3000");
|
httplib::Client cli("http://" + ip_capture + ":"
|
||||||
|
+ std::to_string(port_capture));
|
||||||
httplib::Result res = cli.Get("/capture");
|
httplib::Result res = cli.Get("/capture");
|
||||||
|
|
||||||
// if capture status changed
|
// if capture status changed
|
||||||
|
|
|
@ -59,8 +59,11 @@ public:
|
||||||
/// @param buffer1 Buffer for reference samples.
|
/// @param buffer1 Buffer for reference samples.
|
||||||
/// @param buffer2 Buffer for surveillance samples.
|
/// @param buffer2 Buffer for surveillance samples.
|
||||||
/// @param config Yaml config for device.
|
/// @param config Yaml config for device.
|
||||||
|
/// @param ip_capture IP address of capture API.
|
||||||
|
/// @param port_capture Port of capture API.
|
||||||
/// @return Void.
|
/// @return Void.
|
||||||
void process(IqData *buffer1, IqData *buffer2, c4::yml::NodeRef config);
|
void process(IqData *buffer1, IqData *buffer2, c4::yml::NodeRef config,
|
||||||
|
std::string ip_capture, uint16_t port_capture);
|
||||||
|
|
||||||
std::unique_ptr<Source> factory_source(const std::string& type,
|
std::unique_ptr<Source> factory_source(const std::string& type,
|
||||||
c4::yml::NodeRef config);
|
c4::yml::NodeRef config);
|
||||||
|
|
|
@ -6,7 +6,12 @@ const uint32_t Socket::MTU = 1024;
|
||||||
|
|
||||||
Socket::Socket(const std::string& ip, uint16_t port)
|
Socket::Socket(const std::string& ip, uint16_t port)
|
||||||
: endpoint(asio::ip::address::from_string(ip), port), socket(io_context) {
|
: endpoint(asio::ip::address::from_string(ip), port), socket(io_context) {
|
||||||
socket.connect(endpoint);
|
try {
|
||||||
|
socket.connect(endpoint);
|
||||||
|
} catch (const std::exception& e) {
|
||||||
|
std::cerr << "Error connecting to endpoint: " << e.what() << std::endl;
|
||||||
|
throw;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Socket::~Socket()
|
Socket::~Socket()
|
||||||
|
|
Loading…
Reference in a new issue