four_multi
Multi-Antenna,Multi-Node,Multi-Band,Multi-Cell
core/get_usrp2_ip_addr.cpp
00001 //
00002 // Copyright 2011-2013, Per Zetterberg, KTH Royal Institute of Technology
00003 //
00004 // This program is free software: you can redistribute it and/or modify
00005 // it under the terms of the GNU General Public License as published by
00006 // the Free Software Foundation, either version 3 of the License, or
00007 // (at your option) any later version.
00008 //
00009 // This program is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 // GNU General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU General Public License
00015 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016 //
00017 
00018 
00019 #include <fstream> 
00020 #include "get_usrp2_ip_addr.hpp"
00021 
00022 
00023 
00024 std::string get_usrp2_ip_addr(uint32_t nchan) {
00025   char *temp_str;
00026   std::string IP_addresses;
00027   std::stringstream temp_ss;
00028 
00029     temp_str=getenv ("USRP_IP");
00030     uhd::device_addr_t dev_addr;
00031 
00032     if (temp_str==0) {
00033         IP_addresses="192.168.10.2";
00034         for (uint32_t i1=1;i1<nchan;i1++) {
00035           temp_ss << (i1+1)*10;
00036           IP_addresses+=" 192.168."+temp_ss.str()+".2";
00037           temp_ss.str("");
00038        }
00039    }
00040    else {
00041       IP_addresses=temp_str;
00042    };
00043 
00044     return IP_addresses;
00045 
00046 }
 All Classes Functions Variables