Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

You are here: Forum Home → ANT+ Forums → ANT+ Simulation Tools → Thread

   

Problems about ANT+ProfileLib of SimulANT+

Rank

Total Posts: 4

Joined 2017-07-16

PM

Hi !
I am using ANT+ProfileLib of SimulANT+.I don't have to parse the data. it's really convenient.But ,I found two
problems.First,It seems that it is not possible to connect with the specified device number.After I set up,it's invalid,still 0.Second, It seems impossible to set infinite search.I have set searchTimeout 255.The specific code is as follows:
static HeartRateDisplay heartRateDisplay0;
device0 = new ANT_Device();
channel0 = device0.getChannel(0);
channel0.channelResponse += new dChannelResponseHandler(bsChannelResponse);
device0.setNetworkKey(USER_NETWORK_NUM, USER_NETWORK_KEY, 500)
channel0.setChannelID((ushort)(Convert.ToInt32(DeviceNumber)), false, USER_DEVICETYPE USER_TRANSTYPE, 500)
channel0.setChannelSearchTimeout(255);
hrd();
private static void hrd()
{
heartRateDisplay = new HeartRateDisplay(channel, networkAntPlus);
heartRateDisplay.HeartRateDataReceived += HeartRateDisplay_HeartRateDataReceived0;
heartRateDisplay.TurnOn();

}
private static void HeartRateDisplay_HeartRateDataReceived0(HeartRateData arg3, uint arg4)
{
ANT_Response respChID = device0.requestMessageAndResponse(0,
ANT_ReferenceLibrary.RequestMessageID.CHANNEL_ID_0x51, 500);
dn = ((ushort)((respChID.messageContents[2] << 8) + respChID.messageContents[1])).ToString();
HR = (arg3.HeartRate).ToString();
}
DeviceNumber is the device number of my current device,not 0.It does not work when I use a specific device number to connect.It is equivalent to public 0 device number. And,infinite search is invalid.Where have I been wrong or I can't set it up?
     
RankRankRankRank

Total Posts: 120

Joined 2013-05-07

PM

Hi lwxwv,

I hope you were able to find a fix for your problem.

It seems like you are setting channel ID in the correct way, and so if an HRM exists with that device #, the HRM display should acquire and begin tracking it.

I don't believe an infinite search will work here the way you are expecting it to. Once an HRM is found with the right parameters, the search will always end, and begin tracking the master. It is only in the case of the HRM not being present that the search will continue forever if 255 is set. Consider using a continuous or background scan to accomplish what you are trying to achieve.

Regards,
BK