IMUModule
public protocol IMUModule
Provides an interface to perform various operations related to IMU.
-
Configures the tag for IMU data access.
Before accessing IMU data, the tag must have IMU module loaded and activated. This method will perform all required steps asynchronously and publish when completed.
Declaration
Swift
func initialize() -> AnyPublisher<Void, ModuleError>
Return Value
Any publisher with a
Void
Result, indicating that IMUModule activation was successful or will publish aModuleError
in case of an error. -
Activates the module.
Declaration
Swift
func activateModule() -> AnyPublisher<Void, ModuleError>
Return Value
Any publisher with a
Void
Result, indicating that IMUModule activation was successful or aModuleError
in case of failure. -
Deactivates the module.
Declaration
Swift
func deactivateModule() -> AnyPublisher<Void, ModuleError>
Return Value
Any publisher with a
Void
Result, indicating that IMUModule deactivation was successful or aModuleError
in case of failure. -
Starts recording IMU data.
Parameters cannot be empty,
Declaration
Swift
func startRecording( sessionID: String, campaignID: String, groupID: String, productID: String, subjectID: String, samplingRate: IMUSamplingRate ) -> AnyPublisher<DataCollectionStatus, Error>
Parameters
sessionID
Unique id provided by the client app. Should be non empty & less than 30 characters.
campaignID
Identifier the Campaign of a recording session. Should be non empty & less than 30 characters.
groupID
Identifier the Group or setting of a recording session. Should be non empty & less than 30 characters.
productID
Identifier the Product used for recording the IMU Data. Should be non empty & less than 30 characters.
subjectID
Identifier for the Subject/User performing the motion. Should be non empty & less than 30 characters.
samplingRate
Sampling rate for Accelerometer and Gyroscope sensors of the Tag.
Return Value
Any publisher with a
DataCollectionStatus
Result. Verify status to confirm IMU recording was started or return an error if recording could not be started. -
Stops the current IMU recording session.
Declaration
Swift
func stopRecording() -> AnyPublisher<Void, Error>
Return Value
Any publisher with a
Void
Result, indicating that IMU recording was stopped or will publish an error if recording could not be stopped. -
Requests Tag to send IMU sessions.
Declaration
Swift
func listSessions() -> AnyPublisher<IMUSessionInfo, Error>
Return Value
Any publisher that publishes
IMUSessionInfo
objects available on the tag, or will publish an error if List sessions request was not acknowledged by the Tag. -
Deletes a particular session from the device.
Declaration
Swift
func eraseSession(_ session: IMUSessionInfo) -> AnyPublisher<Void, Error>
Parameters
session
IMU session to delete.
Return Value
Any publisher with a
Void
Result, indicating that session was erased or will publish an error if the session could not be erased from the tag. -
Deletes all sessions from the device.
Declaration
Swift
func eraseAllSessions() -> AnyPublisher<Void, Error>
Return Value
Any publisher with a
Void
Result, indicating that all sessions were erased or will publish an error if the sessions could not be erased from the tag. -
Retrieves data for an IMUSesion.
Declaration
Swift
func downloadIMUSessionData( session: IMUSessionInfo ) -> AnyPublisher<IMUSessionDownloadState, Error>
Parameters
session
IMU session for which data download will be done.
Return Value
Any publisher with
IMUSesionDownloadState
as Result,IMUSesionDownloadState.downloading
indicates the progress of download.IMUSesionDownloadState.downloaded
contains the URL path of the downloaded file . will publish an error if the session data could not be fetched. -
Will stop the current IMU session downloading.
Declaration
Swift
func stopDownloading() -> AnyPublisher<Void, Error>
Return Value
Any publisher with a
Void
Result, indicating that IMU session download was stopped. or will publish an error if downloading could not be stopped. -
Retrieves data for an IMUSession.
Declaration
Swift
func parseIMUSession( at url: URL ) -> AnyPublisher<(fullyParsed: Bool, session: IMUSessionData), Error>
Parameters
at
File path of the downloaded IMU session file.
Return Value
Any publisher with a
bool
andIMUSessionData
as Result. Bool indicates if file was fully parsed, publisher will publish an error if the session data could not be parsed. -
Retrieves data for an IMUSession.
Declaration
Swift
func parseIMUSession( _ session: IMUSessionInfo ) -> AnyPublisher<(fullyParsed: Bool, session: IMUSessionData), Error>
Parameters
session
IMU session to be parsed.
Return Value
Any publisher with a
bool
andIMUSessionData
as Result. Bool indicates if file was fully parsed, publisher will publish an error if the session data could not be parsed. -
Starts streaming IMU data.
Declaration
Swift
func startIMUStreaming(samplingRate: IMUSamplingRate) -> AnyPublisher<IMUSample, Error>
Return Value
Any publisher with a
IMUSample
Result, indicating motion sensor data for the sample from the stream or will publish an error if streaming could not be started. -
Stops the IMU streaming.
Declaration
Swift
func stopIMUStreaming() -> AnyPublisher<Void, Error>
Return Value
Any publisher with a
Void
Result, indicating that IMU streaming was stopped or will publish an error if streaming could not be stopped. -
Provides current data collection mode. It is valid only if
DataCollectionStatus
is.logging
. User is responsible to check theDataCollectionStatus
and if it is.logging
then only this API should be called. It might return an old stored value of mode or an error if config couldn’t be fetched.Declaration
Swift
func getDataCollectionMode() -> AnyPublisher<DataCollectionMode, Error>
Return Value
Any publisher with a
DataCollectionMode
indicating current data collection mode or will publish an error if data collection mode could not be retrieved from the saved config.