Overview
This application is a sample implementation of Cycling Speed And Cadence collector as defined by CSCP specification 1.0. All features are supported (i.e. both mandatory and optional features).
The application is controlled using command line interface exposed over UART2.
The application supports up to 8 simultaneous connections.
Installation procedure
The project is located in the projects/dk_apps/ble_profiles/cscp_collector folder.
To install the project follow the General Installation and Debugging Procedure.
Suggested Configurable parameters
Manual testing
The application is controlled using command line interface (CLI) which can be accessed using serial port available when platform is connected to PC using USB2 connector (e.g. /dev/ttyUSBx or COMx).
Quick start
To quickly scan and connect to sensor device:
- Type
scan start to start scanning for CSCP Sensor devices.
- When device is found, type
scan stop to stop scanning. Scanning...
[01] Device found: public D6:D6:CB:0B:83:DA (Wahoo BlueSC v1.4)
Scan stopped
- Now you can connect to a device by using one of following methods:
- type
connect 1 to connect to 1st device found
- type
connect D6:D6:CB:0B:83:DA to connect to device with given address
The connection is established and device is automatically discovered:
- Note
- The collector stores services of bonded sensors. Any subsequent connection to already bonded sensor will not generate additional GATT traffic. The sensor information is to be read from storage. Since the profile requires bonding first connection will start bonding automatically. Application verifies bond status on reconnection, thus any lose of encryption keys information will trigger pairing procedure and re-discovery of all services
Connecting to D6:D6:CB:0B:83:DA ...
Device connected
Address: public D6:D6:CB:0B:83:DA
Connection index: 0
Security level changed
Connection index: 0
Security level: 2
Browsing...
Pairing completed
Connection index: 0
Status: 0x00
Bond: 1
MITM: 0
Browse completed
Cycling Speed and Cadence service found
Device Information Service found
Querying device...
Manufacturer: Wahoo Fitness
Firmware version: 1.4
Features: 0x03
wheel revolution data supported
crank revolution data supported
multiple sensor locations NOT SUPPORTED
Sensor Location: front wheel
Control Point enabled
Measurement notifications enabled
Ready.
As can be seen above, discovery includes following actions:
- search for Device Information Service and read available characteristics,
- search for Cycling Speed and Cadence Service and read available characteristics, e.g. features and sensor location,
- enable indications for Control Point (if supported by sensor)
- enable notifications for measurement characteristic.
- Initialization is finished when
Ready. message is received, as above. You should see incoming measurement notifications as below. CSC measurement notification received
Last wheel event time: 41.517 [s] (raw 42514)
Cumulative wheel revolutions: 111
Last crank event time: 40.955 [s] (raw 41938)
Cumulative crank revolutions: 141
Calculated speed: 22.725 [km/h]
Calculated cadence: 35 [rpm]
- To use full functionality of the application, check the complete list of commands below.
Available commands
<tt>scan <start|stop> [any]</tt>
Start and stop scanning procedure.
By default, the application scans for devices which include Cycling Speed and Cadence service UUID (0x1816) in advertising data. To scan for any device in range use optional any parameter, i.e. scan start any.
The returned list of devices includes an index, a device address and a device name (if available).
- Note
- The application can cache up to 25 devices. When this limit is reached, application stops filtering duplicated devices and any new devices found are reported with index
00.
<tt>connect <address [public|private] | index></tt>
Connect to peripheral device.
The device can be specified by either providing an address or an index of device found during last scan session.
The optional address type applies only when connecting to a device using an address. If not specified, the address type is searched on results from previous scan session or public is used when not available.
<tt>connect cancel</tt>
Cancel ongoing connection attempt.
Connection completed
Status: 0x0c
<tt>notifications <conn_idx> <on|off></tt>
Enable and disable mesaurement notifications on device with specified <conn_idx>.
This command is provided for debugging purposes. Notifications are always enabled after sensor is connected and there is no need to enable them explicitly.
<tt>disconnect <conn_idx></tt>
Disconnect sensor with specified <conn_idx>.
Disconnected from D6:D6:CB:0B:83:DA
Device disconnected
Connection index: 0
Reason: 0x16
<tt>get <conn_idx> <parameter></tt>
Read parameter from sensor with specified <conn_idx>.
Valid parameters are:
location - sensor location
locations - supported sensor locations
- Note
- Not all parameters may be available to read from the sensor device since support for them is optional as per CSCP specification.
<tt>set <conn_idx> <parameter> <value></tt>
Write parameter to sensor with specified <conn_idx>.
Valid parameters are:
location - sensor location, shall be one of values suppored by sensor (see get locations)
wheelrev - cumulative wheel revolutions data
- Note
- Not all parameters may be available to write to the sensor device since support for them is optional as per CSCP specification.
<tt>show [connected|bonded]</tt>
Show list of connected/bonded sensors
<tt>unbond [[public|private] <address> | all]</tt>
Unbond sensor with specified address or unbond all bonded sensors
- Note
- Write
show bonded to see list of bonded sensors to unbond