Skip to content

Commit 7c3beaf

Browse files
JordanYatesjhedberg
authored andcommitted
gnss: gnss_emul: allow direct config queries
Provide an escape hatch from the GNSS API requirement that a device be active to run the configuration `get` functions. This is useful in the context of an emulator device to query how other software modules have configured the GNSS. Signed-off-by: Jordan Yates <[email protected]>
1 parent 802f4a3 commit 7c3beaf

File tree

2 files changed

+33
-4
lines changed

2 files changed

+33
-4
lines changed

drivers/gnss/gnss_emul.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ static int gnss_emul_set_fix_rate(const struct device *dev, uint32_t fix_interva
123123
return 0;
124124
}
125125

126-
static int gnss_emul_get_fix_rate(const struct device *dev, uint32_t *fix_interval_ms)
126+
int gnss_emul_get_fix_rate(const struct device *dev, uint32_t *fix_interval_ms)
127127
{
128128
struct gnss_emul_data *data = dev->data;
129129

@@ -144,8 +144,7 @@ static int gnss_emul_set_navigation_mode(const struct device *dev,
144144
return 0;
145145
}
146146

147-
static int gnss_emul_get_navigation_mode(const struct device *dev,
148-
enum gnss_navigation_mode *mode)
147+
int gnss_emul_get_navigation_mode(const struct device *dev, enum gnss_navigation_mode *mode)
149148
{
150149
struct gnss_emul_data *data = dev->data;
151150

@@ -165,7 +164,7 @@ static int gnss_emul_set_enabled_systems(const struct device *dev, gnss_systems_
165164
return 0;
166165
}
167166

168-
static int gnss_emul_get_enabled_systems(const struct device *dev, gnss_systems_t *systems)
167+
int gnss_emul_get_enabled_systems(const struct device *dev, gnss_systems_t *systems)
169168
{
170169
struct gnss_emul_data *data = dev->data;
171170

include/zephyr/drivers/gnss/gnss_emul.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,34 @@ void gnss_emul_clear_data(const struct device *dev);
3030
void gnss_emul_set_data(const struct device *dev, const struct navigation_data *nav,
3131
const struct gnss_info *info, int64_t timestamp_ms);
3232

33+
/**
34+
* @brief Retrieve the last configured fix rate, regardless of PM state
35+
*
36+
* @param dev GNSS emulator device
37+
* @param fix_interval_ms Output fix interval
38+
*
39+
* @retval 0 On success
40+
*/
41+
int gnss_emul_get_fix_rate(const struct device *dev, uint32_t *fix_interval_ms);
42+
43+
/**
44+
* @brief Retrieve the last configured navigation mode, regardless of PM state
45+
*
46+
* @param dev GNSS emulator device
47+
* @param mode Output navigation mode
48+
*
49+
* @retval 0 On success
50+
*/
51+
int gnss_emul_get_navigation_mode(const struct device *dev, enum gnss_navigation_mode *mode);
52+
53+
/**
54+
* @brief Retrieve the last configured systems, regardless of PM state
55+
*
56+
* @param dev GNSS emulator device
57+
* @param systems Output GNSS systems
58+
*
59+
* @retval 0 On success
60+
*/
61+
int gnss_emul_get_enabled_systems(const struct device *dev, gnss_systems_t *systems);
62+
3363
#endif /* ZEPHYR_DRIVERS_GNSS_GNSS_EMUL_H_ */

0 commit comments

Comments
 (0)