Skip to content

Commit

Permalink
[messages][gps] add GPS_INJECT message and gps_inject_data
Browse files Browse the repository at this point in the history
  • Loading branch information
fvantienen committed Sep 13, 2015
1 parent 3d4028d commit c9518bf
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
6 changes: 6 additions & 0 deletions conf/messages.xml
Expand Up @@ -2534,6 +2534,12 @@
<field name="pan" type="int8"/>
</message>

<message name="GPS_INJECT" id="153" link="forwarded">
<field name="ac_id" type="uint8"/>
<field name="packet_id" type="uint8"/>
<field name="data" type="uint8[]"/>
</message>

</msg_class>


Expand Down
13 changes: 13 additions & 0 deletions sw/airborne/firmwares/rotorcraft/datalink.c
Expand Up @@ -164,6 +164,19 @@ void dl_parse_msg(void)
DL_REMOTE_GPS_tow(dl_buffer),
DL_REMOTE_GPS_course(dl_buffer));
break;
#endif
#if USE_GPS
case DL_GPS_INJECT :
// Check if the GPS is for this AC
if (DL_GPS_INJECT_ac_id(dl_buffer) != AC_ID) { break; }

// GPS parse data
gps_inject_data(
DL_GPS_INJECT_packet_id(dl_buffer),
DL_GPS_INJECT_data_length(dl_buffer),
DL_GPS_INJECT_data(dl_buffer)
);
break;
#endif
default:
break;
Expand Down
7 changes: 7 additions & 0 deletions sw/airborne/subsystems/gps.c
Expand Up @@ -191,3 +191,10 @@ uint32_t gps_tow_from_sys_ticks(uint32_t sys_ticks)

return itow_now;
}

/**
* Default parser for GPS injected data
*/
void WEAK gps_inject_data(uint8_t packet_id __attribute__((unused)), uint8_t length __attribute__((unused)), uint8_t *data __attribute__((unused))){

}
2 changes: 2 additions & 0 deletions sw/airborne/subsystems/gps.h
Expand Up @@ -108,6 +108,8 @@ extern void gps_init(void);
/** GPS model specific init implementation */
extern void gps_impl_init(void);

/** GPS packet injection (default empty) */
extern void gps_inject_data(uint8_t packet_id, uint8_t length, uint8_t *data);

/** GPS timeout in seconds */
#ifndef GPS_TIMEOUT
Expand Down

0 comments on commit c9518bf

Please sign in to comment.