public LinearAccelerationPageViewModel()
        {
            // Command to start the subscription
            ToggleSubscribeSwitchCommand = new Xamarin.Forms.Command(
                async() =>
            {
                if (IsSubscribeSwitchOn)
                {
                    ConnectionStatusText = "Connecting...";
                    await MovesenseDeviceVM.Connect();
                    ConnectionStatusText = "Subscribing...";

                    subscription = await MovesenseDeviceVM.MovesenseDevice.SubscribeAccelerometerAsync(
                        (d) =>
                    {
                        PlotData(d.Data.Timestamp, d.Data.AccData[0].X, d.Data.AccData[0].Y, d.Data.AccData[0].Z);
                    },
                        26);
                    ConnectionStatusText = "Subscribed";
                }
                else
                {
                    // Unsubscribe
                    subscription.Unsubscribe();
                    ConnectionStatusText = "Unsubscribed";
                    await MovesenseDeviceVM.Disconnect();
                    ConnectionStatusText = "Disconnected";
                }
            }
                , () => (MovesenseDeviceVM != null) // Enable command only if we've got a device
                );

            InitPlotModel();
        }
 public void OnExit()
 {
     subscription?.Unsubscribe();
 }