Beispiel #1
0
    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
    }