@@ -632,6 +632,10 @@ bool GPSHardware::ParseNMEASentence(char *sentence) {
632
632
return false ;
633
633
}
634
634
635
+ /* !
636
+ * @brief Gets the hours from the GPS module.
637
+ * @returns The hours (0-23), or 0 if the GPS driver type is not set.
638
+ */
635
639
uint8_t GPSHardware::GetHour () {
636
640
if (_driver_type == GPS_DRV_MTK) {
637
641
return _ada_gps->hour ;
@@ -641,6 +645,10 @@ uint8_t GPSHardware::GetHour() {
641
645
return 0 ;
642
646
}
643
647
648
+ /* !
649
+ * @brief Gets the minute from the GPS module.
650
+ * @returns The minute (0-59), or 0 if the GPS driver type is not set.
651
+ */
644
652
uint8_t GPSHardware::GetMinute () {
645
653
if (_driver_type == GPS_DRV_MTK) {
646
654
return _ada_gps->minute ;
@@ -650,6 +658,10 @@ uint8_t GPSHardware::GetMinute() {
650
658
return 0 ;
651
659
}
652
660
661
+ /* !
662
+ * @brief Gets the seconds from the GPS module.
663
+ * @returns The seconds (0-59), or 0 if the GPS driver type is not set.
664
+ */
653
665
uint8_t GPSHardware::GetSeconds () {
654
666
if (_driver_type == GPS_DRV_MTK) {
655
667
return _ada_gps->seconds ;
@@ -659,6 +671,11 @@ uint8_t GPSHardware::GetSeconds() {
659
671
return 0 ;
660
672
}
661
673
674
+ /* !
675
+ * @brief Gets the milliseconds from the GPS module.
676
+ * @returns The milliseconds part of the current time, or 0 if the GPS driver
677
+ * type is not set.
678
+ */
662
679
uint16_t GPSHardware::GetMilliseconds () {
663
680
if (_driver_type == GPS_DRV_MTK) {
664
681
return _ada_gps->milliseconds ;
@@ -668,6 +685,10 @@ uint16_t GPSHardware::GetMilliseconds() {
668
685
return 0 ;
669
686
}
670
687
688
+ /* !
689
+ * @brief Gets the day from the GPS module.
690
+ * @returns The day of the month (1-31), or 0 if the GPS driver type is not set.
691
+ */
671
692
uint8_t GPSHardware::GetDay () {
672
693
if (_driver_type == GPS_DRV_MTK) {
673
694
return _ada_gps->day ;
@@ -677,6 +698,11 @@ uint8_t GPSHardware::GetDay() {
677
698
return 0 ;
678
699
}
679
700
701
+ /* !
702
+ * @brief Gets the month from the GPS module.
703
+ * @returns The month as a number (1-12), or 0 if the GPS driver type is not
704
+ * set.
705
+ */
680
706
uint8_t GPSHardware::GetMonth () {
681
707
if (_driver_type == GPS_DRV_MTK) {
682
708
return _ada_gps->month ;
@@ -686,11 +712,172 @@ uint8_t GPSHardware::GetMonth() {
686
712
return 0 ;
687
713
}
688
714
715
+ /* !
716
+ * @brief Gets the year from the GPS module.
717
+ * @returns The year as a 2-digit number (e.g., 23 for 2023), or 0 if the GPS
718
+ * driver type is not set.
719
+ */
689
720
uint8_t GPSHardware::GetYear () {
690
721
if (_driver_type == GPS_DRV_MTK) {
691
722
return _ada_gps->year ;
692
723
} else if (_driver_type == GPS_DRV_UBLOX) {
693
724
// TODO: Implement for UBLOX
694
725
}
695
726
return 0 ;
696
- }
727
+ }
728
+
729
+ /* !
730
+ * @brief Gets the GPS fix status.
731
+ * @returns True if the GPS has a fix, False otherwise.
732
+ */
733
+ bool GPSHardware::GetFix () {
734
+ if (_driver_type == GPS_DRV_MTK) {
735
+ return _ada_gps->fix ;
736
+ } else if (_driver_type == GPS_DRV_UBLOX) {
737
+ // TODO: Implement for UBLOX
738
+ }
739
+ return false ;
740
+ }
741
+
742
+ /* !
743
+ * @brief Gets the GPS latitude.
744
+ * @returns The latitude in degrees, or 0.0 if the GPS driver type is not set.
745
+ */
746
+ float GPSHardware::GetLat () {
747
+ if (_driver_type == GPS_DRV_MTK) {
748
+ return _ada_gps->latitude ;
749
+ } else if (_driver_type == GPS_DRV_UBLOX) {
750
+ // TODO: Implement for UBLOX
751
+ }
752
+ return 0 .0f ;
753
+ }
754
+
755
+ /* !
756
+ * @brief Gets the GPS latitude direction.
757
+ * @returns The latitude direction as a character ('N' or 'S'), or '\0' if the
758
+ * GPS driver type is not set.
759
+ */
760
+ char GPSHardware::GetLatDir () {
761
+ if (_driver_type == GPS_DRV_MTK) {
762
+ return _ada_gps->lat ;
763
+ } else if (_driver_type == GPS_DRV_UBLOX) {
764
+ // TODO: Implement for UBLOX
765
+ }
766
+ return ' \0 ' ;
767
+ }
768
+
769
+ /* !
770
+ * @brief Gets the GPS longitude.
771
+ * @returns The longitude in degrees, or 0.0 if the GPS driver type is not set.
772
+ */
773
+ float GPSHardware::GetLon () {
774
+ if (_driver_type == GPS_DRV_MTK) {
775
+ return _ada_gps->longitude ;
776
+ } else if (_driver_type == GPS_DRV_UBLOX) {
777
+ // TODO: Implement for UBLOX
778
+ }
779
+
780
+ return 0 .0f ;
781
+ }
782
+
783
+ /* !
784
+ * @brief Gets the GPS longitude direction.
785
+ * @returns The longitude direction as a character ('E' or 'W'), or '\0' if the
786
+ * GPS driver type is not set.
787
+ */
788
+ char GPSHardware::GetLonDir () {
789
+ if (_driver_type == GPS_DRV_MTK) {
790
+ return _ada_gps->lon ;
791
+ } else if (_driver_type == GPS_DRV_UBLOX) {
792
+ // TODO: Implement for UBLOX
793
+ }
794
+
795
+ return ' \0 ' ;
796
+ }
797
+
798
+ /* !
799
+ * @brief Gets the number of satellites in view.
800
+ * @returns The number of satellites in view, or 0 if the GPS driver type is
801
+ * not set.
802
+ */
803
+ uint8_t GPSHardware::GetNumSats () {
804
+ if (_driver_type == GPS_DRV_MTK) {
805
+ return _ada_gps->satellites ;
806
+ } else if (_driver_type == GPS_DRV_UBLOX) {
807
+ // TODO: Implement for UBLOX
808
+ }
809
+
810
+ return 0 ;
811
+ }
812
+
813
+ /* !
814
+ * @brief Gets the horizontal dilution of precision (HDOP).
815
+ * @returns The HDOP value, or 0.0 if the GPS driver type is not set.
816
+ */
817
+ float GPSHardware::GetHDOP () {
818
+ if (_driver_type == GPS_DRV_MTK) {
819
+ return _ada_gps->HDOP ;
820
+ } else if (_driver_type == GPS_DRV_UBLOX) {
821
+ // TODO: Implement for UBLOX
822
+ }
823
+
824
+ return 0 .0f ;
825
+ }
826
+
827
+ /* !
828
+ * @brief Gets the altitude from the GPS module.
829
+ * @returns The altitude in meters, or 0.0 if the GPS driver type is not set.
830
+ */
831
+ float GPSHardware::GetAltitude () {
832
+ if (_driver_type == GPS_DRV_MTK) {
833
+ return _ada_gps->altitude ;
834
+ } else if (_driver_type == GPS_DRV_UBLOX) {
835
+ // TODO: Implement for UBLOX
836
+ }
837
+
838
+ return 0 .0f ;
839
+ }
840
+
841
+ /* !
842
+ * @brief Gets the speed from the GPS module.
843
+ * @returns The speed in meters per second, or 0.0 if the GPS driver type is
844
+ * not set.
845
+ */
846
+ float GPSHardware::GetSpeed () {
847
+ if (_driver_type == GPS_DRV_MTK) {
848
+ return _ada_gps->speed ;
849
+ } else if (_driver_type == GPS_DRV_UBLOX) {
850
+ // TODO: Implement for UBLOX
851
+ }
852
+
853
+ return 0 .0f ;
854
+ }
855
+
856
+ /* !
857
+ * @brief Gets the angle from the GPS module.
858
+ * @returns The angle in degrees, or 0.0 if the GPS driver type is not set.
859
+ */
860
+ float GPSHardware::GetAngle () {
861
+ if (_driver_type == GPS_DRV_MTK) {
862
+ return _ada_gps->angle ;
863
+ } else if (_driver_type == GPS_DRV_UBLOX) {
864
+ // TODO: Implement for UBLOX
865
+ }
866
+
867
+ return 0 .0f ;
868
+ }
869
+
870
+ /* !
871
+ * @brief Gets the geoid height from the GPS module.
872
+ * @returns The geoid height in meters, or 0.0 if the GPS driver type is not
873
+ * set.
874
+ */
875
+ float GPSHardware::GetGeoidHeight () {
876
+ if (_driver_type == GPS_DRV_MTK) {
877
+ return _ada_gps->fix ;
878
+ } else if (_driver_type == GPS_DRV_UBLOX) {
879
+ // TODO: Implement for UBLOX
880
+ }
881
+
882
+ return 0 .0f ;
883
+ }
0 commit comments