IDO Smart Band iOS SDK

1.1Functional Overview

IDOBluetooth, IDOBlueProtocol, and IDOBlueUpdate are suitable for iOS devices and support IDO's wristbands to implement Bluetooth connection control framework library. The Bluetooth framework based on the iOS system extends the functions of Bluetooth scanning, connection, binding, control, setting, acquisition, monitoring, and transmission. The protocol library written in c is used to realize the logical processing in the process of structure data conversion and health data synchronization, which reduces the errors of bluetooth communication data and improves the speed and accuracy of bluetooth communication. This feature-rich API is easy to use.

1.2Quick integration

1.2.1 Using Cocoapods integration

Add the following to the Podfile:

source 'https://github.com/idoosmart/IDOSmartSpec.git'
platform :ios, '8.0'
target 'your_target_name' do
   pod 'IDOBluetooth'
   pod 'IDOBlueProtocol'
   pod 'IDOBlueUpdate'
end

Then execute the pod update command in the project root directory to integrate third-party libraries. Please refer to the use of CocoaPods:CocoaPods Guides

1.3 initialization SDK

  1. Open the project settings, Target => Build Settings, modify Other Linker Flags and add -Objc
  2. The Objective-C project needs to add an empty Swift file to generate the Objective-C Bridging Header
  3. Depends on the system library CoreBluetooth.frameworklibc++.tbdlibsqlite3.0.tbd
  4. Add the following to the PrefixHeader.pch file of the project:
#import <IDOBluetooth/IDOBluetooth.h>
#import <IDOBlueProtocol/IDOBlueProtocol.h>
#import <IDOBlueUpdate/IDOBlueUpdate.h>

Swift Add the following to the project

import IDOBlueUpdate
import IDOBluetooth
import IDOBlueProtocol

1.3.1 registration SDK

  1. Open the AppDelegate.m file and register the SDK in the [AppDelegateapplication:didFinishLaunchingWithOptions:] method: Interface Description
IDOBluetoothServices * _Nonnull registrationServices(NSString * _Nullable password)

@property (nonatomic,copy,nullable) IDOBluetoothServices *_Nonnull(^outputSdkLog)(BOOL isOutput);

@property (nonatomic,copy,nullable) IDOBluetoothServices *_Nonnull(^outputProtocolLog)(BOOL isOutput,BOOL isRecord);

@property (nonatomic,copy,nullable) IDOBluetoothServices *_Nonnull(^rawDataLog)(BOOL isRecord);

@property (nonatomic,copy,nullable) void(^startScanBule)(void(^ _Nullable getDeviceInfoBlock)(IDOGetDeviceInfoBluetoothModel * _Nullable model));

Parameter Description

Parameters Description Notes
registrationServices Registration service initialization SDK database password, pass nil database without encryption
startConnectDevice Tell the SDK what device to connect to when starting up Mac address
outputSdkLog output sdk log YES in debug mode
outputProtocolLog Export and log protocol YES in debug mode
rawDataLog Record raw log Add according to project needs

Objc:

#ifdef DEBUG
registrationServices().outputSdkLog(YES).outputProtocolLog(YES,YES).rawDataLog(YES).startScanBule(^(IDOGetDeviceInfoBluetoothModel * _Nullable model) {
        //Perform automatic scan connection according to the binding state, initialize the Bluetooth management center
       if(__IDO_BIND__)[IDOBluetoothManager startScan];
       else [IDOBluetoothManager refreshDelegate];
    });
#else
registrationServices().outputSdkLog(NO).outputProtocolLog(NO,YES).rawDataLog(YES).startScanBule(^(IDOGetDeviceInfoBluetoothModel * _Nullable model) {
         //Perform automatic scan connection according to the binding state, initialize the Bluetooth management center
       if(__IDO_BIND__)[IDOBluetoothManager startScan];
       else [IDOBluetoothManager refreshDelegate];  
});
#endif

Swift

#if DEBUG
registrationServices().outputSdkLog!(true).outputProtocolLog!(true,true).rawDataLog!(true).startScanBule!{
            (model) in
            //Perform automatic scan connection according to the binding state, initialize the Bluetooth management center
if IDOBluetoothEngine.shareInstance()?.peripheralEngine.isBind
 == true  {
    IDOBluetoothManager.startScan()
 }else {
    IDOBluetoothManager.refreshDelegate()
 }
}
#else
registrationServices().outputSdkLog!(false).outputProtocolLog!(false,true).rawDataLog!(true).startScanBule!{
            (model) in
            //Perform automatic scan connection according to the binding state, initialize the Bluetooth management center
 if IDOBluetoothEngine.shareInstance()?.peripheralEngine.isBind 
 == true       {
    IDOBluetoothManager.startScan()
 }else {
    IDOBluetoothManager.refreshDelegate()
 }
}
#endif

1.3.2 SDK Notification service name

// Bluetooth scan, connection status notification listener name | Bluetooth scan, connection status notification listener name
extern NSString *_Nonnull IDOBluetoothConnectStateNotifyName;

// Bluetooth scan, connection process error notification monitor name | Bluetooth scan, connection process error notification listener name
extern NSString * _Nonnull IDOBluetoothConnectErrorNotifyName;

// device bind status notification name | device bind status notification name
extern NSString * _Nonnull IDOBluetoothDeviceBindNotifyName;

// Synchronize configuration to get device information notification name | get device info notification name
extern NSString * _Nonnull IDOBluetoothGetDeviceInfoNotifyName;

// sync config complete notification name | sync config complete notification name
extern NSString *_Nonnull IDOBluetoothSyncConfigNotifyName;

// Sync health data complete notification name | sync health data complete notification name
extern NSString *_Nonnull IDOBluetoothSyncHealthNotifyName;

// Quick configuration completion notification name when just connected | fast sync complete notification name
extern NSString * _Nonnull IDOBluetoothFastSyncNotifyName;
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 ""