public static void Connect(BleDevice d) { m_instance.StartCoroutine("TimeoutDisconnect"); m_currentdevice = d; if (b_Loggin) { Debug.Log("BluetoothLEPlugin.cs; got Connect-Command, calling Connect-Method with adress: " + d.Adress + " and devicetype: " + d.GetType()); } #if UNITY_ANDROID _plugin.Call("Connect", d.Adress, d.GetType().ToString()); #elif UNITY_IPHONE && !UNITY_EDITOR ConnectiOS(d.Adress, d.GetType().ToString()); #elif UNITY_STANDALONE_OSX || UNITY_EDITOR ConnectMacOS(d.Adress, d.GetType().ToString()); #endif }
private void OnReadyForSync(BleDevice device) { m_state = MenuState.CONNECTED; BluetoothLEPlugin.BleDeviceConnectEvent -= OnDeviceConnected; if (b_Loggin) { Debug.Log("HeartRateScene: BleDeviceConnectEvent unsubscribed"); } HeartRate.OnHRMDataReceived -= On_DataReceived; HeartRate.OnHRMDataReceived += On_DataReceived; if (b_Loggin) { Debug.Log("HeartRateScene: OnHRMDataReceived un-/resubscribed"); } if (device.GetType().Equals(typeof(HeartRate))) { m_heartrate = (HeartRate)device; m_heartrate.Sync(b_Loggin); } m_status = "syncing..."; if (b_Loggin) { Debug.Log("HeartRateScene: Device successfully connected, syncing"); } }