forked from espressif/esp-protocols
fix(modem): Update CMUX example with SIM7070_gnss cleaned-up
Merges https://github.com/espressif/esp-protocols/pull/246
This commit is contained in:
committed by
David Cermak
parent
5baaf54291
commit
56fe53279e
@ -49,7 +49,7 @@ std::unique_ptr<DCE_gnss> create_SIM7070_GNSS_dce(const esp_modem::dce_config *c
|
||||
return gnss_factory::LocalFactory::create(config, std::move(dte), netif);
|
||||
}
|
||||
|
||||
esp_modem::command_result get_gnss_information_sim70xx_lib(esp_modem::CommandableIf *t, esp_modem_gps_t &gps)
|
||||
esp_modem::command_result get_gnss_information_sim70xx_lib(esp_modem::CommandableIf *t, sim70xx_gps_t &gps)
|
||||
{
|
||||
|
||||
ESP_LOGV(TAG, "%s", __func__ );
|
||||
@ -293,11 +293,11 @@ esp_modem::command_result get_gnss_information_sim70xx_lib(esp_modem::Commandabl
|
||||
{
|
||||
std::string_view sats_in_view = out.substr(0, pos);
|
||||
if (sats_in_view.length() > 1) {
|
||||
if (std::from_chars(out.data(), out.data() + pos, gps.sats_in_view).ec == std::errc::invalid_argument) {
|
||||
if (std::from_chars(out.data(), out.data() + pos, gps.sat.num).ec == std::errc::invalid_argument) {
|
||||
return esp_modem::command_result::FAIL;
|
||||
}
|
||||
} else {
|
||||
gps.sats_in_view = 0;
|
||||
gps.sat.num = 0;
|
||||
}
|
||||
} //clean up sats_in_view
|
||||
|
||||
@ -332,12 +332,12 @@ esp_modem::command_result get_gnss_information_sim70xx_lib(esp_modem::Commandabl
|
||||
return esp_modem::command_result::OK;
|
||||
}
|
||||
|
||||
esp_modem::command_result SIM7070_gnss::get_gnss_information_sim70xx(esp_modem_gps_t &gps)
|
||||
esp_modem::command_result SIM7070_gnss::get_gnss_information_sim70xx(sim70xx_gps_t &gps)
|
||||
{
|
||||
return get_gnss_information_sim70xx_lib(dte.get(), gps);
|
||||
}
|
||||
|
||||
esp_modem::command_result DCE_gnss::get_gnss_information_sim70xx(esp_modem_gps_t &gps)
|
||||
esp_modem::command_result DCE_gnss::get_gnss_information_sim70xx(sim70xx_gps_t &gps)
|
||||
{
|
||||
return device->get_gnss_information_sim70xx(gps);
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
#include "cxx_include/esp_modem_dce_factory.hpp"
|
||||
#include "cxx_include/esp_modem_dce_module.hpp"
|
||||
#include "nmea_parser.h"
|
||||
#include "sim70xx_gps.h"
|
||||
|
||||
/**
|
||||
* @brief Definition of a custom SIM7070 class with GNSS capabilities.
|
||||
@ -23,7 +23,7 @@
|
||||
class SIM7070_gnss: public esp_modem::SIM7070 {
|
||||
using SIM7070::SIM7070;
|
||||
public:
|
||||
esp_modem::command_result get_gnss_information_sim70xx(esp_modem_gps_t &gps);
|
||||
esp_modem::command_result get_gnss_information_sim70xx(sim70xx_gps_t &gps);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -47,7 +47,7 @@ public:
|
||||
|
||||
#undef ESP_MODEM_DECLARE_DCE_COMMAND
|
||||
|
||||
esp_modem::command_result get_gnss_information_sim70xx(esp_modem_gps_t &gps);
|
||||
esp_modem::command_result get_gnss_information_sim70xx(sim70xx_gps_t &gps);
|
||||
|
||||
};
|
||||
|
||||
|
@ -17,7 +17,6 @@ extern "C" {
|
||||
#define GPS_MAX_SATELLITES_IN_VIEW (16)
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief GPS fix type
|
||||
*
|
||||
@ -53,9 +52,6 @@ typedef enum {
|
||||
*/
|
||||
typedef struct {
|
||||
uint8_t num; /*!< Satellite number */
|
||||
uint8_t elevation; /*!< Satellite elevation */
|
||||
uint16_t azimuth; /*!< Satellite azimuth */
|
||||
uint8_t snr; /*!< Satellite signal noise ratio */
|
||||
} gps_satellite_t;
|
||||
|
||||
/**
|
||||
@ -79,54 +75,31 @@ typedef struct {
|
||||
uint16_t year; /*!< Year (start from 2000) */
|
||||
} gps_date_t;
|
||||
|
||||
/**
|
||||
* @brief NMEA Statement
|
||||
*
|
||||
*/
|
||||
typedef enum {
|
||||
STATEMENT_UNKNOWN = 0, /*!< Unknown statement */
|
||||
STATEMENT_GGA, /*!< GGA */
|
||||
STATEMENT_GSA, /*!< GSA */
|
||||
STATEMENT_RMC, /*!< RMC */
|
||||
STATEMENT_GSV, /*!< GSV */
|
||||
STATEMENT_GLL, /*!< GLL */
|
||||
STATEMENT_VTG /*!< VTG */
|
||||
} nmea_statement_t;
|
||||
|
||||
/**
|
||||
* @brief GPS object
|
||||
*
|
||||
*/
|
||||
struct esp_modem_gps {
|
||||
struct sim70xx_gps {
|
||||
gps_run_t run; /*!< run status */
|
||||
gps_fix_t fix; /*!< Fix status */
|
||||
gps_date_t date; /*!< Fix date */
|
||||
gps_time_t tim; /*!< time in UTC */
|
||||
float latitude; /*!< Latitude (degrees) */
|
||||
float longitude; /*!< Longitude (degrees) */
|
||||
float altitude; /*!< Altitude (meters) */
|
||||
gps_run_t run; /*!< run status */
|
||||
gps_fix_t fix; /*!< Fix status */
|
||||
uint8_t sats_in_use; /*!< Number of satellites in use */
|
||||
gps_time_t tim; /*!< time in UTC */
|
||||
float speed; /*!< Ground speed, unit: m/s */
|
||||
float cog; /*!< Course over ground */
|
||||
gps_fix_mode_t fix_mode; /*!< Fix mode */
|
||||
float dop_h; /*!< Horizontal dilution of precision */
|
||||
float dop_p; /*!< Position dilution of precision */
|
||||
float dop_v; /*!< Vertical dilution of precision */
|
||||
uint8_t sats_in_view; /*!< Number of satellites in view */
|
||||
gps_date_t date; /*!< Fix date */
|
||||
float speed; /*!< Ground speed, unit: m/s */
|
||||
float cog; /*!< Course over ground */
|
||||
gps_satellite_t sat; /*!< Number of satellites in view */
|
||||
float hpa; /*!< Horizontal Position Accuracy */
|
||||
float vpa; /*!< Vertical Position Accuracy */
|
||||
};
|
||||
|
||||
typedef struct esp_modem_gps esp_modem_gps_t;
|
||||
typedef struct sim70xx_gps sim70xx_gps_t;
|
||||
|
||||
/**
|
||||
* @brief NMEA Parser Event ID
|
||||
*
|
||||
*/
|
||||
typedef enum {
|
||||
GPS_UPDATE, /*!< GPS information has been updated */
|
||||
GPS_UNKNOWN /*!< Unknown statements detected */
|
||||
} nmea_event_id_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
Reference in New Issue
Block a user