SWRU580 April 2021 CC2564C , CC2564MODA , CC2564MODN
Description
The following function is responsible for setting the Battery Level of the LE device. This function takes an unsigned integer as a parameter for the desired battery level and returns zero for success or a negative number indicating an error.
Parameters
The only parameter required is battery level.
Command Call Examples
SetBatteryLevel 100 attempts to set the battery level to 100.
Possible Return Values
(0) MAP_Close_Server() Success
(-4) FUNCTION_ERROR
(-6) INVALID_PARAMETERS_ERROR
(-8) INVALID_STACK_ID_ERROR
Description
The following function is responsible for notifying the battery level to the connected host device (if the device has registered for notifications). This function takes no parameters and returns zero on success or a negative number indicating an error.
Parameters
The only parameter required is battery level.
Command Call Examples
NotifyBatteryLevel 100 attempts to notify the battery level to 100.
Possible Return Values
(0) MAP_Close_Server() Success
(-4) FUNCTION_ERROR
(-6) INVALID_PARAMETERS_ERROR
(-8) INVALID_STACK_ID_ERROR
(-1000) BAS_ERROR_INVALID_PARAMETER
(-1001) BAS_ERROR_INVALID_BLUETOOTH_STACK_ID
(-1002) BAS_ERROR_INSUFFICIENT_RESOURCES
(-1003) BAS_ERROR_SERVICE_ALREADY_REGISTERED
(-1004) BAS_ERROR_INVALID_INSTANCE_ID
(-1005) BAS_ERROR_MALFORMATTED_DATA
(-1006) BAS_ERROR_MAXIMUM_NUMBER_OF_INSTANCES_REACHED
(-1007) BAS_ERROR_UNKNOWN_ERROR
API Call
BAS_Notify_Battery_Level(ApplicationStateInfo.BluetoothStackID, ApplicationStateInfo.BASInstanceID, ApplicationStateInfo.LEConnectionInfo.ConnectionID, (Byte_t)ApplicationStateInfo.BatteryLevel);
API Prototype
int BTPSAPI BAS_Notify_Battery_Level(unsigned int BluetoothStackID, unsigned int InstanceID, unsigned int ConnectionID, Byte_t BatteryLevel);
Description of API
The following function is responsible for sending a Battery Level Status notification 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 BAS_Initialize_Server(). The third parameter is the ConnectionID of the remote device to send the notification to. The final parameter contains the Battery Level to send to the remote device. This function returns a zero if successful or a negative return error code if an error occurs.
Description
The following function is responsible for notifying a report to the connected host device (if the device has registered for notifications). The function takes a string parameter that contains an alpha-numeric character that should be included in the report to be notified. This function returns zero on success or a negative number indicating an error.
Parameters
It is not necessary to include parameters when using this command. A parameter will have no effect on the outcome of the server closing.
Possible Return Values
(0) MAP_Close_Server() Success
(-4) FUNCTION_ERROR
(-6) INVALID_PARAMETERS_ERROR
(-8) INVALID_STACK_ID_ERROR
(-1000)HIDS_ERROR_INVALID_PARAMETER (-1001)HIDS_ERROR_INVALID_BLUETOOTH_STACK_ID (-1002)HIDS_ERROR_INSUFFICIENT_RESOURCES (-1003)HIDS_ERROR_SERVICE_ALREADY_REGISTERED (-1004)HIDS_ERROR_INVALID_INSTANCE_ID (-1005)HIDS_ERROR_MALFORMATTED_DATA (-1006)HIDS_ERROR_INDICATION_OUTSTANDING (-1007)HIDS_ERROR_UNKNOWN_ERROR
API Call
HIDS_Notify_Input_Report(ApplicationStateInfo.BluetoothStackID, ApplicationStateInfo.HIDSInstanceID, ApplicationStateInfo.LEConnectionInfo.ConnectionID, rtBootKeyboardInputReport, NULL, HID_KEYBOARD_INPUT_REPORT_SIZE, ApplicationStateInfo.CurrentInputReport);
API Prototype
int BTPSAPI HIDS_Notify_Input_Report(unsigned int BluetoothStackID, unsigned int InstanceID, unsigned int ConnectionID, HIDS_Report_Type_t ReportType, HIDS_Report_Reference_Data_t *ReportReferenceData, Word_t InputReportLength, Byte_t *InputReportData)
Description of API
The following function is responsible for sending an Input Report notification 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 HIDS_Initialize_Server(). The third parameter is the ConnectionID of the remote device to send the notification to. The fourth parameter specifies the ReportType of the report that is to be notified. The fifth parameter is a pointer to a Report Reference structure that is only used (and must be specified only if) the ReportType is rtInputReport. The final parameters contain the length of the Input Report and a pointer to the Input Report that is to be notified. This function returns the number of bytes that were successfully notified on success or a negative return error code if an error occurs.