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( )
}
};
std::string method_type, method, local_ip, remote_ip; //no need to initialize to empty (it's default)
int local_port=0, remote_port=0, num_channels=0;
lf_AssignString( "method_type", method_type );
if( method_type == "stream" )
auto is_number = [] (const std::string& s)
{
lf_AssignString( "method", method );
lf_AssignString( "local_ip", local_ip );
lf_AssignString( "remote_ip", remote_ip );
lf_AssignInt( "local_port", local_port );
lf_AssignInt( "remote_port", remote_port );
lf_AssignInt( "num_channels", num_channels );
json jmsg;
jmsg["method"] = method;
jmsg["local_ip"] = local_ip;
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);
return !s.empty() && std::find_if(s.begin(), s.end(), [](char c) { return !std::isdigit(c); }) == s.end();
};
json jmsg;
for(auto &i : m_Method.m_Parameters){
if( is_number(i.second) ){
jmsg[i.first] = std::stoi(i.second);
}
else{
jmsg[i.first] = i.second;
}
}
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
{
......
......@@ -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)
int local_port=0, remote_port=0, num_channels=0;
lf_AssignString( "method_type", method_type );
if( method_type == "stream" )
auto is_number = [] (const std::string& s)
{
lf_AssignString( "method", method );
lf_AssignString( "local_ip", local_ip );
lf_AssignString( "remote_ip", remote_ip );
lf_AssignInt( "local_port", local_port );
lf_AssignInt( "remote_port", remote_port );
lf_AssignInt( "num_channels", num_channels );
json jmsg;
jmsg["method"] = method;
jmsg["local_ip"] = local_ip;
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);
return !s.empty() && std::find_if(s.begin(), s.end(), [](char c) { return !std::isdigit(c); }) == s.end();
};
json jmsg;
for(auto &i : m_Method.m_Parameters){
if( is_number(i.second) ){
jmsg[i.first] = std::stoi(i.second);
}
else{
jmsg[i.first] = i.second;
}
}
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
{
InitCapsules( );
InitTransports( );
}
}
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