SWRU580 April 2021 CC2564C , CC2564MODA , CC2564MODN
Description
the RegisterHRS command is responsible for registering a HRP Service. This function will return zero on successful execution and a negative value on all errors.
Parameters
It is not necessary to include parameters when using this command. A parameter will have no effect on the outcome.
Possible Return Values
(0) Successfully registered an HRP service
(-4) FUNCTION_ERROR
(-1000) HRS_ERROR_INVALID_PARAMETER
(-1002) HRS_ERROR_INSUFFICIENT_RESOURCES
(-1003) HRS_ERROR_SERVICE_ALREADY_REGISTERED
API Call
HRS_Initialize_Service(BluetoothStackID, HRS_HEART_RATE_CONTROL_POINT_RESET_ENERGY_EXPENDED_SUPPORTED, HRS_EventCallback, NULL, &HRSInstanceID);
API Prototype
int BTPSAPI HRS_Initialize_Service(unsigned int BluetoothStackID, unsigned long Supported_Commands, HRS_Event_Callback_t EventCallback, unsigned long CallbackParameter, unsigned int *ServiceID)
Description of API
This function is responsible for opening a HRS Server. The first parameter is the Bluetooth Stack ID on which to open the Server. The second parameter is the mask of supported Heart Rate Control point commands. The third parameter is the Callback function to call when an event occurs on this Server Port. The fourth parameter is a user-defined callback parameter that will be passed to the callback function with each event. The final parameter is a pointer to store the GATT Service ID of the registered HRS service. This can be used to include the service registered by this call. This function returns the positive, non-zero, Instance ID or a negative error code. Only 1 HRS Server may be open at a time, per Bluetooth Stack ID. The Supported_Commands parameter must be made up of bit masks of the form: HRS_HEART_RATE_CONTROL_POINT_XXX_SUPPORTED All Client Requests will be dispatch to the EventCallback function that is specified by the second parameter to this function.
Description
The UnRegisterHRS command is responsible for unregistering a HRP Service. This command will return zero on successful execution and a negative value on all errors.
Parameters
It is not necessary to include parameters when using this command. A parameter will have no effect on the outcome.
Possible Return Values
(0) Successfully closed the HRS Server
(-4) FUNCTION_ERROR (HRP Service not registered)
(-1000) HRS_ERROR_INVALID_PARAMETER
(-1004) HRS_ERROR_INVALID_INSTANCE_ID
API Call
HRS_Cleanup_Service(BluetoothStackID, HRSInstanceID);
API Prototype
int BTPSAPI HRS_Cleanup_Service(unsigned int BluetoothStackID, unsigned int InstanceID)
Description of API
This function is responsible for closing a previously opened HRS Server. The first parameter is the Bluetooth Stack ID on which to close the Server. The second parameter is the InstanceID that was returned from a successful call to HRS_Initialize_Service(). This function returns a zero if successful or a negative return error code if an error occurs.
Description
The DiscoverHRS command is responsible for performing a HRP Service Discovery Operation. This command will return a zero on successful execution and a negative value on all errors.
Parameters
It is not necessary to include parameters when using this command. A parameter will have no effect on the outcome
Possible Return Values
(0) Service Discovery Start success
(-4) Function_Error
API Call
GDIS_Service_Discovery_Start(BluetoothStackID, ConnectionID, (sizeof(UUID)/sizeof(GATT_UUID_t)), UUID, GDIS_Event_Callback, sdHRS);
API Prototype
int BTPSAPI GDIS_Service_Discovery_Start(unsigned int BluetoothStackID, unsigned int ConnectionID, unsigned int NumberOfUUID, GATT_UUID_t *UUIDList, GDIS_Event_Callback_t ServiceDiscoveryCallback, unsigned long ServiceDiscoveryCallbackParameter)
Description of API
The GDIS_Service_Discover_Start is in an application module called GDIS that is provided to allow an easy way to perform GATT service discovery. This module can and should be modified for the customers use. This function is called to start a service discovery operation by the GDIS module.
Description
The ConfigureRemoteHRS command is responsible for configuring a HRP Service on a remote device. This command will return zero on successful execution and a negative value on all errors.
Parameters
The ConfigureRemoteHRS requires only one parameter, Heart Rate Notify. 0 disables Heart Rate Notify and 1 enables Heart Rate Notify
Command Call Examples
ConfigureRemoteHRS 1 configures the service with Heart Rate Notify enabled.
ConfigureRemoteHRS 0 configures the service with Heart Rate Notify disabled.
Possible Return Values
(0) Successfully configured HRS on the remote device
(-4) FUNCTION_ERROR
Description
The NotifyHeartRate command is responsible for performing a Heart Rate Measurement notification to a connected remote device. This command will return zero on successful execution and a negative value on all errors.
Parameters
the NotifyHeartRate command requires 5 parameters. The first parameter is the BPM (beats per minute). The second is the Heart Rate format, 0 = Byte, 1 = Word. The third is the Sensor Contact Status, 0 = Not Supported, 1 = Supported/Not Detected, 2 = Supported/Detected. The fourth is Energy Expended, 0 = Don't Send, 1 = Send. The fifth and last is the number of RR Intervals, 0 = None, X = Number of Intervals.
Command Call Examples
NotifyHeartRate 80 1 2 1 0
Possible Return Values
(0) Successfully sent the Heart Rate Measurement
(-6) INVALID_PARAMETERS_ERROR
(-8) INVALID_STACK_ID_ERROR
(-1000) HRS_ERROR_INVALID_PARAMETER
(-1002) HRS_ERROR_INSUFFICIENT_RESOURCES
(-1004) HRS_ERROR_INVALID_INSTANCE_ID
API Call
HRS_Notify_Heart_Rate_Measurement(BluetoothStackID, HRSInstanceID, ConnectionID, HeartRatePtr)
API Prototype
Int BTPSAPI HRS_Notify_Heart_Rate_Measurement(unsigned int BluetoothStackID, unsigned int InstanceID, unsigned int ConnectionID, HRS_Heart_Rate_Measurement_Data_t *Heart_Rate_Measurement)
Description of API
This function is responsible for sending a Heart Rate Measurement to a specified remote device. The first parameter is the Bluetooth Stack ID of the Bluetooth Device. The second parameter is the InstanceID returned from a successful call to HRS_Initialize_Server(). The third parameter is the ConnectionID of the remote device to send the notification to. The final parameter is the Heart Rate Measurement data to notify. This function will return zero if the notification was sent successfully or a negative return error code if there was an error condition.
Description
The GetBodySensorLocation command is responsible for reading the Body Sensor Location characteristic. It can be executed by a Server or a Client with an open connection to a remote Server. This command will return zero on successful execution and a negative value on all errors.
Parameters
It is not necessary to include parameters when using this command. A parameter will have no effect on the outcome
Possible Return Values
(0) Successfully Set Body Sensor Location
(-4) FUNCTION_ERROR
(-103) BTPS_ERROR_FEATURE_NOT_AVAILABLE
(-1000) HRS_ERROR_INVALID_PARAMETER
(-1004) HRS_ERROR_INVALID_INSTANCE_ID
API Call
HRS_Query_Body_Sensor_Location(BluetoothStackID, HRSInstanceID, &location)
API Prototype
int BTPSAPI HRS_Query_Body_Sensor_Location(unsigned int BluetoothStackID, unsigned int InstanceID, Byte_t *Body_Sensor_Location)
Description of API
This function is responsible for querying the current location of the body sensor for the specified HRS instance. The first parameter is the Bluetooth Stack ID of the Bluetooth Device. The second parameter is the InstanceID returned from a successful call to HRS_Initialize_Server(). The final parameter is a pointer to return the current Body Sensor Location for the specified HRS instance. This function will return zero if the body sensor location was successfully set or a negative return error code if there was an error condition.
Description
The SetBodySensorlocation command is responsible for writing the Body Sensor Location characteristic. It can be executed only by a Server. This command will return zero on successful execution and a negative value on all errors.
Parameters
The SetBodySensorLocation command requires one parameter which is the Location of the Heart Rate sensor. This parameter should be an integer between 1 and 6 with each number corresponding to a different location.
0 – Other, 1 – Chest, 2 – Wrist, 3 – Finger, 4 – Hand, 5 - Ear Lobe, 6 – Foot.
Command Call Examples
"SetBodySensorLocation 3" sets the sensor location to Finger.
"SetBodySensorLocation 5" sets the sensor location to Ear lobe.
Possible Return Values
(0) Successfully Set Body Sensor Location
(-4) FUNCTION_ERROR
(-103 ) BTPS_ERROR_FEATURE_NOT_AVAILABLE
(-1000) HRS_ERROR_INVALID_PARAMETER
(-1004) HRS_ERROR_INVALID_INSTANCE_ID
API Call
HRS_Set_Body_Sensor_Location(BluetoothStackID, HRSInstanceID, (Byte_t)TempParam->Params[0].intParam
API Prototype
Int BTPSAPI HRS_Set_Body_Sensor_Location(unsigned int BluetoothStackID, unsigned int InstanceID, Byte_t Body_Sensor_Location)
Description of API
This function is responsible for setting the location of the body sensor for the specified HRS instance. The Body_Sensor_Location parameter should be an enumerated value of the form HRS_BODY_SENSOR_LOCATION_XXX. This function will return zero if the body sensor location was successfully set or a negative return error code if there was an error condition.
Description
The ResetEnergyExpended command is responsible for writing the Reset Energy Expended command to a remote Server Control Point. It can be executed only by a Client. This command will return a zero on successful execution and a negative value on all errors.
Parameters
It is not necessary to include parameters when using this command. A parameter will have no effect on the outcome.
Possible Return Values
(0) successfully reset energy expended (-1000) HRS_ERROR_INVALID_PARAMETER
API Call
HRS_Format_Heart_Rate_Control_Command(ccResetEnergyExpended, HRS_HEART_RATE_CONTROL_POINT_VALUE_LENGTH, CommandBuffer)
API Prototype
int BTPSAPI HRS_Format_Heart_Rate_Control_Command(HRS_Heart_Rate_Control_Command_t Command, unsigned int BufferLength, Byte_t *Buffer)
Description of API
The Format_Heart_Rate_Control_Command function is responsible for formatting a Heart Rate Control Command into a user specified buffer. The first parameter is the command to format. The final two parameters contain the length of the buffer, and the buffer, to format the command into. This function returns a zero if successful or a negative return error code if an error occurs. The BufferLength and Buffer parameter must point to a buffer of at least HRS_HEART_RATE_CONTROL_POINT_VALUE_LENGTH in size. HRS_Heart_Rate_Control_Command_t is a ccResetEnergyExpended command which is placed in the buffer.