IDO Smart Bracelet SDK

Functional Overview

Applicable to iOS/Android devices and supports IDO's bracelets, implementing Bluetooth connection control framework library

iOS Integration (to Android)

 

  • Use Cocoapods Integration

Add the following content to the Podfile file:

source 'https://github.com/idoosmart/IDOSmartSpec.git'
platform :ios, '11.0'

target 'your_target_name1' do
pod 'IDOSDK-full', '~> 4.2.0'
end

Then execute the pod install command in the project root directory to integrate. For more information about CocoaPods, please refer to: CocoaPods Guides

  • Manual Integration

Please refer to: https://github.com/idoosmart/Native_Demo/tree/main/example_ios

  • Swift Package Manager

Swift Package Manager (SwiftPM) is a tool for managing Swift code distribution. It simplifies the process of managing Swift package dependencies.

To integrate IDOSDK-full into your project using SwiftPM:

  1. In Xcode, File > Add Package Dependency.

  2. Enter the following package repository URL: https://github.com/idoosmart/ios_sdk_full.git

  3. Select the appropriate version (such as a specific version, branch, or commit).

  4. Add IDOSDK-full to your target dependencies.

IDOSDK-full requires at least Swift tools version 5.3.

Initialize Flutter

func application(_ application: UIApplication, didFinishLaunchingWithOptions
                     launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        self.initFlutterEngine()

        ...

        return true
    } 


  extension AppDelegate {
    private func initFlutterEngine() {
        self.flutterEngine = FlutterEngine(name: "io.flutter", project: nil)
        self.flutterEngine?.run(withEntrypoint: nil) if let engine = flutterEngine {
            GeneratedPluginRegistrant.register(with: engine) print("flutterEngine finished")
        } else {
            print("engine is null")
            assert(false, "engine is null")
        }
    }
}

Register SDK

SDK is divided into three modules: Protocol library, Bluetooth library and Alexa library. Register before use (globally register once)

import protocol_channel

// Register sdk
func registerSDK() {
// ble (limited to using built-in Bluetooth)
sdk.ble.addBleDelegate(api: self)
sdk.ble.bluetoothRegister(heartPingSecond: 5, outputToConsole: false)
sdk.ble.getBluetoothState { [weak self] stateModel in
self?.bleState = stateModel
self?.funcPage?.bleState = stateModel
}

// protocol library
sdk.bridge.setupBridge(delegate: self, logType: .release)

// alexa (no need to connect if there is no alexa function)
sdk.alexa.setupAlexa(delegate: self, clientId: clientId)
}

Use SDK

SDK API, call it by the global constant sdk

import protocol_channel

func someMethod() {
/// Device information
sdk.device.xx

/// Function table
sdk.funcTable.xx

/// Command
sdk.cmd.xx

/// Bridge
sdk.bridge.xx

/// Bluetooth (only use the built-in Bluetooth library)
sdk.ble.xx

/// Alexa
sdk.alexa.xx

/// File transfer
sdk.transfer.xx

/// Message icon
sdk.messageIcon.xx

/// Data synchronization
sdk.syncData.xx

/// Data exchange
sdk.dataExchange.xx

/// Device log
sdk.deviceLog.xx

/// Common tools, cache
sdk.tool.xx
}

Android integration(to iOS

 

  • Integrate using android studio

  • Integrate sdk, sdk is divided into with Bluetooth and without Bluetooth (you can use your own Bluetooth library), users choose one according to their needs

(1) The sdk with Bluetooth library is as follows, a total of 5 files (you can copy it from the lib in example_android demo, the lib contains the latest version, or you can download it here)

protocol_ffi_release-x.x.x.aar protocol_channel_release-x.x.x.aar native_channel_release-x.x.x.aar flutter_release-x.x.x.aar flutter_bluetooth_release-x.x.x.aar

(2) SDK without Bluetooth library, a total of four files (can be copied from the lib in the example_android_lite demo, which contains the latest version, or can be downloaded here)

protocol_ffi_release-x.x.x.aar protocol_channel_release-x.x.x.aar native_channel_release-x.x.x.aar flutter_release-x.x.x.aar

Copy the downloaded AAR package to the libs directory

Modify the build.gradle(app) file

dependencies {

 implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
 implementation "io.flutter:flutter_embedding_release:1.0.0-0f359063c487ee70787e58b4b011cbb3c2f53fd6"  
 implementation "io.flutter:arm64_v8a_release:1.0.0-0f359063c487ee70787e58b4b011cbb3c2f53fd6"
 implementation "io.flutter:armeabi_v7a_release:1.0.0-0f359063c487ee70787e58b4b011cbb3c2f53fd6"implementation
 implementation 'no.nordicsemi.android:dfu:2.5.0'

....

}

Register SDK

SDK is divided into three modules: Protocol library, Bluetooth library and Alexa library. Registration is required before use, please refer to demo for details

import protocol_channel

// Register sdk
func registerSDK() {

sdk.init(this) //Global registration
// ble (limited to using built-in Bluetooth)
sdk.ble.addBleDelegate(bleDelegate: IDOBleDelegate)
sdk.ble.getBluetoothState {

}

// protocol library
sdk.bridge.setupBridge( idoBrigeDelegate : IDOBridgeDelegate, type:logType)

// alexa (no need to access if there is no alexa function)
sdk.alexa.setupAlexa(delegate: IDOAlexaDelegate, clientId: clientId)
}

Using SDK

SDK APIs can be called by the globally defined constant sdk

import protocol_channel

fun someMethod() {
/// Device information
sdk.device.xx

/// Function table
sdk.funcTable.xx

/// Command
sdk.cmd.xx

/// Bridge
sdk.bridge.xx

/// Bluetooth (only for built-in Bluetooth library)
sdk.ble.xx

/// Alexa
sdk.alexa.xx

/// File transfer
sdk.transfer.xx

/// Message icon
sdk.messageIcon.xx

/// Data synchronization
sdk.syncData.xx/// Data exchange
sdk.dataExchange.xx

/// Device log
sdk.deviceLog.xx

/// Common tools, cache
sdk.tool.xx
}
Copyright © 2023-2024 IDO. All rights reserved. all right reserved,powered by Gitbook修改日期: 2024-11-14 11:29:57

results matching ""

    No results matching ""