RSDMotionRecorderConfiguration

@available(iOS 10.0, *)
public struct RSDMotionRecorderConfiguration : RSDRestartableRecorderConfiguration, Codable

The default configuration to use for a RSDMotionRecorder.

  • example:
    // Example json for a codable configuration.
       let json = """
            {
               "identifier": "foo",
               "type": "motion",
               "startStepIdentifier": "start",
               "stopStepIdentifier": "stop",
               "requiresBackgroundAudio": true,
               "recorderTypes": ["accelerometer", "gyro", "magnetometer"],
               "frequency": 50
           }
           """.data(using: .utf8)! // our data in native (JSON) format
  • A short string that uniquely identifies the asynchronous action within the task. If started asynchronously, then the identifier maps to a result stored in RSDTaskResult.asyncResults.

    Declaration

    Swift

    public let identifier: String
  • The standard permission type associated with this configuration.

    Declaration

    Swift

    public let type: RSDStandardPermissionType
  • An identifier marking the step to start the action. If nil, then the action will be started when the task is started.

    Declaration

    Swift

    public var startStepIdentifier: String?
  • An identifier marking the step at which to stop the action. If nil, then the action will be stopped when the task is stopped.

    Declaration

    Swift

    public var stopStepIdentifier: String?
  • Should the file used in a previous run of a recording be deleted? Default = true.

    Declaration

    Swift

    public var shouldDeletePrevious: Bool { get }
  • Whether or not the recorder requires background audio. Default = false.

    If true then background audio can be used to keep the recorder running if the screen is locked because of the idle timer turning off the device screen.

    If the app uses background audio, then the developer will need to turn ON the Background Modes under the Capabilities tab of the Xcode project, and will need to select Audio, AirPlay, and Picture in Picture.

    Declaration

    Swift

    public var requiresBackgroundAudio: Bool { get }
  • The CoreMotion device sensor types to include with this configuration. If nil then the RSDMotionRecorder defaults will be used.

    Declaration

    Swift

    public var recorderTypes: Set<RSDMotionRecorderType>?
  • The sampling frequency of the motion sensors. If nil, then RSDMotionRecorder default frequency will be used.

    Declaration

    Swift

    public var frequency: Double?
  • This recorder configuration requires RSDStandardPermissionType.motion.

    Note

    The use of this recorder requires adding “Privacy - Motion Usage Description” to the application info.plist file.

    Declaration

    Swift

    public var permissionTypes: [RSDPermissionType] { get }
  • Set the flag to true to encode the samples as a CSV file.

    Declaration

    Swift

    public var usesCSVEncoding: Bool?
  • Default initializer.

    Declaration

    Swift

    public init(identifier: String, recorderTypes: Set<RSDMotionRecorderType>?, requiresBackgroundAudio: Bool = false, frequency: Double? = nil, shouldDeletePrevious: Bool? = nil)

    Parameters

    identifier

    The configuration identifier.

    recorderTypes

    The CoreMotion device sensor types to include with this configuration.

    requiresBackgroundAudio

    Whether or not the recorder requires background audio. Default = false.

    frequency

    The sampling frequency of the motion sensors.

  • Do nothing. No validation is required for this recorder.

    Declaration

    Swift

    public func validate() throws