SWRA770 august   2023 CC2564C

 

  1.   1
  2.   Abstract
  3.   Trademarks
  4. 1Demo Overview
  5. 2Running the Bluetooth Code
  6. 3Demo Application
    1. 3.1 Device 1 (Host/HID Host) Setup on the Demo Application
    2. 3.2 Device 2 (Client/HID Device Setup on the Demo Application
    3. 3.3 Initiating Connection from the HID Host
    4. 3.4 Initiating Connection from HID Device
    5. 3.5 Communication Between Host and Device
  7. 4Application Commands
  8. 5Gap Commands
    1. 5.1  Help (DisplayHelp)
    2. 5.2  Inquiry
    3. 5.3  Display Inquiry List
    4. 5.4  Pair
    5. 5.5  End Pairing
    6. 5.6  PIN Code Response
    7. 5.7  Pass Key Response
    8. 5.8  User Confirmation Response
    9. 5.9  Set Discoverability Mode
    10. 5.10 Set Connectability Mode
    11. 5.11 Set Pairability Mode
    12. 5.12 Change Simple Pairing Parameters
    13. 5.13 Get Local Address
    14. 5.14 Set Local Name
    15. 5.15 Get Local Name
    16. 5.16 Set Class of Device
    17. 5.17 Get Class of Device
    18. 5.18 Get Remote Name
  9. 6Human Interface Demo Profile
    1. 6.1 Host
      1. 6.1.1  Connect Remote HID Device
      2. 6.1.2  Close Connection
      3. 6.1.3  Control Request
      4. 6.1.4  Get Report Request
      5. 6.1.5  Set Report Request
      6. 6.1.6  Get Protocol Request
      7. 6.1.7  Set Protocol Request
      8. 6.1.8  Get Idle Request
      9. 6.1.9  Set Idle Request
      10. 6.1.10 Data Write
    2. 6.2 Client
      1. 6.2.1 Get Report Response
      2. 6.2.2 Set Report Response
      3. 6.2.3 Get Protocol Response
      4. 6.2.4 Set Protocol Response
      5. 6.2.5 Get Idle Response
      6. 6.2.6 Set Idle Response
  10. 7References
  11. 8Revision History

Inquiry

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 lasts 10 seconds unless 20 devices (MAX_INQUIRY_RESULTS) are found before that time limit.

Parameters

Including parameters is not necessary when using this command. A parameter has 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 intMaximumPeriodLength, 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 if 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 fails if an outstanding inquiry is in progress. 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 must set BOTH of these values to zero if a simple InquiryProcedure is used (Non-Periodic). If these two parameters are specified, then these two parameters must satisfy the following formula:

MaximumPeriodLength > MinimumPeriodLength > InquiryLength