Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

First we look at how to post binary data to a MOOS variable.  

Code Block
string// some data_payload we =want "hello world";to send
vector<unsigned char> packet;
packet.push_back(0x61);
packet.push_back(0x00);
packet.push_back(0x62);

// betterbinary string - pass a pointer to Notify along with the size 
m_Comms.Notify( "ACOMMS_TRANSMIT_DATA_BINARY", &packet[0], packet.size() );

// okaystring - convert to a string and pass to Notify
m_Comms.Notify( "ACOMMS_TRANSMIT_DATA", string( (char*) &packet[0], packet.size() ) );

...