Hi all,
In my case I use a bound socket / server connection to listen for GCS connections and then stream mavlink messages over that as soon as a client connects.
I'd like to send a couple of extra messages in the message flow, but I'm having some problems figuring out how I can successfully pack them up and send them over
the wire. So, if I receive an AP mavlink message and send the get_msgbuf() content over the wire directly, it works. When I construct my own packets, the
GCS complains about incorrect CRC's and header ID's.
The mavutil mavlink_connection function has no methods to allow a listening socket to be constructed and used for this use case.
What I use now is a fake inactive connection, which gives problems for the GCS based on incorrect CRC's and headers, python code:
self.master = mavutil.mavlink_connection( "udp:
127.0.0.1:12345" )
msg = self.master.mav.heartbeat_encode( find_uav_type( hb.uavtype ), find_ap_type( hb.autopilot ), hb.base_mode, hb.custom_mode, hb.system_status )
self.conn.send( msg.get_msgbuf() )
So, what is the procedure to only construct a correct message and hold it in a buffer somewhere, where custom code manages the transport?
( i.e. no code ending in *send, but which uses the *encode type of functions and then grabs the buffer? )
Or would it just be easier to add a tcplisten: kind of transport device to the mavutil code, write a small wrapper class similar to "mavtcp" and use that
instead?
Rgds,
Gerard