Line data Source code
1 : #include "bus.hpp" 2 : 3 : 4 27 : Bus::Bus(const std::string& bus_dir, const std::string& bus_group, int dmaid, bool verbose) 5 54 : : m_felix_bus_path{"dma-" + std::to_string(dmaid)}, m_bus(bus_dir, bus_group, verbose) 6 27 : { } 7 : 8 : 9 0 : Bus::Bus(const std::string& bus_dir, const std::string& bus_group, const std::string& filename, bool verbose) 10 0 : : m_felix_bus_path{filename}, m_bus(bus_dir, bus_group, verbose) 11 0 : { } 12 : 13 : 14 29 : bool Bus::publish(const std::vector<Elink> &elinks, 15 : const std::string &ip, uint32_t port, 16 : uint32_t num_pages, uint32_t page_size, 17 : bool pubsub, bool unbuffered) 18 : { 19 70 : for(auto& e : elinks){ 20 41 : felixbus::FelixBusInfo info; 21 41 : info.fid = e.fid; 22 41 : info.pubsub = pubsub; 23 41 : info.stream = e.has_streams; 24 41 : info.unbuffered = unbuffered; 25 41 : info.ip = ip; 26 41 : info.port = port; 27 41 : info.netio_pages = num_pages; 28 41 : info.netio_pagesize = page_size; 29 41 : info.raw_tcp = false; 30 41 : try { 31 41 : m_bus.publish(e.fid, m_felix_bus_path, info); 32 : } 33 0 : catch (std::exception& ex){ 34 0 : LOG_ERR("%s", ex.what()); 35 0 : return false; 36 0 : } 37 41 : } 38 : return true; 39 : }