Пример #1
0
    private void Initialize()
    {
        Action<Exception>ErrorHandler = (ex) => {
            Debug.LogError("Failed to initialize ANT connection: " + ex.Message);
        };

        try {
            Connection = AntPlusConnection.GetConnection();
            Connection.Connect ();
            Initialized = true;
        } catch(DuplicateConnectionException dce)
        {
            ErrorHandler(dce);
        } catch(InitializationException ie)
        {
            ErrorHandler(ie);
        }
    }
Пример #2
0
        public void Disconnect()
        {
            Console.WriteLine("Disconnecting and resetting");

            AntInternal.ANT_UnassignAllResponseFunctions();

            AntInternal.ANT_ResetSystem();
            AntInternal.ANT_Close();

            connection = null;
        }
Пример #3
0
 public static AntConnection GetConnection(byte device, byte network, byte [] networkKey)
 {
     if(connection == null) connection = new AntConnection(device, network, networkKey);
     return connection;
 }