| 45 | } |
| 46 | |
| 47 | void GpsService::removeGpsDevice(const std::shared_ptr<GpsDevice>& device) { |
| 48 | auto lock = mutex.asScopedLock(); |
| 49 | lock.lock(); |
| 50 | |
| 51 | GpsDeviceRecord* record = findGpsRecord(device); |
| 52 | |
| 53 | if (getState() == State::On) { // Ignore during OnPending due to risk of data corruption |
| 54 | stopGpsDevice(*record); |
| 55 | } |
| 56 | |
| 57 | std::erase_if(deviceRecords, [&device](auto& reference) { |
| 58 | return reference.device.get() == device.get(); |
| 59 | }); |
| 60 | } |
| 61 | |
| 62 | bool GpsService::onStart(ServiceContext& serviceContext) { |
| 63 | auto lock = mutex.asScopedLock(); |
nothing calls this directly
no test coverage detected