mavlink_msg_ping.h
Go to the documentation of this file.
00001 // MESSAGE PING PACKING
00002 
00003 #define MAVLINK_MSG_ID_PING 4
00004 
00005 typedef struct __mavlink_ping_t
00006 {
00007  uint64_t time_usec; /*< Unix timestamp in microseconds or since system boot if smaller than MAVLink epoch (1.1.2009)*/
00008  uint32_t seq; /*< PING sequence*/
00009  uint8_t target_system; /*< 0: request ping from all receiving systems, if greater than 0: message is a ping response and number is the system id of the requesting system*/
00010  uint8_t target_component; /*< 0: request ping from all receiving components, if greater than 0: message is a ping response and number is the system id of the requesting system*/
00011 } mavlink_ping_t;
00012 
00013 #define MAVLINK_MSG_ID_PING_LEN 14
00014 #define MAVLINK_MSG_ID_4_LEN 14
00015 
00016 #define MAVLINK_MSG_ID_PING_CRC 237
00017 #define MAVLINK_MSG_ID_4_CRC 237
00018 
00019 
00020 
00021 #define MAVLINK_MESSAGE_INFO_PING { \
00022         "PING", \
00023         4, \
00024         {  { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_ping_t, time_usec) }, \
00025          { "seq", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_ping_t, seq) }, \
00026          { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_ping_t, target_system) }, \
00027          { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 13, offsetof(mavlink_ping_t, target_component) }, \
00028          } \
00029 }
00030 
00031 
00044 static inline uint16_t mavlink_msg_ping_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
00045                                                        uint64_t time_usec, uint32_t seq, uint8_t target_system, uint8_t target_component)
00046 {
00047 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
00048         char buf[MAVLINK_MSG_ID_PING_LEN];
00049         _mav_put_uint64_t(buf, 0, time_usec);
00050         _mav_put_uint32_t(buf, 8, seq);
00051         _mav_put_uint8_t(buf, 12, target_system);
00052         _mav_put_uint8_t(buf, 13, target_component);
00053 
00054         memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PING_LEN);
00055 #else
00056         mavlink_ping_t packet;
00057         packet.time_usec = time_usec;
00058         packet.seq = seq;
00059         packet.target_system = target_system;
00060         packet.target_component = target_component;
00061 
00062         memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PING_LEN);
00063 #endif
00064 
00065         msg->msgid = MAVLINK_MSG_ID_PING;
00066 #if MAVLINK_CRC_EXTRA
00067     return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_PING_LEN, MAVLINK_MSG_ID_PING_CRC);
00068 #else
00069     return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_PING_LEN);
00070 #endif
00071 }
00072 
00085 static inline uint16_t mavlink_msg_ping_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
00086                                                            mavlink_message_t* msg,
00087                                                            uint64_t time_usec,uint32_t seq,uint8_t target_system,uint8_t target_component)
00088 {
00089 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
00090         char buf[MAVLINK_MSG_ID_PING_LEN];
00091         _mav_put_uint64_t(buf, 0, time_usec);
00092         _mav_put_uint32_t(buf, 8, seq);
00093         _mav_put_uint8_t(buf, 12, target_system);
00094         _mav_put_uint8_t(buf, 13, target_component);
00095 
00096         memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PING_LEN);
00097 #else
00098         mavlink_ping_t packet;
00099         packet.time_usec = time_usec;
00100         packet.seq = seq;
00101         packet.target_system = target_system;
00102         packet.target_component = target_component;
00103 
00104         memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PING_LEN);
00105 #endif
00106 
00107         msg->msgid = MAVLINK_MSG_ID_PING;
00108 #if MAVLINK_CRC_EXTRA
00109     return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_PING_LEN, MAVLINK_MSG_ID_PING_CRC);
00110 #else
00111     return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_PING_LEN);
00112 #endif
00113 }
00114 
00123 static inline uint16_t mavlink_msg_ping_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_ping_t* ping)
00124 {
00125         return mavlink_msg_ping_pack(system_id, component_id, msg, ping->time_usec, ping->seq, ping->target_system, ping->target_component);
00126 }
00127 
00137 static inline uint16_t mavlink_msg_ping_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_ping_t* ping)
00138 {
00139         return mavlink_msg_ping_pack_chan(system_id, component_id, chan, msg, ping->time_usec, ping->seq, ping->target_system, ping->target_component);
00140 }
00141 
00151 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
00152 
00153 static inline void mavlink_msg_ping_send(mavlink_channel_t chan, uint64_t time_usec, uint32_t seq, uint8_t target_system, uint8_t target_component)
00154 {
00155 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
00156         char buf[MAVLINK_MSG_ID_PING_LEN];
00157         _mav_put_uint64_t(buf, 0, time_usec);
00158         _mav_put_uint32_t(buf, 8, seq);
00159         _mav_put_uint8_t(buf, 12, target_system);
00160         _mav_put_uint8_t(buf, 13, target_component);
00161 
00162 #if MAVLINK_CRC_EXTRA
00163     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PING, buf, MAVLINK_MSG_ID_PING_LEN, MAVLINK_MSG_ID_PING_CRC);
00164 #else
00165     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PING, buf, MAVLINK_MSG_ID_PING_LEN);
00166 #endif
00167 #else
00168         mavlink_ping_t packet;
00169         packet.time_usec = time_usec;
00170         packet.seq = seq;
00171         packet.target_system = target_system;
00172         packet.target_component = target_component;
00173 
00174 #if MAVLINK_CRC_EXTRA
00175     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PING, (const char *)&packet, MAVLINK_MSG_ID_PING_LEN, MAVLINK_MSG_ID_PING_CRC);
00176 #else
00177     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PING, (const char *)&packet, MAVLINK_MSG_ID_PING_LEN);
00178 #endif
00179 #endif
00180 }
00181 
00182 #if MAVLINK_MSG_ID_PING_LEN <= MAVLINK_MAX_PAYLOAD_LEN
00183 /*
00184   This varient of _send() can be used to save stack space by re-using
00185   memory from the receive buffer.  The caller provides a
00186   mavlink_message_t which is the size of a full mavlink message. This
00187   is usually the receive buffer for the channel, and allows a reply to an
00188   incoming message with minimum stack space usage.
00189  */
00190 static inline void mavlink_msg_ping_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan,  uint64_t time_usec, uint32_t seq, uint8_t target_system, uint8_t target_component)
00191 {
00192 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
00193         char *buf = (char *)msgbuf;
00194         _mav_put_uint64_t(buf, 0, time_usec);
00195         _mav_put_uint32_t(buf, 8, seq);
00196         _mav_put_uint8_t(buf, 12, target_system);
00197         _mav_put_uint8_t(buf, 13, target_component);
00198 
00199 #if MAVLINK_CRC_EXTRA
00200     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PING, buf, MAVLINK_MSG_ID_PING_LEN, MAVLINK_MSG_ID_PING_CRC);
00201 #else
00202     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PING, buf, MAVLINK_MSG_ID_PING_LEN);
00203 #endif
00204 #else
00205         mavlink_ping_t *packet = (mavlink_ping_t *)msgbuf;
00206         packet->time_usec = time_usec;
00207         packet->seq = seq;
00208         packet->target_system = target_system;
00209         packet->target_component = target_component;
00210 
00211 #if MAVLINK_CRC_EXTRA
00212     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PING, (const char *)packet, MAVLINK_MSG_ID_PING_LEN, MAVLINK_MSG_ID_PING_CRC);
00213 #else
00214     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PING, (const char *)packet, MAVLINK_MSG_ID_PING_LEN);
00215 #endif
00216 #endif
00217 }
00218 #endif
00219 
00220 #endif
00221 
00222 // MESSAGE PING UNPACKING
00223 
00224 
00230 static inline uint64_t mavlink_msg_ping_get_time_usec(const mavlink_message_t* msg)
00231 {
00232         return _MAV_RETURN_uint64_t(msg,  0);
00233 }
00234 
00240 static inline uint32_t mavlink_msg_ping_get_seq(const mavlink_message_t* msg)
00241 {
00242         return _MAV_RETURN_uint32_t(msg,  8);
00243 }
00244 
00250 static inline uint8_t mavlink_msg_ping_get_target_system(const mavlink_message_t* msg)
00251 {
00252         return _MAV_RETURN_uint8_t(msg,  12);
00253 }
00254 
00260 static inline uint8_t mavlink_msg_ping_get_target_component(const mavlink_message_t* msg)
00261 {
00262         return _MAV_RETURN_uint8_t(msg,  13);
00263 }
00264 
00271 static inline void mavlink_msg_ping_decode(const mavlink_message_t* msg, mavlink_ping_t* ping)
00272 {
00273 #if MAVLINK_NEED_BYTE_SWAP
00274         ping->time_usec = mavlink_msg_ping_get_time_usec(msg);
00275         ping->seq = mavlink_msg_ping_get_seq(msg);
00276         ping->target_system = mavlink_msg_ping_get_target_system(msg);
00277         ping->target_component = mavlink_msg_ping_get_target_component(msg);
00278 #else
00279         memcpy(ping, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_PING_LEN);
00280 #endif
00281 }


dji_sdk_dji2mav
Author(s):
autogenerated on Thu Jun 6 2019 17:55:35