IAntRadioInitializeContinuousScanMode Method

Initializes the ANT radio for continuous scan mode.

Definition

Namespace: SmallEarthTech.AntRadioInterface
Assembly: SmallEarthTech.AntRadioInterface (in SmallEarthTech.AntRadioInterface.dll) Version: 3.0.0.0+01fc5ca24e8f030354f28ec9cef320bc5cbb0ef6
C#
Task<IAntChannel[]> InitializeContinuousScanMode()

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.

Example

Implementors typically would perform the following setup -
C#
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);
             }

See Also