iOS Connected document
SDK Support Platform
- iOS Version 12.0 or higher
- WatchOS Version 6.0 or higher(Not supported by default. If you need support, please contact your business colleagues to apply.)
Permissions
The following permissions need to be added to Info.plist
NSBluetoothAlwaysUsageDescription
NSBluetoothPeripheralUsageDescription
If you want to run in the background, you also need to add the following permissions:
App communicates using CoreBluetooth
App shares data using CoreBluetooth
App Privacy
Type | Reasons | SDK Used Reason |
---|---|---|
User Defaults | CA92.1: Access info from same app, per documentation | It is used to cache device information scanned by Bluetooth to speed up connection |
File Timestamp | C617.1: Inside app or group container, per documentation | Use the stat function to obtain the size and time of the SDK log file to automatically clear the SDK log file |
System Boot Time | 35F9.1: Measure time on-device, per documentation | Use the mach_absolute_time function to record the output log time |
Import SDK
the SDK will be released as xcframework after version 1.3.1.
Old: framework
Please import the frameworks in Build Phases
Welland's framework
ICDeviceManager.xcframework
System's framework
libc++.tbd
libz.tbd
Eg.
New: xcframework
Please import the frameworks in Build Phases
Welland's framework
ICBleProtocol.xcframework
ICBodyFatAlgorithms.xcframework
ICDeviceManager.xcframework
ICLogger.xcframework
System's framework
libc++.tbd
libz.tbd
Eg.
Add header file reference
In the file that needs to call ICDeviceManager, add a header file reference.
import <ICDeviceManager/ICDeviceManager.h>
SDK Access process
Initialize the SDK
Call [[ICDeviceManager shared] initMgr]
to initialize the SDK. Before initialization, it is recommended to call [ICDeviceManager shared].delegate
to set up the proxy object. Otherwise, some callbacks may be lost.
Eg.
[ICDeviceManager shared].delegate = self;
[[ICDeviceManager shared] initMgr];
Scan device
After the SDK is initialized, if you need to find nearby devices, you can call the scanning function to scan the devices:
[[ICDeviceManager shared] scanDevice:delegate];
The device will call back through the scan callback proxy object. (Before calling the scan function, please make sure Bluetooth is turned on, otherwise the function will not take effect.If Bluetooth is turned off during scanning, turning on Bluetooth and call the function again, the SDK will not automatically turn on scanning).
Note: If you have the MAC address of the device, you can call addDevice function without call the scanDevice function. The SDK will automatically connect to device.
Stop scanning
The scanning device function is called. After the device has been found, please call to stop scanning (sdk will not stop automatically):
[[ICDeviceManager shared] stopScan];
Add device
If the device has been found, call the add device function:
[[ICDeviceManager shared] addDevice:device callback:^(ICDevice *device ICAddDeviceCallBackCode code) {}];
The function can be used to connect the device to the SDK and receive device data (please ensure that the device is powered on, If the device is disconnected, the SDK automatically connects to the device. There is no need to re-add devices or scan devices).
Remove device
When you do not want the SDK to connect and receive device data, you can call the remove device function:
[[ICDeviceManager shared] removeDevice:device callback:^(ICDevice *device, ICRemoveDeviceCallBackCode code) {
}];
Update user information
Because the user's bodyfat data and some other data need to be calculated, the App needs to call the update user information interface:
[[ICDeviceManager shared] updateUserInfo:userInfo];
Log directory
If the SDK cannot receive data or the connection is abnormal, please send us the SDK log and obtain the SDK log directory:
[[ICDeviceManager shared] getLogPath];
Device setting function
Some devices support change units or other setting. These setting interfaces are obtained by:
[[ICDeviceManager shared] getSettingManager];
Body fat algorithm function
Get the body fat algorithm function:
[[ICDeviceManager shared] getBodyFatAlgorithmsManager];