Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

Connecting two Bike Speed and Cadence devices

Rank

Total Posts: 11

Joined 2014-06-15

PM

Hi

I inherited a code-base for connecting to a custom Bike Speed and Cadence (SCS) device, which was based on the ANTPlusDemo android source code, and is used for research purposes. I now need to connect to a second custom SCS device, and hope to continue to build upon my code base and change as little as possible. However, the method for distinguishing between and decoding incoming messages in ANTPlusDemo appears to require a unique channel number, which is extracted from the incoming message of a master device (e.g. HR, WEIGHT, SDM, SCS). Both of my devices transmit the same number (for the SPEED_CADENCE_CHANNEL).

I know the full channel ID of both devices, which are distinct only by their device numbers, and the data message format (they measure different things). Is there a way, for instance, of extracting the device number from an incoming AntRxMessage?
I.e:
case AntMesg.MESG_CHANNEL_ID_ID:
                     
short deviceNum = (short) ((ANTRxMessage[AntMesg.MESG_DATA_OFFSET 1]&0xFF; | ((ANTRxMessage[AntMesg.MESG_DATA_OFFSET 2]&0xFF;) << 8)) & 0xFFFF); 


works to extract the device number, but only in the case of MESG_CHANNEL_ID_ID. Is the device number transmitted in every message sent from a master, so that I may simply call the correct decode() function for each incoming message based on device number? How might I extract it from the ANTRxMessage?

Thanks.
     
Avatar
RankRankRankRank

Total Posts: 745

Joined 2012-09-14

PM

Hi mallen,

We recommend switching to the new ANT+ Plugin Sampler. The ANT+ Plugins are a far more straightforward method for decoding ANT+ Data (and have been certified).

Best regards      
Rank

Total Posts: 11

Joined 2014-06-15

PM

Hi

Thanks very much for this, I've had a look at the source code and it looks very useful indeed (and at first glance a lot simpler than the old method).

I have an issue however. I am developing Android software to work with two bespoke hardware devices, which have been implemented using customised Bike Speed and Cadence ANT+ profiles (different transmission rates and data messages to the standard profile). Previously I was able to alter the channel parameters for the devices by setting the transmission rate manually in AntPlusManager and access the raw messages to extract our modified data. Is this possible in the AntPlusPluginSampler? I can't see where I might achieve this in the Activity_BikeCadenceSampler class, all I can see in the API is onNewCalculatedCadence(...), which doesn't give me the control I need to change the Rx rate and/or access our device data from the transmitted messages.

Thanks very much for the assistance.      
Avatar
RankRankRankRank

Total Posts: 745

Joined 2012-09-14

PM

The ANT+ Plugins are intended for only decoding data from ANT+ compliant devices and cannot have their channel period's changed. We recommend using the ANT Android SDK instead to implement your own custom ANT channels.