diff --git a/grc/gen_osmosdr_blocks.py b/grc/gen_osmosdr_blocks.py index 1af1009..2e496d6 100644 --- a/grc/gen_osmosdr_blocks.py +++ b/grc/gen_osmosdr_blocks.py @@ -115,7 +115,7 @@ of devices. If left blank, the first device found will be used. Examples (some arguments may be optional): fcd=0 rtl=0,rtl_xtal=28.80001e6,tuner_xtal=26e6,buffers=64 ... - rtl_tcp=host=127.0.0.1,port=1234,psize=16384 + rtl_tcp=127.0.0.1:1234,psize=16384 uhd=0|name,mcr=52e6,nchan=2,subdev='\\\\'B:0 A:0'\\\\' ... osmosdr=0|name,mcr=64e6,nchan=5,port=/dev/ttyUSB0 ... file=/path/to/file.ext,freq=428e6,rate=1e6,repeat=true,throttle=true ... diff --git a/lib/rtl_tcp/rtl_tcp_source_c.cc b/lib/rtl_tcp/rtl_tcp_source_c.cc index 059e99f..5bb13e0 100644 --- a/lib/rtl_tcp/rtl_tcp_source_c.cc +++ b/lib/rtl_tcp/rtl_tcp_source_c.cc @@ -23,6 +23,7 @@ #include #include +#include #include #include @@ -56,11 +57,16 @@ rtl_tcp_source_c::rtl_tcp_source_c(const std::string &args) : dict_t dict = params_to_dict(args); - if (dict.count("host")) - host = dict["host"]; + if (dict.count("rtl_tcp")) { + std::vector< std::string > tokens; + boost::algorithm::split( tokens, dict["rtl_tcp"], boost::is_any_of(":") ); - if (dict.count("port")) - port = boost::lexical_cast< unsigned short >( dict["port"] ); + if ( tokens[0].length() && (tokens.size() == 1 || tokens.size() == 2 ) ) + host = tokens[0]; + + if ( tokens.size() == 2 ) // port given + port = boost::lexical_cast< unsigned short >( tokens[1] ); + } if (dict.count("psize")) payload_size = boost::lexical_cast< int >( dict["psize"] );