<!DOCTYPE module SYSTEM "module.dtd">

<module name="gps_datalink" dir="gps">
  <doc>
    <description>
      Remote GPS via datalink.
      Parses the REMOTE_GPS and REMOTE_GPS_SMALL datalink messages and publishes it onboard via ABI.
    </description>
  </doc>
  <autoload name="gps"/>
  <autoload name="gps_nps"/>
  <autoload name="gps_sim"/>
  <header>
    <file name="gps.h" dir="subsystems"/>
  </header>
  <init fun="gps_datalink_init()"/>
  <periodic fun="gps_datalink_periodic_check()" freq="1." autorun="TRUE"/>
  <datalink message="REMOTE_GPS" fun="gps_datalink_parse_REMOTE_GPS()"/>
  <datalink message="REMOTE_GPS_SMALL" fun="gps_datalink_parse_REMOTE_GPS_SMALL()"/>
  <makefile target="ap|fbw">
    <file name="gps_datalink.c" dir="subsystems/gps"/>
    <raw>
      ifdef SECONDARY_GPS
      ifneq (,$(findstring $(SECONDARY_GPS), datalink))
      # this is the secondary GPS
      $(TARGET).CFLAGS += -DGPS_SECONDARY_TYPE_H=\"subsystems/gps/gps_datalink.h\"
      $(TARGET).CFLAGS += -DSECONDARY_GPS=GPS_DATALINK
      else
      $(TARGET).CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_datalink.h\"
      $(TARGET).CFLAGS += -DPRIMARY_GPS=GPS_DATALINK
      endif
      else
      # plain old single GPS usage
      $(TARGET).CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_datalink.h\"
      endif
    </raw>
  </makefile>
  <makefile target="fbw">
    <define name="USE_GPS"/>
  </makefile>
</module>

