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); } }
public void Disconnect() { Console.WriteLine("Disconnecting and resetting"); AntInternal.ANT_UnassignAllResponseFunctions(); AntInternal.ANT_ResetSystem(); AntInternal.ANT_Close(); connection = null; }
public static AntConnection GetConnection(byte device, byte network, byte [] networkKey) { if(connection == null) connection = new AntConnection(device, network, networkKey); return connection; }