/// <summary>
        /// Disconnect a device from MdsLib
        /// </summary>
        /// <param name="Uuid">Uuid of the device</param>
        /// <returns></returns>
        public Task <object> DisconnectMdsAsync(string Uuid)
        {
            mUuid         = Uuid;
            disconnectTcs = new TaskCompletionSource <object>();
            // Get the single instance of the connection listener
            mListener = MdsConnectionListener.Current;
            // Ensure the connection listener is setup
            mListener.EnsureInitializedAsync().Wait();

            mListener.Disconnect += MListener_Disconnect;

            ((Movesense.MDSWrapper)(CrossMovesense.Current.MdsInstance)).DisconnectPeripheralWithUUID(new Foundation.NSUuid(Uuid));

            return(disconnectTcs.Task);
        }
Exemple #2
0
        /// <summary>
        /// Disconnect a device from MdsLib
        /// </summary>
        /// <param name="Uuid">Uuid of the device</param>
        /// <returns></returns>
        public async Task <object> DisconnectMdsAsync(Guid Uuid)
        {
            mUuid         = Uuid;
            disconnectTcs = new TaskCompletionSource <object>();
            // Get the single instance of the connection listener
            mListener = MdsConnectionListener.Current;
            // Ensure the connection listener is setup
            await mListener.EnsureInitializedAsync().ConfigureAwait(false);

            mListener.DeviceDisconnected += MListener_Disconnect;

            ((Movesense.MDSWrapper)(CrossMovesense.Current.MdsInstance)).DisconnectPeripheralWithUUID(new Foundation.NSUuid(mUuid.ToString()));

            return(await disconnectTcs.Task.ConfigureAwait(false));
        }
        /// <summary>
        /// Connect a device to MdsLib
        /// </summary>
        /// <param name="Uuid">Uuid of the device</param>
        /// <returns></returns>
        public Task <object> ConnectMdsAsync(string Uuid)
        {
            mUuid         = Uuid;
            connectiontcs = new TaskCompletionSource <object>();
            // Get the single instance of the connection listener
            mListener = MdsConnectionListener.Current;
            // Ensure the connection listener is setup
            mListener.EnsureInitializedAsync().Wait();

            // Listen for connect/disconnect events
            mListener.ConnectionComplete += MListener_ConnectionComplete;

            // Start the device connection
            ((Movesense.MDSWrapper)(CrossMovesense.Current.MdsInstance)).ConnectPeripheralWithUUID(new Foundation.NSUuid(Uuid));

            return(connectiontcs.Task);
        }
Exemple #4
0
        /// <summary>
        /// Connect a device to MdsLib
        /// </summary>
        /// <param name="Uuid">Uuid of the device</param>
        /// <returns></returns>
        public async Task <IMovesenseDevice> ConnectMdsAsync(Guid Uuid)
        {
            mUuid         = Uuid;
            connectiontcs = new TaskCompletionSource <IMovesenseDevice>();
            // Get the single instance of the connection listener
            mListener = MdsConnectionListener.Current;
            // Ensure the connection listener is setup
            await mListener.EnsureInitializedAsync().ConfigureAwait(false);

            // Listen for connect/disconnect events
            mListener.DeviceConnectionComplete += MListener_ConnectionComplete;

            // Start the device connection
            ((Movesense.MDSWrapper)(CrossMovesense.Current.MdsInstance)).ConnectPeripheralWithUUID(new Foundation.NSUuid(mUuid.ToString()));

            return(await connectiontcs.Task.ConfigureAwait(false));
        }