Пример #1
0
        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);
            }
        }
Пример #2
0
        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);
            }
        }
Пример #3
0
 internal SpheroConnection(SpheroInformation peerInformation)
 {
     _peerInformation     = peerInformation;
     _responseDictionnary = new Dictionary <byte, Action <ResponsePacket> >();
     _currentSeq          = 0x01;
 }
Пример #4
0
 internal SpheroConnection(SpheroInformation peerInformation)
 {
     _peerInformation = peerInformation;
     _responseDictionnary = new Dictionary<byte, Action<ResponsePacket>>();
     _currentSeq = 0x01;
 }