26 #include "goby/acomms/connect.h" 27 #include "goby/acomms/modem_driver.h" 28 #include "goby/common/logger.h" 32 using goby::acomms::operator<<;
36 std::cout <<
"usage: whoi_ranging /dev/tty_of_modem narrowband|remus max_range_meters" 43 int main(
int argc,
char* argv[])
48 std::string type = argv[2];
49 if (type !=
"narrowband" && type !=
"remus")
62 cfg.set_serial_port(argv[1]);
63 using google::protobuf::uint32;
66 cfg.set_modem_id(our_id);
72 cfg.MutableExtension(micromodem::protobuf::Config::remus_lbl);
74 remus_params->set_turnaround_ms(50);
76 remus_params->set_enable_beacons(0x0F);
77 remus_params->set_lbl_max_range(goby::util::as<unsigned>(argv[3]));
79 else if (type ==
"narrowband")
83 cfg.MutableExtension(micromodem::protobuf::Config::narrowband_lbl);
85 narrowband_params->set_turnaround_ms(20);
86 narrowband_params->set_transmit_freq(26000);
87 narrowband_params->set_transmit_ping_ms(5);
88 narrowband_params->set_receive_ping_ms(5);
89 narrowband_params->add_receive_freq(25000);
90 narrowband_params->set_transmit_flag(
true);
91 narrowband_params->set_lbl_max_range(goby::util::as<unsigned>(argv[3]));
106 request_msg.set_src(our_id);
107 request_msg.set_type(goby::acomms::protobuf::ModemTransmission::DRIVER_SPECIFIC);
108 request_msg.SetExtension(micromodem::protobuf::type,
110 ? micromodem::protobuf::MICROMODEM_REMUS_LBL_RANGING
111 : micromodem::protobuf::MICROMODEM_NARROWBAND_LBL_RANGING);
113 std::cout <<
"Sending " << type <<
" LBL ranging request:\n" << request_msg << std::endl;
133 std::cout <<
"Sending " << type <<
" LBL ranging request:\n" 134 << request_msg << std::endl;
145 std::cout <<
"Received LBL ranging reply:\n" << reply_msg << std::endl;
void set_name(const std::string &s)
Set the name of the application that the logger is serving.
google::protobuf::uint32 uint32
an unsigned 32 bit integer
void handle_initiate_transmission(const protobuf::ModemTransmission &m)
See ModemDriverBase::handle_initiate_transmission()
provides an API to the WHOI Micro-Modem driver
boost::signals2::signal< void(const protobuf::ModemTransmission &message)> signal_receive
Called when a binary data transmission is received from the modem.
void do_work()
See ModemDriverBase::do_work()
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.
void startup(const protobuf::DriverConfig &cfg)
Starts the driver.
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...