GoFIT SDK iOS Application Programming Interface Specifications

Jethro E. Lee edited this page Aug 9, 2018 · 3 revisions

GoFIT SDK iOS Application Programming Interface Specifications

Scope

The present document specifies the GoFIT SDK - iOS Application Programming Interfaces (API's).

Terms and Definitions

  • 裝置 (Device)
    • 本 SDK 之目標物、連接對象;為手錶、手環。
  • API's
    • Application Programming Interfaces.
    • Particularly, in the present document, API's (Application Programming Interfaces) 特指 function / method 等可呼叫之類型的介面
  • Data Object
    • 在 API's 之外,還有其所關聯到的資料物件,或資料結構。In the present document, they are called Data Object (s). 為 data model.
  • 健康資料 (Fitness Data)
  • SDK vs. Client
    • SDK 指的即為本文件所描述的程式套件
    • Client 特指使用本文件所描述的程式套件之客戶端 (i.e., 本 SDK 的 user / caller)

API's

本 SDK 以 Singleton Pattern 形式呈現並提供所需服務 / 功能. 各 method 若有 callback 者, 則在 callback 完成前, 都不允許再次呼叫 (本 SDK 非 reentrant, 非 multi-threaded 使用).


SDK Instance

+ (GoFIT_SDK*)shareInstance;
  • 功能
    • 取得 GoFIT SDK singleton

Instantiation

- (void)instantiate:(NSString*)certificate
         andLicense:(NSString*)license
            success:(void (^)(ResponseInfo *resp))success
            failure:(void (^)(ResponseInfo *resp))failure;
  • 功能
    • 建構 GoFIT SDK singleton instance
  • 參數
    • certificate : GOLiFE offered certificate (sequence of bytes); mandatory.
    • license : License (sequence of bytes). Will download license from GOLiFE server (i.e., AAA procedure will be executed, and authorized license, if passed, will be returned via success() callback) in case this parameter is null. Client shall store received license -- otherwise this license download operation will occur each time this singleton is initiated (and thus network is required every time). 另一種情況是 license 雖不為 null,但已過期,則此時 SDK 本身也會重新向 server 進行 renewal 程序,若成功也會帶回新的 SDK License 給 Client 儲存。
    • (callback) success : 表示成功,回傳 ResponseInfo
      • responseObject: 若不為 null,則帶著更新的 SDK License (型態是 `<NSString*>) 傳回給 Client 儲存。
    • (callback) failure : 表示失敗,回傳 ResponseInfo
      • Cause
        • code = 601 (DEVICE_NETWORK_NOT_ENABLE),手機網路未開啟
        • code = 621 (SDK_AUTHENICATION_FAIL),授權失敗

Scan Device

- (void)doScanDevice:(void (^)(NSDictionary* device))success
          completion:(void (^)(ResponseInfo *resp))completion
             failure:(void (^)(ResponseInfo *resp))failure;
  • 功能
    • 掃瞄裝置
  • 參數
    • (callback) success : 會不斷更新,每掃描到一個新的 device 即 callback 帶回一個 <NSDictionary> of <key> : <value> pair where :
      • UUID : objectForKey:@"UUID"
      • productID : objectForKey:@"productID"
    • (callback) completion : 掃描完成,回傳 ResponseInfo
      • code = 10 (BLE_CMD_OK),表示掃瞄完成,並帶回一個 array of devices 於 responseObject 內
      • responseObject : <NSDictionary> of <key> : <value> pair where :
        • UUID : objectForKey:@"UUID"
        • productID : objectForKey:@"productID"
    • (callback) failure : 表示失敗,回傳 ResponseInfo
      • Cause
        • code = 11 (BLE_NOT_ENABLE),手機藍牙未開啟
  • Timeout : 10 秒 (10 秒後回傳 scan 結果)

New Pairing Device

- (void)doNewPairing:(NSString*)uuidStr
      andProductID:(NSString*)productID
             success:(void (^)(ResponseInfo *resp))success
             failure:(void (^)(ResponseInfo *resp))failure;
  • 功能
    • 新配對裝置,不帶有配對碼的連線機制
  • 參數
    • uuidStr : 欲連線裝置之 UUID。必須為之前透過 Scan Device 所回傳者。
    • productID : 欲連線裝置之 Product ID。必須為之前透過 Scan Device 所回傳者,且與當時回傳之 UUID 成對 (即此時傳入之上述 uuidStr)。
    • (callback) success : 表示成功,回傳 ResponseInfo
      • code = 10 (BLE_CMD_OK),表示連接成功,回傳一組配對資訊
      • responseObject : <NSDictionary> of <key> : <value> pair where :
        • pairingCode : objectForKey:@"pairingCode",為一 NSString object,帶著裝置螢幕顯示之四位字元 (ASCI value 0x30 ~ 0x39。字串的字元依序為裝置上顯示之順序)。
        • pairingTime : objectForKey:@"pairingTime",為一 NSString object,配對碼於裝置上生成的時間 (裝置螢幕不顯示)
    • (callback) failure : 表示失敗,回傳 ResponseInfo
      • Cause
        • code = 11 (BLE_NOT_ENABLE),手機藍牙未開啟
        • code = 12 (BLE_CONNECT_FAIL),連接失敗,距離太遠或藍牙訊號太弱
  • Timeout : 5 秒 (若 5 秒內連不上目標裝置,則 callback fail)

Confirm Pairing Code

- (void)confirmPairingCode:(NSString*)pairingCode
            andPairingTime:(NSString*)pairingTime
            andProductID:(NSString*)productID
                   success:(void (^)(ResponseInfo *resp))success
                   failure:(void (^)(ResponseInfo *resp))failure;
  • 功能
    • 確認輸入的配對碼,完成裝置配對機制
  • 參數
    • pairingCode : 輸入裝置螢幕顯示之四字元配對碼
    • pairingTime : 於上述 New Pairing Devicesuccess callback 取得之 pairingTime
    • productID : 欲連線裝置之 Product ID。必須為之前透過 Scan Device 所回傳者,且與當時回傳之 UUID 成對。此參數之值應亦等同於呼叫 New Pairing Device 時所傳入者。
    • (callback) success : 表示成功,回傳 ResponseInfo
      • code = 10 (BLE_CMD_OK),表示配對成功,連接好裝置
    • (callback) failure : 表示失敗,回傳 ResponseInfo
      • Cause
        • code = 11 (BLE_NOT_ENABLE),手機藍牙未開啟
        • code = 12 (BLE_CONNECT_FAIL),連接失敗,距離太遠或藍牙訊號太弱
        • code = 13 (DEVICE_DISCONNECT),裝置斷線
        • code = 14 (DEVICE_PAIRING_FAIL),裝置配對碼匹配錯誤
  • Timeout : 5 秒 (若 5 秒內連不上目標裝置,則 callback fail)

Connect Device

- (void)doConnectDevice:(NSString*)uuidStr
           andProductID:(NSString*)productID
         andPairingCode:(NSString*)pairingCode
         andPairingTime:(NSString*)pairingTime
                success:(void (^)(ResponseInfo *resp))success
                failure:(void (^)(ResponseInfo *resp))failure;
  • 功能
    • 帶有配對碼的連線機制,適合已配對過的裝置
    • 傳入裝置之 UUIDpairingCodepairingTime 以連接裝置
    • 此 API 會連帶執行手環時間校正功能
  • 參數
    • uuidStr : 裝置之 UUID. 可為 null, 但將較為耗時, 請於為了無痛跨系統 (手機; e.g., Android ⇒ iOS) 時使用
    • productID : 欲連線裝置之 Product ID。必須為之前透過 Scan Device 所回傳者,且與當時回傳之 UUID 成對 (即此時傳入之上述 uuidStr)。
    • pairingCode : 裝置配對碼
    • pairingTime : 裝置配對時間戳記
    • (callback) success : 表示成功,回傳 ResponseInfo
      • code = 10 (BLE_CMD_OK),表示連接成功
    • (callback) failure : 表示失敗,回傳 ResponseInfo
      • Cause
        • code = 11 (BLE_NOT_ENABLE),手機藍牙未開啟
        • code = 12 (BLE_CONNECT_FAIL),連接失敗,距離太遠或藍牙訊號太弱
        • code = 14 (DEVICE_PAIRING_FAIL),裝置配對碼匹配錯誤
  • Timeout : 5 秒 (若 5 秒內連不上目標裝置,則 callback fail)

Get Fitness Data

- (void)doSyncFitnessData:(void (^)(int progressValue))progress
                  success:(void (^)(ResponseInfo *resp))success
                  failure:(void (^)(ResponseInfo *resp))failure;
  • 功能
    • 同步手環上所有健康資料
    • 需要先呼叫 Connect Device API,連接成功後才能執行此 API
  • 參數
    • (callback) progress : 表示目前 sync 進度 (單純為一累進數值; 無)
    • (callback) success : 表示成功,回傳 ResponseInfo,其中 :
    • (callback) failure : 表示失敗,回傳 ResponseInfo
      • Cause
        • code = 11 (BLE_NOT_ENABLE),手機藍牙未開啟
        • code = 12 (BLE_CONNECT_FAIL),連接失敗,距離太遠或藍牙訊號太弱
        • code = 13 (DEVICE_DISCONNECT),裝置未連線
        • code = 14 (DEVICE_PAIRING_FAIL),裝置配對碼匹配錯誤
        • code = 602 (SYNC_IS_ALREADY_START),先前同步的裝置尚未完成,無法再執行一次同步 (本 SDK 不支援 reentrancy 機制)
  • Timeout : 15 秒 (若裝置無回應,15 秒後會 callback fail)

Device Settings

- (void)doSetSetting:(NSArray*)settings
             success:(void (^)(ResponseInfo *resp))success
             failure:(void (^)(ResponseInfo *resp))failure;
  • 功能
    • 設定手環功能
    • 需要先呼叫 Connect Device API,連接成功後才能執行此 API
  • 參數
    • settings : Array (variable length) carrying selected object types defined in Setting Object
      • settings array 內只需填入欲設定的 setting objects
    • (callback) success : 表示成功,回傳 ResponseInfo
      • code = 10 (BLE_CMD_OK),表示設定成功
    • (callback) failure : 表示失敗,回傳 ResponseInfo
      • Cause
        • code = 11 (BLE_NOT_ENABLE),手機藍牙未開啟
        • code = 12 (BLE_CONNECT_FAIL),連接失敗,距離太遠或藍牙訊號太弱
        • code = 13 (DEVICE_DISCONNECT),裝置未連線
        • code = 14 (DEVICE_PAIRING_FAIL),裝置配對碼匹配錯誤
        • code = 18 (BLE_SETTING_FORMAT_ERROR),設定格式錯誤
        • code = 602 (SYNC_IS_ALREADY_START),先前同步的裝置尚未完成,無法執行設定 (本 SDK 不支援 reentrancy 機制)
  • Timeout : 15 秒 (若裝置無回應,15 秒後會 callback fail)

Clear Data

- (void)doClearDeviceData:(void (^)(ResponseInfo *resp))success
                  failure:(void (^)(ResponseInfo *resp))failure;
  • 功能
  • 參數
    • (callback) success : 表示成功,回傳 ResponseInfo
      • code = 10 (BLE_CMD_OK),表示清除成功
    • (callback) failure : 表示失敗,回傳 ResponseInfo
      • Cause
        • code = 11 (BLE_NOT_ENABLE),手機藍牙未開啟
        • code = 12 (BLE_CONNECT_FAIL),連接失敗,距離太遠或藍牙訊號太弱
        • code = 13 (DEVICE_DISCONNECT),裝置未連線
        • code = 14 (DEVICE_PAIRING_FAIL),裝置配對碼匹配錯誤
        • code = 602 (SYNC_IS_ALREADY_START),先前同步的裝置尚未完成,無法執行此指令 (本 SDK 不支援 reentrancy 機制)
  • Timeout : 15 秒 (若裝置無回應,15秒後會 callback fail)

Device Data Initialization

- (void)doInitialDevice:(void (^)(ResponseInfo *resp))success
                failure:(void (^)(ResponseInfo *resp))failure;
  • 功能
    • 初始化裝置內之資料
    • 需要先呼叫 Connect Device API,連接成功後才能執行此 API
  • 參數
    • (callback) success : 表示成功,回傳 ResponseInfo
      • code = 10 (BLE_CMD_OK),表示清除成功
    • (callback) failure : 表示失敗,回傳 ResponseInfo
      • Cause
        • code = 11 (BLE_NOT_ENABLE),手機藍牙未開啟
        • code = 12 (BLE_CONNECT_FAIL),連接失敗,距離太遠或藍牙訊號太弱
        • code = 13 (DEVICE_DISCONNECT),裝置未連線
        • code = 14 (DEVICE_PAIRING_FAIL),裝置配對碼匹配錯誤
        • code = 602 (SYNC_IS_ALREADY_START),先前同步的裝置尚未完成,無法執行此指令 (本 SDK 不支援 reentrancy 機制)
  • Timeout : 15 秒 (若裝置無回應,15秒後會 callback fail)

Device Firmware Update

- (void)doDFU:(void (^)(int progressValue))progress
      success:(void (^)(ResponseInfo *resp))success
      failure:(void (^)(ResponseInfo *resp))failure;
  • 功能
    • 升級手環韌體
    • 需要先呼叫 Connect Device API,連接成功後才能執行此 API
  • Callback
    • progress : 目前 DFU 的進度 (百分比)
    • (callback) success : 表示成功,回傳 ResponseInfo
      • code = 10 (BLE_CMD_OK),表示清除成功
    • (callback) failure : 表示失敗,回傳 ResponseInfo
      • 可能失敗原因
        • code = 11 (BLE_NOT_ENABLE),手機藍牙未開啟
        • code = 12 (BLE_CONNECT_FAIL),連接失敗,距離太遠或藍牙訊號太弱
        • code = 13 (DEVICE_DISCONNECT),裝置未連線
        • code = 14 (DEVICE_PAIRING_FAIL),裝置配對碼匹配錯誤
        • code = 20 (DFU_APP_MODE_ERROR),DFU 過程中發生錯誤
        • code = 602 (SYNC_IS_ALREADY_START),先前同步的手環尚未完成,無法執行此指令 (本 SDK 不支援 reentrancy 機制)
  • Timeout : 30 秒 (若裝置無回應,30秒後會 callback fail)

Disconnect Device

- (void)doDisconnectDevice;
  • 功能
    • 將目前連線之裝置斷線

Check Device Connection Status

- (BOOL)isBLEConnect;
  • 功能
    • 確認裝置目前的連線狀態
  • Return
    • TRUE if connected; FALSE otherwise

Get Device Battery Level

- (NSInteger)getDeviceBatteryValue;
  • 功能
    • 取得裝置電量
    • 需要先呼叫 Connect Device API,連接成功後才能執行此 API
  • Return
    • 電量 (為百分比)

Get Device Serial Number

- (NSString*)getDeviceSN;
  • 功能
    • 取得裝置之序號
    • 需要先呼叫 Connect Device API,連接成功後才能執行此 API
  • Return
    • 裝置之序號

Get Device MAC Address

- (NSString*)getDeviceMAC;
  • 功能
    • 取得裝置之 MAC Address
    • 需要先呼叫 Connect Device API,連接成功後才能執行此 API
  • Return
    • 裝置之 MAC address

Get Device Firmware Version

- (NSString*)getDeviceFWVersion;
  • 功能
    • 取得裝置之韌體版本
    • 需要先呼叫 Connect Device API,連接成功後才能執行此 API
  • Return
    • 裝置之 firmware 版本

Re-Initialize Instance

- (void)reInitInstance;
  • 功能
    • 為避免一些例外情況造成 SDK instance 錯亂 (e.g., 防止 reentrant 的 lock 在異常狀態下沒有解開,造成下一個裝置無法進行連線同步),透過此方法可手動 re-inititalize SDK singleton instance


Data Models and Objects

Response Code Enumeration

typedef NS_ENUM(NSUInteger, E_RESPONSE_CODE) {
    // Reserverd
    HTTP_REQUEST_FAIL = 0,                        // Http request fail
    
    // BLE
    BLE_CMD_OK = 10,                              // BLE command OK
    BLE_NOT_ENABLE,                               // BLE not enable
    BLE_CONNECT_FAIL,                             // BLE connect fail
    DEVICE_DISCONNECT,                            // Device disconnect
    DEVICE_PAIRING_FAIL,                          // Pairing fail
    DEVICE_PAIRING_CODE_NOT_FOUND,                // Pairing code not found, do new pairing first
    DEVICE_ALREADY_PAIRED,                        // Device already paired, forget device first
    DEVICE_RELEASE_PAIR_FAIL,                     // Release pair fail
    BLE_SETTING_FORMAT_ERROR,                     // Setting format error
    DEVICE_NOT_SUPPORT_JUMP_BOOTLOADER,           // Device is not support jumping to bootloader
    DFU_APP_MODE_ERROR,                           // DFU with App mode error
    MESSAGE_TYPE_NON_EXISTENT_OR_NOT_IMPLEMENTED, // Message type non existent or not implemented
    PAIRING_NEEDED,                               // Pairing needed
    AUTHORIZATION_NEEDED,                         // Authorization needed
    ANCS_BONDING_FAIL,                            // ANCS bonding fail
    START_TRANSMISSION_FAIL,                      // GoWatch Start transmission fail
    GET_ACTIVITY_SUMMARY_FAIL,                    // GoWatch Get activity summary fail
    GET_NMEA_FAIL,                                // GoWatch Get NMEA fail
    DEVICE_NOT_FOUND,
    WRITE_COMMAND_TO_DEVICE_TIMEOUT,
    PAIRING_CODE_MISMATCH,
    DEVICE_FIRMWARE_UPDATE_FAILED,
    DEVICE_FIRMWARE_UPDATE_PROGRESSING,
    OTHER_DEVICE_SYNCING,
    
    // Cloud
    GOLiFE_RESULT_OK = 200,
    GOLiFE_RESULT_REDIRECTION_FOUND = 302,
    GOLiFE_RESULT_BAD_REQUEST = 400,
    GOLiFE_RESULT_UNAUTHORIZED = 401,
    GOLiFE_RESULT_FORBIDDEN = 403,
    GOLiFE_RESULT_NOT_FOUND = 404,
    GOLiFE_RESULT_CONFLICT = 409,
    GOLiFE_RESULT_SERVER_ERROR = 500,
    GOLiFE_RESULT_CONNECTION_ERROR = 520,
    
    // App
    USER_CANCEL = 600,                            // User operation cancelled
    DEVICE_NETWORK_NOT_ENABLE,                    // Device network is not enable
    DEVICE_NETWORK_SUPPORT_ONLY_WIFI,             // Only support WiFi enviorment
    EMAIL_NOT_VALID,                              // Email format is not valid
    PASSWORD_NOT_ENOUGH,                          // Password less than 8 characters
    REGISTER_ACCOUNT_ALREADY_EXIST,               // Register account already exist
    LOGIN_ACCOUNT_OR_PASSWORD_ERROR,              // Login account or password error
    THIRD_PARTY_TYPE_ERROR,                       // Third party type error
    COMPONENT_INITIAL_ERROR,                      // Component initial error
    PARSER_DATA_ERROR,                            // Parsing data error
    GET_EXCEPTION,                                // Get exception
    WECHAT_APP_DO_NOT_EXIST,                      // Wechat App not exist
    SOURCE_TYPE_ERROR,                            // data source type error
    PASSWORD_NOT_THE_SAME,                        // Password is not the same
    DEVICE_API_NOT_SUPPORT,                       // Device API is not supported
    API_PARAMETER_ERROR,                          // API parameter error
    DATABASE_NO_AFFECT,
    SHARE_TO_QQ_NOT_SUPPORT_IMAGE_OBJECT,
    CANNOT_REGISTER_RECEIVER,
    WRITE_DATABASE_FAILED,
    SYNC_IS_ALREADY_START
};

Response Info Data Object

@interface ResponseInfo : NSObject
    @property (nonatomic, retain) NSNumber * responseCode;
    @property (nonatomic, retain) NSString * message;
    @property (nonatomic, retain) id responseObject;   // for extensions
@end

Fitness Data Objects

  • Step Fitness Data Object

    @interface FitnessStep : NSObject
        @property (nonatomic, retain) NSNumber * timestamp;   // Unix Time, i.e., number of seconds that have elapsed since 00:00:00 UTC time, 1 January 1970
        @property (nonatomic, retain) NSNumber * distance;
        @property (nonatomic, retain) NSNumber * calories;
        @property (nonatomic, retain) NSNumber * steps;
    @end
  • Sleep Fitness Data Object

    @interface FitnessSleep : NSObject
        @property (nonatomic, retain) NSNumber * timestamp;   // Unix Time, i.e., number of seconds that have elapsed since 00:00:00 UTC time, 1 January 1970
        @property (nonatomic, retain) NSNumber * score;
    @end
  • Heart Rate Fitness Data Object

    @interface FitnessHR : NSObject
        @property (nonatomic, retain) NSNumber * timestamp;   // Unix Time, i.e., number of seconds that have elapsed since 00:00:00 UTC time, 1 January 1970
        @property (nonatomic, retain) NSNumber * pulse;
    @end

Settings Data Objects

  • User Profile Settings Data Object

    @interface DeviceSettingUserProfile : NSObject
        @property (nonatomic) CGFloat height;   // cm
        @property (nonatomic) CGFloat weight;   // kg
        @property (nonatomic) NSUInteger age;   // 0 ~ 99
        @property (nonatomic) CGFloat stride;   // cm
        @property (nonatomic, retain) NSString * birthday;  // yyyy-MM-dd
        @property (nonatomic) NSUInteger gender;            // 0 : male, 1 :female
    @end
  • Step Goal Settings Data Object

    @interface DeviceSettingStepGoal : NSObject
        @property (nonatomic) NSUInteger stepGoal;
    @end
  • System Unit Settings Data Object

    @interface DeviceSettingSystemUnit : NSObject
        @property (nonatomic, retain) NSString * systemUnit;  // metric | imperial
    @end
  • Time Format Settings Data Object

    @interface DeviceSettingTimeFormat : NSObject
        @property (nonatomic, retain) NSString * timeFormat;  // 12 | 24
    @end
  • Wear Handedness Settings Data Object

    @interface DeviceSettingHandedness : NSObject
        @property (nonatomic, retain) NSString * handedness;  // left | right
    @end
  • Auto Light Up Settings Data Object

    @interface DeviceSettingAutoLightUp : NSObject
        @property (nonatomic) BOOL enable;
    @end
  • Disconnect Alert Settings Data Object

    @interface DeviceSettingDisconnectAlert : NSObject
        @property (nonatomic) BOOL enable;
    @end
  • Idle Alert Settings Data Object

    @interface DeviceSettingIdleAlert : NSObject
        @property (nonatomic) BOOL enable;
        @property (nonatomic) NSInteger repeatDays;
        // bit0 : Sun
        // bit1 : Mon
        // bit2 : Tue
        // bit3 : Wed
        // bit4 : Thu
        // bit5 : Fri
        // bit6 : Sat
        @property (nonatomic, retain) NSString * startTimeHHMM;   // 00:00 ~ 23:59
        @property (nonatomic, retain) NSString * endTimeHHMM;     // 00:00 ~ 23:59
        @property (nonatomic) NSInteger intervalMin;  // minutes
    @end
  • Alarm Clock Settings Data Object

    @interface DeviceSettingAlarms : NSObject
        @property (nonatomic) BOOL enable;
        @property (nonatomic) NSInteger clockID;
        @property (nonatomic) NSInteger category;
        // 0 : wake up
        // 1 : sleep
        // 2 : meeting
        // 3 : training
        // 4 : dating
        // 5 : party
        // 6 : others
        // 7 : medicine
    
        @property (nonatomic) NSInteger repeatDays;
        // bit0 : Sun
        // bit1 : Mon
        // bit2 : Tue
        // bit3 : Wed
        // bit4 : Thu
        // bit5 : Fri
        // bit6 : Sat
    
        @property (nonatomic, retain) NSString * alarmEnableDate;  // YYYY-MM-dd
        @property (nonatomic, retain) NSString * alarmTimeHHMM;    // HH:mm
        @property (nonatomic) BOOL isActive;
        @property (nonatomic, retain) NSString * alarmText;
    @end
  • Detecting Heart Rate by Interval Settings Data Object

    @interface DeviceSettingTimingDetectHR : NSObject
        @property (nonatomic) BOOL enable;
        @property (nonatomic, retain) NSString * startTimeHHMM;   // 00:00 ~ 23:59
        @property (nonatomic, retain) NSString * endTimeHHMM;     // 00:00 ~ 23:59
        @property (nonatomic) NSInteger intervalMin;   // minutes
        @property (nonatomic) NSInteger repeatDays;    // useless
    @end
  • Do Not Disturb Settings Data Object

    @interface DeviceSettingDND : NSObject
        @property (nonatomic) BOOL enable;
        @property (nonatomic, retain) NSString * startTimeHHMM;   // 00:00 ~ 23:59
        @property (nonatomic, retain) NSString * endTimeHHMM;     // 00:00 ~ 23:59
        @property (nonatomic) NSInteger repeatDays;   // useless
    @end
  • Display Language Settings Data Object

    @interface DeviceSettingLanguage : NSObject
        @property (nonatomic) NSUInteger language;
        // 0 : TW
        // 1 : CN
        // 2 : EN
        // 3 : JP
    @end
  • Find My Band Settings Data Object

    @interface DeviceSettingFindMyCare : NSObject
        @property (nonatomic) BOOL vibrationOnOff;
        @property (nonatomic) NSInteger vibrationSecond;
        @property (nonatomic) BOOL vibrationRepeat;
    @end
  • Find My Phone Settings Data Object

    @interface DeviceSettingFindMyPhone : NSObject
        @property (nonatomic) BOOL enable;
        @property (nonatomic) NSInteger vibrationTime;
        @property (nonatomic) BOOL soundOnOff;
    @end
  • Heart Rate Warning Settings Data Object

    @interface DeviceSettingHRWarning : NSObject
        @property (nonatomic) BOOL enable;
        @property (nonatomic) NSInteger maxValue;
        @property (nonatomic) NSInteger minValue;
    @end
  • Screen Lock Settings Data Object

    @interface DeviceSettingHorizontalUnlock : NSObject
        @property (nonatomic) BOOL enable;
    @end


Sample Data

  • Step Fitness Data

    Step Record : {
       timestamp : 1529924400    // UTC time : 2018, Jun, 25 11:00:00 GMT+00:00
       steps : 129               // step counts
       distance : 102            // distance, unit : m
       calories : 7              // unit : 大卡
    }
    
    Step Record : {
       timestamp : 1529925600
       steps : 467
       distance : 369
       calories : 23
    }
    
    Step Record : {
       timestamp : 1529926800
       steps : 27
       distance : 21
       calories : 2
    }
    
  • Heart Rate Fitness Data

    HR Record : {
       timestamp : 1530006834    // UTC time : 2018, Jun, 26 09:53:54 GMT+00:00
       pulse : 84                // Heart Rate counts
    }
    HR Record : {
       timestamp : 1530006844
       pulse : 83
    }
    HR Record : {
       timestamp : 1530006868
       pulse : 81
    }
    
  • Sleep Fitness Data

    Sleep Record : {
       timestamp : 1529938800    // UTC time : 2018, Jun, 25 15:00:00 GMT+00:00
       score : 5                 // 睡眠分數:0~5,0為深眠,5為淺眠
    }
    Sleep Record : {
       timestamp : 1529939400
       score : 3
    }
    Sleep Record : {
       timestamp : 1529940000
       score : 1
    }
    
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.