24 #include "goby/acomms/acomms_helpers.h" 25 #include "goby/acomms/connect.h" 26 #include "goby/acomms/modemdriver/udp_driver.h" 27 #include "goby/common/logger.h" 28 #include "goby/util/binary.h" 36 boost::asio::io_service io1;
37 boost::shared_ptr<goby::acomms::UDPDriver> driver1;
44 int main(
int argc,
char* argv[])
51 std::cerr <<
"Usage: test_udpdriver2 remote_addr remote_port remote_id local_port local_id " 57 std::string remote_addr = argv[1];
58 int remote_port = as<int>(argv[2]);
59 int remote_id = as<int>(argv[3]);
60 int local_port = as<int>(argv[4]);
61 int local_id = as<int>(argv[5]);
63 bool is_quiet =
false;
65 is_quiet = as<bool>(argv[6]);
73 cfg1.set_modem_id(local_id);
77 local_endpoint1->set_port(local_port);
81 remote_endpoint1->set_ip(remote_addr);
82 remote_endpoint1->set_port(remote_port);
91 driver1->startup(cfg1);
94 while (((i / 10) < 1))
102 goby::glog << group(
"test") <<
"Test 1" << std::endl;
106 transmit.set_type(protobuf::ModemTransmission::DATA);
107 transmit.set_src(local_id);
108 transmit.set_dest(remote_id);
109 transmit.set_rate(0);
110 transmit.set_ack_requested(
true);
118 if ((i % 100 == 0) && !is_quiet)
119 driver1->handle_initiate_transmission(transmit);
125 goby::glog << group(
"test") <<
"all tests passed" << std::endl;
130 goby::glog << group(
"driver1") <<
"Data request: " << *msg << std::endl;
133 msg->add_frame(std::string(32, i++ % 256));
135 goby::glog << group(
"driver1") <<
"Post data request: " << *msg << std::endl;
140 goby::glog << group(
"driver1") <<
"Can modify: " << *msg << std::endl;
145 goby::glog << group(
"driver1") <<
"Completed transmit: " << msg << std::endl;
150 goby::glog << group(
"driver1") <<
"Received: " << msg << std::endl;
void set_name(const std::string &s)
Set the name of the application that the logger is serving.
ReturnType goby_time()
Returns current UTC time as a boost::posix_time::ptime.
void connect(Signal *signal, Slot slot)
connect a signal to a slot (e.g. function pointer)
common::FlexOstream glog
Access the Goby logger through this object.
Objects pertaining to acoustic communications (acomms)
void add_stream(logger::Verbosity verbosity=logger::VERBOSE, std::ostream *os=0)
Attach a stream object (e.g. std::cout, std::ofstream, ...) to the logger with desired verbosity...