/// <summary> /// Disconnect a device from MdsLib /// </summary> /// <param name="MACAddress">MAC address of the device</param> /// <returns></returns> public Task <object> DisconnectMdsAsync(string MACAddress) { mMACAddress = MACAddress; disconnectTcs = new TaskCompletionSource <object>(); // Get the single instance of the connection listener mListener = MdsConnectionListener.Current; mListener.Disconnect += MListener_Disconnect; ((Com.Movesense.Mds.Mds)(CrossMovesense.Current.MdsInstance)).Disconnect(MACAddress); return(disconnectTcs.Task); }
/// <summary> /// Disconnect a device from MdsLib /// </summary> /// <param name="Uuid">Unique ID of the device, includes MAC address</param> /// <returns></returns> public Task <object> DisconnectMdsAsync(Guid Uuid) { mUuid = Uuid; mMACAddress = GetMACAddressFromUuid(Uuid); disconnectTcs = new TaskCompletionSource <object>(); // Get the single instance of the connection listener mListener = MdsConnectionListener.Current; mListener.DeviceDisconnected += MListener_DeviceDisconnected; ((Com.Movesense.Mds.Mds)(CrossMovesense.Current.MdsInstance)).Disconnect(mMACAddress); return(disconnectTcs.Task); }
/// <summary> /// Connect a device to MdsLib /// </summary> /// <param name="MACAddress">MAC address of the device</param> /// <returns></returns> public Task <object> ConnectMdsAsync(string MACAddress) { mMACAddress = MACAddress; connectiontcs = new TaskCompletionSource <object>(); // Get the single instance of the connection listener mListener = MdsConnectionListener.Current; mListener.ConnectionComplete += MListener_ConnectionComplete; // Start the connection ((Com.Movesense.Mds.Mds)(CrossMovesense.Current.MdsInstance)).Connect(MACAddress, mListener); return(connectiontcs.Task); }
/// <summary> /// Connect a device to MdsLib /// </summary> /// <param name="Uuid">Unique ID of the device, includes MAC address</param> /// <returns></returns> public Task <IMovesenseDevice> ConnectMdsAsync(Guid Uuid) { mUuid = Uuid; mMACAddress = GetMACAddressFromUuid(Uuid); connectiontcs = new TaskCompletionSource <IMovesenseDevice>(); // Get the single instance of the connection listener mListener = MdsConnectionListener.Current; mListener.DeviceConnectionComplete += MListener_DeviceConnectionComplete; // Start the connection ((Com.Movesense.Mds.Mds)(CrossMovesense.Current.MdsInstance)).Connect(mMACAddress, mListener); return(connectiontcs.Task); }
/// <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); }
/// <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); }
/// <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)); }