public void Close() { if (channel != null) { channel.closeChannel(); channel.Dispose(); } if (isBackgroundScan) { device.enableRxExtendedMessages(false, 500); } broadcasting = false; AntManager.Instance.channelList.Remove(this); Destroy(this); }
private void CloseAllChannles() { if (channel0 != null) { Console.WriteLine("Closing Channel"); channel0.closeChannel(); channel0.Dispose(); channel0 = null; } if (device0 != null) { device0.Dispose(); device0 = null; } //dispose time and wait object and semaphore }
public void Close() { if (channel != null) { channel.closeChannel(); channel.Dispose(); } if (isBackgroundScan) { device.enableRxExtendedMessages(false, 500); isBackgroundScan = false; } broadcasting = false; AntManager.Instance.channelList.Remove(this); AntManager.Instance.channelIDUsed[device.getOpenedUSBDeviceNum(), userChannel] = false; Destroy(this); }
public void Stop() { // Nothing to stop if not started or already finished. if (state == AntState.NotStarted || state == AntState.Finished) { return; } //if (state == AntState.StartFail || state == AntState.ConnectFail) // return; if (this.channel != null) { try { ANT_Channel tempChannel = this.channel; this.channel = null; tempChannel.closeChannel(RESPONSE_WAIT_TIME); tempChannel.Dispose(); } catch { } } if (this.device != null) { try { ANT_Device tempDevice = this.device; this.device = null; // We use a temp var here because this Dispose method is a little strange... tempDevice.Dispose(); } catch { } } UpdateState(AntState.Finished); }