MCPcopy Create free account
hub / github.com/TactilityProject/Tactility / startGpsDevice

Method startGpsDevice

Tactility/Source/service/gps/GpsService.cpp:75–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73}
74
75bool GpsService::startGpsDevice(GpsDeviceRecord& record) {
76 LOGGER.info("[device {}] starting", record.device->getId());
77
78 auto lock = mutex.asScopedLock();
79 lock.lock();
80
81 auto device = record.device;
82
83 if (!device->start()) {
84 LOGGER.error("[device {}] starting failed", record.device->getId());
85 return false;
86 }
87
88 record.satelliteSubscriptionId = device->subscribeGga([this](hal::Device::Id deviceId, auto& record) {
89 mutex.lock();
90 if (record.fix_quality > 0) {
91 ggaRecord = record;
92 ggaTime = kernel::getTicks();
93 }
94 onGgaSentence(deviceId, record);
95 mutex.unlock();
96 });
97
98 record.rmcSubscriptionId = device->subscribeRmc([this](hal::Device::Id deviceId, auto& record) {
99 mutex.lock();
100 if (record.longitude.value != 0 && record.longitude.scale != 0) {
101 rmcRecord = record;
102 rmcTime = kernel::getTicks();
103 }
104 onRmcSentence(deviceId, record);
105 mutex.unlock();
106 });
107
108 return true;
109}
110
111bool GpsService::stopGpsDevice(GpsDeviceRecord& record) {
112 LOGGER.info("[device {}] stopping", record.device->getId());

Callers

nothing calls this directly

Calls 10

getTicksFunction · 0.85
infoMethod · 0.80
getIdMethod · 0.80
asScopedLockMethod · 0.80
errorMethod · 0.80
subscribeGgaMethod · 0.80
subscribeRmcMethod · 0.80
lockMethod · 0.45
startMethod · 0.45
unlockMethod · 0.45

Tested by

no test coverage detected