Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

device type from the ANT_Response object

Rank

Total Posts: 12

Joined 2013-07-09

PM

Dear All,

I want to know the device type from the ANT_Response object. But in CSharp I have not find such a field in the byte array. However in C++ it was easily accessible through ANT_MESSAGE DevicMsg.aucData[12].
Kindly suggest me how I check the device type for each ANT message.

Actually I want to write a single general message interpreter code for more than one devices. But ANT_Response is not providing this information in its byte array.

Thanks,      
Avatar
RankRankRankRank

Total Posts: 296

Joined 0

PM

class ANT_Managed_Library.ANT_Response,method getDeviceIDfromExt()

Before you can use this, you must check that the ANT device generally supports extended messaging (ANT_DeviceCapabilities.ExtendedMessaging)
and switch on enabled messaging for this device: class ANT_Managed_Library.ANT_Device, method enableRxExtendedMessages()

Cheers,
OMB      
Rank

Total Posts: 12

Joined 2013-07-09

PM

Dear OMB,

I have opened up USB device like this:

try{
usb = new ANT_Device();
}
catch (Exception){
MessageBox.Show("Error initialising ANT module.");
return false;
}
usb.ResetSystem();

if (usb.enableRxExtendedMessages(true, 50)) //extended messages are enabled
{
usbCapabilities = usb.getDeviceCapabilities(20);
if (usbCapabilities.ExtendedMessaging)
{
MessageBox.Show("Extended Messaging is enabled", "ANT Debug", MessageBoxButtons.OK);
}
}

however when I try to access the extended messages it gives me the following message:

ANT_Managed_Library: Response is not an extended message.

I am accessing the capabilities and then the extended messages in the ANT_Channel event function as:


try
{
if (usbCapabilities.ExtendedMessaging)
{
currChannelID = ANTresponse.getDeviceIDfromExt();
}
}catch(ANT_Exception e){
MessageBox.Show(e.Message.ToString(), "ANT Error",
MessageBoxButtons.YesNo);
}

then latter from the currChannelID when I try to access the device type it returns me zero.I am expecting it 25 in the case of temperature sensor. Any suggestions please.
thanks      
Rank

Total Posts: 12

Joined 2013-07-09

PM

I checked that I was resetting the device again which was creating the problem. After removing it, now it is going fine. Thanks.