Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

You are here: Forum Home → ANT+ Forums → ANT+ Fitness Equipment → Thread

   

FitnessEquipmentDisplay.SendDataPageRequest(drq)

Rank

Total Posts: 2

Joined 2016-10-26

PM

I'm using the Simulant libraries and getting some unexpected behavior when calling FitnessEquipmentDisplay.SendDataPageRequest. All works well when the transmission completes, but if the transmission fails (EVENT_TRANSFER_TX_FAILED_0x06), no subsequent transfers are acknowledged (failure or otherwise).

In the code below , getData(0x30) is called every second. It runs for about 20 seconds (not consistent) , sends back a transaction failed, and then never generates another failure or call to FecDisplay_DataPageReceived.

Any ideas here? I'm doing something similar in a legacy application based off the old ANT+DisplaySimulator code without issue. Is there any reason that this might be happening with the Simulant libraries.

//////  >>>>> Snippet from initalization
         
fecDisplay = new FitnessEquipmentDisplay(channels[4]networkAntPlus);
         
channelAssignments[4].display fecDisplay ;
            
fecDisplay.SensorFound += FecDisplay_SensorFound;
         
            
fecDisplay.ControlBasicResistancePageReceived += FecDisplay_ControlBasicResistancePageReceived;
            
fecDisplay.ControlTargetPowerPageReceived += FecDisplay_ControlTargetPowerPageReceived;
            
fecDisplay.ControlWindResistancePageReceived += FecDisplay_ControlWindResistancePageReceived;
            
fecDisplay.CommandStatusPageReceived += FecDisplay_CommandStatusPageReceived; ;
            
fecDisplay.SpecificTrainerPageReceived += FecDisplay_SpecificTrainerPageReceived;
            
fecDisplay.ChannelStatusChanged += FecDisplay_ChannelStatusChanged;
            
fecDisplay.DataPageReceived += FecDisplay_DataPageReceived;

            
fecDisplay.TurnOn();


     
///// <<<<<< End snippet 

      
public  static void getData(byte page)
        
{

                    AntPlus
.Profiles.Common.RequestDataPage drq = new AntPlus.Profiles.Common.RequestDataPage();
                    
drq.RequestedNumberTx 1;
                    
drq.RequestedPageNumber page;
                    
drq.UseAck true;
                    
                   
lock(fecDisplay)
                       
fecDisplay.SendDataPageRequest(drq);
        
}
/// Event handler wired to fecDisplay
        
private static void FecDisplay_DataPageReceived(DataPage arg1uint arg2)
        
{
            
if (arg1.DataPageNumber == 0x30)
            
{

                
                log
("GOT IT");
            
}
            
else
            
{
                log
(arg1.GetType().ToString());
            
}
        } 
     
RankRankRankRank

Total Posts: 120

Joined 2013-05-07

PM

Hi snippingplate,

Calling SendDataPageRequest in code works exactly like it would in the SimulANT+ UI. As long as a channel is open, the request should be successful. Why do you have a lock around SendDataPageRequest? SendDataPageRequest is a non-blocking call. The page is not garunteed to have been sent after the call returns, and may be sent soon afterwards.

Also, even if the data page request transmission is successful:
1. If the display is not connected to a sensor, the tx will fail.
2. Even if a sensor is connected and the txs succeed, if the sensor does not support the requested page, you will not receive a page response.

BK.      
Rank

Total Posts: 2

Joined 2016-10-26

PM

I understand that the method call queues the message to be sent and returns and the resulting message is passed through the callback. The lock was an attempt to see if the issue was related to the fact that the sendData method can be called from multiple threads and it wasn't clear if the display classes were thread safe. I've since removed that logic and its only being called from a single thread, so the lock is superfluous.

The sensor is connected when the page request is sent and I do get responses to that page request via the callback. After a certain number of requests, though, a Tx Failure occurs and the device no longer responds to page requests. I've since discovered that dialing the message frequency back reduces the likelihood this happens, but the only way I've found I can continue to send requests once it happens it to close/ reopen the channel.

FWIW - the device is a 2016 Wahoo Kickr      
RankRankRankRank

Total Posts: 120

Joined 2013-05-07

PM

It could be that you are overwhelming the Kickr with request which causes a the system to crash. We recommend that no more than 4 data page requests be sent in a row to allow the receiving device time to respond.