我们的SDK支持iOS、Android等移动设备,提供统一的蓝牙协议接口,让您能够快速集成穿戴设备功能到您的应用中。使您在开发移动应用中能够轻松连接和管理穿戴设备。
# 小程序SDK接入示例
"plugins": {
    "YCBluetooth-plugin": { 
        "version": "3.1.2",   
        "provider": "wxe1e0a9838f57e796"
    }
},
# 使用CocoaPods (iOS)
override func viewDidLoad() {
    super.viewDidLoad()
    _ = YCProduct.shared
}
# 使用Gradle (Android)
implementation 'com.weartech:sdk:1.5.2'
                    我们的SDK提供全面的功能,满足所有智能穿戴应用场景需求
简单几行代码,实现设备的发现、连接和管理,支持多设备同时连接。自动处理蓝牙配对和连接维护,确保稳定的设备通信。
支持双向数据传输,高效同步穿戴设备的健康数据到应用。提供分包传输功能,确保数据完整性,支持离线数据缓存和后续同步。
发送自定义通知到设备,包括消息提醒、运动提示和健康建议。支持富文本和表情符号,允许用户设置优先级和分类管理。
提供AI驱动的健康数据分析接口,获取深度见解和趋势。包括心率变异性分析、睡眠质量评估、压力水平监测和运动效果分析。
端到端加密,保护用户数据安全。提供细粒度的数据访问控制和匿名化选项,保障用户隐私。
自定义设备显示、提醒模式和功能设置,灵活调整设备行为。支持远程固件更新,自定义表盘上传和应用程序安装。
通过简单的代码快速实现设备连接与数据获取
// 引入SDK
const YCBluetoothPlugin = requirePlugin("YCBluetooth-plugin");
// 搜索设备
YCBluetoothPlugin.startSearchDevice( function (devices) {
    // 搜索到的设备列表 -> BlueToothDevice[] 
    if(devices.length > 0){
        console.log('当前蓝牙设备的信号强度(单位 dBm):', device[0].RSSI);
        console.log('当前蓝牙设备的广播数据段中的 ManufacturerData 数据段:', device[0].advertisData);
        console.log('当前蓝牙设备的广播数据段中的 ServiceUUIDs 数据段:', device[0].advertisServiceUUIDs);
        console.log('当前蓝牙设备是否可连接( Android 8.0 以下不支持返回该值 ):', device[0].connectable);
        console.log('蓝牙设备 id:', device[0].deviceId);
        console.log('当前蓝牙设备的广播数据段中的 LocalName 数据段:', device[0].localName);
        console.log('蓝牙设备名称,某些设备可能没有:', device[0].name);
        console.log('当前蓝牙设备的广播数据段中的 ServiceData 数据段:', device[0].serviceData);
    }
});
// 连接设备
YCBluetoothPlugin.connectDevice(deviceId, function (isConnected, res) {
  // 是否连接 isConnected : true->成功  false->失败
  // 失败信息 res
    if(isConnected){
        console.log("连接成功")
    } else{
        console.log("连接失败:" + res)
    }
});
// 同步步数数据
YCBluetoothPlugin.queryDeviceHealthData(queryHealthDataStep, function (state, response) {
 
    if (state != succeed) {
      return
    }
    response.forEach(info => {
      console.log(info)
      console.log(info.startTime + ', ' + info.endTime + ',' + info.step + ',' + info.distance + ',' + info.calories)
    });
  });import YCProductSDK
// 搜索设备
YCProduct.scanningDevice { [weak self] devices, error in 
    if let devices = devices {
        for device in devices {
            print("设备名称: \(device.name)")
            print("设备ID: \(device.deviceId)")
            print("设备信号强度: \(device.rssi)")
        }
    }
        
}
// 连接设备
YCProduct.connectDevice(device) { [weak self] state, error in 
    guard state == .connected,
    error == nil else {
        print("连接失败:\(error?.localizedDescription ?? "未知错误")")
        return
    }
}
// 断开连接
YCProduct.disconnectDevice { state, error in 
    guard state == .disconnected,
    error == nil else {
        print("断开连接失败:\(error?.localizedDescription ?? "未知错误")")
        return
    }
}
 
    正在开发,敬请期待!
//初始化  
YcProductPlugin().initPlugin(isReconnectEnable: true, isLogEnable: true);
    // ble state change
    YcProductPlugin().onListening((event) {
      if (event.keys.contains(NativeEventType.bluetoothStateChange)) {
        final int st = event[NativeEventType.bluetoothStateChange];
        debugPrint('蓝牙状态变化 $st');
        debugPrint(YcProductPlugin().connectedDevice?.deviceFeature?.isSupportBloodPressure.toString());
        setState(() {
          _st = st;
        });
      }
    });
//搜索设备
YcProductPlugin()
    .scanDevice(time: 3)
    .then((devices) {
// debugPrint("=== 设备 $devices");
setState(() {
    devices?.sort((a, b) =>  (b?.rssiValue.toInt() ?? 0) - (a?.rssiValue.toInt() ?? 0));
    _devices = devices ?? [];
    EasyLoading.dismiss();
});
});
//连接设备
 YcProductPlugin().connectDevice(item).then((value) {
    if (value == true) {
    Navigator.pop(context);
    EasyLoading.showSuccess("Connected");
    } else {
    debugPrint("连接失败");
    EasyLoading.showError("Connect failed");
    }
});
// 引入插件
var ble = uni.requireNativePlugin('bluetooth-ycSdkPlugin');
// 初始化
ble.initPlugin((res) => {
    if (res.code == 0) {
        console.log("初始化成功")
    } else {
        console.log("初始化失败:" + res.message)
    }
});
// 搜索设备
ble.scanDevice(5, (res) => {
    if (res.code == 0) {
        console.log("搜索设备成功")
    } else {
        console.log("搜索设备失败:" + res.message)
    }
});
// 连接设备
ble.connectDevice((res) => {
    if (res.code == 0) {
        console.log("连接设备成功")
    } else {
        console.log("连接设备失败:" + res.message)
    }
});
// 断开连接
ble.disconnectDevice((res) => {
    if (res.code == 0) {
        console.log("断开连接成功")
    } else {
        console.log("断开连接失败:" + res.message)
    }
});
了解开发者最常问的问题及解答