Skip to content
Snippets Groups Projects
Commit 9d7bd89e authored by Wang, Ruonan's avatar Wang, Ruonan
Browse files

changed DataMan engine to send arbitrary parameters to DataMan library

parent 31a553c7
No related branches found
No related tags found
1 merge request!8Integrate groupless
...@@ -143,30 +143,27 @@ void DataManReader::Init( ) ...@@ -143,30 +143,27 @@ void DataManReader::Init( )
} }
}; };
std::string method_type, method, local_ip, remote_ip; //no need to initialize to empty (it's default) auto is_number = [] (const std::string& s)
int local_port=0, remote_port=0, num_channels=0;
lf_AssignString( "method_type", method_type );
if( method_type == "stream" )
{ {
lf_AssignString( "method", method ); return !s.empty() && std::find_if(s.begin(), s.end(), [](char c) { return !std::isdigit(c); }) == s.end();
lf_AssignString( "local_ip", local_ip ); };
lf_AssignString( "remote_ip", remote_ip );
lf_AssignInt( "local_port", local_port ); json jmsg;
lf_AssignInt( "remote_port", remote_port ); for(auto &i : m_Method.m_Parameters){
lf_AssignInt( "num_channels", num_channels ); if( is_number(i.second) ){
jmsg[i.first] = std::stoi(i.second);
json jmsg; }
jmsg["method"] = method; else{
jmsg["local_ip"] = local_ip; jmsg[i.first] = i.second;
jmsg["remote_ip"] = remote_ip; }
jmsg["local_port"] = local_port;
jmsg["remote_port"] = remote_port;
jmsg["num_channels"] = num_channels;
jmsg["stream_mode"] = "receiver";
m_Man.add_stream(jmsg);
} }
jmsg["stream_mode"] = "receiver";
m_Man.add_stream(jmsg);
std::string method_type;
int num_channels=0;
lf_AssignString( "method_type", method_type );
lf_AssignInt( "num_channels", num_channels );
} }
else else
{ {
......
...@@ -198,37 +198,33 @@ void DataManWriter::Init( ) ...@@ -198,37 +198,33 @@ void DataManWriter::Init( )
} }
}; };
std::string method_type, method, local_ip, remote_ip; //no need to initialize to empty (it's default) auto is_number = [] (const std::string& s)
int local_port=0, remote_port=0, num_channels=0;
lf_AssignString( "method_type", method_type );
if( method_type == "stream" )
{ {
lf_AssignString( "method", method ); return !s.empty() && std::find_if(s.begin(), s.end(), [](char c) { return !std::isdigit(c); }) == s.end();
lf_AssignString( "local_ip", local_ip ); };
lf_AssignString( "remote_ip", remote_ip );
lf_AssignInt( "local_port", local_port ); json jmsg;
lf_AssignInt( "remote_port", remote_port ); for(auto &i : m_Method.m_Parameters){
lf_AssignInt( "num_channels", num_channels ); if( is_number(i.second) ){
jmsg[i.first] = std::stoi(i.second);
json jmsg; }
jmsg["method"] = method; else{
jmsg["local_ip"] = local_ip; jmsg[i.first] = i.second;
jmsg["remote_ip"] = remote_ip; }
jmsg["local_port"] = local_port;
jmsg["remote_port"] = remote_port;
jmsg["num_channels"] = num_channels;
jmsg["stream_mode"] = "sender";
m_Man.add_stream(jmsg);
} }
jmsg["stream_mode"] = "sender";
m_Man.add_stream(jmsg);
std::string method_type;
int num_channels=0;
lf_AssignString( "method_type", method_type );
lf_AssignInt( "num_channels", num_channels );
} }
else else
{ {
InitCapsules( ); InitCapsules( );
InitTransports( ); InitTransports( );
} }
} }
void DataManWriter::InitCapsules( ) void DataManWriter::InitCapsules( )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment