예제 #1
0
    /// <summary>
    /// 连接并使用蓝牙设备
    /// </summary>
    public void InitConnect()
    {
#if UNITY_IPHONE
        ConnectBLE.InitBluetooth_IOS(serviceUUID, (address, name) =>
        {
            //todo:储存并显示蓝牙的名称及信号强度
            ShowBLE();
        }, (address, name, rssi, advertisingInfo) =>
        {
            ShowYouy002(name, rssi, minRSSI);
        });
#elif UNITY_ANDROID
        ConnectBLE.InitBluetooth_Android(serviceUUID, (address, name) =>
        {
            //todo:储存并显示蓝牙的名称及信号强度
            ShowBLE();
        }, (address, name, rssi, advertisingInfo) =>
        {
            ShowYouy002(name, rssi, minRSSI);
        });
#endif
    }
 protected virtual void OnConnectBLE(EventArgs e)
 {
     ConnectBLE?.Invoke(this, e);
 }