Sensing
The main entry point for the HRSensing SDK. Ensure that setup, activation and initialization instructions have been followed. Please consult the HRSensing iOS Integration Guide for setup instructions.
-
Reference to the shared instance of HRSensing.
-
Enables or disables logging. By default, logging is enabled.
-
Logger delegate.
-
The preferred authentication mode. Persisted in
UserDefaults
.
-
Downloads a configuration from the HealthRhythms backend for a passed in activation code. A valid configuration is required before signing in as a user or initializing Sensing.
- withActivationCode: The configuration activation code to be passed in for downloading the config file, e.g. ‘hr-test-1’.
- completion: The completion block to be called post execution.
-
Indicates whether HRSensing is currently initialized.
- A bool indicating whether HRSensing is currently initialized.
-
Indicates whether HRSensing has a valid configuration available from a previous activation.
- A bool indicating whether HRSensing has a valid configuration available.
-
Indicates whether HRSensing has been activated successfully at any time in the past.
- A bool indicating whether HRSensing has been activated successfully at any time in the past.
-
Indicates whether HRSensing is ready to be initialized, checks for a valid configuration, a user ID, and if a user is signed in depending on
AuthenticationMode
.- completion: The completion block to be called post execution. Returns a result indicating if the sensing can be initialized and if not an error message, which indicates the reason why sensing cannot be initialized.
-
Returns the currently supported authentication modes.
- An array of the currently supported
AuthenticationMode
s.
- An array of the currently supported
-
Indicates whether a federated sign in through a hosted login page is required.
- A bool indicating if a user sign in is required.
-
Indicates whether a token sign in is required: true if token sign in is supported by the study configuration, and no user is signed in yet.
- A bool indicating if a token sign in is required.
-
Presents a sign in screen, should only be called on sign in enabled configurations when the auth mode is set to sign in.
- presenter: The UIViewController to modally present the sign in screen on.
- completion: The completion block to be called post execution. Returns a result indicating success and if not an error message.
-
Authenticate using a passed in token, for the given study activation code.
- withToken: The token to authenticate with.
- completion: The completion block to be called post execution. Returns a result indicating success and if not an error message.
-
Presents a sign out screen, should only be called on SSO enabled configurations.
- completion: The completion block to be called post execution. Returns a result indicating success and if not an error message.
-
Initializes sensing, and commences uploads to the HR backend. Call once integration steps are complete, and
Sensing.canBeInitialized
returns true.- completion: A block to execute after initialization has completed. Passes in a
SensingError
in the completion handler if an error occured during initialization.
- completion: A block to execute after initialization has completed. Passes in a
-
Must be called from within
AppDelegate.application(application:identifier:completion:)
for handleEventsForBackgroundURLSession, passing in the same parameters. This is required to enable uploads to the HR backend.- application: The UIApplication.
- identifier: The background URL session identifier.
- completion: The completion block to be called post execution.
-
Pass in a raw device token assigned from APNS via
AppDelegate.application(application:,deviceToken:)
to enable push notifications from the HR backend, and the appropriate APNS environment.- deviceToken: The raw APNS assigned device token.
- environment: The
PushNotificationsEnvironment
to use.
-
Handle any diagnostic silent notifications from the HR backend. Accepts a raw userInfo dictionary from the
didReceiveRemoteNotification
app delegate method.- userInfo: The raw userInfo dictionary from the
didReceiveRemoteNotification
app delegate method. - completion: The completion block to be called post execution.
- userInfo: The raw userInfo dictionary from the
-
Iintialize a permission request for the given
PermissionType
- type: The
PermissionType
to request the permission for. - completion: The completion block to be called post execution.
- type: The
-
Returns the required permissions for your configuration.
- An array of the required permission
PermissionType
s
- An array of the required permission
-
Returns the unauthorized and required permissions for your configuration.
- An array of the currently unauthorized permissions as
PermissionType
- An array of the currently unauthorized permissions as
-
Downloads and updates to the latest available configuration from the HR backend for a previously activated configuration.
- completion: The completion block to be called post execution.
-
Retrieves any additional configuration options present in the configuration.
- forKey: the key present in the config, e.g. “demo”.
- A an arbitrary value that must be cast to the appopriate type.
-
The current User ID.
- id: A string indicating the User ID.
- A string containing the current User ID.
-
The User ID Formatter, which can be used to validate user ID formatting.
- A
UserIDFormatter
instance which can be used to determine the format of User IDs and validate against formatting.
- A
-
Retrieves the name of the current configuration.
- A string containing the configuration name.
-
Retrieves the id of the current configuration.
- A string containing the configuration id.
-
Retrieves the
Date
when the configuration was activated.- A
Date
object for when the configuration was activated.
- A
-
Retrieves the current healthrhythms ID.
- A String representing the current healthrhythms ID.
-
Retrieves the associated ID from a token sign in.
- A String representing the associated ID from a token sign in (if present).
-
Deactivates the current configuration and disables sensing. This removes the existing configuration and resets HRSensing, as well as signing out users.
- completion: The completion block to be called post execution.
-
Unenrolls the current user from the study, deactivates the current configuration and disables sensing. This removes the existing configuration and resets HRSensing, as well as signing out users.
- reason: the reason for unenreollement, e.g. “Patient requested in app”.
- completion: The completion block to be called post execution, passes a success boolean and a boolean indicating whether the issue (if there was one) was an internet connection issue.
-
Updates the current scheduled self-report tasks, can be called periodically to safely refresh.
- completion: A completion block which is executed once the update task is complete, passes a success boolean.
-
Updates the current scheduled self-report tasks, can be called periodically to safely refresh.
- presenter: The active UIViewController to modally present the self report on.
- completion: A completion block which is executed once the self report task is completed.
-
Retrieves the number of currently pending self reports.
- A int representing the number of pending self reports.
-
BETA: Retrieves a list of available inferences. This method signature is subject to change without a major version bump.
- An Array of
HRDataSet.Inference
data sets available.
- An Array of
-
BETA: Updates the currently available inference data from the HR Backend. This method signature is subject to change without a major version bump.
- completion: A completion block which is executed once the task update operation has completed.
-
BETA: Retrieves inference data for the passed in Inference and start/end dates. This method signature is subject to change without a major version bump.
- forInference: The
HRDataSet.Inference
to retrieve data for. - startDate: A Date object for the start date to retrieve from.
- endDate: A Date object for the end date to retrieve from.
- completion: A completion block which is executed once the task update operation has completed.
- A dictionary containing the key representing the inference data for the specified inference and date.
- forInference: The
-
BETA: Retrieves inference average data for the passed in Inference and start/end dates. This method signature is subject to change without a major version bump.
- forInference: The
HRDataSet.Inference
to retrieve data for. - startDate: A Date object for the start date to retrieve from.
- endDate: A Date object for the end date to retrieve from.
- completion: A completion block which is executed once the task update operation has completed.
- A double representing the inference average value for the specified inference and date range, a start and end date associated with the average value.
- forInference: The
-
BETA: Retreives inference data. This method signature is subject to change without a major version bump.
- forInference: The
HRDataSet.Inference
to retrieve data for. - forDate: A Date object representing the day to retrieve data from.
- completion: A completion block which is executed once the task update operation has completed.
- A double representing the inference data for the specified inference and date.
- forInference: The
-
BETA: Retreives the raw inference data. This method signature is subject to change without a major version bump.
- forInference: The
HRDataSet.Inference
to retrieve data for. - forDate: A Date object representing the day to retrieve data from.
- completion: A completion block which is executed once the task update operation has completed.
- A double representing the raw inference data for the specified inference and date.
- forInference: The