Example #1
0
 /// <summary>
 /// Error callback called by Mds when an error is encoubntered reading subscription data
 /// </summary>
 /// <param name="e"></param>
 public void OnError(Com.Movesense.Mds.MdsException e)
 {
     Debug.WriteLine($"ERROR error = {e.ToString()}");
     mTcs.SetException(new MdsException(e.ToString(), e));
 }
Example #2
0
        /// <summary>
        /// Callback function that MdsLib calls when an exception is thrown during device connection
        /// </summary>
        /// <param name="e"></param>
        public void OnError(Com.Movesense.Mds.MdsException e)
        {
            // Unexpected device disconnections come in here
            if (e.Message.StartsWith("com.polidea.rxandroidble.exceptions.BleDisconnectedException"))
            {
                var    msgParts   = e.Message.Split(" ");
                string MACaddress = msgParts[msgParts.Length - 1];
                var    uuid       = GetUuidFromMACAddress(MACaddress);

                Debug.WriteLine($"DISCONNECT MdsConnectionListener OnError callback called for unintended disconnection: MACaddress {MACaddress}");
                var serial = string.Empty;
                this.UuidToSerialMapper.TryGetValue(uuid, out serial);
                DeviceDisconnected?.Invoke(this, new MdsConnectionListenerEventArgs(serial, uuid));
            }
            else
            {
                // Other unexpected error
                Debug.WriteLine($"ERROR MdsConnectionListener OnError callback called for unexpected error: {e.ToString()}");
                DeviceConnectionError?.Invoke(this, new MdsException("MdsConnectionListener unexpected error", e));
            }
        }
Example #3
0
 /// <summary>
 /// Callback function that MdsLib calls when an exception is thrown during device connection
 /// </summary>
 /// <param name="e"></param>
 public void OnError(Com.Movesense.Mds.MdsException e)
 {
     throw new MdsException(e.ToString(), e);
 }