void OnMovesenseControllerCallbackEvent(object sender, MovesenseController.EventArgs e)
    {
        switch (e.Type)
        {
        case MovesenseController.EventType.CONNECTED:           // a sensor succesfully connected
            isConnected = true;
            break;

        case MovesenseController.EventType.DISCONNECTED:        // a sensor disconnected
            isConnected = false;
            heartRate   = null;
            break;

        case MovesenseController.EventType.NOTIFICATION:        // got data from a sensor
            for (int i = 0; i < e.OriginalEventArgs.Count; i++)
            {
                var ne = (NotificationCallback.EventArgs)e.OriginalEventArgs[i];
                RefreshHeartrate(ne);
            }
            break;

        default:
            break;
        }
    }
    void OnMovesenseControllerCallbackEvent(object sender, MovesenseController.EventArgs e)
    {
        //Debug.Log("OnMovesenseControllerCallbackEvent, Type: " + e.Type + ", invoked by: " + e.InvokeMethod);
        switch (e.Type)
        {
        case MovesenseController.EventType.CONNECTING:
            for (int i = 0; i < e.OriginalEventArgs.Count; i++)
            {
                var ce = (ConnectCallback.EventArgs)e.OriginalEventArgs[i];

                Debug.Log("OnMovesenseControllerCallbackEvent, CONNECTING " + ce.MacID);
            }
            break;

        case MovesenseController.EventType.CONNECTED:
            for (int i = 0; i < e.OriginalEventArgs.Count; i++)
            {
                var ce = (ConnectCallback.EventArgs)e.OriginalEventArgs[i];

                Debug.Log("OnMovesenseControllerCallbackEvent, CONNECTED " + ce.MacID + ", subscribing linearAcceleration");

                MovesenseController.Subscribe(ce.Serial, SubscriptionPath.LinearAcceleration, SampleRate.slowest);
            }
            break;

        case MovesenseController.EventType.NOTIFICATION:
            for (int i = 0; i < e.OriginalEventArgs.Count; i++)
            {
                var ne = (NotificationCallback.EventArgs)e.OriginalEventArgs[i];

                Debug.Log("OnMovesenseControllerCallbackEvent, NOTIFICATION for " + ne.Serial + ", SubscriptionPath: " + ne.Subscriptionpath + ", Data: " + ne.Data);
            }
            break;
        }
    }
Exemple #3
0
    void OnMovesenseControllerCallbackEvent(object sender, MovesenseController.EventArgs e)
    {
        switch (e.Type)
        {
        case MovesenseController.EventType.CONNECTING:                          // a sensor is currently connecting
                                #pragma warning disable CS0162
            if (isLogging)
            {
                Debug.Log(TAG + "RefreshScrollViewContentScan: EventType.CONNECTING");
            }
                                #pragma warning restore CS0162
            RefreshScrollViewContentScan();
            break;

        case MovesenseController.EventType.CONNECTED:                           // a sensor is succesfully connected
                                #pragma warning disable CS0162
            if (isLogging)
            {
                Debug.Log(TAG + "RefreshScrollViewContentScan: EventType.CONNECTED");
            }
                                #pragma warning restore CS0162
            RefreshScrollViewContentScan();

            buttonSubscriptions.gameObject.SetActive(true);
            break;

        case MovesenseController.EventType.DISCONNECTED:                        // a sensor disconnected
                                #pragma warning disable CS0162
            if (isLogging)
            {
                Debug.Log(TAG + "RefreshScrollViewContentScan: EventType.DISCONNECTED");
            }
                                #pragma warning restore CS0162
            RefreshScrollViewContentScan();

            if (!MovesenseDevice.IsAnyConnectedOrConnecting())
            {
                buttonSubscriptions.gameObject.SetActive(false);
            }
            break;

        case MovesenseController.EventType.RESPONSE:
                                #pragma warning disable CS0162
            if (!isLogging)
            {
                return;
            }

            for (int i = 0; i < e.OriginalEventArgs.Count; i++)
            {
                var ne = (ResponseCallback.EventArgs)e.OriginalEventArgs[i];
                Debug.Log(TAG + "OnMovesenseControllerCallbackEvent: " + ne.Uri + ", method: " + ne.Method + ", data: " + ne.Data);
            }
                                #pragma warning restore CS0162
            break;
        }
    }
 void OnMovesenseControllerCallbackEvent(object sender, MovesenseController.EventArgs e)
 {
     switch (e.Type)
     {
     case MovesenseController.EventType.NOTIFICATION:
         for (int i = 0; i < e.OriginalEventArgs.Count; i++)
         {
             var ne = (NotificationCallback.EventArgs)e.OriginalEventArgs[i];
             UpdateTransform(MovesenseDevice.ContainsSerialAt(ne.Serial), ne);
         }
         break;
     }
 }
Exemple #5
0
    void OnMovesenseControllerCallbackEvent(object sender, MovesenseController.EventArgs e)
    {
                #pragma warning disable CS0162
        if (isLogging)
        {
            Debug.Log(TAG + "OnMovesenseControllerCallbackEvent, e.Type: " + e.Type);
        }
                #pragma warning restore CS0162
        switch (e.Type)
        {
        case MovesenseController.EventType.NOTIFICATION:                // got data from a sensor
                        #pragma warning disable CS0162
            if (isLogging)
            {
                Debug.Log(TAG + "OnMovesenseControllerCallbackEvent, case MovesenseController.EventType.NOTIFICATION");
            }
                        #pragma warning restore CS0162
            for (int i = 0; i < e.OriginalEventArgs.Count; i++)
            {
                var ne = (NotificationCallback.EventArgs)e.OriginalEventArgs[i];
                                #pragma warning disable CS0162
                if (isLogging)
                {
                    Debug.Log(TAG + "OnMovesenseControllerCallbackEvent, e.OriginalEventArgs[" + i + "].Data: " + ne.Data);
                }
                                #pragma warning restore CS0162
                RefreshPanelSubscription(MovesenseDevice.ContainsSerialAt(ne.Serial), ne);
            }
            break;

        case MovesenseController.EventType.CONNECTED:                   // a sensor succesfully connected (in the background)
            RefreshScrollViewContentConnectedDevices(false);
            break;

        case MovesenseController.EventType.DISCONNECTED:                // a sensor disconnected
            RefreshScrollViewContentConnectedDevices(true);

            RefreshPanelSubscription(0, null);
            break;
        }
    }