This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

getting device number from master

Hello, I want to implement device pairing, using the pairing bit. The pairing bit is set in the masters device type. For a slave to pair with such master, it opens a channel with the device type set to the pairings masters device type and the device number to 0 (aka wildcard). Now, when the slave receives a first message from the master, it should obtain the masters device number and reopen the channel with the correct device number.

How can the slave get the masters device id? In ANT_MESSAGE I don't find any field, where I device number or the channel id is in. On the othere hand, the device number must be somehow communicate over the air.

Edit: In "ANT Message Protocal and Usage" I found a documented message for ANT devices that are connected via a serial interface. The message is named "Channel ID" (page 114) and is transmitted from the ant device to the host. From the documentation it sounds like it could correspond with function named sd_ant_channel_id_get() from ant_interface.h.

This would make sense but: in ant_parameters.h there is a #define MESG_CHANNEL_ID_ID with the same value (0x51) as in the documentation for the "Host / ANT-Device over serial interface" documentation. This would imply that I have to obtain the information (master device number) from an event.

  1. Can I use sd_ant_channel_id_get() on a slave side to obtain the masters device number?

  2. or do I have to listen / wait for a MESG_CHANNEL_ID_ID event and pick the device number out of the payload from that message?

Thanks in advance and thanks for reading, Torsten

Parents
  • ad 1) yes, you can:

    // #define CHANNEL_0 0x06

    uint16_t ChanDevNum; uint8_t ChanDevType, ChanTransType;

    err_code = sd_ant_channel_id_get(CHANNEL_0, &ChanDevNum, &ChanDevType, &ChanTransType);


    ad 2) or use ANTLibConfig & check extended payload:

    err_code = sd_ant_lib_config_set(ANT_LIB_CONFIG_MESG_OUT_INC_DEVICE_ID); // prior to opening SLAVE channel enable extended messaging to standard 8byte payload

Reply
  • ad 1) yes, you can:

    // #define CHANNEL_0 0x06

    uint16_t ChanDevNum; uint8_t ChanDevType, ChanTransType;

    err_code = sd_ant_channel_id_get(CHANNEL_0, &ChanDevNum, &ChanDevType, &ChanTransType);


    ad 2) or use ANTLibConfig & check extended payload:

    err_code = sd_ant_lib_config_set(ANT_LIB_CONFIG_MESG_OUT_INC_DEVICE_ID); // prior to opening SLAVE channel enable extended messaging to standard 8byte payload

Children
Related