Wahoo Fitness API  3.6.1
Documentation for the iPhone version of the Wahoo Fitness API.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Pages
WFBikeSpeedCadenceConnection Class Reference

Represents a connection to an ANT+ combined Bike Speed and Cadence sensor. More...

#import <WFBikeSpeedCadenceConnection.h>

+ Inheritance diagram for WFBikeSpeedCadenceConnection:
+ Collaboration diagram for WFBikeSpeedCadenceConnection:

Instance Methods

(void) - cscConnection:didReceiveGearRatio:numerator:denominator:
 Invoked when the WFBikeSpeedCadenceConnection receives the status of a request to get the current gear ratio. More...
 
(void) - cscConnection:didReceiveOdometerHistory:
 Invoked when the WFBikeSpeedCadenceConnection receives odometer history from the device. More...
 
(void) - cscConnection:didReceiveSetGearRatioResponse:
 Invoked when the WFBikeSpeedCadenceConnection receives the status of a request to set the current gear ratio. More...
 
(void) - cscConnection:didResetOdometer:
 Invoked when the WFBikeSpeedCadenceConnection receives the status of a request to reset the odometer value. More...
 
(void) - disconnect
 Disconnects the sensor. More...
 
(void) - disconnect:
 Disconnects the sensor and for BTLE peripheral, ensures the BTLE connection is closed. More...
 
(WFBikeSpeedCadenceData *) - getBikeSpeedCadenceData
 Returns the latest data available from the sensor. More...
 
(WFBikeSpeedCadenceRawData *) - getBikeSpeedCadenceRawData
 Returns the latest raw (unformatted) data available from the sensor. More...
 
(WFBTLEBikeSpeedCadenceData *) - getCSCData
 Returns the latest data available from the sensor. More...
 
(WFSensorData *) - getData
 Retrieves the most current data available from the sensor. More...
 
(BOOL- getDeviceGearRatio
 Sends a request to get the device's current gear ratio. More...
 
(WFSensorData *) - getRawData
 Retrieves the most current raw data available from the sensor. More...
 
(BOOL- hasData
 Returns a boolean value indicating whether new data is available. More...
 
(BOOL- requestOdometerHistoryFrom:to:
 Sends a request for the odometer history within the specified range. More...
 
(BOOL- requestOdometerReset:
 Sends a request to reset the odometer value on the device. More...
 
(BOOL- sendRecordCommand:withOperator:operands:
 Sends a command to the CSC device. More...
 
(WFBTLEServiceProcessor *) - serviceProcessorForSensorType:
 Returns a WFBTLEService derived instance which handles BTLE service processing for the specified sensor type. More...
 
(BOOL- setDeviceGearRatioWithNumerator:andDenomonator:
 Sets the gear ratio on a Wahoo Fitness Cadence Pod device. More...
 
(BOOL- setDeviceTime
 Sets the time on a Wahoo Fitness BlueSC device. More...
 
(float) - signalEfficiency
 Returns the signal efficiency for the connected sensor. More...
 

Properties

WFSensorConnectionStatus_t connectionStatus
 Gets the current connection status. More...
 
id< WFBikeSpeedCadenceDelegatecscDelegate
 Specifies the WFBikeSpeedCadenceDelegate instance which will handle callback methods for this WFBikeSpeedCadenceConnection. More...
 
id< WFSensorConnectionDelegatedelegate
 Specifies the WFSensorConnectionDelegate instance which will handle callback methods for this WFSensorConnection. More...
 
NSString * deviceIDString
 Returns the Device ID of the connected sensor for both ANT and BTLE. More...
 
WFDeviceInformationdeviceInformation
 
USHORT deviceNumber
 Gets the ANT device ID of the connected sensor. More...
 
NSString * deviceUUIDString
 Specifies the BTLE Device UUID String. More...
 
BOOL didTimeout
 Gets a boolean value indicating whether a connection timeout occurred. More...
 
WFSensorConnectionError_t error
 Get the error status for the connection. More...
 
BOOL hasAntBridgeSupport
 Gets a boolean value indicating whether this WFSensorConnection instance is connected to a device which supports the Wahoo Fitness ANT Bridge. More...
 
BOOL hasError
 TRUE if an error has occured, otherwise FALSE. More...
 
BOOL hasValidParams
 Gets a boolean value indicating whether this WFSensorConnection has valid connection parameters. More...
 
BOOL hasWildcardParams
 Gets a boolean value indicating whether the connection parameters for this WFSensorConnection indicate a wildcard search. More...
 
BOOL isANTConnection
 TRUE if the sensor is a ANT device, otherwise FALSE. More...
 
BOOL isBTLEConnection
 TRUE if the sensor is a BTLE device, otherwise FALSE. More...
 
BOOL isConnected
 TRUE if the sensor is currently connected, otherwise FALSE. More...
 
BOOL isValid
 Gets a boolean value indicating whether this WFSensorConnection instance is valid. More...
 
WFNetworkType_t networkType
 Specifies the network type of this WFSensorConnection (ANT+, BTLE, etc). More...
 
WFSensorSubType_t sensorSubType
 Gets the sensor sub type for this WFSensorConnection. More...
 
WFSensorType_t sensorType
 Gets the sensor type for this WFSensorConnection. More...
 
NSTimeInterval timeSinceLastMessage
 Gets the time since the last ANT message was received (in seconds). More...
 
UCHAR transmissionType
 Gets the ANT transmission type of the connected sensor. More...
 

Detailed Description

Represents a connection to an ANT+ combined Bike Speed and Cadence sensor.

Method Documentation

- (void) cscConnection: (WFBikeSpeedCadenceConnection *)  cscConn
didReceiveGearRatio: (BOOL bSuccess
numerator: (USHORT usNumerator
denominator: (USHORT usDenominator 

Invoked when the WFBikeSpeedCadenceConnection receives the status of a request to get the current gear ratio.

Parameters
cscConnThe WFBikeSpeedCadenceConnection instance.
bSuccessTRUE if the request to reset the odometer was successful, otherwise FALSE.
usNumeratorThe gear ratio Numerator.
usDenominatorThe gear ratio Denominator.
- (void) cscConnection: (WFBikeSpeedCadenceConnection *)  cscConn
didReceiveOdometerHistory: (WFOdometerHistory *)  history 

Invoked when the WFBikeSpeedCadenceConnection receives odometer history from the device.

Parameters
cscConnThe WFBikeSpeedCadenceConnection instance.
historyA WFOdometerHistory representing the glucose data record.
- (void) cscConnection: (WFBikeSpeedCadenceConnection *)  cscConn
didReceiveSetGearRatioResponse: (BOOL bSuccess 

Invoked when the WFBikeSpeedCadenceConnection receives the status of a request to set the current gear ratio.

Parameters
cscConnThe WFBikeSpeedCadenceConnection instance.
bSuccessTRUE if the request to reset the odometer was successful, otherwise FALSE.
- (void) cscConnection: (WFBikeSpeedCadenceConnection *)  cscConn
didResetOdometer: (BOOL bSuccess 

Invoked when the WFBikeSpeedCadenceConnection receives the status of a request to reset the odometer value.

Parameters
cscConnThe WFBikeSpeedCadenceConnection instance.
bSuccessTRUE if the request to reset the odometer was successful, otherwise FALSE.
- (void) disconnect

Disconnects the sensor.

- (void) disconnect: (BOOL bKillPeripheralConnection

Disconnects the sensor and for BTLE peripheral, ensures the BTLE connection is closed.

BTLE peripheral connections are held in a "peripheral pool" to facilitate multiple logical connections to the same physical device. Normally, when the last logical connection (WFSensorConnection) is disconnected, the BTLE connection will be held in the pool briefly to reduce the overhead of any subsequent connection requests from the application. To override this behaviour, the disconnect: method may be invoked with the bKillPeripheralConnection parameter set to TRUE. In this case, if the WFSensorConnection requesting the disconnect is the last logical connection to the BTLE peripheral, the BTLE peripheral connection will be closed immediately and the BTLE peripheral will be removed from the pool.

Note
For ANT+ devices, this method behaves exactly the same as the disconnect method, regardless of the value of the bKillPeripheralConnection parameter.
Parameters
bKillPeripheralConnectionTRUE if the underlying BTLE connection should be closed immediately, otherwise FALSE.
- (WFBikeSpeedCadenceData*) getBikeSpeedCadenceData

Returns the latest data available from the sensor.

See also
- getData (WFSensorConnection)
Returns
A WFBikeSpeedCadenceData instance containing data if available, otherwise nil.
- (WFBikeSpeedCadenceRawData*) getBikeSpeedCadenceRawData

Returns the latest raw (unformatted) data available from the sensor.

See also
- getRawData (WFSensorConnection)
Returns
A WFBikeSpeedCadenceRawData instance containing data if available, otherwise nil.
- (WFBTLEBikeSpeedCadenceData*) getCSCData

Returns the latest data available from the sensor.

Note
This property is only available for BTLE speed and cadence sensors. For other types, this property will be nil.
See also
- getData (WFSensorConnection)
Returns
A WFBTLEBikeSpeedCadenceData instance containing data if available, otherwise nil.
- (WFSensorData*) getData

Retrieves the most current data available from the sensor.

Note
WFSensorData is an abstract base class for all sensor data types. The specific type will be determined by the type of sensor. The instance returned must be cast to the specific type in order to be useful.
Returns
A WFSensorData derived instance containing data if available, otherwise nil.
- (BOOL) getDeviceGearRatio

Sends a request to get the device's current gear ratio.

Note
This method is only available for Wahoo Fitness Cadence pod devices. For other types, this method will return FALSE, and will have no effect.
Returns
TRUE if the request was sent successfully, otherwise FALSE.
- (WFSensorData*) getRawData

Retrieves the most current raw data available from the sensor.

Note
This method will return raw (unformatted) data from the sensor. It is made available for applications which require processing of data as close to the original measured values a possible. There may be other rarely used data available via this method as well. For most applications, the getData method should be used instead.

WFSensorData is an abstract base class for all sensor data types. The specific type will be determined by the type of sensor. The instance returned must be cast to the specific type in order to be useful.
Returns
A WFSensorData derived instance containing data if available, otherwise nil.
- (BOOL) hasData

Returns a boolean value indicating whether new data is available.

Returns
TRUE if new data is available since the last time getData was invoked, otherwise FALSE.
- (BOOL) requestOdometerHistoryFrom: (UCHAR ucStart
to: (UCHAR ucEnd 

Sends a request for the odometer history within the specified range.

Note
This method is only available for Wahoo Fitness BlueSC BTLE speed and cadence devices. For other types, this method will return FALSE, and will have no effect.

Odometer history is indexed in descending order. The latest week is indexed 0, the week before that is 1, etc. The earliest possible week is WF_ODOMETER_HISTORY_MAX_SIZE, though history for this week is not necessarily available.

The device will return all available odometer history between the starting and ending indices, inclusive.

Parameters
ucStartThe index of the latest week for which odometer history should be retrieved.
ucEndThe index of the earliest week for which odometer history should be retrieved.
Returns
TRUE if the command was sent successfully, otherwise FALSE.
- (BOOL) requestOdometerReset: (float)  resetVal

Sends a request to reset the odometer value on the device.

Note
This method is only available for BTLE speed and cadence devices. For other types, this method will return FALSE, and will have no effect.

The device odometer will be reset to the specified value.

Note
For Wahoo Fitness BlueSC devices, this command will also clear the odometer history.
Parameters
resetValThe value to which the odometer will be reset. This value is interpreted based on the current WFConnectorSettings values for metric and bike wheel circumference. If WFConnectorSettings::useMetricUnits is TRUE, the value will be interpreted as kilometers, otherwise it will be interpreted as miles.
Returns
TRUE if the command was sent successfully, otherwise FALSE.
- (BOOL) sendRecordCommand: (WFBTLEWahooCSCOpCode_t opCode
withOperator: (WFBTLERecordOperator_t op
operands: (NSData *)  operands 

Sends a command to the CSC device.

Note
This method is only available for Wahoo Fitness BlueSC BTLE speed and cadence devices. For other types, this method will return FALSE, and will have no effect.
Parameters
opCodeThe type of command to be sent.
opThe operator for the command.
operandsThe operands for the command. This value is variable length, and the contents are dependent on the command (opCode). For some commands, this value may be nil.
Returns
TRUE if the command was sent successfully, otherwise FALSE.
- (WFBTLEServiceProcessor*) serviceProcessorForSensorType: (WFSensorType_t eSensorType

Returns a WFBTLEService derived instance which handles BTLE service processing for the specified sensor type.

Parameters
eSensorTypeThe sensor type.
Returns
A WFBTLEService derived instance if successful, otherwise nil.
- (BOOL) setDeviceGearRatioWithNumerator: (USHORT numerator
andDenomonator: (USHORT denomonator 

Sets the gear ratio on a Wahoo Fitness Cadence Pod device.

Note
This method is only available for Wahoo Fitness Cadence pod devices. For other types, this method will return FALSE, and will have no effect.
Returns
TRUE if the request was sent successfully, otherwise FALSE.
- (BOOL) setDeviceTime

Sets the time on a Wahoo Fitness BlueSC device.

This method is called internally when the device connects.

Note
This method is only available for Wahoo Fitness BlueSC BTLE speed and cadence devices. For other types, this method will return FALSE, and will have no effect.
Returns
TRUE if the request to set the device time was sent successfully, otherwise FALSE.
- (float) signalEfficiency

Returns the signal efficiency for the connected sensor.

Returns
For ANT connections, this property represents the ratio of messages received from the sensor over the number of messages expected (range [0, 1.0]). This value should give a good indication of the reception quality for the sensor. For BTLE connections, this property represents the RSSI (in dBm). If the sensor is not currently connected, the return value is -1.

Property Documentation

- (WFSensorConnectionStatus_t) connectionStatus
readnonatomicassigninherited

Gets the current connection status.

- (id<WFBikeSpeedCadenceDelegate>) cscDelegate
readwritenonatomicretain

Specifies the WFBikeSpeedCadenceDelegate instance which will handle callback methods for this WFBikeSpeedCadenceConnection.

- (id<WFSensorConnectionDelegate>) delegate
readwritenonatomicretaininherited

Specifies the WFSensorConnectionDelegate instance which will handle callback methods for this WFSensorConnection.

- (NSString*) deviceIDString
readnonatomicassigninherited

Returns the Device ID of the connected sensor for both ANT and BTLE.

- (WFDeviceInformation*) deviceInformation
readnonatomicretaininherited
- (USHORT) deviceNumber
readnonatomicassigninherited

Gets the ANT device ID of the connected sensor.

- (NSString*) deviceUUIDString
readnonatomicassigninherited

Specifies the BTLE Device UUID String.

- (BOOL) didTimeout
readnonatomicassigninherited

Gets a boolean value indicating whether a connection timeout occurred.

- (WFSensorConnectionError_t) error
readnonatomicassigninherited

Get the error status for the connection.

- (BOOL) hasAntBridgeSupport
readnonatomicassigninherited

Gets a boolean value indicating whether this WFSensorConnection instance is connected to a device which supports the Wahoo Fitness ANT Bridge.

See also
- enableAntBridge: (WFHardwareConnector)
WFConnectorSettings::isAntBridgeAutoEnabled
- (BOOL) hasError
readnonatomicassigninherited

TRUE if an error has occured, otherwise FALSE.

- (BOOL) hasValidParams
readnonatomicassigninherited

Gets a boolean value indicating whether this WFSensorConnection has valid connection parameters.

When the WFSensorConnection is initiated as a wildcard search, the connection parameters (WFSensorConnection::deviceNumber, WFSensorConnection::transmissionType, etc.) are not set to a specific device. Once the sensor connection is established, the connection parameters will contain values which uniquely identify the connected sensor. At this point the connection parameters may be persisted and used in the future to establish a connection with this same sensor (pairing).

The value of this property is TRUE when the connection parameters are suitable for uniquely identifying a specific sensor. Otherwise, the value is FALSE.

See also
WFSensorConnection::hasWildcardParams
- (BOOL) hasWildcardParams
readnonatomicassigninherited

Gets a boolean value indicating whether the connection parameters for this WFSensorConnection indicate a wildcard search.

See also
WFSensorConnection::hasValidParams
- (BOOL) isANTConnection
readnonatomicassigninherited

TRUE if the sensor is a ANT device, otherwise FALSE.

- (BOOL) isBTLEConnection
readnonatomicassigninherited

TRUE if the sensor is a BTLE device, otherwise FALSE.

- (BOOL) isConnected
readnonatomicassigninherited

TRUE if the sensor is currently connected, otherwise FALSE.

- (BOOL) isValid
readnonatomicassigninherited

Gets a boolean value indicating whether this WFSensorConnection instance is valid.

The WFSensorConnection is invalidated when the sensor is disconnected, or when the API is reset.

Note
The WFSensorConnection instance returned via the requestSensorConnection: (WFHardwareConnector) method should be retained by the application for retrieving data and managing the connection. The Wahoo API will also maintain a reference to this instance (it may be retrieved by the getSensorConnections: (WFHardwareConnector) method). When the sensor is disconnected, the WFSensorConnection instance is invalidated. At this point, the Wahoo API will release its reference to the instance. Once this happens, the instance may not be used to retrieve data, and any properties of the instance will contain spurious values, and should not be used. An application may check for this state with the WFSensorConnection::isValid property.
- (WFNetworkType_t) networkType
readnonatomicassigninherited

Specifies the network type of this WFSensorConnection (ANT+, BTLE, etc).

- (WFSensorSubType_t) sensorSubType
readnonatomicassigninherited

Gets the sensor sub type for this WFSensorConnection.

- (WFSensorType_t) sensorType
readnonatomicassigninherited

Gets the sensor type for this WFSensorConnection.

- (NSTimeInterval) timeSinceLastMessage
readnonatomicassigninherited

Gets the time since the last ANT message was received (in seconds).

WF_INVALID_DATA_TIME if unknown or invalid.

- (UCHAR) transmissionType
readnonatomicassigninherited

Gets the ANT transmission type of the connected sensor.