#include "goby/acomms/connect.h"
#include "goby/acomms/modem_driver.h"
#include "goby/common/logger.h"
#include "goby/util/binary.h"
#include <iostream>
using goby::acomms::operator<<;
int main(int argc, char* argv[])
{
if (argc < 3)
{
std::cout << "usage: driver_simple /dev/tty_of_modem modem_id [type: MMDriver "
"(default)|ABCDriver]"
<< std::endl;
return 1;
}
cfg.
set_serial_port(argv[1]);
using google::protobuf::uint32;
uint32 our_id = goby::util::as<uint32>(argv[2]);
cfg.
set_modem_id(our_id);
if (argc == 4)
{
if (boost::iequals(argv[3], "ABCDriver"))
{
std::cout << "Starting Example driver ABCDriver" << std::endl;
}
}
if (!driver)
{
std::cout << "Starting WHOI Micro-Modem MMDriver" << std::endl;
cfg.AddExtension(micromodem::protobuf::Config::nvram_cfg, "DQF,1");
}
transmit_message.
set_type(goby::acomms::protobuf::ModemTransmission::DATA);
transmit_message.
set_src(goby::util::as<unsigned>(our_id));
transmit_message.
set_rate(0);
transmit_message.
add_frame(
"Hello, world!");
transmit_message.
set_ack_requested(
false);
std::cout << transmit_message << std::endl;
int i = 0;
while (1)
{
++i;
if (!(i % 600))
usleep(100000);
}
delete driver;
return 0;
}
{
std::cout << "got a message: " << data_msg << std::endl;
}