IAntRadioInitializeContinuousScanMode Method
Initializes the ANT radio for continuous scan mode.
Namespace: SmallEarthTech.AntRadioInterfaceAssembly: SmallEarthTech.AntRadioInterface (in SmallEarthTech.AntRadioInterface.dll) Version: 5.0.0+2b48744145fe7ef0b0e6d89d46e9cc83d8627463
Task<IAntChannel[]> InitializeContinuousScanMode()
Function InitializeContinuousScanMode As Task(Of IAntChannel())
Task<array<IAntChannel^>^>^ InitializeContinuousScanMode()
abstract InitializeContinuousScanMode : unit -> Task<IAntChannel[]>
Return Value
TaskIAntChannel
Returns an array of ANT channels. The first element of the array (ANT channel 0) is used for continuous
scan mode to receive broadcast messages from ANT master devices. The remaining channels
should be configured so messages may be sent to ANT master devices.
Implementors typically would perform the following setup -
public Task<IAntChannel[]> InitializeContinuousScanMode()
{
// multiple clients may attempt to initialize
lock (_lock)
{
// test if channels have not been allocated (first time initialization)
if (_channels.Length == 0)
{
// allocate channels for this radio
_logger.LogInformation("Allocating channels for continuous scan mode.");
_channels = new IAntChannel[NumChannels];
// configure channel 0 for continuous scan mode
SetNetworkKey(0, new byte[] { 0xB9, 0xA5, 0x21, 0xFB, 0xBD, 0x72, 0xC3, 0x45 });
EnableRxExtendedMessages(true);
_channels[0] = GetChannel(0);
_channels[0].AssignChannel(ChannelType.BaseSlaveReceive, 0, 500);
_channels[0].SetChannelID(new ChannelId(0), 500);
_channels[0].SetChannelFreq(57, 500);
OpenRxScanMode();
// assign channels for devices to use for sending messages
for (int i = 1; i < NumChannels; i++)
{
_channels[i] = GetChannel(i);
_ = _channels[i].AssignChannel(ChannelType.BaseSlaveReceive, 0, 500);
}
}
}
return Task.FromResult(_channels);
}