public static async Task <SpheroConnection> CreateConnection(SpheroInformation spheroInformations)
        {
            try
            {
                SpheroConnection connection = new SpheroConnection(spheroInformations);

                if (await connection.Connect())
                {
                    return(connection);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception ex)
            {
                if (ex.HResult == -2147023729)
                {
                    throw new BluetoothDeactivatedException(ex);
                }

                throw new NoSpheroFoundException(ex);
            }
        }
        public static async Task<SpheroConnection> CreateConnection(SpheroInformation spheroInformations)
        {
            try
            {
                SpheroConnection connection = new SpheroConnection(spheroInformations);

                if (await connection.Connect())
                    return connection;
                else
                    return null;
            }
            catch (Exception ex)
            {
                if (ex.HResult == -2147023729)
                {
                    throw new BluetoothDeactivatedException(ex);
                }

                throw new NoSpheroFoundException(ex);
            }
        }
Exemple #3
0
 internal SpheroConnection(SpheroInformation peerInformation)
 {
     _peerInformation     = peerInformation;
     _responseDictionnary = new Dictionary <byte, Action <ResponsePacket> >();
     _currentSeq          = 0x01;
 }
Exemple #4
0
 internal SpheroConnection(SpheroInformation peerInformation)
 {
     _peerInformation = peerInformation;
     _responseDictionnary = new Dictionary<byte, Action<ResponsePacket>>();
     _currentSeq = 0x01;
 }