Important: Before you run this example, make sure to program the SoftDevice.
With standard ANT search, you can search for devices in one network and one radio frequency at a time. For applications that intend to connect to devices on different networks and frequencies, this means that the second slave channel can start searching for a master only after the first slave channel has either acquired a master or timed out its search. Search sharing enables two or more channels to search concurrently on different radio frequencies or networks, by alternating which channel uses the radio for searching.
The purpose of this example is to demonstrate how to use search sharing to perform concurrent searches for two devices transmitting in different radio frequencies. This example also shows how to configure the search waveform to limit the impact on acquisition time from switching between multiple frequencies during search. This example can be paired with ANTware, with two master channels in two different radio frequencies.
After startup, this example will configure and open two slave channels with the following parameters:
Parameter | Slave 0 | Slave 1 |
---|---|---|
Channel type | Slave (0x10) | Slave (0x10) |
Extended assignment | 0 | 0 |
Network | Public | Public |
Radio frequency | 50 | 70 |
Device number | 0 (wildcard) | 0 (wildcard) |
Device type | 2 | 3 |
Transmission type | 1 | 1 |
Channel period | 8192 (4 Hz) | 8192 (4 Hz) |
High priority search timeout | 0 (disabled) | 0 (disabled) |
Low priority search timeout | 12 (30 seconds) | 12 (30 seconds) |
Search sharing cycles | 1 | 1 |
Search waveform | ANT_WAVEFORM_FAST | ANT_WAVEFORM_FAST |
The high priority search timeout is disabled on both channels to reduce the impact of search on tracking channels. Low priority search timeout is configured to the desired timeout, 30 seconds. Search sharing cycles are set to 1, so that search alternates between the two channels in every search cycle. Finally, to reduce the impact on acquisition time from switching back and forth between the two radio frequencies, the search waveform is configured to the fast waveform.
Note: You can use a custom channel or encryption when running any of the ANT examples. When adding a new channel or encryption, remember to update SoftDevice ANT event handler configuration.
<InstallFolder>\examples\ant\ant_search_sharing\search_sharing_test.xml
. Alternatively, you can configure the device channel manually: