22 #include "goby/acomms/connect.h" 23 #include "goby/acomms/queue.h" 24 #include "goby/util/binary.h" 25 #include "on_demand.pb.h" 29 using goby::acomms::operator<<;
36 int main(
int argc,
char* argv[])
43 const int MY_MODEM_ID = 1;
44 cfg.set_modem_id(MY_MODEM_ID);
51 std::cout << q_manager << std::endl;
60 request_msg.set_max_frame_bytes(32);
61 request_msg.set_max_num_frames(1);
63 std::cout <<
"requesting data..." << std::endl;
64 std::cout <<
"request message:" << request_msg << std::endl;
68 std::cout <<
"data message: " << request_msg << std::endl;
69 std::cout <<
"\tdata as hex: " << goby::util::hex_encode(request_msg.frame(0)) << std::endl;
71 std::cout <<
"feeding the requested data back to the QueueManager as incoming... " << std::endl;
84 std::cout <<
"encoded on demand: " << msg << std::endl;
87 data_msg->CopyFrom(msg);
95 std::cout <<
"Received: " << msg << std::endl;
provides an API to the goby-acomms Queuing Library.
boost::signals2::signal< void(const protobuf::ModemTransmission &request_msg, google::protobuf::Message *data_msg)> signal_data_on_demand
Forwards the data request to the application layer. This advanced feature is used when queue...
boost::signals2::signal< void(const google::protobuf::Message &msg)> signal_receive
Signals when a DCCL message is received.
void handle_modem_data_request(protobuf::ModemTransmission *msg)
Finds data to send to the modem.
void add_queue(const protobuf::QueuedMessageEntry &queue_cfg)
Add a DCCL queue for use with QueueManager. Note that the queue must be added before receiving messag...
void handle_modem_receive(const protobuf::ModemTransmission &message)
Receive incoming data from the modem.
void connect(Signal *signal, Slot slot)
connect a signal to a slot (e.g. function pointer)
void set_cfg(const protobuf::QueueManagerConfig &cfg)
Set (and overwrite completely if present) the current configuration. (protobuf::QueueManagerConfig de...