Skip to main content
Version: 1.2.4

iOS

SDK Integretion

Flow Diagram

Flow Diagram

Environment

  • iOS 9.0 or above, Xcode 9.0 or above.
  • Need apply dbay account,in order to perform authentication.

Integration Steps

Permissions

Privacy - Bluetooth Always Usage Description
Privacy - Bluetooth Peripheral Usage Description

How to call method(s)

  • Import <DBAlgorithm/DBAlgorithm.h> then use [DBAlgorithmCalculate sharedInstance] to call method(s).

Init Method

-(void)startWithToken: accountId: completion:^(DBErrorCode code);

ParameterTypeDescription
tokenStringUnique token, provided by deepbay team
accountIdStringUnique accountId, provided by deepbay team
completionBlock2 callback parameters: 1. DBErrorCodeSuccess call SDK after success;2. DBErrorCodeInvalidUser return error message when init unsuccessfully

Auth

-(BOOL)isCanUseSDK;

Close

Call close method when finish.

-(void)close;

Add Device Method

-(int)addDevice:(NSString *)deviceName;

ParameterTypeDescription
deviceNameStringHeadband Device Name
ResultTypeDescription
deviceIndexIntDevice SN Number

实例

Delete Device

-(void)deleteDevice:(NSString *)deviceName;

Note: delete target device need add before, or the algorithm will be caculted error

ParameterTypeDescription
deviceNameStringHeadband Device Name

Swith to Turn On/Off Original Data

-(void)setRawDataSwitch:(BOOL)isOpenRaw;

ParameterTypeDescription
isOpenRawBOOLIf turn on or off original data

Call Algorithm Method(s)

-(void)parseRawString:(NSString )raw deviceIndex:(int)deviceIndex eegCompletion:(void(^)(DBEegModel ))eegCompletion completion:(void(^)(DBAlgorithmModel *))completion;

ParameterTypeDescription
rawStringBluetooth hexadecimal string per frame
deviceIndexIntDevice SN Number
ResultTypeDescription
eegCompletionDBEegModelIs return data successfully
completionDBAlgorithmModelResult from algorithm
@interface DBEegModel : DBModel

@property (nonatomic) BOOL detectOK;
@property (nonatomic) BOOL haveSecTime;
@property (nonatomic) NSArray * af7Eegs;
@property (nonatomic) NSArray * af8Eegs;
@property (nonatomic) NSArray * af7Leadoffs;
@property (nonatomic) NSArray * af8Leadoffs;
@property (nonatomic) NSNumber * counter;
@property (nonatomic) NSNumber * flag;
@property (nonatomic) NSNumber * index;

@end

@interface DBAlgorithmModel : DBModel

@property (nonatomic) double mindfulness;
@property (nonatomic) int focus;
@property (nonatomic) int stress;
@property (nonatomic) int fatigue;
@property (nonatomic) int relax;
@property (nonatomic) double emotion;

-(int)getSignalQuailty:(DBSignalQuailtyType)type;// Get signal quality indicators from AF7 and AF8 (signal description: 0 stands for good signal quality,1 stands for poor signal quality)
-(DBAlgorithmEnergyModel *)getEnergy;// Get original data

@end

/**
Original Data Model
*/
@interface DBAlgorithmEnergyModel : DBModel

@property (nonatomic) double alpha;
@property (nonatomic) double beta;
@property (nonatomic) double delta;
@property (nonatomic) double gamma;

-(double)getMindfullness;

@end

More about data specification, please ref to Data Specification

Mindfulness Indicators Radar Map Scores

-(void)getMindfullnessScore:(NSArray )array completion:(void(^)(DBRadarModel ))completion;

ParameterTypeDescription
tbrsArrayData array from algorithm
ResultTypeDescription
completionDBRadarModelResult from algorithm
@interface DBRadarModel : DBModel

@property (nonatomic) int stability; // Mindfulness Stability
@property (nonatomic) float percent; // Mindfulness Percentage
@property (nonatomic) int score; // Mindfulness Score
@property (nonatomic) float potential; // Mindfulness Potential

@end