mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
CommonCLI: gps management commands
This commit is contained in:
parent
5ae574b426
commit
0502bc370d
6 changed files with 72 additions and 0 deletions
|
|
@ -758,6 +758,44 @@ void MyMesh::removeNeighbor(const uint8_t *pubkey, int key_len) {
|
|||
#endif
|
||||
}
|
||||
|
||||
void MyMesh::gpsGetStatus(char * reply) {
|
||||
LocationProvider * l = sensors.getLocationProvider();
|
||||
if (l != NULL) {
|
||||
bool status = l->isActive();
|
||||
bool sync = l->isValid();
|
||||
int sats = l->satellitesCount();
|
||||
if (status) {
|
||||
sprintf(reply, "on, %s, %d sats", sync?"fix":"no fix", sats);
|
||||
} else {
|
||||
strcpy(reply, "off");
|
||||
}
|
||||
} else {
|
||||
strcpy(reply, "Can't find GPS");
|
||||
}
|
||||
}
|
||||
|
||||
void MyMesh::gpsStart() {
|
||||
LocationProvider * l = sensors.getLocationProvider();
|
||||
if (l != NULL) {
|
||||
l->begin();
|
||||
l->reset();
|
||||
}
|
||||
}
|
||||
|
||||
void MyMesh::gpsStop() {
|
||||
LocationProvider * l = sensors.getLocationProvider();
|
||||
if (l != NULL) {
|
||||
l->stop();
|
||||
}
|
||||
}
|
||||
|
||||
void MyMesh::gpsSyncTime() {
|
||||
LocationProvider * l = sensors.getLocationProvider();
|
||||
if (l != NULL) {
|
||||
l->syncTime();
|
||||
}
|
||||
}
|
||||
|
||||
void MyMesh::saveIdentity(const mesh::LocalIdentity &new_id) {
|
||||
self_id = new_id;
|
||||
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
|
||||
|
|
|
|||
|
|
@ -176,6 +176,12 @@ public:
|
|||
void formatNeighborsReply(char *reply) override;
|
||||
void removeNeighbor(const uint8_t* pubkey, int key_len) override;
|
||||
|
||||
// Gps mgmt cli callbacks
|
||||
void gpsGetStatus(char * reply) override;
|
||||
void gpsStart() override;
|
||||
void gpsStop() override;
|
||||
void gpsSyncTime() override;
|
||||
|
||||
mesh::LocalIdentity& getSelfId() override { return self_id; }
|
||||
|
||||
void saveIdentity(const mesh::LocalIdentity& new_id) override;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue