Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

CSM - Emulating a sensor broadcast message

Avatar
RankRankRankRank

Total Posts: 123

Joined 2013-10-07

PM

I am using the continuous scanning mode to receive messages from sensors in my software.
I would also like to emulate and send Power-only messages from time to time, so that this message can be received by others devices (Garmin watch, etc.)

I have tried, but my messages are ignored by other devices. I am wondering if it's possible to do this while I am in CSM mode. The CSM Documentation specify sending messages to a master, but not a generic broadcast message that is meant to be received by any device. I use CSM in bi-mode so sending is not a problem. I can already send and control FE-C trainers sucessuflly.

Here is the function that create and send the message over the air:
Any help appreciated, I can hard code the message if I need to.


// antID: ANT+ ID to emulate (1-65532)
// power: current power to send
// A Power-Only message example: 0 -  10 -  17 -  ff -  5a -  6d -  19 -  1b -  1 -  80 -  65 -  0 -  b -  5 -  0 -  0 -  0
void Hub::sendPowerOnlyMessage(int antIDint power{

    configureSendChannelBroadcastPM
();

    
powerEventCount++;
    
accumulatedPower += power;

    if (
powerEventCount 255{
        powerEventCount 
0;
    
}
    
if (accumulatedPower 65535{
        accumulatedPower 
accumulatedPower 65535;
    
}

    uint8_t aucTxBuf[ANT_STANDARD_DATA_PAYLOAD_SIZE]
;  //8
    
aucTxBuf[0] =  0x10;
    
aucTxBuf[1] =  powerEventCount//event count
    
aucTxBuf[2] =  0xFF//pedal power, not used
    
aucTxBuf[3] =  0xFF//instant cadence, not used
    
aucTxBuf[4] =  (uint8_t)accumulatedPower;
    
aucTxBuf[5] =  (uint8_t)(accumulatedPower >> 8);
    
aucTxBuf[6] =  (uint8_t)power;
    
aucTxBuf[7] =  (uint8_t)(power >> 8);

    
pclMessageObject->SendBroadcastData(constants::pmChannelNumberaucTxBuf);
}

void Hub
::configureSendChannelBroadcastPM() {

    qDebug
() << "configureSendChannelBroadcastPM Now";
    if (
currentSendingChannel != constants::pmChannelNumber{
        pclMessageObject
->AssignChannel(constants::pmChannelNumber0USER_NETWORK_NUM);
        
currentSendingChannel constants::pmChannelNumber;
    
}
    pclMessageObject
->SetChannelID(constants::pmChannelNumber0constants::powerDeviceTypeconstants::transTypePower); //id=0 --> (wildcard so that any device accept the message)
     

Signature

——————————————————
Free Indoor Cycling Software - https://maximumtrainer.com

Avatar
RankRankRankRank

Total Posts: 745

Joined 2012-09-14

PM

Continuous scan mode does not allow you to send broadcast messages as the mode uses the other channels as buffers for responding to received messages (and they no longer function as regular ANT channels). You will have to temporarily disable continuous scan mode in order to send a regular broadcast message.      
Avatar
RankRankRankRank

Total Posts: 123

Joined 2013-10-07

PM

Thanks harrison for the fast reply!

We wanted to emit back calculated power (calculated with speed data and power curve) to ANT+ Power, but changing the mode away from CSM is not a option and risk causing lot of problems.
I think we will pass on this one!

Have a great day,
Max      

Signature

——————————————————
Free Indoor Cycling Software - https://maximumtrainer.com

Avatar
RankRankRankRank

Total Posts: 123

Joined 2013-10-07

PM

Just a quick note, I thought it would be possible because I can send calibration message fine to any power meter.,but theses are ack message, not broadcast messages.
So there is no way to "hack" the sending of a power-only broadcast message in CSM mode? maybe send the same message as an ack message?

Thanks Harrison!      

Signature

——————————————————
Free Indoor Cycling Software - https://maximumtrainer.com

Avatar
RankRankRankRank

Total Posts: 745

Joined 2012-09-14

PM

Hi Max,

CSM can only respond to received messages, so there's no way to force it to send a message while in CSM, sorry! High duty search on the USB-m lets you do a CSM-like background scan to receive all messages, while also opening regular channels, so that could be an option for you as well.

Cheers      
Avatar
RankRankRankRank

Total Posts: 123

Joined 2013-10-07

PM

Thanks Harrison, an alternate solution would be to use a dedicated stick for sending broadcast message.
Great support as always, they should give you a rise! wink      

Signature

——————————————————
Free Indoor Cycling Software - https://maximumtrainer.com