Cortex iOS
 All Classes Functions Properties
CSCoachingEngine Class Reference

#import <CSCoachingEngine.h>

Inheritance diagram for CSCoachingEngine:

Instance Methods

(void) - initializeWithAppKey:
 
(void) - setupForTesting
 
(void) - registerUserWithEmail:andPassword:andSecretCode:andUserInfo:success:failure:
 
(void) - loginWithUser:withPassword:success:failure:
 
(void) - getDomainState:from:to:success:failure:
 
(void) - logout
 
(Coach *) - getCoachForType:
 
(void) - synchronizeWithServer
 

Class Methods

(CSCoachingEngine *) + sharedCoachingEngine
 Get the singleton.
 

Properties

CalibrationCoachcalibrationCoach
 
ExerciseCoachexerciseCoach
 
SleepDurationCoachsleepDurationCoach
 
MentalResilienceCoachmentalResilienceCoach
 
BioRhythmCoachbioRhythmCoach
 
JetlagCoachjetlagCoach
 
ShiftWorkCoachshiftWorkCoach
 
Psychologistpsychologist
 
Historianhistorian
 
MessageProxy * messageProxy
 
CoachingEngineAPIapi
 
NSArray * coaches
 
BOOL simulationMode
 
NSDate * simulationTime
 

Detailed Description

The coaching engine manages all coaches. This singleton serves as a factory and manager of coaches. It reloads coaches when neccessary and synchronizes with the backend.

Method Documentation

- (Coach *) getCoachForType: (CoachType)  type

Return the instance for the specified coach type.

- (void) getDomainState: (NSString*)  state
from: (NSDate*)  from
to: (NSDate*)  to
success: (void(^)(NSArray *states))  success
failure: (void(^)(NSError* error))  failure 

Get state information for a domain

Parameters
statethe state name. refer to the Coaching engine backend specification for available state
fromunix epoch time start of the data
tounix epoch time end of the data
Returns
NSArray of NSDictionary: {"date": [NSDATE], @"value": [id]} the value can be anything of parsed JSON
- (void) initializeWithAppKey: (NSString*)  appKey

Initialize the coaching engine. This function should be called at the start of the application.

Parameters
appKeythe application key of the application as provided by Sense
- (void) loginWithUser: (NSString*)  username
withPassword: (NSString*)  password
success: (void(^)())  success
failure: (void(^)(NSError* error))  failure 

Login

Parameters
usernameUsername to login with
passwordplain text password to authenticate the user
successsuccess handler, called on the main thread
failurehandler. Might contain extra info on the error. Called on the main queue
- (void) logout

Logout

- (void) registerUserWithEmail: (NSString*)  email
andPassword: (NSString*)  password
andSecretCode: (NSString*)  secretCode
andUserInfo: (NSDictionary*)  userInfo
success: (void(^)())  success
failure: (void(^)(NSError* error))  failure 

Registers a new user with email and password and connects the user to a specific organization for a specific application based on the secret code that is provided. Success and failure functions can be specified.

Parameters
emailEmail to register
passwordplain text password
secretCodesecret code (subscription code) of the user
successsuccess handler. Called on the main queue
failurefailure handler. Might contain extra info on the error. Called on the main queue
Warning
Function has changed so that it requires a secret code now and cannot be used anymore without specifying a secret code
- (void) setupForTesting

Can be called to talk to the staging environment instead of the live environment of commonsense APIs.

- (void) synchronizeWithServer

Synchronize the coaching backend with the server. Synchronization is done implicitly and regularly. Use this to force a synchronization immediately.


The documentation for this class was generated from the following files: