Skip to content

Commit

Permalink
Make initializers of sensor capturer and location capturer public
Browse files Browse the repository at this point in the history
  • Loading branch information
muthenberg committed Nov 28, 2024
1 parent e1d905c commit 50dc4ca
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public class SmartphoneLocationCapturer: NSObject, LocationCapturer {
- lifecycleQueue: The lifecycle queue of the running `Measurement`. Using the lifecycle queue prevents pause and stop events from finishing if there are still locations to be processed.
- locationManagerFactory: Factory class for creating a `LocationManager`. This factory is mainly used to inject different location manager implementations into an object of this class.
*/
init(
public init(
lifecycleQueue: DispatchQueue = DispatchQueue.global(qos: .userInitiated),
locationManagerFactory: () -> LocationManager = {
let manager = CLLocationManager()
Expand All @@ -87,7 +87,7 @@ public class SmartphoneLocationCapturer: NSObject, LocationCapturer {
}

/// Start capturing locations and provide a `Publisher` for receiving updates.
func start() -> AnyPublisher<Message, Never> {
public func start() -> AnyPublisher<Message, Never> {
coreLocationManager.locationDelegate = self
if authorizationStatus == .authorizedAlways || authorizationStatus == .authorizedWhenInUse {
self.coreLocationManager.startUpdatingLocation()
Expand All @@ -99,7 +99,7 @@ public class SmartphoneLocationCapturer: NSObject, LocationCapturer {
}

/// Stop capturing locations and free all resources.
func stop() {
public func stop() {
self.coreLocationManager.stopUpdatingLocation()
coreLocationManager.locationDelegate = nil
}
Expand Down
6 changes: 3 additions & 3 deletions Sources/DataCapturing/Capturing/Sensors/SensorCapturer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public class SmartphoneSensorCapturer: SensorCapturer {
- motionManager: Manager used to caputre CoreMotion events. This parameter may be used to mock the actual calls to physical sensors, if none are available, for example during testing.
- altimeter: Used to capture height data if no actual sensor is available. That way it is possible to mock this sensor during testing.
*/
init(
public init(
capturingQueue: DispatchQueue = DispatchQueue.global(qos: .default),
accelerometerInterval: Double = 100.0,
gyroInterval: Double = 100.0,
Expand All @@ -97,7 +97,7 @@ public class SmartphoneSensorCapturer: SensorCapturer {

// MARK: - Methods
/// The the sensor capturing to the storage instances `accelertions`, `rotations`, `directions` and `altitudes`.
func start() -> AnyPublisher<Message, Never> {
public func start() -> AnyPublisher<Message, Never> {
let queue = OperationQueue()
queue.qualityOfService = QualityOfService.userInitiated
queue.underlyingQueue = capturingQueue
Expand All @@ -122,7 +122,7 @@ public class SmartphoneSensorCapturer: SensorCapturer {
}

/// Stop sensor capturing.
func stop() {
public func stop() {
motionManager.stopAccelerometerUpdates()
motionManager.stopGyroUpdates()
motionManager.stopDeviceMotionUpdates()
Expand Down

0 comments on commit 50dc4ca

Please sign in to comment.