public static void Connect(string MacID) { // mds checks, if already connecting or connected if (!isInitialized) { Debug.LogError(TAG + "Connect: MovesenseController is not initialized. Did you forget to add MovesenseController object in the scene?"); return; } string serial = MovesenseDevice.GetSerial(MacID); #pragma warning disable CS0162 if (isLogging) { Debug.Log(TAG + "Connect: " + MacID + " (" + serial + ")"); } #pragma warning restore CS0162 MovesenseDevice.SetConnecting(MacID); #pragma warning disable CS0162 if (isLogging) { Debug.Log(TAG + "Connect, raising Connecting-event"); } #pragma warning restore CS0162 if (Event != null) { Event(null, new EventArgs(EventType.CONNECTING, TAG + "Connect", new List <System.EventArgs> { new ConnectCallback.EventArgs(false, MacID, serial) })); } #if UNITY_ANDROID && !UNITY_EDITOR movesensePlugin.Call("connect", MacID, new ConnectCallback()); #elif UNITY_IOS && !UNITY_EDITOR ConnectMDS(MacID); #elif UNITY_STANDALONE_OSX || UNITY_EDITOR #endif }
public static void Disconnect(string MacID) { // mds checks, if device is connected string serial = MovesenseDevice.GetSerial(MacID); #pragma warning disable CS0162 if (isLogging) { Debug.Log(TAG + "Disconnect: " + MacID + " (" + serial + ")"); } #pragma warning restore CS0162 #if UNITY_ANDROID && !UNITY_EDITOR movesensePlugin.Call("disconnect", MacID); #elif UNITY_IOS && !UNITY_EDITOR DisConnectMDS(MacID); if (MovesenseDevice.GetConnectingState(MacID)) { // connection has not been completed => there will be no callback if disconnect is called MovesenseDevice.SetConnectionState(MacID, false); #pragma warning disable CS0162 if (isLogging) { Debug.Log(TAG + "Disconnect, while connecting, raising Disconnect-event"); } #pragma warning restore CS0162 if (Event != null) { Event(null, new EventArgs(EventType.DISCONNECTED, TAG + "Disconnect", new List <System.EventArgs> { new ConnectCallback.EventArgs(false, MacID, serial) })); } } #elif UNITY_STANDALONE_OSX || UNITY_EDITOR #endif }