How to send multiple frames with one transmission

Asked by Laszlo Techy

I have looked at the example code in driver_simple, and put together some code that would send messages between the Micromodems. When I assemble a goby::acomms::protobuf::ModemTransmission message, and add several frames to be sent over the Micromodem, it seems that a single call to handle_initiate_transmission only sends the data frame at index 0. I would expect the driver to send all frames that haven't been sent yet. Is there something I am missing?

acomms.transmit_message.set_type(goby::acomms::protobuf::ModemTransmission::DATA);// goby 2.0
acomms.transmit_message.set_src(goby::util::as<unsigned>(acomms.our_id));// goby 2.0
acomms.transmit_message.set_dest(goby::util::as<unsigned>(acomms.dest_id));// goby 2.0
acomms.transmit_message.set_rate(0);// goby 2.0
acomms.transmit_message.set_ack_requested(false);// goby 2.0

if (acomms.transmit_message.frame_size() < 1)
acomms.transmit_message.add_frame(buff);
else
acomms.transmit_message.set_frame(0,buff);

acomms.driver.handle_initiate_transmission(acomms.transmit_message); //goby 2.0

The above code works, but if I assign values at frame indexes higher than 0, those messages are not sent over to the other modem.

Question information

Language:
English Edit question
Status:
Answered
For:
Goby Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
toby schneider (tes) said :
#1

A single call to handle_initiate_transmission only makes a single modem transmission. The number of frames per transmission is governed by the hardware. For the WHOI Micro-Modem it follows the table given here: http://gobysoft.com/wiki/MicroModemRates.

For rate 0, this is a single frame of 32 bytes. In MMDriver, any extra frames are ignored and discarded as you saw. If you want to transmit multiple frames (at rate 0) you will need to send multiple calls to handle_initiate_transmission, spaced by an appropriate guard time (10-15 seconds for the Micro-Modem). This is what AMAC (MACManager) is used for.

As a side note: if you want to write driver-agnostic code you can leave the "frame" field empty in the ModemTransmission passed to .handle_initiate_transmission, and then listen on signal_data_request (http://gobysoft.com/doc/2.0/classgoby_1_1acomms_1_1ModemDriverBase.html#a4e381e730697f12c4e370f5827023e23). The ModemTransmission passed to signal_data_request will contain "max_num_frames" and "max_frame_bytes". Then you can fill in the frames accordingly.

Revision history for this message
toby schneider (tes) said :
#2

Can you help with this problem?

Provide an answer of your own, or ask Laszlo Techy for more information if necessary.

To post a message you must log in.