Can someone help me with deep ANT+ knowledge? How to open a 2nd GenericChannel for HRM RD device

Since years I'm developing apps with interfaces to different ANT+ devices by use of CIQ Ant API. Since Months I try to follow ANT+ Device Profle documentation for HRM Running Dynamics, by now without success.

Following ThisIsAnt documentation, it is necessary to
- open an ANT+ channel ,
- send a page 74 to activate running dynamics
- open separate channel to receive Running Dynamics pages
- every second a speed metrics page to be sent to RD channel to keep alive

Clear so far how it should work. Following SimulANT+ tool analyzing a real HRM RD this is true, I checked.

I compared payload in my code with SimulANT+ output, everything seems to be ok. But my code is not working. Receiving HR on 1st channel no issue, but seems to be opening 2nd GenericChannel is the issue. Is it allowed to open a 2nd GenericChannel? If not how to do? Or do I have to do specific thinks to open a 2nd channel?

Maybe someone with deep CIQ ANT+ knowhow can help.

  • No deep knowledge, but I also use ANT for HR. Maybe if you include your code to open the second channel we'll be able to help more.

  • Because of my issues I did a PoC ... simply used official sample code. 1st channel absolutely no issue, receiving HR and everything is ok. So device config for 1st channel is ok.

    Than request for RD data in 1st channel:

    var payload = new Lang.Array<Lang.Number>[8];
    payload[0] = 0x4a;  // Open channel Command
    payload[1] = 0x01;  // SessionLeader ID LSB 51068 in hex
    payload[2] = 0x00;  // SessionLeader ID 
    payload[3] = 0x00;  // SessionLeader ID mSB
    payload[4] = 0x1E;  // device typ must be 30
    payload[5] = 0x03;  // channel (2400 + x MHz)
    payload[6] = 0x86;  // period LSB, must be 8070 (0x1f86)
    payload[7] = 0x1f;  // period MSB
    var message = new Ant.Message();
    message.setPayload(payload);
    GenericChannel.sendAcknowledge(message);

    Inside onMessage I'm waiting for ack of RD sending and opening another GenericChannel class


    if (msg.messageId == Ant.MSG_ID_BROADCAST_DATA) {
        if ( ( payload[0].toNumber() & 0xFF ) == 0x4a ) { // ack RD request, than open another channel
    		rdANT = new RDANT();
            rdANT.open(); // if RD Date Request confirmed, start RD Channel
    		return;
    	}
    }

    And this is a duplicate of sample code, but simply different device config:

                :deviceNumber => 0, // search
                :deviceType => 30, // needs to be 30
                :transmissionType => 0x00,
                :messagePeriod => 8070, // needs to be 8070
                :radioFrequency => 03,              //Ant+ Frequency
                :searchTimeoutLowPriority => 10,    //Timeout in 25s
                :searchTimeoutHighPriority => 2, // Timeout in 5s
                :searchThreshold => 0           // Pair to all transmitting sensors
    

    It seems to be, the 2nd channel is not opened properly. Try to send speed matrics every second (following doc), But channel seems to be not opened (or closed right after opening or closed because 1st channel is closed (which would keep 2nd channel alive)).

    This is the reason why is asked the question, if opening multiple GenericChannels is possible in CIQ, or if there is another way

  • 1. how do you initialize the 2nd channel? Maybe it's in the constructor of RDANT or maybe that's the part that's missing. In my code (again I only have 1 channel) I have this:

    class MySensor extends Ant.GenericChannel {
        public function initialize() {
                try {
                    Ant.GenericChannel.initialize(method(:onMessage), new Ant.ChannelAssignment(
                        Ant.CHANNEL_TYPE_RX_NOT_TX, // Bidirectional Receive (Slave)
                        Ant.NETWORK_PLUS)
                    );
                } catch (e instanceof Ant.UnableToAcquireChannelException) {
                    errorRelease("" + e.getErrorMessage());
                    searching = -1;
                }
        }
        ...

    do you do this for the 2nd channel?

    2. it's not clear whether you have to send the keepalive (and what exactly speed metrics means? Is it page 74?) on the 1st or the 2nd channel.

  • 1. init 2nd channel like in your example -> exception. Clear to me because generic channel already open. Already tried to use the same channel, no success (also clear to me because each channel has fix frequency to be used). Tried to close 1st channel and open new ... 2nd channel is closed immediately, because 1st channel is no longer up (also clear to me, because following doc, open HR channel and 1Hz page 74 request is mandatory to keey alife). So no clue so far how to keep both generic channels open in parallel.

    2. page 74 to be sent on 2nd channel every second. Speed metrics means current speed, obviously needed by HRM RD to calculate RD data.

    Mabe the issue can be reduced to one question: How to open two different ANT channels in one app?