Cortex iOS
|
#import <CSCoachingEngine.h>
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 | |
CalibrationCoach * | calibrationCoach |
ExerciseCoach * | exerciseCoach |
SleepDurationCoach * | sleepDurationCoach |
MentalResilienceCoach * | mentalResilienceCoach |
BioRhythmCoach * | bioRhythmCoach |
JetlagCoach * | jetlagCoach |
ShiftWorkCoach * | shiftWorkCoach |
Psychologist * | psychologist |
Historian * | historian |
MessageProxy * | messageProxy |
CoachingEngineAPI * | api |
NSArray * | coaches |
BOOL | simulationMode |
NSDate * | simulationTime |
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.
- (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
state | the state name. refer to the Coaching engine backend specification for available state |
from | unix epoch time start of the data |
to | unix epoch time end of the data |
- (void) initializeWithAppKey: | (NSString*) | appKey |
Initialize the coaching engine. This function should be called at the start of the application.
appKey | the 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
username | Username to login with |
password | plain text password to authenticate the user |
success | success handler, called on the main thread |
failure | handler. Might contain extra info on the error. Called on the main queue |
- (void) logout |
Logout
- (void) registerUserWithEmail: | (NSString*) | ||
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.
Email to register | |
password | plain text password |
secretCode | secret code (subscription code) of the user |
success | success handler. Called on the main queue |
failure | failure handler. Might contain extra info on the error. Called on the main queue |
- (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.