Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

ANT_DLL.dll and Advanced Bursts (patch)

Rank

Total Posts: 2

Joined 0

PM

I use ANT_DLL.dll to interface ANT+ in my Delphi application, and use the N5 Starter kit.

While ANT_DLL.dll allows you to configure Advanced Bursts, they do not appear via CHANNEL_EVENT_FUNC.
The CHANNEL_EVENT_FUNC infrastructure also does not provide you with any idea how much data you actually got - advanced burst packets seem to be the only ones with real variable length (flagged packets still have fixed length for each flag setting). Sou you would have no idea whether a packet is 16 or 24 bytes long.

There is a surprisingly easy workaround for that:
Below code is a section from ANT_DLL\ant.cpp with a simple fix that splits advanced burst packets to normal 8 byte bursts on application level. It does that by setting a flag in ANT_ConfigureAdvancedBurst() functions - you need one of these to activate advanced burst anyway. The splitting code is already in the provided ANT_LIB source code, but just not activated by default.


This is from ant.cpp, line 596ff:
///////////////////////////////////////////////////////////////////////
// Response TimeOut Version 
///////////////////////////////////////////////////////////////////////
extern "C" EXPORT
BOOL ANT_ConfigureAdvancedBurst_RTO
(BOOL bEnable_UCHAR ucMaxPacketLength_ULONG ulRequiredFields_ULONG ulOptionalFields_ULONG ulResponseTime_)
{
   
if(pclMessageObject)
   
{
      pclMessageObject
->SetSplitAdvBursts(true);  //  advanced burst as normal in CHANNEL_EVENT_FUNC
      
return(pclMessageObject->ConfigAdvancedBurst(bEnable_ucMaxPacketLength_ulRequiredFields_ulOptionalFields_ulResponseTime_));
   
}
   
return(FALSE);
}

///////////////////////////////////////////////////////////////////////
// Stall count version
///////////////////////////////////////////////////////////////////////
extern "C" EXPORT
BOOL ANT_ConfigureAdvancedBurst_ext
(BOOL bEnable_UCHAR ucMaxPacketLength_ULONG ulRequiredFields_ULONG ulOptionalFields_USHORT usStallCount_UCHAR ucRetryCount_)
{
   
return ANT_ConfigureAdvancedBurst_ext_RTO(bEnable_ucMaxPacketLength_ulRequiredFields_ulOptionalFields_usStallCount_ucRetryCount_0);
}

///////////////////////////////////////////////////////////////////////
// Stall count version with response timeout
///////////////////////////////////////////////////////////////////////
extern "C" EXPORT
BOOL ANT_ConfigureAdvancedBurst_ext_RTO
(BOOL bEnable_UCHAR ucMaxPacketLength_ULONG ulRequiredFields_ULONG ulOptionalFields_USHORT usStallCount_UCHAR ucRetryCount_ULONG ulResponseTime_)
{
   
if(pclMessageObject)
   
{
      pclMessageObject
->SetSplitAdvBursts(true); //  advanced burst as normal in CHANNEL_EVENT_FUNC
      
return(pclMessageObject->ConfigAdvancedBurst_ext(bEnable_ucMaxPacketLength_ulRequiredFields_ulOptionalFields_usStallCount_ucRetryCount_ulResponseTime_));
   
}
   
return(FALSE);


Side effects: Advanced burst packets appear to be normal burst in the application, but they are still send over the air (and over USB/serial interface) as advanced with up to 60Kb/sec.
     
Avatar
RankRankRankRank

Total Posts: 662

Joined 2012-10-09

PM

Thanks for contributing this patch!