Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

two channels(c#)?

Rank

Total Posts: 4

Joined 2017-07-16

PM

Hello!
Recently I was using a demo of the ANT_SDK(C#demo.cs). Based on your data, the protocol can open multiple channels。
static ANT_Channel channel0;
static ANT_Channel channel1;
channel0 = device0.getChannel(0);
channel1 = device0.getChannel(1);
Does this represent two channels?How can I receive two channels' data at the same time? I can only accept one.Please help me, thank you very much!      
Avatar
RankRankRankRank

Total Posts: 744

Joined 2012-09-14

PM

Hi,

This does represent two separate ANT channels. You handle responses from them by passing them a dChannelResponseHandler delegate which represents a response handler (analagous to an event handler). The code sample below shows getting two separate channels but passing them the same response handler

ANT_Channel channel device.getChannel(FIRST_ANT_CHANNEL);    // Get channel from ANT device
channel.channelResponse += new dChannelResponseHandler(ChannelResponse);  // Add channel response function to receive channel event messages

ANT_Channel secondChannel device.getChannel(SECOND_ANT_CHANNEL);    // Get channel from ANT device
secondChannel.channelResponse += new dChannelResponseHandler(ChannelResponse);  // Add channel response function to receive channel event messages 


The channel response handler is passed a reference to the channel, so you can tell which channel sent the event:

static void ChannelResponse(ANT_Response response{
    ANT_Channel channel 
= (ANT_Channel)response.sender;
    ...
     
Rank

Total Posts: 4

Joined 2017-07-16

PM

Hi!
Thank you for your reply. The problem has been solved.
Because of "device0.ResetSystem(); "