Data synchronization function

9.1 Functional Overview

Synchronizing device data is a very important feature. The synchronization process recommends that no other commands be executed, and even executing a command is invalid. The synchronization configuration is performed after the first successful binding of the connected device, and the synchronization configuration is also required when the device is restored to factory settings. Progress is returned during the sync process, and a completed status is returned after each item is synced. Judging whether the synchronization is complete according to the synchronization status, the synchronization log will be recorded and stored during the synchronization process.。

9.2 Synchronous initialization

Objc:

initSyncManager().wantToSyncType = IDO_WANT_TO_SYNC_CONFIG_ITEM_TYPE | IDO_WANT_TO_SYNC_HEALTH_ITEM_TYPE
        | IDO_WANT_TO_SYNC_ACTIVITY_ITEM_TYPE | IDO_WANT_TO_SYNC_GPS_ITEM_TYPE;

Swift:

initSyncManager().wantToSyncType = IDO_WANT_TO_SYNC_ITEM_TYPE.CONFIG_ITEM_TYPE | IDO_WANT_TO_SYNC_ITEM_TYPE.HEALTH_ITEM_TYPE
            |IDO_WANT_TO_SYNC_ITEM_TYPE.ACTIVITY_ITEM_TYPE | IDO_WANT_TO_SYNC_ITEM_TYPE.GPS_ITEM_TYPE;

9.3 Parameter Description

Parameters Description Notes
isSyncHealthRun Whether the currently connected device is syncing readonly,bool
isSyncConfigRun Whether the currently connected device is synchronizing configuration information readonly,bool
isNeedSyncConfig Whether the currently connected device needs to synchronize configuration readonly,bool
wantToSyncType Set options to sync Sync Configuration, Sync Health,
Sync Activity, Sync GPS
isSave Whether the synchronized data is stored in the SDK database Default YES
itemSyncTimeout Each synchronization timeout period Default 60 seconds

9.4 Basic Method

Objc:

//start sync
[IDOSyncManager startSync];
//end synchronization
[IDOSyncManager stopSync];

Swift:

//start sync
IDOSyncManager.startSync();
//end synchronization
IDOSyncManager.stopSync();

9.5 execute callback method

Objc:

initSyncManager().addSyncComplete(^(IDO_SYNC_COMPLETE_STATUS stateCode) {
      //Sync complete status
    if(stateCode == IDO_SYNC_GLOBAL_COMPLETE) {
       //Query the corresponding cached data after synchronization is complete
   }
}).addSyncProgess(^(IDO_CURRENT_SYNC_TYPE type, float progress) {
   //Sync item, sync progress (0-1)
}).addSyncFailed(^(int errorCode) {
    //sync failed
}).addSyncConfigInitData(^NSArray <IDOBluetoothBaseModel *>* (IDO_SYNC_CONFIG_DATA_TYPE type){
 //The first binding or device restart will synchronize the configuration supported types and call back
  //According to the returned synchronization type, return the initialized data model collection according to the business requirements
switch (type) {
                case IDO_SYNC_SET_TIME_TYPE:
                {
                    // Set Time info
                   // IDOSetTimeInfoBluetoothModel
                }
                    break;
                case IDO_SYNC_SET_ALARM_TYPE:
                {
                    // Set Alarm
                   // IDOSetAlarmInfoBluetoothModel
                }
                    break;
                case IDO_SYNC_SET_LONG_SIT_TYPE:
                {
                    // Set LongSit Info
                   // IDOSetLongSitInfoBuletoothModel
                }
                    break;
                case IDO_SYNC_SET_LOST_FIND_TYPE:
                {
                    // Set Prevent Lost
                    // IDOSetPreventLostInfoBuletoothModel
                }
                    break;
                case IDO_SYNC_SET_FIND_PHONE_TYPE:
                {
                    // Set Find Phone
                    // IDOSetFindPhoneInfoBuletoothModel
                }
                    break;
                case IDO_SYNC_SET_SPORT_GOAL_TYPE:
                {
                    // Set exercise target steps
                     // IDOSetUserInfoBuletoothModel
                 }
                     break;
                 case IDO_SYNC_SET_USER_INFO_TYPE:
                 {
                     // set user information
                     // IDOSetUserInfoBuletoothModel
                 }
                     break;
                 case IDO_SYNC_SET_UNIT_TYPE:
                 {
                     // set the unit
                    // IDOSetUnitInfoBluetoothModel
                }
                    break;
                case IDO_SYNC_SET_AUTH_TYPE:
                {
                    // Setting permissions
                     // IDOSetBindingInfoBluetoothModel
                 }
                     break;
                 case IDO_SYNC_SET_HEART_RATE_MODE_TYPE:
                 {
                     // set v2 heart rate mode
                     //IDOSetHrModeInfoBluetoothModel
                 }
                     break;
                 case IDO_SYNC_SET_V3_SET_HR_MODE_TYPE:
                 {
                     // set v3 heart rate mode
                     //IDOSetV3HeartRateModeBluetoothModel
                 }
                     break;
                 case IDO_SYNC_SET_UP_HAND_GESTURE_TYPE:
                 {
                     // set hand up
                    // IDOSetHandUpInfoBuletoothModel
                }
                    break;
                case IDO_SYNC_SET_DO_NOT_DISTURB_TYPE:
                {
                    // Set up do not disturb mode
                     //IDOSetNoDisturbModeInfoBluetoothModel
                 }
                     break;
                 case IDO_SYNC_SET_DISPLAY_MODE_TYPE:
                 {
                     // set display mode
                     //IDOSetDisplayModeInfoBluetoothModel
                 }
                     break;
                 case IDO_SYNC_SET_ONE_KEY_SOS_TYPE:
                 {
                     // Set up one key call
                     //IDOSetOneKeySosInfoBuletoothModel
                 }
                     break;
                 case IDO_SYNC_SET_MUISC_ON_OFF_TYPE:
                 {
                     // set the music switch
                    // IDOSetMusicOpenInfoBuletoothModel
                }
                    break;
                case IDO_SYNC_SET_WEATHER_SWITCH_TYPE:
                {
                    // Set the weather switch
                     //IDOSetWeatherSwitchInfoBluetoothModel
                 }
                     break;
                 case IDO_SYNC_SET_HEART_RATE_INTERVAL_TYPE:
                 {
                     // set heart rate zone
                     //IDOSetHrIntervalInfoBluetoothModel
                 }
                     break;
                 case IDO_SYNC_SET_SPORT_MODE_SELECT_TYPE:
                 {
                     // Set sport mode selection
                     //IDOSetSportShortcutInfoBluetoothModel
                 }
                     break;
                 case IDO_SYNC_SET_SPORT_MODE_SORT_TYPE:
                 {
                     // Set the motion mode ordering
                    // IDOSetSportSortingInfoBluetoothModel
                }
                    break;
                case IDO_SYNC_SET_WATCH_DIAL_TYPE:
                {
                     // Set watch face ID
                      //IDOSetWatchDiaInfoBluetoothModel
                 }
                     break;
                 case IDO_SYNC_SET_SHORTCUT_TYPE:
                 {
                     // set shortcut
                     //IDOSetShortcutInfoBluetoothModel
                 }
                     break;
                 case IDO_SYNC_SET_SLEEP_PERIOD_TYPE:
                 {
                     // set sleep time period
                     //IDOSetSleepPeriodInfoBluetoothModel
                 }
                     break;
                 case IDO_SYNC_SET_SCREEN_BRIGHTNESS_TYPE:
                 {
                     // set screen brightness
                    // IDOSetScreenBrightnessInfoBluetoothModel
                }
                    break;
                case IDO_SYNC_SET_MENSTRUATION_REMIND_TYPE:
                {
                    // Setting reminders for women's menstrual cycles
                     //IDOSetMenstrationRemindBluetoothModel
                 }
                     break;
                 case IDO_SYNC_SET_SET_MENSTRUATION_TYPE:
                 {
                     // set the female menstrual cycle
                     //IDOSetMenstrationInfoBluetoothModel
                 }
                     break;
                 case IDO_SYNC_SET_CALORIE_DISTANCE_GOAL_TYPE:
                 {
                     // Set calorie and distance goals
                     // IDOSetUserInfoBuletoothModel
                 }
                     break;
                 case IDO_SYNC_SET_CONFIG_GPS_TYPE:
                 {
                     // set gps information
                    // IDOSetGpsConfigInfoBluetoothModel
                }
                    break;
                case IDO_SYNC_SET_WALK_REMINDER_TYPE:
                {
                    // Set reminders to move
                     //IDOSetWalkReminderBluetoothModel
                 }
                     break;
                 case IDO_SYNC_SET_BREATHE_TRAIN_TYPE:
                 {
                     // set up breathing training
                     //IDOSetBreatheTrainBluetoothModel
                 }
                     break;
                 case IDO_SYNC_SET_ACTIVITY_SWITCH_TYPE:
                 {
                     // set the active switch
                     //IDOSetActivitySwitchBluetoothModel
                 }
                     break;
                 case IDO_SYNC_SET_PRESSURE_SWITCH_TYPE:
                 {
                     // set the pressure switch
                     //IDOSetPressureSwitchBluetoothModel
                 }
                     break;
                 case IDO_SYNC_SET_MENU_LIST_TYPE:
                 {
                      // set menu list
                     // IDOGetMenuListInfoBluetoothModel
                }
                    break;
                case IDO_SYNC_SET_SCIENTIFIC_SLEEP_SWITCH_TYPE:
                {
                     // Setting the Science Sleep Switch
                      // IDOSetV3ScientificSleepModel
                 }
                     break;
                 case IDO_SYNC_SET_TEMPERATURE_SWITCH_TYPE:
                 {
                     // set the temperature switch
                     // IDOSetV3TemperatureModel
                 }
                     break;
                 case IDO_SYNC_SET_FITNESS_GUIDANCE_TYPE:
                 {
                     // set fitness guide
                     //IDOSetFitnessGuidanceModel
                 }
                     break;
                 case IDO_SYNC_SET_SPO2_SWITCH_TYPE:
                 {
                     // set the blood oxygen switch
                     //IDOSetSpo2SwitchBluetoothModel
                 }
                     break;
                 case IDO_SYNC_SET_NOISE_SWITCH_TYPE:
                 {
                      // set the noise switch
                     // IDOSetV3NoiseSwitchModel
                }
                    break;
                case IDO_SYNC_SET_RESPI_RATE_TYPE:
                {
                     // Set breathing rate switch
                      //IDOSetBreathRateSwitchModel
                 }
                     break;
                 case IDO_SYNC_SET_HEART_RATE_MODE_SMART:
                 {
                      // Set smart heart rate mode
                     // IDOSetSmartHeartRateModel
                }
                    break;
                default:
                    break;
            }  
   return [NSArray array];
}).mandatorySyncConfig(YES or NO); // Binding needs to perform synchronization configuration, and subsequent reconnection does not need to perform synchronization configuration, and it is cached locally.

Swift:

initSyncManager().addSyncComplete!{(stateCode)in
     //Sync complete status
      if stateCode == .GLOBAL_COMPLETE {
      //Query the corresponding cached data after synchronization is complete
      }
}.addSyncProgess!{(type,progress)in
     //Sync item, sync progress (0-1)
}.addSyncFailed!{(errorCode)in
     //sync failed
}.addSyncConfigInitData!{(type)in
     //According to the returned synchronization type, return the initialized data model collection according to the business requirements
     //Refer to the above objc code execution
     return [];
}.mandatorySyncConfig!(true or false);// The binding needs to perform synchronization configuration, and subsequent reconnection does not need to perform synchronization configuration

9.6 Demo Synchronization function entry

Copyright © 2015-2020 IDO. All rights reserved. all right reserved,powered by GitbookModify Date: 2023-12-18 10:04:13

results matching ""

    No results matching ""