NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.

CC256x TI Bluetooth Stack HIDDemo App

From Texas Instruments Wiki
Jump to: navigation, search

Return to CC256x MSP430 TI’s Bluetooth stack Basic Demo APPS

Return to CC256x Tiva TI’s Bluetooth stack Basic Demo APPS

Return to CC256x MSP432 TI’s Bluetooth stack Basic Demo APPS

Return to CC256x STM32F4 TI’s Bluetooth stack Basic Demo APPS

Demo Overview[edit]

NoteNote: The same instructions can be used to run this demo on the Tiva, MSP432 or STM32F4 Platforms.

The human interface Device enables a Host to connect and control a HID Device. There are two roles defined in this profile, Host and Device. The first is the Host which sends control and report requests and the second is the Device which responds to the Host’s requests. The Host is a Device that like a computer or tablet and the Device is a I/O Device like keyboard or mouse.

This application allows the user to use a console to use Bluetooth Low Energy (BLE) to establish connection between two BLE devices, control the Device, and get Reports and Protocols.

It is recommended that the user visits the kit setup Getting Started Guide for MSP430, Getting Started Guide for TIVA, Getting Started Guide for MSP432 or Getting Started Guide for STM32F4 pages before trying the application described on this page.


Running the Bluetooth Code[edit]

Once the code is flashed, connect the board to a PC using a miniUSB or microUSB cable. Once connected, wait for the driver to install. It will show up as MSP-EXP430F5438 USB - Serial Port(COM x), Tiva Virtual COM Port (COM x), XDS110 Class Application/User UART (COM x) for MSP432, under Ports (COM & LPT) in the Device manager. Attach a Terminal program like PuTTY to the serial port x for the board. The serial parameters to use are 115200 Baud (9600 for MSP430), 8, n, 1. Once connected, reset the Device using Reset S3 button (located next to the mini USB connector for the MSP430) and you should see the stack getting initialized on the terminal and the help screen will be displayed, which shows all of the commands.

HIDDEMOSS1-1.png




Demo Application[edit]

The demo application provides a description on how to use the demo application to connect two configured boards and communicate over bluetoothLE. The included application registers a custom service on a board when the stack is initialized.

Device 1 (Host/ HID Host) setup on the demo application[edit]

a) We will setup the first board as a Host. Perform the steps mentioned earlier in Running the Bluetooth Code section to initialize the application. Once initialized, note the Bluetooth address of the server. We will later use this to initiate a connection from the Device or Client.

b) On the Choose mode> prompt, enter Host.

c) You will see a list of all possible commands at this time for a Host. You can see this list at any time by entering Help at the Host> prompt.


HIDDEMOSS1-3.png




d) At the Host> prompt, enter Inquiry This will initiate the Inquiry process. Once it is complete, you will get a list of all discovered devices.

HIDDEMOSS1-4.png



e) You can access this list any time by choosing DisplayInquiryList at the Host> prompt.



Device 2 (Client/HID Device) setup on the demo application [edit]

f) We will setup the second board as a Device. Perform the steps mentioned earlier in Running the Bluetooth Code section to initialize the application. On the Choose mode> prompt, enter Device.

g) You will see a list of all possible commands at this time for a Device. You can see this list at any time by entering Help at the Device> prompt.

HIDDEMOSS1-2.png




Initiating connection from the HID Host[edit]

NoteNote: Note: When connecting for the first time, the connection should be initiated from the HID Host Device. If not the connection will be rejected as the HID Host will not allow a connection from an unknown HID Device.

h) Note the index number of the second board that was configured as a HID Device. [If the list is not on the screen, issue the DisplayInquiryList command on the client to display the list of discovered devices.]


i) Issue a ConnectRemoteHIDDevice <Inquiry Index> command from the Device.


j) Wait for HID Open confirmation.

HIDDEMOSS1-35.png



NoteNote: A status of 0x0000 means the connection was successful. Any other status implies that the connection did not succeed.

k) When a client successfully connects to a server, the server will see the open indication.

HIDDEMOSS1-6.png




Initiating connection from the HID Device[edit]

Initiating a connection from the HID Device is the same as the procedure as the Host except that we run the inquiry(mentioned in Step (d)) on the HID Device instead and issue a ConnectRemoteHIDHost <Inquiry Index> where the Inquiry Index is the number that corresponds to the BD-ADDR of the Host when we run the inquiry.

HIDDEMOSS1-5.png



Communication between Host and Device[edit]

m) Now that we have a connection established, the Host and Device can communicate with each other.

n) We can send a control operation from either the Host or the Device using the ControlRequest command. For the Host we issue the Controlrequest <parameter-number> command. The options for control request are 0= hcNop, 1= hcHardReset, 2= hcSoftReset, 3= hcSuspend, 4=hcExitSuspend, 5=hcVirtualCableUnplug. When we type Control Request 5 on the Host we get the following message.

HIDDEMOSS1-7.png



On the Device side, we get a hcVirtualCableUnplug indication.

HIDDEMOSS1-8.png



For the Device ControlRequest has no parameters. It does hcVirtualCableUnplug by default.

HIDDEMOSS1-9.png



On the Host side, we get a hcVirtualCableUnplug indication.

HIDDEMOSS1-10.png



o) We can make Report Requests issuing the GetReportRequest command. It needs either 3 or 4 parameters. The first one is Size which is 0 for using the size of the Report or 1 for using a custom buffer size. The second is ReportType which is 0 for rtOther, 1 for rtInput, 2 for rtOutput, and 3 for rtFeature. The third is ReportID. IF we used a custom buffer for size in the first parameter we specify it here. For example, we send a Report Request with size of Report, rtInput and ReportID of 2. We get a Report Request Success indication.

HIDDEMOSS1-11.png



On the Device, we receive a get Report Indication with the Report Type, Id and size and Buffer size.

HIDDEMOSS1-12.png



The Device can respond to GetReportRequest using GetReportResponse. It needs the Result type (0 for rtSuccessful, 1 for rtNotReady, 2 for rtErrInvalidReportID, 3 for rtErrUnsupportedRequest, 4 for rtErrInvalidParameter, 5 for rtErrUnknown, 6 for rtErrFatal, 7 for rtData) and ReportType (0 for rtOther, 1 for rtInput, 2 for rtOutput, 3 for rtFeature) as parameters. For example we respond to the above rtInput request from the Host with rtData as Result type and rtInput as Report Type.

HIDDEMOSS1-13.png



The Host gets a report Confirmation back.

HIDDEMOSS1-14.png



p) We can run SetReportRequest from the Host. The only parameter it needs is the report type which is 0 for rtOther, 1 for rtInput, 2 for rtOutput, and 3 for rtFeature.

HIDDEMOSS1-15.png



The Device gets a Set Report Indication with the Report type.

HIDDEMOSS1-16.png



The Device can respond to SetReportRequest by issuing the SetReportResponse command. The only parameter it needs is Result type (0 for rtSuccessful, 1 for rtNotReady, 2 for rtErrInvalidReportID, 3 for rtErrUnsupportedRequest, 4 for rtErrInvalidParameter, 5 for rtErrUnknown, 6 for rtErrFatal, 7 for rtData). For example we respond to the above rtInput Report request using rtSuccesful.

HIDDEMOSS1-17.png



The Host receives a Set Report confirmation indication with the Result type.

HIDDEMOSS1-18.png



q) We can send a Protocol Request using GetProtocolRequest. It requires no parameters.

HIDDEMOSS1-19.png



The Device gets a Protocol Indication.

HIDDEMOSS1-20.png



The Device can respond to the Protocol Request by issuing the GetProtocolResponse command. It requires two parameters, Result type (0 for rtSuccessful, 1 for rtNotReady, 2 for rtErrInvalidReportID, 3 for rtErrUnsupportedRequest, 4 for rtErrInvalidParameter, 5 for rtErrUnknown, 6 for rtErrFatal, and 7 for rtData) and Protocol (0 for ptBoot and 1 for ptReport). For example, we respond to the previous Request with rtData and ptBoot.

HIDDEMOSS1-21.png



The Host gets a protocol confirmation with the Result type and Protocol.

HIDDEMOSS1-22.png



r) We can issue SetProtocolRequest from the Host. The only parameter we need is the protocol(0 for ptBoot and 1 for ptReport). For example we send a request with ptReport.

HIDDEMOSS1-23.png



The Host gets a Set Protocol Indication along with the protocol. It can respond to it by issuing the SetProtocolResponse command which requires Result type as the parameter (0 for rtSuccessful, 1 for rtNotReady, 2 for rtErrInvalidReportID, 3 for rtErrUnsupportedRequest, 4 for rtErrInvalidParameter, 5 for rtErrUnknown, 6 for rtErrFatal, and 7 for rtData).

HIDDEMOSS1-24.png



We get a Protocol Confirmation with the Result type in the Host.

HIDDEMOSS1-25.png



s) We can set the Idle request issuing the GetIdleRequest command. It requires no parameters.

HIDDEMOSS1-26.png



The Device gets a GetIdleIndication.

HIDDEMOSS1-27.png



It can respond to it with a GetIdleResponse which requires Result type (0 for rtSuccessful, 1 for rtNotReady, 2 for rtErrInvalidReportID, 3 for rtErrUnsupportedRequest, 4 for rtErrInvalidParameter, 5 for rtErrUnknown, 6 for rtErrFatal, and 7 for rtData) and Idle Rate as parameters. For example we respond with a Result type of rtData and Idle Rate of 50.

HIDDEMOSS1-28.png



On the Host we get a Idle Confirmation.

HIDDEMOSS1-29.png



t) We can Set the Idle Rate using SetIdleRequest from the Host which requires Idle rate as the only parameter. For example we set the Idle rate to 50 from here.

HIDDEMOSS1-30.png



The Device receives a Set Idle Indication. It can respond to it using Set Idle Response which requires Result type (0 for rtSuccessful, 1 for rtNotReady, 2 for rtErrInvalidReportID, 3 for rtErrUnsupportedRequest, 4 for rtErrInvalidParameter, 5 for rtErrUnknown, 6 for rtErrFatal, and 7 for rtData) as its one parameter.

HIDDEMOSS1-31.png



We get a SetIdleConfirmation with the Result type on the Host.

HIDDEMOSS1-32.png




u) We can write data between devices using DataWrite. The one parameter it needs is ReportType (0 for rtOther, 1 for rtInput, 2 for rtOutput, and 3 for rtFeature). We write data from the Device in this example.

HIDDEMOSS1-33.png




The Host gets a Data indication.

HIDDEMOSS1-34.png



Application Commands[edit]

TI’s Bluetooth stack is implementation of the upper layers of the Bluetooth protocol stack. TI’s Bluetooth stackprovides a robust and flexible software development tool that implements the Bluetooth Protocols and Profiles above the Host Controller Interface (HCI). TI’s Bluetooth stack's Application Programming Interface (API) provides access to the upper-layer protocols and profiles and can interface directly with the Bluetooth chips.

An overview of the application and other applications can be read at the Getting Started Guidefor MSP430, Getting Started Guide for TIVA M4, Getting Started Guide for MSP432 and Getting Started Guide for STM32F4.

This page describes the various commands that a user of the application can use. Each command is a wrapper over a TI’s Bluetooth stack API which gets invoked with the parameters selected by the user. This is a subset of the APIs available to the user. TI’s Bluetooth stack API documentation (TI_Bluetooth_Stack_Version-Number\Documentation or for STM32F4, TI_Bluetooth_Stack_Version-Number\RTOS_VERSION\Documentation) describes all of the API's in detail.

GAP Commands[edit]

The Generic Access Profile defines standard procedures related to the discovery and connection of Bluetooth devices. It defines modes of operation that are generic to all devices and allows for procedures which use those modes to decide how a Device can be interacted with by other Bluetooth devices. Discoverability, Connectability, Pairability, Bondable Modes, and Security Modes can all be changed using Generic Access Profile procedures. All of these modes affect the interaction two devices may have with one another. GAP also defines the procedures for how bond two Bluetooth devices.

Help (DisplayHelp)[edit]

Description
The Help command is responsible for displaying the current Command Options for either Serial Port Client or Serial Port Server. The input parameter to this function is completely ignored, and only needs to be passed in because all Commands that can be entered at the Prompt pass in the parsed information. This command displays the current Command Options that are available and always returns zero.

Parameters
It is not necessary to include parameters when using this command. A parameter will have no effect on the outcome of the command.

Possible Return Values
This command always returns 0



Inquiry[edit]

Description
The Inquiry command is responsible for performing a General Inquiry for discovering Bluetooth Devices. The command requires that a valid Bluetooth Stack ID exists before running. This command returns zero on a successful call or a negative value if an error occurred during execution. The inquiry will last 10 seconds unless 20 devices (MAX_INQUIRY_RESULTS) are found before that time limit.

Parameters
It is not necessary to include parameters when using this command. A parameter will have no effect on the outcome of the Inquiry.

Possible Return Values
(0) Successful Inquiry Procedure
(-1) BTPS_ERROR_INVALID_PARAMETER
(-2) BTPS_ERROR_INVALID_BLUETOOTH_STACK_ID
(-57) BTPS_ERROR_DEVICE_HCI_ERROR
(-58) BTPS_ERROR_INVALID_MODE

API Call
GAP_Perform_Inquiry(BluetoothStackID, itGeneralInquiry, 0, 0, 10, MAX_INQUIRY_RESULTS, GAP_Event_Callback, (unsigned long) NULL);

API Prototype
int BTPSAPI GAP_Perform_Inquiry(unsigned int BluetoothStackID, GAP_Inquiry_Type_t GAP_Inquiry_Type, unsigned int MinimumPeriodLength, unsigned int MaximumPeriodLength, unsigned int InquiryLength, unsigned int MaximumResponses, GAP_Event_Callback_t GAP_Event_Callback, unsigned long CallbackParameter);

Description of API
This function is provided to allow a mechanism for starting an Inquiry Scan Procedure. The first parameter to this function is the Bluetooth Protocol Stack of the Bluetooth Device that is to perform the Inquiry. The second parameter is the type of Inquiry to perform. The third and fourth parameters are the Minimum and Maximum Period Lengths which are specified in seconds (only valid in case a Periodic Inquiry is to be performed). The fifth parameter is the Length of Time to perform the Inquiry, specified in seconds. The sixth parameter is the Number of Responses to wait for. The final two parameters represent the Callback Function (and parameter) that is to be called when the specified Inquiry has completed. This function returns zero is successful, or a negative return error code if an Inquiry was unable to be performed. Only ONE Inquiry can be performed at any given time. Calling this function with an outstanding Inquiry is in progress will fail. The caller can call the GAP_Cancel_Inquiry() function to cancel a currently executing Inquiry procedure. The Minimum and Maximum Inquiry Parameters are optional and, if specified, represent the Minimum and Maximum Periodic Inquiry Periods. The called should set BOTH of these values to zero if a simple Inquiry Procedure is to be used (Non-Periodic). If these two parameters are specified, then these two parameters must satisfy the following formula:
MaximumPeriodLength > MinimumPeriodLength > InquiryLength



DisplayInquiryList[edit]

Description
The DisplayInquiryList command exists to display the current Inquiry List with indexes. This command is useful for when a user has forgotten the Inquiry Index for a particular Bluetooth Device the user may want to interact with. This function returns zero on a successful execution and a negative value on all errors. The command requires that a valid Bluetooth Stack ID exists before running and it should be called after using the Inquiry command, since the list would be empty without already discovering devices.

Parameters
It is not necessary to include parameters when using this command. A parameter will have no effect on the outcome of the Inquiry List displayed.

Possible Return Values
(0) Successful Display of the Inquiry List
(-8) INVALID_STACK_ID_ERROR



Pair[edit]

Description
The Pair command is responsible for initiating bonding with a remote Bluetooth Device. The function returns zero on a successful execution and a negative value on all errors. A Bluetooth Stack ID must exist before attempting to pair and the Device must not already be connected to any Device (including the one it tries to pair with). It is also important to note that the use of the Inquiry command before calling Pair is necessary to connect to a remote Device. Both General and Dedicated bonding are supported.

Parameters
The Pair command requires one or two parameters with specific values in order to work successfully. The first parameter is the Inquiry Index of the remote Bluetooth Device. This parameter is always necessary. This can be found after an Inquiry or displayed when the command DisplayInquiryList is used. If the desired remote Device does not appear in the list, it cannot be paired with. The second parameter is the bonding type used for the pairing procedure. It is an optional parameter which is only required if General Bonding is desired for the connection. This must be specified as either 0 (for Dedicated Bonding) or 1 (for General Bonding). If only one parameter is given, the Bonding Type will be Dedicated Bonding.

Command Call Examples
"Pair 5 0" Attempts to pair with the remote Device at the fifth Inquiry Index using Dedicated Bonding.
"Pair 5" Is the exact same as the above example. If no parameters, the Bonding Type will be Dedicated.
"Pair 8 1" Attempts to pair with the remote Device at the eighth Inquiry Index using General Bonding.

Possible Return Values
(0) Successful Pairing
(-2) BTPS_ERROR_INVALID_BLUETOOTH_STACK_ID
(-1) BTPS_ERROR_INVALID_PARAMETER
(-59) BTPS_ERROR_ADDING_CALLBACK_INFORMATION
(-8) BTPS_ERROR_DEVICE_HCI_ERROR

API Call
GAP_Initiate_Bonding(BluetoothStackID, InquiryResultList[(TempParam->Params[0].intParam – 1)], BondingType, GAP_Event_Callback, (unsigned long)0);

API Prototype
int BTPSAPI GAP_Initiate_Bonding(unsigned int BluetoothStackID, BD_ADDR_t BD_ADDR, GAP_Bonding_Type_t GAP_Bonding_Type, GAP_Event_Callback_t GAP_Event_Callback, unsigned long CallbackParameter);

Description of API
This function is provided to allow a means to Initiate a Bonding Procedure. This function can perform both General and Dedicated Bonding based upon the type of Bonding requested. This function accepts as input, the Bluetooth Protocol Stack ID of the Local Bluetooth Device that is perform the Bonding, the Remote Bluetooth address of the Device to Bond with, the type of bonding to perform, and the GAP Event Callback Information that will be used to handle Authentication Events that will follow if this function is successful. If this function is successful, then all further information will be returned through the Registered GAP Event Callback. It should be noted that if this function returns success that it does NOT mean that the Remote Device has successfully Bonded with the Local Device, ONLY that the Remote Device Bonding Process has been started. This function will only succeed if a Physical Connection to the specified Remote Bluetooth Device does NOT already exist. This function will connect to the Bluetooth Device and begin the Bonding Process. If General Bonding is specified, then the Link is maintained, and will NOT be terminated until the GAP_End_Bonding function has been called. This will allow any higher level initialization that is needed on the same physical link. If Dedicated Bonding is performed, then the Link is terminated automatically when the Authentication Process has completed.Due to the asynchronous nature of this process, the GAP Event Callback that is specified will inform the caller of any Events and/or Data that is part of the Authentication Process. The GAP_Cancel_Bonding function can be called at any time to end the Bonding Process and terminate the link (regardless of which Bonding method is being performed).When using General Bonding, if an L2CAP Connection is established over the Bluetooth Link that was initiated with this function, the Bluetooth Protocol Stack MAY or MAY NOT terminate the Physical Link when (and if) an L2CAP Disconnect Request (or Response) is issued. If this occurs, then calling the GAP_End_Bonding function will have no effect (the GAP_End_Bonding function will return an error code in this case).



EndPairing[edit]

Description
The EndPairing command is responsible for ending a previously initiated bonding session with a remote Device. The function returns zero on a successful execution and a negative value on all errors. A Bluetooth Stack ID must exist before attempting to end pairing and the Device must already be connected to a remote Device. It is also important to note that the use of the Pair and Inquiry commands before calling EndPairing are necessary to disconnect from a remote Device.

Parameters
The EndPairing command requires one parameter which is the Inquiry Index of the Remote Bluetooth Device. This value can be found after an Inquiry or displayed when the command DisplayInquiryList is used. It should be the same value as the first parameter used in the Pair command, unless a new Inquiry has been called after pairing. If this is the case, find the Bluetooth Address of the Device used in the Pair command.

Command Call Examples
"EndPairing 5" Attempts to end pairing with the remote Device at the fifth Inquiry Index.
"EndPairing 8" Attempts to end pairing with the remote Device at the eighth Inquiry Index.

Possible Return Values
(0) Successful End Pairing
(-2)BTPS_ERROR_INVALID_BLUETOOTH_STACK_ID
(-1)BTPS_ERROR_INVALID_PARAMETER
(-58)BTPS_ERROR_INVALID_MODE
(-4) FUNCTION_ERROR
(-6) INVALID_PARAMETERS_ERROR
(-8) INVALID_STACK_ID_ERROR

API Call
GAP_End_Bonding(BluetoothStackID, InquiryResultList[(TempParam->Params[0].intParam – 1)]);

API Prototype
int BTPSAPI GAP_Initiate_Bonding(unsigned int BluetoothStackID, BD_ADDR_t BD_ADDR, GAP_Bonding_Type_t GAP_Bonding_Type, GAP_Event_Callback_t GAP_Event_Callback, unsigned long CallbackParameter);

Description of API
This function is provided to allow a means to terminate a connection that was established via a call to the GAP_Initiate_Bonding function (that specified general bonding as the bonding type to perform). This function has NO effect if the bonding procedure was initiated using dedicated bonding (or the Device is already disconnected). This function accepts the Bluetooth Device address of the remote Bluetooth Device that was specified to be bonded with (general bonding). This function terminates the ACL connection that was established and it guarantees that NO GAP Event Callbacks will be issued to the GAP Event Callback that was specified in the original GAP_Initiate_Bonding function call (if this function returns success).



PINCodeResponse[edit]

Description
The PINCodeResponse command is responsible for issuing a GAP Authentication Response with a PIN Code value specified via the input parameter. This function returns zero on a successful execution and a negative value on all errors. A Bluetooth Stack ID must exist before attempting to call this function. The Device must also be in the middle of an on-going Pairing operation that was started by the local Device or a remote Device.

Parameters
The PINCodeResponse command requires one parameter which is the PIN Code used for authenticating the connection. This is a string value which can be up to 16 digits long. The initiator of the Pairing will see a message displayed during the Pairing Procedure to call this command. A responder will receive a message to call this command after the initiator has put in the PIN Code.

Command Call Examples
"PINCodeResponse 1234" Attempts to set the PIN Code to "1234."
"PINCodeResponse 5921302312564542 Attempts to set the PIN Code to "5921302312564542." This value represents the longest PIN Code value of 16 digits.

Possible Return Values
(0) Successful PIN Code Response
(-4) FUNCTION_ERROR
(-6) INVALID_PARAMETERS_ERROR
(-8) INVALID_STACK_ID_ERROR
(-2) BTPS_ERROR_INVALID_BLUETOOTH_STACK_ID
(-1) BTPS_ERROR_INVALID_PARAMETER
(-57) BTPS_ERROR_DEVICE_HCI_ERROR

API Call
GAP_Authentication_Response(BluetoothStackID, CurrentRemoteBD_ADDR, &GAP_Authentication_Information);

API Prototype
int BTPSAPI GAP_Authentication_Response(unsigned int BluetoothStackID, BD_ADDR_t BD_ADDR, GAP_Authentication_Information_t *GAP_Authentication_Information);

Description of API
This function is provided to allow a mechanism for the local Device to respond to GAP authentication events. This function is used to specify the authentication information for the specified Bluetooth Device. This function accepts as input, the Bluetooth protocol stack ID of the Bluetooth Device that has requested the authentication action, and the authentication response information (specified by the caller).



PassKeyResponse[edit]

Description
The PassKeyResponse command is responsible for issuing a GAP Authentication Response with a Pass Key value via the input parameter. This function returns zero on a successful execution and a negative value on all errors. A Bluetooth Stack ID must exist before attempting to call this function. The Device must also be in the middle of an on-going Pairing operation that was started by the local Device or a remote Device.

Parameters
The PassKeyResponse command requires one parameter which is the Pass Key used for authenticating the connection. This is a string value which can be up to 6 digits long (with a value between 0 and 999999).

Command Call Examples
"PassKeyResponse 1234" Attempts to set the Pass Key to "1234."
"PassKeyResponse 999999" Attempts to set the Pass Key to "999999." This value represents the longest Pass Key value of 6 digits.

Possible Return Values
(0) Successful Pass Key Response
(-4) FUNCTION_ERROR
(-6) INVALID_PARAMETERS_ERROR
(-8) INVALID_STACK_ID_ERROR
(-2) BTPS_ERROR_INVALID_BLUETOOTH_STACK_ID
(-1) BTPS_ERROR_INVALID_PARAMETER
(-57) BTPS_ERROR_DEVICE_HCI_ERROR

API Call
GAP_Authentication_Response(BluetoothStackID, CurrentRemoteBD_ADDR, &GAP_Authentication_Information);

API Prototype
int BTPSAPI GAP_Authentication_Response(unsigned int BluetoothStackID, BD_ADDR_t BD_ADDR, GAP_Authentication_Information_t *GAP_Authentication_Information);

Description of API
This function is provided to allow a mechanism for the local Device to respond to GAP authentication events. This function is used to specify the authentication information for the specified Bluetooth Device. This function accepts as input, the Bluetooth protocol stack ID of the Bluetooth Device that has requested the authentication action, and the authentication response information (specified by the caller).



UserConfirmationResponse[edit]

Description
The UserConfirmationResponse command is responsible for issuing a GAP Authentication Response with a User Confirmation value via the input parameter. This function returns zero on a successful execution and a negative value on all errors. A Bluetooth Stack ID must exist before attempting to call this function. The Device must also be in the middle of an on-going Pairing operation that was started by the local Device or a remote Device.

Parameters
The UserConfirmationResponse command requires one parameter which is the User Confirmation value used for authenticating the connection. This is an integer value that must be either 1, to confirm the connection, or 0 to NOT confirm the Authentication and stop the Pairing Procedure.
Command Call Examples
"UserConfirmationResponse 0" Attempts to decline the connection made with a remote Bluetooth Device and cancels the Authentication Procedure.
"UserConfirmationResponse 1" Attempts to accept the connection made with a remote Bluetooth Device and confirm the Authentication Procedure.
Possible Return Values
(0) Successful User Confirmation Response
(-4) FUNCTION_ERROR
(-6) INVALID_PARAMETERS_ERROR
(-8) INVALID_STACK_ID_ERROR
(-2) BTPS_ERROR_INVALID_BLUETOOTH_STACK_ID
(-1) BTPS_ERROR_INVALID_PARAMETER
(-57) BTPS_ERROR_DEVICE_HCI_ERROR

API Call
GAP_Authentication_Response(BluetoothStackID, CurrentRemoteBD_ADDR, &GAP_Authentication_Information);

API Prototype
int BTPSAPI GAP_Authentication_Response(unsigned int BluetoothStackID, BD_ADDR_t BD_ADDR, GAP_Authentication_Information_t *GAP_Authentication_Information);

Description of API
This function is provided to allow a mechanism for the local Device to respond to GAP authentication events. This function is used to specify the authentication information for the specified Bluetooth Device. This function accepts as input, the Bluetooth protocol stack ID of the Bluetooth Device that has requested the authentication action, and the authentication response information (specified by the caller).



SetDiscoverabilityMode[edit]

Description
The SetDiscoverabilityMode command is responsible for setting the Discoverability Mode of the local Device. This command returns zero on successful execution and a negative value on all errors. A Bluetooth Stack ID must exist before attempting to call this function. If setting the Device as Limited Discoverable, the Device will be discoverable for 60 seconds; a General Discoverable Device will always be discoverable.

Parameters
This command requires only one parameter which is an integer value that represents a Discoverability Mode. This value must be specified as 0 (for Non-Discoverable Mode), 1 (for Limited Discoverable Mode), or 2 (for General Discoverable Mode).

Command Call Examples
"SetDiscoverabilityMode 0" Attempts to change the Discoverability Mode of the Local Device to Non-Discoverable.
"SetDiscoverabilityMode 1" Attempts to change the Discoverability Mode of the Local Device to Limited Discoverable.
"SetDiscoverabilityMode 2" Attempts to change the Discoverability Mode of the Local Device to General Discoverable.

Possible Return Values
(0) Successfully Set Discoverability Mode
(-4) FUNCTION_ERROR
(-6) INVALID_PARAMETERS_ERROR
(-8) INVALID_STACK_ID_ERROR
(-2) BTPS_ERROR_INVALID_BLUETOOTH_STACK_ID
(-5) BTPS_ERROR_GAP_NOT_INITIALIZED
(-58) BTPS_ERROR_INVALID_MODE
(-57) BTPS_ERROR_DEVICE_HCI_ERROR
(-64) BTPS_ERROR_INTERNAL_ERROR
(-1) BTPS_ERROR_INVALID_PARAMETER

API Call
GAP_Set_Discoverability_Mode(BluetoothStackID, DiscoverabilityMode, (DiscoverabilityMode == dmLimitedDiscoverableMode)?60:0);

API Prototype
int BTPSAPI GAP_Set_Discoverability_Mode(unsigned int BluetoothStackID, GAP_Discoverability_Mode_t GAP_Discoverability_Mode, unsigned int Max_Discoverable_Time);

Description of API
This function is provided to set the discoverability mode of the local Bluetooth Device specified by the Bluetooth Protocol Stack that is specified by the Bluetooth protocol stack ID. The second parameter specifies the discoverability mode to place the local Bluetooth Device into, and the third parameter species the length of time (in seconds) that the local Bluetooth Device is to be placed into the specified discoverable mode (if mode is not specified as non-discoverable). At the end of this time (provided the time is not infinite), the local Bluetooth Device will return to non-discoverable mode.



SetConnectabilityMode[edit]

Description
The SetConnectabilityMode command is responsible for setting the Connectability Mode of the local Device. This command returns zero on successful execution and a negative value on all errors. A Bluetooth Stack ID must exist before attempting to call this function.

Parameters
This command requires only one parameter which is an integer value that represents a Discoverability Mode. This value must be specified as 0 (for Non-Connectable) or 1 (for Connectable).

Command Call Examples
"SetConnectabilityMode 0" Attempts to set the Local Device's Connectability Mode to Non-Connectable.
"SetConnectabilityMode 1" Attempts to set the Local Device's Connectability Mode to Connectable.

Possible Return Values
(0) Successfully Set Connectability Mode
(-4) FUNCTION_ERROR
(-6) INVALID_PARAMETERS_ERROR
(-8) INVALID_STACK_ID_ERROR
(-2) BTPS_ERROR_INVALID_BLUETOOTH_STACK_ID
(-5) BTPS_ERROR_GAP_NOT_INITIALIZED
(-58) BTPS_ERROR_INVALID_MODE
(-57) BTPS_ERROR_DEVICE_HCI_ERROR

API Call
GAP_Set_Connectability_Mode(BluetoothStackID, ConnectableMode);

API Prototype
int BTPSAPI GAP_Set_Connectability_Mode(unsigned int BluetoothStackID, GAP_Connectability_Mode_t GAP_Connectability_Mode);

Description of API
This function is provided to set the connectability mode of the local Bluetooth Device specified by the Bluetooth protocol stack that is specified by the Bluetooth protocol stack ID. The second parameter specifies the connectability mode to place the local Bluetooth Device into.



SetPairabilityMode[edit]

Description
The SetPairabilityMode command is responsible for setting the Pairability Mode of the local Device. This command returns zero on successful execution and a negative value on all errors. A Bluetooth Stack ID must exist before attempting to call this function.

Parameters
This command requires only one parameter which is an integer value that represents a Pairability Mode. This value must be specified as 0 (for Non-Pairable), 1 (for Pairable), or 2 (for Secure Simple Pairing).

Command Call Examples
"SetPairabilityMode 0" Attempts to set the Pairability Mode of the Local Device to Non-Pairable.
"SetPairabilityMode 1" Attempts to set the Pairability Mode of the Local Device to Pairable.
"SetPairabilityMode 2" Attempts to set the Pairability Mode of the Local Device to Secure Simple Pairing.

Possible Return Values
(0) Successfully Set Pairability Mode
(-4) FUNCTION_ERROR
(-6) INVALID_PARAMETERS_ERROR
(-8) INVALID_STACK_ID_ERROR
(-2) BTPS_ERROR_INVALID_BLUETOOTH_STACK_ID
(-5) BTPS_ERROR_GAP_NOT_INITIALIZED
(-58) BTPS_ERROR_INVALID_MODE

API Call
GAP_Set_Pairability_Mode(BluetoothStackID, PairabilityMode);

API Prototype
int BTPSAPI GAP_Set_Pairability_Mode(unsigned int BluetoothStackID, GAP_Pairability_Mode_t GAP_Pairability_Mode);

Description of API
This function is provided to set the pairability mode of the local Bluetooth Device. The second parameter specifies the pairability mode to place the local Bluetooth Device into. If secure simple pairing (SSP) pairing mode is specified, then SSP *MUST* be used for all pairing operations. The Device can be placed into non pairable mode after this, however, if pairing is re-enabled, it *MUST* be set to pairable with SSP enabled.



ChangeSimplePairingParameters[edit]

Description
The ChangeSimplePairingParameters command is responsible for changing the Secure Simple Pairing Parameters that are exchanged during the Pairing procedure whenSecure Simple Pairing (Security Level 4) is used. This function returns zero on a successful execution and a negative value on all errors. A Bluetooth Stack ID must exist before attempting to call this function. The IOCapability and MITMProtection values are stored in static global variables which are used for Secure Simple Pairing.

Parameters
This command requires two parameters which are the I/O Capability and the MITM Requirement. The first parameter must be specified as 0 (for Display Only), 1 (for Display Yes/No), 2 (for Keyboard Only), or 3 (for No Input/Output). The second parameter must be specified as 0 (for No MITM) or 1 (for MITM required).

Command Call Examples
"ChangeSimplePairingParameters 3 0" Attempts to set the I/O Capability to No Input/Output and turns off MITM Protection.
"ChangeSimplePairingParameters 2 1" Attempts to set the I/O Capability to Keyboard Only and activates MITM Protection.
"ChangeSimplePairingParameters 1 1" Attempts to set the I/O Capability to Display Yes/No and activates MITM Protection.

Possible Return Values
(0) Successfully Pairing Parameters Change
(-6) INVALID_PARAMETERS_ERROR
(-8) INVALID_STACK_ID_ERROR



GetLocalAddress[edit]

Description
The GetLocalAddress command is responsible for querying the Bluetooth Device Address of the local Bluetooth Device. This function returns zero on a successful execution and a negative value on all errors. A Bluetooth Stack ID must exist before attempting to call this function.

Parameters
It is not necessary to include parameters when using this command. A parameter will have no effect on the outcome of the Query.

Possible Return Values
(0) Successfully Query Local Address
(-1) BTPS_ERROR_INVALID_PARAMETER
(-2) BTPS_ERROR_INVALID_BLUETOOTH_STACK_ID
(-8) INVALID_STACK_ID_ERROR
(-4) FUNCTION_ERROR

API Call
GAP_Query_Local_BD_ADDR(BluetoothStackID, &BD_ADDR);

API Prototype
int BTPSAPI GAP_Query_Local_BD_ADDR(unsigned int BluetoothStackID, BD_ADDR_t *BD_ADDR);

Description of API
This function is responsible for querying (and reporting) the Device address of the local Bluetooth Device. The second parameter is a pointer to a buffer that is to receive the Device address of the local Bluetooth Device. If this function is successful, the buffer that the BD_ADDR parameter points to will be filled with the Device address read from the local Bluetooth Device. If this function returns a negative value, then the Device address of the local Bluetooth Device was NOT able to be queried (error condition).



SetLocalName[edit]

Description
The SetLocalName command is responsible for setting the name of the local Bluetooth Device to a specified name. This function returns zero on a successful execution and a negative value on all errors. A Bluetooth Stack ID must exist before attempting to call this function.

Parameters
One parameter is necessary for this command. The specified Device name must be the only parameter (which means there should not be spaces in the name or only the first section of the name will be set).

Command Call Examples
"SetLocalName New_Bluetooth_Device_Name" Attempts to set the Local Device Name to "New_Bluetooth_Device_Name."
"SetLocalName New Bluetooth Device Name" Attempts to set the Local Device Name to "New Bluetooth Device Name" but only sets the first parameter, which would make the Local Device Name "New."
"SetLocalName MSP430" Attempts to set the Local Device Name to "MSP430."

Possible Return Values
(0) Successfully Set Local Device Name
(-1) BTPS_ERROR_INVALID_PARAMETER
(-2) BTPS_ERROR_INVALID_BLUETOOTH_STACK_ID
(-8) INVALID_STACK_ID_ERROR
(-4) FUNCTION_ERROR
(-57) BTPS_ERROR_DEVICE_HCI_ERROR

API Call
GAP_Set_Local_Device_Name(BluetoothStackID, TempParam->Params[0].strParam);

API Prototype
int BTPSAPI GAP_Set_Local_Device_Name(unsigned int BluetoothStackID, char *Name);

Description of API
This function is provided to allow the changing of the Device name of the local Bluetooth Device. The Name parameter must be a pointer to a NULL terminated ASCII string of at most MAX_NAME_LENGTH (not counting the trailing NULL terminator). This function will return zero if the local Device name was successfully changed, or a negative return error code if there was an error condition.



GetLocalName[edit]

Description
This function is responsible for querying the name of the local Bluetooth Device. This function returns zero on a successful execution and a negative value on all errors. A Bluetooth Stack ID must exist before attempting to call this function.

Parameters
It is not necessary to include parameters when using this command. A parameter will have no effect on the outcome of the Query.

Possible Return Values
(0) Successfully Queried Local Device Name
(-8) INVALID_STACK_ID_ERROR
(-4) FUNCTION_ERROR
(-2) BTPS_ERROR_INVALID_BLUETOOTH_STACK_ID
(-1) BTPS_ERROR_INVALID_PARAMETER
(-57) BTPS_ERROR_DEVICE_HCI_ERROR
(-65) BTPS_ERROR_INSUFFICIENT_BUFFER_SPACE

API Call
GAP_Query_Local_Device_Name(BluetoothStackID, 257, (char *)LocalName);

API Prototype
int BTPSAPI GAP_Query_Local_Device_Name(unsigned int BluetoothStackID, unsigned int NameBufferLength, char *NameBuffer);

Description of API
This function is responsible for querying (and reporting) the user friendly name of the local Bluetooth Device. The final parameters to this function specify the buffer and buffer length of the buffer that is to receive the local Device name. The NameBufferLength parameter should be at least (MAX_NAME_LENGTH+1) to hold the maximum allowable Device name (plus a single character to hold the NULL terminator). If this function is successful, this function returns zero, and the buffer that NameBuffer points to will be filled with a NULL terminated ASCII representation of the local Device name. If this function returns a negative value, then the local Device name was NOT able to be queried (error condition).



SetClassOfDevice[edit]

Description
The SetClassOfDevice command is responsible for setting the Class of Device of the local Bluetooth Device to a Class of Device value. This function returns zero on a successful execution and a negative value on all errors. A Bluetooth Stack ID must exist before attempting to call this function.

Parameters
The only parameter needed is the new Class of Device value. It is preferred to start the value with “0x” and use a six digit value after that. Without doing this, the Class of Device written will be assumed decimal and will be converted to hexadecimal format and change the values given.

Command Call Examples
"SetClassOfDevice 0x123456" Attempts to set the Class of Device for the local Bluetooth Device to "0x123456."
"SetClassOfDevice 123456" Attempts to set the Class of Device for the local Bluetooth Device to "0x01E240" which is equivalent to the decimal value of 123456.

Possible Return Values
(0) Successfully Set Local Class of Device
(-57) BTPS_ERROR_DEVICE_HCI_ERROR
(-2) BTPS_ERROR_INVALID_BLUETOOTH_STACK_ID
(-8) INVALID_STACK_ID_ERROR
(-4) FUNCTION_ERROR
(-5) BTPS_ERROR_GAP_NOT_INITIALIZED

API Call
GAP_Set_Class_of_Device(BluetoothStackID, Class_of_Device);

API Prototype
int BTPSAPI GAP_Set_Class_Of_Device(unsigned int BluetoothStackID, Class_of_Device_t Class_of_Device);

Description of API
This function is provided to allow the changing of the class of Device of the local Bluetooth Device. The Class_of_Device parameter represents the class of Device value that is to be written to the local Bluetooth Device. This function will return zero if the class of Device was successfully changed, or a negative return error code if there was an error condition.



GetClassOfDevice[edit]

Description
The GetClassOfDevice command is responsible for querying the Bluetooth Class of Device of the local Bluetooth Device. This function returns zero on a successful execution and a negative value on all errors. A Bluetooth Stack ID must exist before attempting to call this function.

Parameters
It is not necessary to include parameters when using this command. A parameter will have no effect on the outcome of the Query.

Possible Return Values
(0) Successfully Queried Local Class of Device
(-57) BTPS_ERROR_DEVICE_HCI_ERROR
(-2) BTPS_ERROR_INVALID_BLUETOOTH_STACK_ID
(-8) INVALID_STACK_ID_ERROR
(-4) FUNCTION_ERROR
(-1) BTPS_ERROR_INVALID_PARAMETER

API Call
GAP_Query_Class_Of_Device(BluetoothStackID, &Class_of_Device);

API Prototype
int BTPSAPI GAP_Query_Class_Of_Device(unsigned int BluetoothStackID, Class_of_Device_t *Class_of_Device);

Description of API
This function is responsible for querying (and reporting) the class of Device of the local Bluetooth Device. The second parameter is a pointer to a class of Device buffer that is to receive the Bluetooth class of Device of the local Device. If this function is successful, this function returns zero, and the buffer that Class_Of_Device points to will be filled with the Class of Device read from the local Bluetooth Device. If there is an error, this function returns a negative value, and the class of Device of the local Bluetooth Device is NOT copied into the specified input buffer.



GetRemoteName[edit]

Description
The GetRemoteName command is responsible for querying the Bluetooth Device Name of a Remote Device. This function returns zero on a successful execution and a negative value on all errors. The command requires that a valid Bluetooth Stack ID exists before running and it should be called after using the Inquiry command. The DisplayInquiryList command would be useful in this situation to find which Remote Device goes with which Inquiry Index.

Parameters
The GetRemoteName command requires one parameter which is the Inquiry Index of the Remote Bluetooth Device. This value can be found after an Inquiry or displayed when the command DisplayInquiryList is used.

Command Call Examples
"GetRemoteName 5" Attempts to query the Device Name for the Remote Device that is at the fifth Inquiry Index.
"GetRemoteName 8" Attempts to query the Device Name for the Remote Device that is at the eighth Inquiry Index.

Possible Return Values
(0) Successfully Queried Remote Name
(-6) INVALID_PARAMETERS_ERROR
(-4) FUNCTION_ERROR
(-8) INVALID_STACK_ID_ERROR
(-2) BTPS_ERROR_INVALID_BLUETOOTH_STACK_ID
(-1) BTPS_ERROR_INVALID_PARAMETER
(-59) BTPS_ERROR_ADDING_CALLBACK_INFORMATION
(-57) BTPS_ERROR_DEVICE_HCI_ERROR

API Call
GAP_Query_Remote_Device_Name(BluetoothStackID, InquiryResultList[(TempParam->Params[0].intParam – 1)], GAP_Event_Callback, (unsigned long)0);

API Prototype
int BTPSAPI GAP_Query_Remote_Device_Name(unsigned int BluetoothStackID, BD_ADDR_t BD_ADDR, GAP_Event_Callback_t GAP_Event_Callback, unsigned long CallbackParameter);

Description of API
This function is provided to allow a mechanism to query the user-friendly Bluetooth Device name of the specified remote Bluetooth Device. This function accepts as input the Bluetooth Device address of the remote Bluetooth Device to query the name of and the GAP event callback information that is to be used when the remote Device name process has completed. This function returns zero if successful, or a negative return error code if the remote name request was unable to be submitted. If this function returns success, then the caller will be notified via the specified callback when the remote name information has been determined (or there was an error). This function cannot be used to determine the user-friendly name of the local Bluetooth Device. The GAP_Query_Local_Name function should be used to query the user-friendly name of the local Bluetooth Device. Because this function is asynchronous in nature (specifying a remote Device address), this function will notify the caller of the result via the specified callback. The caller is free to cancel the remote name request at any time by issuing the GAP_Cancel_Query_Remote_Name function and specifying the Bluetooth Device address of the Bluetooth Device that was specified in the original call to this function. It should be noted that when the callback is cancelled, the operation is attempted to be cancelled and the callback is cancelled (i.e. the GAP module still might perform the remote name request, but no callback is ever issued).



Human Interface Demo Profile[edit]



1) Host

ConnectRemoteHIDDevice[edit]

Description
The following function is responsible for Connecting to a Remote HID Device. This function returns zero on successful execution and a negative value on all errors.
Parameters
This command takes Inquiry Index number to work which can be found using the DisplayInquiryList command after an Inquiry has been completed.

Possible Return Values
(0)HID_Connect_Remote_Device: Function Successful
(-4) FUNCTION_ERROR
(-6)INVALID_PARAMETERS_ERROR
(-8) INVALID_STACK_ID_ERROR
(-103)BTPS_ERROR_FEATURE_NOT_AVAILABLE
(-1000)BTHID_ERROR_INVALID_PARAMETER
(-1001)BTHID_ERROR_NOT_INITIALIZED
(-1002)BTHID_ERROR_INVALID_BLUETOOTH_STACK_ID
(-1004)BTHID_ERROR_INSUFFICIENT_RESOURCES


API Call
HID_Connect_Remote_Device(BluetoothStackID, InquiryResultList[(TempParam->Params->intParam-1)], &HIDConfiguration, HID_Event_Callback, 0)

API Prototype
int BTPSAPI HID_Connect_Remote_Device(unsigned int BluetoothStackID, BD_ADDR_t BD_ADDR, HID_Configuration_t *HIDConfiguration, HID_Event_Callback_t EventCallback, unsigned long CallbackParameter)

Description of API
The following function is responsible for opening a connection to a Remote HID Device on the Specified Bluetooth Device. This function accepts as its first parameter the Bluetooth Stack ID of the Bluetooth Stack which is to open the HID Connection. The second parameter specifies the Board Address (NON NULL) of the Remote Bluetooth Device to connect with. The third parameter to this function is the HID Configuration Specification to be used in the negotiation of the L2CAP Channels associated with this Device Client. The final two parameters specify the HID Event Callback function and Callback Parameter, respectively, of the HID Event Callback that is to process any further events associated with this Device Client. This function returns a non-zero, positive, value if successful, or a negative return error code if this function is unsuccessful. If this function is successful, the return value will represent the HID ID that can be passed to all other functions that require it. Once a Connection is opened to a Remote Device it can only be closed via a call to the HID_Close_Connection() function (passing in the return value from a successful call to this function as the HID ID input parameter).

CloseConnection[edit]

Description
The following function is responsible for closing any ongoing connection. This function returns 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 of Close connection.

Possible Return Values
(0) HID_Close_Connection: Function Successful
(-4) FUNCTION_ERROR
(-8) INVALID_STACK_ID_ERROR
(-1000)BTHID_ERROR_INVALID_PARAMETER
(-1001)BTHID_ERROR_NOT_INITIALIZED
(-1002)BTHID_ERROR_INVALID_BLUETOOTH_STACK_ID
(-1004)BTHID_ERROR_INSUFFICIENT_RESOURCES
(-1005)BTHID_ERROR_INVALID_OPERATION
(-1006)BTHID_ERROR_REQUEST_OUTSTANDING

API Call
HID_Close_Connection(BluetoothStackID, HIDID)

API Prototype
int BTPSAPI HID_Close_Connection(unsigned int BluetoothStackID, unsigned int HIDID)

Description of API
The following function is responsible for closing a HID connection established through a connection made to a Registered Server or a connection that was made by calling either the HID_Open_Remote_Device() or HID_Open_Remote_Host() functions. This function accepts as input the Bluetooth Stack ID of the Bluetooth Protocol Stack that the HID ID specified by the Second Parameter is valid for. This function returns zero if successful, or a negative return error code if an error occurred. Note that if this function is called with the HID ID of a Local Server, the Server will remain registered but the connection associated with the specified HID ID will be closed.

ControlRequest[edit]

Description
The following function is responsible for sending a HID_CONTROL Transaction to the remote entity. This function returns zero on successful execution and a negative value on all errors.
Parameters
If the Device is a Host then it requires one parameter which is the Control Operation, 0= hcNop, 1= hcHardReset, 2= hcSoftReset, 3= hcSuspend, 4=hcExitSuspend, 5=hcVirtualCableUnplug. If the Device is not a Host then it is not necessary to include parameters when using this command. A parameter will have no effect on the outcome of Control Request

Possible Return Values
(0) HID_Control_Request: Function Successful
(-4) FUNCTION_ERROR
(-6)INVALID_PARAMETERS_ERROR
(-8) INVALID_STACK_ID_ERROR
(-1000)BTHID_ERROR_INVALID_PARAMETER
(-1001)BTHID_ERROR_NOT_INITIALIZED
(-1002)BTHID_ERROR_INVALID_BLUETOOTH_STACK_ID
(-1005)BTHID_ERROR_INVALID_OPERATION
(-1006)BTHID_ERROR_REQUEST_OUTSTANDING


API Call
HID_Control_Request(BluetoothStackID, HIDID, (HID_Control_Operation_Type_t)((!IsHost)?(hcVirtualCableUnplug):(TempParam->Params->intParam)))

API Prototype
int BTPSAPI HID_Control_Request(unsigned int BluetoothStackID, unsigned int HIDID, HID_Control_Operation_Type_t ControlOperation)


Description of API
The following function is responsible for Sending a HID_CONTROL transaction to the remote side. This function accepts as input the Bluetooth Stack ID of the Bluetooth Stack which is to send the request and the HID ID for which the Connection has been established. The third parameter is the Control Operation that will be sent. This function returns zero if successful, or a negative return error code if there as an error.

Note: Control Channel Transfers normally consist of two phases, a Request by the Host and a Response by the Device. However, HID Control transactions require no Response phase. Note that HID Control Requests are not allowed while other transactions are being processed unless the Control Operation Type is hcVirtualCableUnplug which may be sent at any time.



GetReportRequest[edit]

Description
The following function is responsible for sending a GET_REPORT Transaction to the remote HID Device. This function returns zero on successful execution and a negative value on all errors.
Parameters
This function required three or four parameters. The first is size, 0 = grSizeOfReport, 1 = grUseBufferSize, the second is ReportType 0 = rtOther, 1 = rtInput, 2 = rtOutput, 3 = rtFeature, the third is ReportId. If the size parameter is 1, we need to specify a fourth parameter Buffersize.

Possible Return Values
(0) HID_Get_Report_Request: Function Successful
(-4) FUNCTION_ERROR
(-6)INVALID_PARAMETERS_ERROR
(-8) INVALID_STACK_ID_ERROR
(-103)BTPS_ERROR_FEATURE_NOT_AVAILABLE
(-1000)BTHID_ERROR_INVALID_PARAMETER
(-1001)BTHID_ERROR_NOT_INITIALIZED
(-1002)BTHID_ERROR_INVALID_BLUETOOTH_STACK_ID
(-1005)BTHID_ERROR_INVALID_OPERATION


API Call
HID_Get_Report_Request(BluetoothStackID, HIDID, (HID_Get_Report_Size_Type_t)TempParam->Params[0].intParam, (HID_Report_Type_Type_t)TempParam->Params[1].intParam, (Byte_t)(TempParam->Params[2].intParam), (Word_t)(TempParam->Params[3].intParam))

API Prototype
HID_Get_Report_Request(unsigned int BluetoothStackID, unsigned int HIDID, HID_Get_Report_Size_Type_t Size, HID_Report_Type_Type_t ReportType, Byte_t ReportID, Word_t BufferSize)


Description of API
The following function is responsible for Sending a GET_REPORT transaction to the remote Device. This function accepts as input the Bluetooth Stack ID of the Bluetooth Stack which is to send the request and the HID ID for which the Connection has been established. The third parameter is the descriptor that indicates how the Device is to determine the size of the buffer that the Host has allocated. The fourth parameter is the type of report requested. The fifth parameter is the Report ID determined by the Device's SDP record. Passing a zero for this parameter will indicate that this parameter is not used and will exclude the appropriate byte from the transaction payload. The fifth parameters use is based on the parameter passed as Size. If the Host indicates it has allocated a buffer of a size smaller than the report it is requesting, this parameter will be used as the size of the report returned. Otherwise, the appropriate bytes will not be included in the transaction payload. This function returns zero if successful or a negative return error code if there was an error.

Note:- Control Channel transfers have two phases, a Request by the Host and a Response by the Device. Only ONE Host control channel Request shall be outstanding at a time. Reception of a HID Get Report Confirmation event indicates that a Response has been received and the Control Channel is now free for further Transactions.


SetReportRequest[edit]

Description
The following function is responsible for sending a SET_REPORT Transaction to the remote HID Device. This function returns zero on successful execution and a negative value on all errors.
Parameters
SetReportRequest uses one parameter, ReportType 0 = rtOther, 1 = rtInput, 2 = rtOutput, 3 = rtFeature.

Possible Return Values
(0)HID_Set_Report_Request: Function Successful. (-4) FUNCTION_ERROR
(-6)INVALID_PARAMETERS_ERROR
(-8) INVALID_STACK_ID_ERROR
(-103)BTPS_ERROR_FEATURE_NOT_AVAILABLE
(-1000)BTHID_ERROR_INVALID_PARAMETER
(-1001)BTHID_ERROR_NOT_INITIALIZED
(-1002)BTHID_ERROR_INVALID_BLUETOOTH_STACK_ID
(-1005)BTHID_ERROR_INVALID_OPERATION
(-1006)BTHID_ERROR_REQUEST_OUTSTANDING


API Call
HID_Set_Report_Request(BluetoothStackID, HIDID, (HID_Report_Type_Type_t)TempParam->Params[1].intParam, sizeof(GenericMouseReport), GenericMouseReport);

API Prototype
int BTPSAPI HID_Set_Report_Request(unsigned int BluetoothStackID, unsigned int HIDID, HID_Report_Type_Type_t ReportType, Word_t ReportPayloadSize, Byte_t *ReportDataPayload);

Description of API
The following function is responsible for sending a SET_REPORT request to the remote Device. This function accepts as input the Bluetooth Stack ID of the Bluetooth Stack which is to send the transaction and the HID ID for which the Connection has been established. The third parameter is the type of report being sent. Note that rtOther is an Invalid Report Type for use with this function. The final two parameters to this function are the Length of the Report Payload to send and a pointer to the Report Payload that will be sent. This function returns zero if successful or a negative return error code if there was an error.

Note :- Control Channel transfers have two phases, a Request by the Host and a Response by the Device. Only ONE Host control channel Request shall be outstanding at a time. Reception of a HID Set Report Confirmation event indicates that a Response has been received and the Control Channel is now free for further Transactions.



GetProtocolRequest[edit]

Description
The following function is responsible for sending a GET_PROTOCOL Transaction to the remote HID Device. This function returns 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 of GetProtocolRequest .

Possible Return Values
(0)HID_Get_Protocol_Request: Function Successful. (-4) FUNCTION_ERROR
(-8) INVALID_STACK_ID_ERROR
(-103)BTPS_ERROR_FEATURE_NOT_AVAILABLE
(-1000)BTHID_ERROR_INVALID_PARAMETER
(-1001)BTHID_ERROR_NOT_INITIALIZED
(-1002)BTHID_ERROR_INVALID_BLUETOOTH_STACK_ID
(-1005)BTHID_ERROR_INVALID_OPERATION
(-1006)BTHID_ERROR_REQUEST_OUTSTANDING

API Call
HID_Get_Protocol_Request(BluetoothStackID, HIDID)

API Prototype
int BTPSAPI HID_Get_Protocol_Request(unsigned int BluetoothStackID, unsigned int HIDID);

Description of API
The following function is responsible for sending a GET_PROTOCOL transaction to the remote HID Device. This function accepts as input the Bluetooth Stack ID of the Bluetooth Stack which is to send the request and the HID ID for which the Connection has been established. This function returns a zero if successful or a negative return error code if there was an error.

NOTE :- Control Channel transfers have two phases, a Request by the Host and a Response by the Device. Only ONE Host control channel request shall be outstanding at a time. Reception of a HID Get Protocol Confirmation event indicates that a response has been received and the Control Channel is now free for further Transactions.


SetProtocolRequest[edit]

Description
The following function is responsible for sending a SET_PROTOCOL Transaction to the remote HID Device. This function returns zero on successful execution and a negative value on all errors.
Parameters
SetProtocolRequest needs one parameter which is Protocol, 0= ptReport and 1=ptBoot.

Possible Return Values
(0) HID_Set_Protocol_Request: Function Successful (-4) FUNCTION_ERROR
(-6)INVALID_PARAMETERS_ERROR
(-8) INVALID_STACK_ID_ERROR
(-103)BTPS_ERROR_FEATURE_NOT_AVAILABLE
(-1000)BTHID_ERROR_INVALID_PARAMETER
(-1001)BTHID_ERROR_NOT_INITIALIZED
(-1002)BTHID_ERROR_INVALID_BLUETOOTH_STACK_ID
(-1005)BTHID_ERROR_INVALID_OPERATION
(-1006)BTHID_ERROR_REQUEST_OUTSTANDING


API Call
HID_Set_Protocol_Request(BluetoothStackID, HIDID, (HID_Protocol_Type_t)TempParam->Params[0].intParam)

API Prototype
int BTPSAPI HID_Set_Protocol_Request(unsigned int BluetoothStackID, unsigned int HIDID, HID_Protocol_Type_t Protocol)

Description of API
The following function is responsible for sending a SET_PROTOCOL transaction to the remote HID Device. This function accepts the Bluetooth Stack ID of the Bluetooth Stack which is to send the request and the HID ID for which the Connection has been established. The last parameter is the protocol to be set. This function returns a zero if successful or a negative return error code if there was an error.

Note:- Control Channel transfers have two phases, a Request by the Host and a Response by the Device. Only ONE Host control channel Request shall be outstanding at a time. Reception of a HID Set Protocol Confirmation event indicates that a response has been received and the Control Channel is now free for further Transactions.


GetIdleRequest[edit]

Description
The following function is responsible for sending a GET_IDLE Transaction to the remote HID Device. This function returns 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 of GetIdleRequest.

Possible Return Values
(0) HID_Get_Idle_Request: Function Successful. (-4) FUNCTION_ERROR
(-8) INVALID_STACK_ID_ERROR
(-103)BTPS_ERROR_FEATURE_NOT_AVAILABLE
(-1000)BTHID_ERROR_INVALID_PARAMETER
(-1001)BTHID_ERROR_NOT_INITIALIZED
(-1002)BTHID_ERROR_INVALID_BLUETOOTH_STACK_ID
(-1005)BTHID_ERROR_INVALID_OPERATION
(-1006)BTHID_ERROR_REQUEST_OUTSTANDING


API Call
HID_Get_Idle_Request(BluetoothStackID, HIDID)

API Prototype
int BTPSAPI HID_Get_Idle_Request(unsigned int BluetoothStackID, unsigned int HIDID)

Description of API
The following function is responsible for sending a GET_IDLE transaction to the remote HID Device. This function accepts the Bluetooth Stack ID of the Bluetooth Stack which is to send the request and the HID ID for which the Connection has been established. This function returns a zero if successful or a negative return error code if there was an error.

Note:- Control Channel transfers have two phases, a Request by the Host and a Response by the Device. Only ONE Host control channel request shall be outstanding at a time. Reception of a HID Get Idle Confirmation event indicates that a response has been received and the Control Channel is now free for further Transactions.



SetIdleRequest[edit]

Description
The following function is responsible for sending a SET_IDLE Transaction to the remote HID Device. This function returns zero on successful execution and a negative value on all errors.
Parameters
SetIdleRequest requires one Parameter which is Idlerate.

Possible Return Values
(0) HID_Set_Idle_Request: Function Successful
(-4) FUNCTION_ERROR
(-8) INVALID_STACK_ID_ERROR
(-1000)BTHID_ERROR_INVALID_PARAMETER
(-1001)BTHID_ERROR_NOT_INITIALIZED
(-1002)BTHID_ERROR_INVALID_BLUETOOTH_STACK_ID
(-1004)BTHID_ERROR_INSUFFICIENT_RESOURCES
(-1005)BTHID_ERROR_INVALID_OPERATION
(-1006)BTHID_ERROR_REQUEST_OUTSTANDING


API Call
HID_Set_Idle_Request(BluetoothStackID, HIDID, (Byte_t)TempParam->Params[0].intParam)

API Prototype
int BTPSAPI HID_Set_Idle_Request(unsigned int BluetoothStackID, unsigned int HIDID, Byte_t IdleRate)

Description of API
The following function is responsible for sending a SET_IDLE transaction to the remote HID Device. This function accepts the Bluetooth Stack ID of the Bluetooth Stack which is to send the request and the HID ID for which the Connection has been established. The last parameter is the Idle Rate to be set. The Idle Rate LSB is weighted to 4ms (i.e. the Idle Rate resolution is 4ms with a range from 4ms to 1.020s). This function returns a zero if successful or a negative return error code if there was an error.

Note:- Control Channel transfers have two phases, a Request by the Host and a Response by the Device. Only ONE Host control channel request shall be outstanding at a time. Reception of a HID Set Idle Confirmation event indicates that a response has been received and the Control Channel is now free for further Transactions.



DataWrite[edit]

Description
The following function is responsible for sending a DATA Transaction on the Interrupt Channel to the remote entity. This function returns zero on successful execution and a negative value on all errors.
Parameters
It requires one parameter which is ReportType, 0 = rtOther, 1 = rtInput, 2 = rtOutput, 3 = rtFeature.

Possible Return Values
(0) HID_Control_Request: Function Successful
(-4) FUNCTION_ERROR
(-6)INVALID_PARAMETERS_ERROR
(-8) INVALID_STACK_ID_ERROR
(-1000)BTHID_ERROR_INVALID_PARAMETER
(-1001)BTHID_ERROR_NOT_INITIALIZED
(-1002)BTHID_ERROR_INVALID_BLUETOOTH_STACK_ID
(-1005)BTHID_ERROR_INVALID_OPERATION


API Call
HID_Data_Write(BluetoothStackID, HIDID, (HID_Report_Type_Type_t)TempParam->Params[0].intParam, sizeof(GenericMouseReport), GenericMouseReport)

API Prototype
int BTPSAPI HID_Data_Write(unsigned int BluetoothStackID, unsigned int HIDID, HID_Report_Type_Type_t ReportType, Word_t ReportPayloadSize, Byte_t *ReportDataPayload)

Description of API
The following function is responsible for sending Reports over the Interrupt Channel. This function accepts the Bluetooth Stack ID of the Bluetooth Stack which is to send the Report Data and the HID ID for which the Connection has been established. The third Parameter is the type of report being sent. The final two parameters are the Length of the Report Payload to send and a pointer to the Report Payload that will be sent. Note that rtOther and rtFeature are Invalid Report Types for use with this function. Also note that rtInput Reports must be sent from the Device to the Host, and that rtOutput Reports must be sent from the Host to the Device. This function returns a zero if successful or a negative return error code if there was an error.


2) Client

GetReportResponse[edit]

Description
The following function is responsible for sending a response for an outstanding GET_REPORT Transaction to the remote HID Host. This function returns zero on successful execution and a negative value on all errors.


Parameters
GetReportResponse requires two parameters, ResultType, 0= rtSuccessful 1= rtNotReady, 2= rtErrInvalidReportID, 3= rtErrUnsupportedRequest, 4= rtErrInvalidParameter, 5= rtErrUnknown, 6= rtErrFatal, 7= rtData and ReportType, 0 = rtOther, 1 = rtInput, 2 = rtOutput, 3 = rtFeature.


Possible Return Values
(0) HID_Get_Report_Response: Function Successful.
(-4) FUNCTION_ERROR
(-6)INVALID_PARAMETERS_ERROR
(-8) INVALID_STACK_ID_ERROR
(-103)BTPS_ERROR_FEATURE_NOT_AVAILABLE
(-1000)BTHID_ERROR_INVALID_PARAMETER
(-1001)BTHID_ERROR_NOT_INITIALIZED
(-1002)BTHID_ERROR_INVALID_BLUETOOTH_STACK_ID
(-1005)BTHID_ERROR_INVALID_OPERATION
(-1006)BTHID_ERROR_REQUEST_OUTSTANDING


API Call
HID_Get_Report_Response(BluetoothStackID, HIDID, (HID_Result_Type_t)TempParam->Params[0].intParam, (HID_Report_Type_Type_t)TempParam->Params[1].intParam, sizeof(GenericMouseReport), GenericMouseReport);


API Prototype
int BTPSAPI HID_Get_Report_Response(unsigned int BluetoothStackID, unsigned int HIDID, HID_Result_Type_t ResultType, HID_Report_Type_Type_t ReportType, Word_t ReportPayloadSize, Byte_t *ReportDataPayload);

Description of API
The following function is responsible for Sending the appropriate Response to an Outstanding GET_REPORT transaction. This function accepts the Bluetooth Stack ID of the Bluetooth Stack which is to send the response and the HID ID for which the Connection has been established. The third parameter to this function is the Result Type that is to be associated with this response. The rtSuccessful Result Type is Invalid for use with this function. If the rtNotReady through rtErrFatal Result Statuses are used to respond, a HANDSHAKE response that has a Result Code parameter of the specified Error Condition is sent. If the ResultType specified is rtData, the GET_REPORT transaction is responded to with a DATA Response that has the Report (specified by the final parameter) as its Payload. The fourth parameter is the type of report being sent. Note that rtOther is an Invalid Report Type for use with this function. The final two parameters are the Length of the Report Payload to send and a pointer to the Report Payload that will be sent. This function returns a zero if successful, or a negative return error code if there was an error.

SetReportResponse[edit]

Description
The following function is responsible for sending a response for an outstanding SET_REPORT Transaction to the remote HID Host. This function returns zero on successful execution and a negative value on all errors.
Parameters
SetReportResponse requires one parameter which is ResultType, 0= rtSuccessful 1= rtNotReady, 2= rtErrInvalidReportID, 3= rtErrUnsupportedRequest, 4= rtErrInvalidParameter, 5= rtErrUnknown, 6= rtErrFatal, 7= rtData.


Possible Return Values
(0) HID_Set_Report_Response: Function Successful.
(-4) FUNCTION_ERROR
(-6)INVALID_PARAMETERS_ERROR
(-8) INVALID_STACK_ID_ERROR
(-103)BTPS_ERROR_FEATURE_NOT_AVAILABLE
(-1000)BTHID_ERROR_INVALID_PARAMETER
(-1001)BTHID_ERROR_NOT_INITIALIZED
(-1002)BTHID_ERROR_INVALID_BLUETOOTH_STACK_ID
(-1005)BTHID_ERROR_INVALID_OPERATION


API Call
HID_Get_Report_Response(BluetoothStackID, HIDID, (HID_Result_Type_t)TempParam->Params[0].intParam, (HID_Report_Type_Type_t)TempParam->Params[1].intParam, sizeof(GenericMouseReport), GenericMouseReport)

API Prototype
int BTPSAPI HID_Set_Report_Response(unsigned int BluetoothStackID, unsigned int HIDID, HID_Result_Type_t ResultType)

Description of API
The following function is responsible for Sending the appropriate Response to an Outstanding SET_REPORT transaction. This function accepts as input the Bluetooth Stack ID of the Bluetooth Stack which is to send the response and the HID ID for which the Connection has been established. The third parameter to this function is the Result Type that is to be associated with this response. The rtData Result Type is Invalid for use with this function. If the rtSuccessful through rtErrFatal Result Types are specified, this function responds to the SET_REPORT request with a HANDSHAKE response that has a Result Code parameter that matches the specified Result Type. This function returns zero if successful or a negative return error code if there was an error.

GetProtocolResponse[edit]

Description
The following function is responsible for sending a response for an outstanding GET_PROTOCOL Transaction to the remote HID Host. This function returns zero on successful execution and a negative value on all errors.
Parameters
GetProtocolResponse requires two parameters which are ResultType, 0= rtSuccessful, 1= rtNotReady, 2= rtErrInvalidReportID, 3= rtErrUnsupportedRequest, 4= rtErrInvalidParameter, 5= rtErrUnknown, 6= rtErrFatal, 7= rtData and Protocol, 0= ptReport and 1=ptBoot.

Possible Return Values
(0) HID_Get_Protocol_Response: Function Successful.
(-4) FUNCTION_ERROR
(-6)INVALID_PARAMETERS_ERROR
(-8) INVALID_STACK_ID_ERROR
(-103)BTPS_ERROR_FEATURE_NOT_AVAILABLE
(-1000)BTHID_ERROR_INVALID_PARAMETER
(-1001)BTHID_ERROR_NOT_INITIALIZED
(-1002)BTHID_ERROR_INVALID_BLUETOOTH_STACK_ID
(-1004)BTHID_ERROR_INSUFFICIENT_RESOURCES
(-1005)BTHID_ERROR_INVALID_OPERATION

API Call
HID_Get_Protocol_Response(BluetoothStackID, HIDID, (HID_Result_Type_t)TempParam->Params[0].intParam, (HID_Protocol_Type_t)TempParam->Params[1].intParam)

API Prototype
int BTPSAPI HID_Get_Protocol_Response(unsigned int BluetoothStackID, unsigned int HIDID, HID_Result_Type_t ResultType, HID_Protocol_Type_t Protocol)

Description of API
The following function is responsible for Sending the appropriate Response to an Outstanding GET_PROTOCOL transaction. This function accepts the Bluetooth Stack ID of the Bluetooth Stack which is to send the response and the HID ID for which the Connection has been established. The third parameter to this function is the Result Type that is to be associated with this response. The rtSuccessful Result Type is Invalid for use with this function.If the rtNotReady through rtErrFatal Result Types are specified, this function will respond to the GET_PROTOCOL request with a HANDSHAKE response that has a Result Code parameter of the specified Error Condition. If the ResultType specified is rtData, the GET_PROTOCOL transaction is responded to with a DATA Response that has the Protocol type specified as the final parameter as its Payload. This function returns zero if successful or a negative return error code if there was an error.


SetProtocolResponse[edit]

Description
The following function is responsible for sending a response for an outstanding SET_PROTOCOL transaction to the remote HID Host. This function returns zero on successful execution and a negative value on all errors.
Parameters
SetProtocolResponse requires one parameter which is ResultType, 0= rtSuccessful, 1= rtNotReady, 2= rtErrInvalidReportID, 3= rtErrUnsupportedRequest, 4= rtErrInvalidParameter, 5= rtErrUnknown, 6= rtErrFatal, 7= rtData.


Possible Return Values
(0) HID_Set_Protocol_Response: Function Successful.
(-4) FUNCTION_ERROR
(-6)INVALID_PARAMETERS_ERROR
(-8) INVALID_STACK_ID_ERROR
(-103)BTPS_ERROR_FEATURE_NOT_AVAILABLE
(-1000)BTHID_ERROR_INVALID_PARAMETER
(-1001)BTHID_ERROR_NOT_INITIALIZED
(-1002)BTHID_ERROR_INVALID_BLUETOOTH_STACK_ID
(-1005)BTHID_ERROR_INVALID_OPERATION
(-1006)BTHID_ERROR_REQUEST_OUTSTANDING

API Call
HID_Set_Protocol_Response(BluetoothStackID, HIDID, (HID_Protocol_Type_t)TempParam->Params[0].intParam)


API Prototype
int BTPSAPI HID_Set_Protocol_Response(unsigned int BluetoothStackID, unsigned int HIDID, HID_Result_Type_t ResultType);

Description of API
The following function is responsible for Sending the appropriate Response to an Outstanding SET_PROTOCOL transaction. This function accepts the Bluetooth Stack ID of the Bluetooth Stack which is to send the response and the HID ID for which the Connection has been established. The third parameter to this function is the Result Type that is to be associated with this response. The rtData Result Type is Invalid for use with this function. If the rtSuccessful through rtErrFatal Result Types are specified then this function will respond to the SET_PROTOCOL Transaction with a HANDSHAKE response that has a Result Code parameter that matches the specified Result Type. This function returns zero if successful, or a negative return error code if there was an error.


GetIdleResponse[edit]

Description
The following function is responsible for sending a response for an outstanding GET_IDLE Transaction to the remote HID Host. This function returns zero on successful execution and a negative value on all errors.
Parameters
GetIdleResponse requires two parameters, ResultType, 0= rtSuccessful, 1= rtNotReady, 2= rtErrInvalidReportID, 3= rtErrUnsupportedRequest, 4= rtErrInvalidParameter, 5= rtErrUnknown, 6= rtErrFatal, 7= rtData and IdleRate.

Possible Return Values
(0) HID_Set_Idle_Response: Function Successful.
(-4) FUNCTION_ERROR
(-6)INVALID_PARAMETERS_ERROR
(-8) INVALID_STACK_ID_ERROR
(-103)BTPS_ERROR_FEATURE_NOT_AVAILABLE
(-1000)BTHID_ERROR_INVALID_PARAMETER
(-1001)BTHID_ERROR_NOT_INITIALIZED
(-1002)BTHID_ERROR_INVALID_BLUETOOTH_STACK_ID
(-1005)BTHID_ERROR_INVALID_OPERATION


API Call
HID_Get_Idle_Response(BluetoothStackID, HIDID, (HID_Result_Type_t)TempParam->Params[0].intParam, (Byte_t)TempParam->Params[1].intParam)


API Prototype
int BTPSAPI HID_Get_Idle_Response(unsigned int BluetoothStackID, unsigned int HIDID, HID_Result_Type_t ResultType, Byte_t IdleRate)


Description of API
The following function is responsible for Sending the appropriate Response to an Outstanding GET_IDLE transaction. This function accepts the Bluetooth Stack ID of the Bluetooth Stack which is to send the response and the HID ID for which the Connection has been established. The third parameter to this function is the Result Type that is to be associated with this response. The rtSuccessful Result Type is Invalid for use with this function. If the rtNotReady through rtErrFatal Result Types are specified, then this function will respond to the GET_IDLE Transaction with a HANDSHAKE response that has a Result Code parameter of the specified Error Condition. If the ResultType specified is rtData the GET_IDLE transaction is responded to with a DATA Response that has the Idle Rate specified as the final parameter as its Payload. This function returns zero if successful, or a negative return error code if there was an error.

SetIdleResponse[edit]

Description
The following function is responsible for sending a response for an outstanding SET_IDLE Transaction to the remote HID Host. This function returns zero on successful execution and a negative value on all errors.
Parameters
SetIdleResponse requires one parameter which is ResultType, 0= rtSuccessful, 1= rtNotReady, 2= rtErrInvalidReportID, 3= rtErrUnsupportedRequest, 4= rtErrInvalidParameter, 5= rtErrUnknown, 6= rtErrFatal, 7= rtData.

Possible Return Values
(0) HID_Get_ Idle _Response: Function Successful.
(-4) FUNCTION_ERROR
(-6)INVALID_PARAMETERS_ERROR
(-8) INVALID_STACK_ID_ERROR
(-103)BTPS_ERROR_FEATURE_NOT_AVAILABLE
(-1000)BTHID_ERROR_INVALID_PARAMETER
(-1001)BTHID_ERROR_NOT_INITIALIZED
(-1002)BTHID_ERROR_INVALID_BLUETOOTH_STACK_ID
(-1005)BTHID_ERROR_INVALID_OPERATION
(-1006)BTHID_ERROR_REQUEST_OUTSTANDING

API Call
HID_Set_Idle_Response(BluetoothStackID, HIDID, (HID_Result_Type_t)TempParam->Params[0].intParam)

API Prototype
int BTPSAPI HID_Set_Idle_Response(unsigned int BluetoothStackID, unsigned int HIDID, HID_Result_Type_t ResultType)

Description of API
The following function is responsible for Sending the appropriate Response to an Outstanding SET_IDLE transaction. This function accepts the Bluetooth Stack ID of the Bluetooth Stack which is to send the response and the HID ID for which the Connection has been established. The third parameter to this function is the Result Type that is to be associated with this response. The rtData Result Type is Invalid for use with this function. If the rtSuccessful through rtErrFatal Result Types are specified, then this function will respond to the SET_IDLE Transaction with a HANDSHAKE response that has a Result Code parameter that matches the specified Result Type. This function returns zero if successful, or a negative return error code if there was an error.

E2e.jpg {{
  1. switchcategory:MultiCore=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article CC256x TI Bluetooth Stack HIDDemo App here.

Keystone=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article CC256x TI Bluetooth Stack HIDDemo App here.

C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article CC256x TI Bluetooth Stack HIDDemo App here. DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article CC256x TI Bluetooth Stack HIDDemo App here. MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article CC256x TI Bluetooth Stack HIDDemo App here. OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article CC256x TI Bluetooth Stack HIDDemo App here. OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article CC256x TI Bluetooth Stack HIDDemo App here. MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article CC256x TI Bluetooth Stack HIDDemo App here. For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article CC256x TI Bluetooth Stack HIDDemo App here.

}}

Hyperlink blue.png Links

Amplifiers & Linear
Audio
Broadband RF/IF & Digital Radio
Clocks & Timers
Data Converters

DLP & MEMS
High-Reliability
Interface
Logic
Power Management

Processors

Switches & Multiplexers
Temperature Sensors & Control ICs
Wireless Connectivity