void ReceivedBackgroundScanData(Byte[] data) { byte deviceType = (data[12]); // extended info Device Type byte //use the Extended Message Formats to identify nodes switch (deviceType) { case AntplusDeviceType.FitnessEquipment: { backgroundScanChannel.Close(); deviceNumber = (ushort)((data[10]) | data[11] << 8); transType = data[13]; Debug.Log("found FEC trainer, opening channel, device number is " + deviceNumber); FECChannel = AntManager.Instance.OpenChannel(ANT_ReferenceLibrary.ChannelType.BASE_Slave_Receive_0x00, 1, deviceNumber, 17, transType, 57, 8192, false); FECChannel.onReceiveData += FECData; FECChannel.hideRXFAIL = true; break; } default: { break; } } }
public void Onclick_Close() { if (hrChannel) { hrChannel.onChannelResponse -= OnChannelResponse; hrChannel.Close(); CancelInvoke("HRMTransmit"); hrChannel = null; } if (speedChannel) { speedChannel.onReceiveData -= ReceivedSpeedAntData; speedChannel.Close(); speedChannel = null; } if (backgroundScanChannel) { backgroundScanChannel.onReceiveData -= ReceivedBackgroundScanData; backgroundScanChannel.onChannelResponse -= OnChannelResponse; backgroundScanChannel.Close(); backgroundScanChannel = null; } StopCoroutine("Reconnect"); }
void CloseBackgroundScan() { nScanRequest--; if (nScanRequest == 0) { backgroundScanChannel.Close(); backgroundScanChannel = null; Debug.Log("all devices connected, closing background scan channel"); } }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.S)) { StartScan(); } if (Input.GetKeyDown(KeyCode.Space)) { backgroundScanChannel.Close(); StartDisplay(); } }