GAP_DeviceInit
--------------
:Opcode: 0xFE00
:Command Description: This command is used to setup the device. Can only be called once per reset. In order to change the address mode / random address, it is necessary to reset the device and call this API again. In the case where the address mode or random address is different than it was for the last initialization, all bonds and local information stored in NV will be erased.

**Command Parameters**

:profileRole: Bit Mask - GAP Profile Roles

 :Size: 1 byte(s)
 :Default: 8
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x01                  GAP_PROFILE_BROADCASTER  
         0x02                  GAP_PROFILE_OBSERVER     
         0x04                  GAP_PROFILE_PERIPHERAL   
         0x08                  GAP_PROFILE_CENTRAL      
         ===================== ========================================================

:addrMode: Address Mode

 :Size: 1 byte(s)
 :Default: 2
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x00                  ADDRMODE_PUBLIC
         0x01                  ADDRMODE_RANDOM
         0x02                  ADDRMODE_RP_WITH_PUBLIC_ID
         0x03                  ADDRMODE_RP_WITH_RANDOM_ID
         ===================== ========================================================

:ramdomAddr: Address Mode

 :Size: 6 byte(s)
 :Default: "00:00:00:00:00:00"
 :Range: Any 6 byte value

**Events Generated**

When this command is received, the host will send the CommandStatus Event.When initialization task is complete, the host will send the GAP_DeviceInitDone event.

GAP_TerminateLinkReq
--------------------
:Opcode: 0xFE0A
:Command Description: Send this command to terminate a connection link or all active connections.

**Command Parameters**

:connectionHandle: Connection handle of link to terminate.

 :Size: 2 byte(s)
 :Default: 0
 :Range: 0 - 0xFFFD to terminate a connection, 0xFFFF to terminate all connections

:reason: Error Code to send over the air in the termination request.

 :Size: 1 byte(s)
 :Default: 0x13
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x05                  Authentication Failure
         0x13                  Remote User Terminated Connection
         0x14                  Remote Device Terminated Connection Due To Low Resources
         0x15                  Remote Device Terminated Connection due to Power Off
         0x1A                  Unsupported Remote Feature
         0x29                  Pairing With Unit Key Not Supported
         0x3B                  Unacceptable Connection Interval
         ===================== ========================================================

**Events Generated**

When this command is received, the host will send the CommandStatus Event. When the connection is terminated, the GAP_LinkTerminated Event will be generated.

GAP_Authenticate
----------------
:Opcode: 0xFE0B
:Command Description: Send this command to initiate the pairing process (if Central device), wait for the pairing process (if Peripheral device), or accept a pairing request (if Peripheral device).

**Command Parameters**

:Connection Handle: Identifies the connection.

 :Size: 2 byte(s)
 :Default: 0x0000
 :Range: 0x0000 to 0x0EFF

:secReq_ioCaps: Defines the values which are used when exchanging IO capabilities

 :Size: 1 byte(s)
 :Default: 3
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x00                  DisplayOnly    
         0x01                  DisplayYesNo   
         0x02                  KeyboardOnly   
         0x03                  NoInputNoOutput
         0x04                  KeyboardDisplay
         ===================== ========================================================

:secReq_oobAvailable: "Enable" if Out-of-band key available.

 :Size: 1 byte(s)
 :Default: 0
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0                     Disable
         1                     Enable
         ===================== ========================================================

:secReq_oob: OOB data - Initial TK value for the pairing process.

 :Size: 16 byte(s)
 :Default: "4d:9f:88:5a:6e:03:12:fe:00:00:00:00:00:00:00:00"
 :Range: Any 16 byte value

:secReq_oobConfirm: OOB data Confirm value. Secure Connection only.

 :Size: 16 byte(s)
 :Default: "00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00"
 :Range: Any 16 byte value

:secReq_localOobAvailable: Secure Connections Local OOB data available

 :Size: 1 byte(s)
 :Default: 0
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x00                  Locally generated OOB data is NOT available
         0x01                  Local generated OOB data is available
         ===================== ========================================================

:secReq_localOob: Secure Connections local OOB value - 16 bytes in length.

 :Size: 16 byte(s)
 :Default: "00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00"
 :Range: Any 16 byte value

:secReq_isSCOnlyMode: Type of pairing to allow

 :Size: 1 byte(s)
 :Default: 0
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x00                  Legacy Pairing allowed
         0x01                  Only Secure Connections pairing allowed
         ===================== ========================================================

:secReq_eccKeys_isUsed: 1 if ECC Keys are specified, 0 for internal generation.

 :Size: 1 byte(s)
 :Default: 0
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x00                  Stack chooses ECC keys.
         0x01                  Use application provided ECC keys.
         ===================== ========================================================

:secReq_eccKeys_sK: P-256 ECC Private Key.

 :Size: 32 byte(s)
 :Default: "BD:1A:3C:CD:A6:B8:99:58:99:B7:40:EB:7B:60:FF:4A:50:3F:10:D2:E3:B3:C9:74:38:5F:C5:A3:D4:F6:49:3F"
 :Range: Any 32 byte value

:secReq_eccKeys_pK_x: P-256 ECC Public Key X-Coordinate.

 :Size: 32 byte(s)
 :Default: "E6:9D:35:0E:48:01:03:CC:DB:FD:F4:AC:11:91:F4:EF:B9:A5:F9:E9:A7:83:2C:5E:2C:BE:97:F2:D2:03:B0:20"
 :Range: Any 32 byte value

:secReq_eccKeys_pK_y: P-256 ECC Public Key Y-Coordinate.

 :Size: 32 byte(s)
 :Default: "8B:D2:89:15:D0:8E:1C:74:24:30:ED:8F:C2:45:63:76:5C:15:52:5A:BF:9A:32:63:6D:EB:2A:65:49:9C:80:DC"
 :Range: Any 32 byte value

:secReq_authReq: A bit field that indicates the requested security properties for STK and GAP bonding information.

 :Size: 1 byte(s)
 :Default: 1
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x01                  Bonding   
         0x04                  MITM      
         0x08                  SC        
         0x10                  KP        
         0x20                  CT2       
         ===================== ========================================================

:secReq_maxEncKeySize: This value defines the maximum encryption key size in octets that the device can support.

 :Size: 1 byte(s)
 :Default: 16
 :Range: 7-16

:secReq_keyDist: The Key Distribution field indicates which keys will be distributed.

 :Size: 1 byte(s)
 :Default: 119
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x01                  GAPBOND_KEYDIST_PENCKEY  
         0x02                  GAPBOND_KEYDIST_PIDKEY   
         0x04                  GAPBOND_KEYDIST_PSIGN    
         0x08                  GAPBOND_KEYDIST_PLINK   
         0x10                  GAPBOND_KEYDIST_CENCKEY 
         0x20                  GAPBOND_KEYDIST_CIDKEY  
         0x40                  GAPBOND_KEYDIST_CSIGN   
         0x80                  GAPBOND_KEYDIST_CLINK   
         ===================== ========================================================

:pairReq_Enable: "Enable" if Pairing Request has already been received and to respond with a Pairing Response. This should only be used in a Peripheral device.

 :Size: 1 byte(s)
 :Default: 0
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0                     Disable
         1                     Enable
         ===================== ========================================================

:pairReq_ioCaps: Defines the values which are used when exchanging IO capabilities

 :Size: 1 byte(s)
 :Default: 3
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x00                  DisplayOnly    
         0x01                  DisplayYesNo   
         0x02                  KeyboardOnly   
         0x03                  NoInputNoOutput
         0x04                  KeyboardDisplay
         ===================== ========================================================

:pairReq_oobDataFlag: "Enable" if OOB key is available.

 :Size: 1 byte(s)
 :Default: 0
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0                     Disable
         1                     Enable
         ===================== ========================================================

:pairReq_authReq: A bit field that indicates the requested security properties for STK and GAP bonding information.

 :Size: 1 byte(s)
 :Default: 1
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x01                  Bonding   
         0x04                  MITM      
         0x08                  SC        
         0x10                  KP        
         0x20                  CT2       
         ===================== ========================================================

:pairReq_maxEncKeySize: This value defines the maximum encryption key size in octets that the device can support.

 :Size: 1 byte(s)
 :Default: 16
 :Range: 7-16

:pairReq_keyDist: The Key Distribution field indicates which keys will be distributed.

 :Size: 1 byte(s)
 :Default: 119
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x01                  GAPBOND_KEYDIST_PENCKEY  
         0x02                  GAPBOND_KEYDIST_PIDKEY   
         0x04                  GAPBOND_KEYDIST_PSIGN    
         0x08                  GAPBOND_KEYDIST_PLINK   
         0x10                  GAPBOND_KEYDIST_CENCKEY 
         0x20                  GAPBOND_KEYDIST_CIDKEY  
         0x40                  GAPBOND_KEYDIST_CSIGN   
         0x80                  GAPBOND_KEYDIST_CLINK   
         ===================== ========================================================

**Events Generated**

When this command is received, the host will send the CommandStatus Event. When the pairing process is complete (either SUCCESS or Failure), a GAP_AuthenticationComplete will be generated. If a passkey is needed, a GAP_PasskeyNeeded will be generated.

GAP_TerminateAuth
-----------------
:Opcode: 0xFE10
:Command Description: Send this command to terminate a pairing process.

**Command Parameters**

:Connection Handle: Identifies the connection.

 :Size: 2 byte(s)
 :Default: 0x0000
 :Range: 0x0000 to 0x0EFF

:reason: Pairing Failed Message reason field.

 :Size: 1 byte(s)
 :Default: 3
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x00                  SUCCESS
         0x01                  SMP_PAIRING_FAILED_PASSKEY_ENTRY_FAILED
         0x02                  SMP_PAIRING_FAILED_OOB_NOT_AVAIL
         0x03                  SMP_PAIRING_FAILED_AUTH_REQ
         0x04                  SMP_PAIRING_FAILED_CONFIRM_VALUE
         0x05                  SMP_PAIRING_FAILED_NOT_SUPPORTED
         0x06                  SMP_PAIRING_FAILED_ENC_KEY_SIZE
         0x07                  SMP_PAIRING_FAILED_CMD_NOT_SUPPORTED
         0x08                  SMP_PAIRING_FAILED_UNSPECIFIED
         0x09                  SMP_PAIRING_FAILED_REPEATED_ATTEMPTS
         0x0A                  SMP_PAIRING_FAILED_INVALID_PARAMETERS
         0x0B                  SMP_PAIRING_FAILED_DHKEY_CHECK_FAILED
         0x0C                  SMP_PAIRING_FAILED_NUM_COMPARISON_FAILED
         0x0D                  SMP_PAIRING_FAILED_BREDR_PAIR_IN_PROGRESS
         0x0E                  SMP_PAIRING_FAILED_CT_KEYDER_NOT_ALLOWED
         0x0F                  SMP_PAIRING_FAILED_KEY_REJECTED
         0x10                  Command Disallowed
         0x11                  Unsupported Feature Or Parameter Value
         0x12                  Invalid HCI Command Parameters
         0x17                  bleTimeout
         ===================== ========================================================

**Events Generated**

When this command is received, the host will send the CommandStatus Event. When the existing pairing had ended, the GAP_AuthenticationComplete with be generated.

GAP_UpdateLinkParamReq
----------------------
:Opcode: 0xFE11
:Command Description: Send this command to change the Link Layer connection parameters of a connection. This command can only be used when the local devices role is Central or peripheral.

**Command Parameters**

:Connection Handle: Identifies the connection.

 :Size: 2 byte(s)
 :Default: 0x0000
 :Range: 0x0000 to 0xFFFD

:intervalMin: Minimum value (* 1.25 ms) for the connection event interval. This shall be less than or equal to intervalMax.

 :Size: 2 byte(s)
 :Default: 80
 :Range: 6 - 3200

:intervalMax: Maximum value (* 1.25 ms) for the connection event interval. This shall be greater than or equal to intervalMin./

 :Size: 2 byte(s)
 :Default: 160
 :Range: 6 - 3200

:connLatency: The desired peripheral latency for the connection in number of connection events.

 :Size: 2 byte(s)
 :Default: 0
 :Range: 0 - 499

:connTimeout: The desired supervision timeout (* 10 ms)

 :Size: 2 byte(s)
 :Default: 1000
 :Range: 10 - 3200

**Events Generated**

When this command is received, the host will send the CommandStatus Event. When the connection parameters have been applied by the Controller, the GAP_LinkParamUpdate Event will be generated.

GAP_UpdateLinkParamReqReply
---------------------------
:Opcode: 0xFE12
:Command Description: Reply to a GAP_LinkParamUpdateRequest that was received from a remote device

**Command Parameters**

:Connection Handle: Identifies the connection.

 :Size: 2 byte(s)
 :Default: 0x0000
 :Range: 0x0000 to 0xFFFD

:intervalMin: Minimum value (* 1.25 ms) for the connection event interval. This shall be less than or equal to intervalMax.

 :Size: 2 byte(s)
 :Default: 80
 :Range: 6 - 3200

:intervalMax: Maximum value (* 1.25 ms) for the connection event interval. This shall be greater than or equal to intervalMin./

 :Size: 2 byte(s)
 :Default: 160
 :Range: 6 - 3200

:connLatency: The desired peripheral latency for the connection in number of connection events.

 :Size: 2 byte(s)
 :Default: 0
 :Range: 0 - 499

:connTimeout: The desired supervision timeout (* 10 ms)

 :Size: 2 byte(s)
 :Default: 1000
 :Range: 10 - 3200

:signalIdentifier: Signal ID for L2CAP Connection Parameter Update Request. 0 for LL Connection Parameter Request. This must match the signal ID provided by the corresponding update request.

 :Size: 1 byte(s)
 :Default: 1
 :Range: 0 - 255

:accepted: Yes to accept Parameter Update Request, No to reject it.

 :Size: 1 byte(s)
 :Default: 1
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x00                  No 
         0x01                  Yes  
         ===================== ========================================================

**Events Generated**

When this command is received, the host will send the CommandStatus Event. When the connection parameters have been applied by the Controller, the GAP_LinkParamUpdate Event will be generated.

Gap_RegisterConnEvent
---------------------
:Opcode: 0xFE13
:Command Description: Register/Unregister to receive connection event information.

**Command Parameters**

:Action: Whether to register or unregister.

 :Size: 1 byte(s)
 :Default: 0
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x00                  GAP_CB_REGISETER
         0x01                  GAP_CB_UNREGISTER
         ===================== ========================================================

:Connection Handle: Identifies the connection. If 0xFFFF, apply to all connections. Else, apply only for a specific connection

 :Size: 2 byte(s)
 :Default: 0xFFFF
 :Range: 0x0000 to 0xFFFD

:Event Type: Which Event Type Information to register to. This will prevent the event from getting generated after each connection event, instead it will be generated in specific cases of the connection event.

 :Size: 1 byte(s)
 :Default: 0x00
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x01                  GAP_CB_CONN_ESTABLISHED
         0x02                  GAP_CB_PHY_UPDATE
         0x03                  GAP_CB_CONN_ESTABLISHED | GAP_CB_PHY_UPDATE
         0xFF                  GAP_CB_CONN_EVENT_ALL
         ===================== ========================================================

**Events Generated**

When this command is received, the host will send the CommandStatus Event. If successfully registers, the GAP_ConnectionEventNotice Event will be generated after each connection event or on specific instances.

GapAdv_SetPeriodicAdvParams
---------------------------
:Opcode: 0xFE14
:Command Description: Create a periodic advertising set.

**Command Parameters**

:Handle: The extended advertising handle

 :Size: 1 byte(s)
 :Default: 0x00
 :Range: 0x00 to 0xEF

:Interval Min: Periodic interval minimum time = Min Interval * 1.25 ms

 :Size: 2 byte(s)
 :Default: 0x0006
 :Range: 0x0006 to 0xFFFF

:Interval Max: Periodic interval maximum time = Min Interval * 1.25 ms

 :Size: 2 byte(s)
 :Default: 0x0006
 :Range: 0x0006 to 0xFFFF

:Properties: Periodic advertising properties. Set 0x0040 to include TxPower in the advertising PDU

 :Size: 2 byte(s)
 :Default: 0x0000
 :Range: 0x0000 or 0x0040

**Events Generated**

When this command is received, the host will send the CommandStatus Event. If the host returns SUCCESS GapAdv_SetPeriodicAdvParams VS event will be received with the controller completion status

GapAdv_setPeriodicAdvData
-------------------------
:Opcode: 0xFE15
:Command Description: Add data to a periodic advertising set.

**Command Parameters**

:Handle: The extended advertising handle

 :Size: 1 byte(s)
 :Default: 0x00
 :Range: 0x00 to 0xEF

:Operation: Type of operation used to send the payload in the controller

 :Size: 1 byte(s)
 :Default: 0x03
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x00                  Intermediate fragment of data
         0x01                  First fragment of fragmented data
         0x02                  Last fragment of fragmented data
         0x03                  Complete data
         ===================== ========================================================

:Payload Length: 

 :Size: 1 byte(s)
 :Value: size(dataLen)

:Data: Periodic advertising data up to 252

 :Size: input byte(s)
 :Default: "00:11:22:33"
 :Range: 0 to 252

**Events Generated**

When this command is received, the host will send the CommandStatus Event. If the host returns SUCCESS GAPAdv_SetPeriodicAdvData VS event will be received with the controller completion status

GapAdv_SetPeriodicAdvEnable
---------------------------
:Opcode: 0xFE16
:Command Description: Enable a periodic advertising set

**Command Parameters**

:Enable: Enable or disable the periodic adverising set

 :Size: 1 byte(s)
 :Default: 0x00
 :Range: 0x00 to 0x01

:Handle: The extended advertising handle

 :Size: 1 byte(s)
 :Default: 0x00
 :Range: 0x00 to 0xEF

**Events Generated**

When this command is received, the host will send the CommandStatus Event. If the host returns SUCCESS GAPAdv_SetPeriodicAdvEnable VS event will be received with the controller completion status

GapScan_PeriodicAdvCreateSync
-----------------------------
:Opcode: 0xFE17
:Command Description: Set sync parameters for periodic scanning

**Command Parameters**

:advSID: Persiodic Advertising SID

 :Size: 1 byte(s)
 :Default: 0x00
 :Range: 0x00 to 0x0F

:options: Use periodic list and/or enable/disable periodic report

 :Size: 1 byte(s)
 :Default: 0x00
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x01                  Use Periodic Advertiser List
         0x02                  Disable Periodic Advertising Report
         ===================== ========================================================

:advAddrType: Advertiser Address Type

 :Size: 1 byte(s)
 :Default: 0x00
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x00                  PEER_ADDRTYPE_PUBLIC_OR_PUBLIC_ID
         0x01                  PEER_ADDRTYPE_RANDOM_OR_RANDOM_ID
         ===================== ========================================================

:advAddress: Advertiser Address

 :Size: 6 byte(s)
 :Default: "00:00:00:00:00:00"
 :Range: Any 6 byte value

:skip: Periodic Advertising events that can be skipped after a successful receive

 :Size: 2 byte(s)
 :Default: 0
 :Range: 0x0000 to 0x01F3

:syncTimeout: Synchronization timeout for the periodic advertising train

 :Size: 2 byte(s)
 :Default: 0x000A
 :Range: 0x000A-0x4000

:syncCteType: Select cte type for syncing periodic train (bit mask)

 :Size: 1 byte(s)
 :Default: 0x00
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x01                  Do not sync to packets with AoA
         0x02                  Do not sync to packets with 1us AoD
         0x04                  Do not sync to packets with 2us AoD
         0x08                  not in use
         0x10                  Do not sync to packets without CTE
         ===================== ========================================================

**Events Generated**

When this command is received, the host will send the CommandStatus Event. If the host returns SUCCESS GAPScan_PeriodicAdvCreateSync VS event will be received with the controller completion status

GapScan_PeriodicAdvCreateSyncCancel
-----------------------------------
:Opcode: 0xFE18
:Command Description: Cancel the ongoing scanner's synchronizing state

**Events Generated**

The host will send the CommandComplete Event to indicate whether the cancel was completed and periodic Advertising Sync Establish with status "Operation Cancelled by Host"

GapScan_PeriodicAdvTerminateSync
--------------------------------
:Opcode: 0xFE19
:Command Description: Used by the scanner to stop reception of the periodic advertising train identified by the syncHandle parameter

**Command Parameters**

:syncHandle: Periodic Advertising train identifier

 :Size: 2 byte(s)
 :Default: 0x0000
 :Range: 0x0000 to 0x0EFF

**Events Generated**

When this command is received, the host will send the CommandStatus Event. If the host returns SUCCESS GAPScan_PeriodicAdvTerminateSync VS event will be received with the controller completion status

GapScan_SetPeriodicAdvReceiveEnable
-----------------------------------
:Opcode: 0xFE1A
:Command Description: Used by the scanner to enabling or diabling the periodic advertising reports

**Command Parameters**

:syncHandle: Periodic Advertising train identifier

 :Size: 2 byte(s)
 :Default: 0x0000
 :Range: 0x0000 to 0x0EFF

:Enable: Enable or disable reports

 :Size: 1 byte(s)
 :Default: 1
 :Range: 0 to 1

**Events Generated**

When this command is received, the host will send the CommandStatus Event. If the host returns SUCCESS GAPScan_SetPeriodicAdvReceiveEnable VS event will be received with the controller completion status

GapScan_AddDeviceToPeriodicAdvList
----------------------------------
:Opcode: 0xFE1B
:Command Description: Adding device to the periodic advertiser list

**Command Parameters**

:advAddrType: Advertiser Address Type

 :Size: 1 byte(s)
 :Default: 0x00
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x00                  PEER_ADDRTYPE_PUBLIC_OR_PUBLIC_ID
         0x01                  PEER_ADDRTYPE_RANDOM_OR_RANDOM_ID
         ===================== ========================================================

:advAddress: Advertiser Address

 :Size: 6 byte(s)
 :Default: "00:00:00:00:00:00"
 :Range: Any 6 byte value

:advSID: Persiodic Advertising SID

 :Size: 1 byte(s)
 :Default: 0x00
 :Range: 0x00 to 0x0F

**Events Generated**

When this command is received, the host will send the CommandStatus Event. If the host returns SUCCESS GAPScan_AddDeviceToPeriodicAdvList VS event will be received with the controller completion status

GapScan_RemoveDeviceFromPeriodicAdvList
---------------------------------------
:Opcode: 0xFE1C
:Command Description: Removing device to the periodic advertiser list

**Command Parameters**

:advAddrType: Advertiser Address Type

 :Size: 1 byte(s)
 :Default: 0x00
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x00                  PEER_ADDRTYPE_PUBLIC_OR_PUBLIC_ID
         0x01                  PEER_ADDRTYPE_RANDOM_OR_RANDOM_ID
         ===================== ========================================================

:advAddress: Advertiser Address

 :Size: 6 byte(s)
 :Default: "00:00:00:00:00:00"
 :Range: Any 6 byte value

:advSID: Persiodic Advertising SID

 :Size: 1 byte(s)
 :Default: 0x00
 :Range: 0x00 to 0x0F

**Events Generated**

When this command is received, the host will send the CommandStatus Event. If the host returns SUCCESS GAPScan_RemoveDeviceFromPeriodicAdvList VS event will be received with the controller completion status

GapScan_ReadPeriodicAdvListSize
-------------------------------
:Opcode: 0xFE1D
:Command Description: Read the advertisers list size

**Events Generated**

When this command is received, the host will send the CommandStatus Event. After GAPScan_ReadPeriodicAdvListSize with the advertisers list size will be received

GapScan_ClearPeriodicAdvList
----------------------------
:Opcode: 0xFE1E
:Command Description: Clear the advertisers list size

**Events Generated**

When this command is received, the host will send the CommandStatus Event. If the host returns SUCCESS GAPScan_ClearPeriodicAdvList VS event will be received with the controller completion status

GAP_Bond
--------
:Opcode: 0xFE0F
:Command Description: Send this command for a connected and bound device to load the encryption key.

**Command Parameters**

:Connection Handle: Identifies the connection.

 :Size: 2 byte(s)
 :Default: 0x0000
 :Range: 0x0000 to 0xFFFD

:authenticated: 1 if authenticated. 0 if not.

 :Size: 1 byte(s)
 :Default: 0
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x00                  No 
         0x01                  Yes  
         ===================== ========================================================

:secureConnections: 1 if Secure Connections. 0 if not.

 :Size: 1 byte(s)
 :Default: 0
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x00                  No 
         0x01                  Yes  
         ===================== ========================================================

:secInfo.LTK: Long Term Key

 :Size: 16 byte(s)
 :Default: "4d:9f:88:5a:6e:03:12:fe:00:00:00:00:00:00:00:00"
 :Range: Any 16 byte value

:secInfo.DIV: Diversifier

 :Size: 2 byte(s)
 :Default: 0x1111
 :Range: Any 16-bit value

:secInfo.rand: LTK Rand pairing

 :Size: 8 byte(s)
 :Default: "11:22:33:44:55:66:77:88"
 :Range: Any 8-byte value

:secInfo.LTKsize: LTK Key size (bytes)

 :Size: 1 byte(s)
 :Default: 16
 :Range: 7-16

**Events Generated**

When this command is received, the host will send the CommandStatus Event.  When both connected devices have setup encryption, the GAP_BondComplete is generated.

GAP_Signable
------------
:Opcode: 0xFE0E
:Command Description: Send this command for a connected and bound device to enable signed data.

**Command Parameters**

:connectionHandle: Used to identify the connection

 :Size: 2 byte(s)
 :Default: 0
 :Range: 0 - 0xFFFD

:authenticated: "1 if the signing information was authenticated; 0 otherwise

 :Size: 1 byte(s)
 :Default: 0
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x00                  No 
         0x01                  Yes  
         ===================== ========================================================

:CSRK: Connection Signature Resolving Key for the connected device

 :Size: 16 byte(s)
 :Default: 0
 :Range: Any 16 byte value

:signCounter: Sign Counter for the connected device

 :Size: 4 byte(s)
 :Default: 0
 :Range: Any 4 byte value

**Events Generated**

When this command is received, the host will send the CommandStatus Event.

GAP_PasskeyUpdate
-----------------
:Opcode: 0xFE0C
:Command Description: Send this command when the GAP Passkey Needed Event is received. This command sends a passkey needed during the Pairing Process.

**Command Parameters**

:connectionHandle: Used to identify the connection

 :Size: 2 byte(s)
 :Default: 0
 :Range: 0 - 0xFFFD

:Passkey: 6 character ASCII string of numbers (ex. 019655? )

 :Size: 6 byte(s)
 :Default: "019655"
 :Range: Any 6 character string

**Events Generated**

When this command is received, the host will send the CommandStatus Event.

GAP_PeripheralSecurityRequest
-----------------------------
:Opcode: 0xFE0D
:Command Description: Send this command, Peripheral Role only, to initiate security from a peripheral device. This message is also sent, by the Peripheral, to upgrade security (Pairing) to "Authenticated", make sure to ask for Man-In-The-Middle (MITM) protection in the "authReq" field.

**Command Parameters**

:connectionHandle: Used to identify the connection

 :Size: 2 byte(s)
 :Default: 0
 :Range: 0 - 0xFFFD

:authReq: A bit field that indicates the requested security properties for STK and GAP bonding information.

 :Size: 1 byte(s)
 :Default: 5
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x01                  Bonding   
         0x04                  MITM      
         0x08                  SC        
         0x10                  KP        
         0x20                  CT2       
         ===================== ========================================================

**Events Generated**

When this command is received, the host will send the CommandStatus Event.

GapConfig_SetParameter
----------------------
:Opcode: 0xFE2F
:Command Description: Set a configuration parameter (IRK or SRK)

**Command Parameters**

:paramID: Parameter ID

 :Size: 1 byte(s)
 :Default: 0
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0                     GAP_CONFIG_PARAM_IRK
         1                     GAP_CONFIG_PARAM_SRK
         2                     GAP_CONFIG_PARAM_IRK_UPDATE_IMMED
         ===================== ========================================================

:paramValue: Key to set the parameter with

 :Size: 16 byte(s)
 :Default: "00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00"
 :Range: Any 16-byte value

**Events Generated**

When this command is received, the host will send the CommandStatus Event.

GAP_SetParamValue
-----------------
:Opcode: 0xFE30
:Command Description: Set a GAP Parameter. See the respective parameter for more information

**Command Parameters**

:paramID: Parameter to Set

 :Size: 1 byte(s)
 :Default: 0
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0                     GAP_PARAM_LINK_UPDATE_DECISION
         1                     GAP_PARAM_CONN_PARAM_TIMEOUT
         2                     GAP_PARAM_PRIVATE_ADDR_INT
         3                     GAP_PARAM_SM_TIMEOUT
         4                     GAP_PARAM_SM_MIN_KEY_LEN
         5                     GAP_PARAM_SM_MAX_KEY_LEN
         6                     GAP_PARAM_AUTH_TASK_ID
         7                     GAP_PARAM_VERIFY_CAR
         8                     GAP_PARAM_GGS_PARAMS
         9                     GAP_PARAM_GAP_TESTCODE
         10                    GAP_PARAM_SM_TESTCODE
         11                    GAP_PARAM_GATT_TESTCODE
         12                    GAP_PARAM_ATT_TESTCODE
         13                    GAP_PARAM_L2CAP_TESTCODE
         14                    GAP_PARAM_SET_SCAN_CHAN
         ===================== ========================================================

:GAP_PARAM_LINK_UPDATE_DECISION: Action to take upon receiving a parameter update request

 :Condition: ( paramID == 0)
 :Size: 2 byte(s)
 :Default: 0x02
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x00                  GAP_UPDATE_REQ_ACCEPT_ALL
         0x01                  GAP_UPDATE_REQ_DENY_ALL
         0x02                  GAP_UPDATE_REQ_PASS_TO_APP
         ===================== ========================================================

:GAP_PARAM_CONN_PARAM_TIMEOUT:  Minimum time after an L2CAP Connection Parameter Update Response has been received that a L2CAP Connection Parameter Update Request can be sent. See section Version 5.0 Vol 3, Part C, Section 9.3.9.2 of the BT Core Spec

 :Condition: ( paramID == 1)
 :Size: 2 byte(s)
 :Default: 30000
 :Range: 1-65535

:GAP_PARAM_PRIVATE_ADDR_INT: Minimum Time Interval between private (resolvable) address changes (in minutes)

 :Condition: ( paramID == 2)
 :Size: 2 byte(s)
 :Default: 15
 :Range: 1-65535

:GAP_PARAM_SM_TIMEOUT: Time to wait for security manager response before returning bleTimeout (in ms)

 :Condition: ( paramID == 3)
 :Size: 2 byte(s)
 :Default: 30000
 :Range: 1-65535

:GAP_PARAM_SM_MIN_KEY_LEN: SM Minimum Key Length supported

 :Condition: ( paramID == 4)
 :Size: 2 byte(s)
 :Default: 7
 :Range: 1-65535

:GAP_PARAM_SM_MAX_KEY_LEN: SM Maximum Key Length supported

 :Condition: ( paramID == 5)
 :Size: 2 byte(s)
 :Default: 16
 :Range: 1-65535

:GAP_PARAM_AUTH_TASK_ID: For TestMode Only

 :Condition: ( paramID == 6)
 :Size: 2 byte(s)
 :Default: 0xFF
 :Range: Any 2 byte value

:GAP_PARAM_VERIFY_CAR: Verify the Central Address Resolution (CAR) characteristic is set before sending directed advertisements using RPA

 :Condition: ( paramID == 7)
 :Size: 2 byte(s)
 :Default: 1
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x00                  No 
         0x01                  Yes  
         ===================== ========================================================

:GAP_PARAM_GGS_PARAMS: For TestMode Only

 :Condition: ( paramID == 8)
 :Size: 2 byte(s)
 :Default: 30720
 :Range: For TestMode Only

:GAP_PARAM_GAP_TESTCODE: For TestMode Only

 :Condition: ( paramID == 9)
 :Size: 2 byte(s)
 :Default: 30720
 :Range: For TestMode Only

:GAP_PARAM_SM_TESTCODE: For TestMode Only

 :Condition: ( paramID == 10)
 :Size: 2 byte(s)
 :Default: 30720
 :Range: For TestMode Only

:GAP_PARAM_GATT_TESTCODE: For TestMode Only

 :Condition: ( paramID == 11)
 :Size: 2 byte(s)
 :Default: 30720
 :Range: For TestMode Only

:GAP_PARAM_ATT_TESTCODE: For TestMode Only

 :Condition: ( paramID == 12)
 :Size: 2 byte(s)
 :Default: 30720
 :Range: For TestMode Only

:GAP_PARAM_L2CAP_TESTCODE: For TestMode Only

 :Condition: ( paramID == 13)
 :Size: 2 byte(s)
 :Default: 30720
 :Range: For TestMode Only

:GAP_PARAM_SET_SCAN_CHAN: Set the Scan Channels Mapping

 :Condition: ( paramID == 14)
 :Size: 2 byte(s)
 :Default: 0x7
 :Range: 1-7

**Events Generated**

When this command is received, the host will send the CommandStatus Event.

GAP_GetParamValue
-----------------
:Opcode: 0xFE31
:Command Description: Get a Parameter value.

**Command Parameters**

:paramID: Parameter to get

 :Size: 1 byte(s)
 :Default: 0
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0                     GAP_PARAM_LINK_UPDATE_DECISION
         1                     GAP_PARAM_CONN_PARAM_TIMEOUT
         2                     GAP_PARAM_PRIVATE_ADDR_INT
         3                     GAP_PARAM_SM_TIMEOUT
         4                     GAP_PARAM_SM_MIN_KEY_LEN
         5                     GAP_PARAM_SM_MAX_KEY_LEN
         6                     GAP_PARAM_AUTH_TASK_ID
         7                     GAP_PARAM_VERIFY_CAR
         8                     GAP_PARAM_GGS_PARAMS
         9                     GAP_PARAM_GAP_TESTCODE
         10                    GAP_PARAM_SM_TESTCODE
         11                    GAP_PARAM_GATT_TESTCODE
         12                    GAP_PARAM_ATT_TESTCODE
         13                    GAP_PARAM_L2CAP_TESTCODE
         14                    GAP_PARAM_SET_SCAN_CHAN
         ===================== ========================================================

**Events Generated**

When this command is received, the host will send the CommandStatus Event.

GapAdv_create
-------------
:Opcode: 0xFE3E
:Command Description: Create an advertising set.

**Command Parameters**

:Properties: Advertising Event Properties bit field

 :Size: 2 byte(s)
 :Default: 0x0013
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x0001                GAP_ADV_PROP_CONNECTABLE
         0x0002                GAP_ADV_PROP_SCANNABLE
         0x0004                GAP_ADV_PROP_DIRECTED
         0x0008                GAP_ADV_PROP_HDC
         0x0010                GAP_ADV_PROP_LEGACY
         0x0020                GAP_ADV_PROP_ANONYMOUS
         0x0040                GAP_ADV_PROP_TX_POWER
         ===================== ========================================================

:Interval Min: 

 :Size: 3 byte(s)
 :Default: 160
 :Range: 20 ms to 10,485.759375 s

:Interval Max: 

 :Size: 3 byte(s)
 :Default: 160
 :Range:  ms to 10,485.759375 s

:Primary channel map: 

 :Size: 1 byte(s)
 :Default: 0x07
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x01                  GAP_ADV_CHAN_37
         0x02                  GAP_ADV_CHAN_38
         0x04                  GAP_ADV_CHAN_39
         ===================== ========================================================

:Peer address type: 

 :Size: 1 byte(s)
 :Default: 0x00
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x00                  PEER_ADDRTYPE_PUBLIC_OR_PUBLIC_ID
         0x01                  PEER_ADDRTYPE_RANDOM_OR_RANDOM_ID
         ===================== ========================================================

:Peer Address: Address of the peer. Only applicable for directed advertising.

 :Size: 6 byte(s)
 :Default: "00:00:00:00:00:00"
 :Range: Any 6 byte value.

:Filter Policy: 

 :Size: 1 byte(s)
 :Default: 0x00
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x00                  GAP_ADV_AL_POLICY_ANY_REQ
         0x01                  GAP_ADV_AL_POLICY_AL_SCAN_REQ
         0x02                  GAP_ADV_AL_POLICY_AL_CONNECT_IND
         0x03                  GAP_ADV_AL_POLICY_AL_ALL_REQ
         ===================== ========================================================

:Tx Power: 

 :Size: 1 byte(s)
 :Default: 127
 :Range: 0 - 127

:Primary PHY: 

 :Size: 1 byte(s)
 :Default: 0x01
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x01                  GAP_ADV_PRIM_PHY_1_MBPS
         0x03                  GAP_ADV_PRIM_PHY_CODED_S8
         0x83                  GAP_ADV_PRIM_PHY_CODED_S2
         ===================== ========================================================

:Secoondary PHY: 

 :Size: 1 byte(s)
 :Default: 0x01
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x01                  GAP_ADV_SEC_PHY_1_MBPS
         0x02                  GAP_ADV_SEC_PHY_2_MBPS
         0x03                  GAP_ADV_SEC_PHY_CODED_S8
         0x83                  GAP_ADV_SEC_PHY_CODED_S2
         ===================== ========================================================

:sid: 

 :Size: 1 byte(s)
 :Default: 0
 :Range: 0-15

**Events Generated**

The host will send the CommandStatus Event to indicate the advertising handle that is associated with this set.

**Additional Command Status Return Parameters**

:length: Length of data

 :Size: 1 byte(s)
 :Range: 

:handle: Advertising handle

 :Size: 1 byte(s)
 :Range: 


GapAdv_enable
-------------
:Opcode: 0xFE3F
:Command Description:  This will attempt to enable advertising for a set identified by the handle. The advertising set must first be created with GapAdv_create.

**Command Parameters**

:handle: handle of the advertisement set

 :Size: 1 byte(s)
 :Default: 0x00
 :Range: 0x00 - 0xFE

:enable options: Whether to use the max possible duration for advertising, a user specified duration, or a user specified maximum number of events. Note that if the max possible duration is used, the maxEvent parameter is not applicable.

 :Size: 1 byte(s)
 :Default: 0x00
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x00                  GAP_ADV_ENABLE_OPTIONS_USE_MAX
         0x01                  GAP_ADV_ENABLE_OPTIONS_USE_DURATION
         0x02                  GAP_ADV_ENABLE_OPTIONS_USE_MAX_EVENTS
         ===================== ========================================================

:duration or max event: 

 :Size: 2 byte(s)
 :Default: 0x00
 :Range: 10 ms to 655,540 ms.

**Events Generated**

The host will send the CommandStatus Event to indicate the advertising handle that is associated with this set.  Also, if enabled by GapAdv_setEventMask, GAP_Advertiser/Scanner_Event events with the following event ID's can be received: GAP_EVT_ADV_START_AFTER_ENABLE after advertising is enabled, GAP_EVT_ADV_START after each advertising set starts, GAP_EVT_ADV_END after each advertising set ends, GAP_EVT_SCAN_REQ_RECEIVED after received scan requests

GapAdv_disable
--------------
:Opcode: 0xFE40
:Command Description: Disable an active advertising set.

**Command Parameters**

:handle: handle of the advertisement

 :Size: 1 byte(s)
 :Default: 0x00
 :Range: 0x00 - 0xFE

**Events Generated**

When this command is received, the host will send the CommandStatus Event to indicate advertising has been disabled.

GapAdv_setParam
---------------
:Opcode: 0xFE42
:Command Description: Set a parameter for an advertising set by advertising handle.

**Command Parameters**

:handle: handle of the advertisement set

 :Size: 1 byte(s)
 :Default: 0x00
 :Range: 0x00 - 0x0FE

:ParamID: identification of the data to set 

 :Size: 1 byte(s)
 :Default: 0x00
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0                     GAP_ADV_PARAM_PROPS
         1                     GAP_ADV_PARAM_PRIMARY_INTERVAL_MIN
         2                     GAP_ADV_PARAM_PRIMARY_INTERVAL_MAX
         3                     GAP_ADV_PARAM_PRIMARY_CHANNEL_MAP
         4                     GAP_ADV_PARAM_PEER_ADDRESS_TYPE
         5                     GAP_ADV_PARAM_PEER_ADDRESS
         6                     GAP_ADV_PARAM_FILTER_POLICY
         7                     GAP_ADV_PARAM_TX_POWER
         8                     GAP_ADV_PARAM_PRIMARY_PHY
         9                     GAP_ADV_PARAM_SECONDARY_PHY
         10                    GAP_ADV_PARAM_SID
         11                    GAP_ADV_PARAM_OWN_ADDRESS_TYPE
         12                    GAP_ADV_PARAM_ZERODELAY
         ===================== ========================================================

:Properties: Advertising Event Properties bit field

 :Condition: ( paramID == 0x0)
 :Size: 2 byte(s)
 :Default: 0x0013
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x0001                GAP_ADV_PROP_CONNECTABLE
         0x0002                GAP_ADV_PROP_SCANNABLE
         0x0004                GAP_ADV_PROP_DIRECTED
         0x0008                GAP_ADV_PROP_HDC
         0x0010                GAP_ADV_PROP_LEGACY
         0x0020                GAP_ADV_PROP_ANONYMOUS
         0x0040                GAP_ADV_PROP_TX_POWER
         ===================== ========================================================

:Interval Min: Minimum advertising interval (n * 0.625 ms)

 :Condition: ( paramID == 0x1)
 :Size: 3 byte(s)
 :Default: 160
 :Range: 20 ms to 10,485.759375 s

:Interval Max: Maximum advertising interval (n * 0.625 ms). This is currently ignored; the minimum advertising interval will always be used.

 :Condition: ( paramID == 0x2)
 :Size: 3 byte(s)
 :Default: 160
 :Range: 20 ms to 10,485.759375 s

:Primary channel map: A bit field that indicates the advertising channels that shall be used when transmitting advertising packets on primary channels

 :Condition: ( paramID == 0x3)
 :Size: 1 byte(s)
 :Default: 7
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x01                  GAP_ADV_CHAN_37
         0x02                  GAP_ADV_CHAN_38
         0x04                  GAP_ADV_CHAN_39
         ===================== ========================================================

:Peer address type: Address type of the peer. Only applicable for directed advertising.

 :Condition: ( paramID == 0x4)
 :Size: 1 byte(s)
 :Default: Public
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x00                  PEER_ADDRTYPE_PUBLIC_OR_PUBLIC_ID
         0x01                  PEER_ADDRTYPE_RANDOM_OR_RANDOM_ID
         ===================== ========================================================

:Peer address: The Peer address  for directed advertising.

 :Condition: ( paramID == 0x5)
 :Size: 6 byte(s)
 :Default: "00:00:00:00:00:00"
 :Range: Any 6 byte value

:Filter Policy: Advertising filter policy.

 :Condition: ( paramID == 0x6)
 :Size: 1 byte(s)
 :Default: 0
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x00                  GAP_ADV_AL_POLICY_ANY_REQ
         0x01                  GAP_ADV_AL_POLICY_AL_SCAN_REQ
         0x02                  GAP_ADV_AL_POLICY_AL_CONNECT_IND
         0x03                  GAP_ADV_AL_POLICY_AL_ALL_REQ
         ===================== ========================================================

:Tx power: The maximum power level at which the advertising packets are to be transmitted on the advertising channels. The Controller will choose a power level lower than or equal to this. The range is 0 - 126 or 127 if there is no preference.

 :Condition: ( paramID == 0x7)
 :Size: 1 byte(s)
 :Default: 127
 :Range: 0-127

:Primary PHY: The PHY on which the advertising packets are transmitted on the primary advertising channels.

 :Condition: ( paramID == 0x8)
 :Size: 1 byte(s)
 :Default: 1
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x01                  GAP_ADV_PRIM_PHY_1_MBPS
         0x03                  GAP_ADV_PRIM_PHY_CODED_S8
         0x83                  GAP_ADV_PRIM_PHY_CODED_S2
         ===================== ========================================================

:Secondary PHY: The PHY on which the advertising packets are transmitted on the secondary advertising channels.

 :Condition: ( paramID == 0x9)
 :Size: 1 byte(s)
 :Default: 1
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x01                  GAP_ADV_SEC_PHY_1_MBPS
         0x02                  GAP_ADV_SEC_PHY_2_MBPS
         0x03                  GAP_ADV_SEC_PHY_CODED_S8
         0x83                  GAP_ADV_SEC_PHY_CODED_S2
         ===================== ========================================================

:SID: This is the value to be transmitted in the Advertising SID subfield of the ADI field of the Extended Header of those advertising channel PDUs that have an ADI field. If the advertising set only uses PDUs that do not contain an ADI field, this parameter is ignored. The range is 0-15.

 :Condition: ( paramID == 0xA)
 :Size: 1 byte(s)
 :Default: 0
 :Range: 0-15

:addrMode: Address Mode

 :Condition: ( paramID == 0xB)
 :Size: 1 byte(s)
 :Default: 2
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x00                  ADDRMODE_PUBLIC
         0x01                  ADDRMODE_RANDOM
         0x02                  ADDRMODE_RP_WITH_PUBLIC_ID
         0x03                  ADDRMODE_RP_WITH_RANDOM_ID
         ===================== ========================================================

:zeroDelay: This is the condition which determines if an extra random delay between advertising sets will be generated. if 0, a delay will be generated. if 1, there will be no extra delay. default - 0.

 :Condition: ( paramID == 0xC)
 :Size: 1 byte(s)
 :Default: 0x0
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0                     Disable
         1                     Enable
         ===================== ========================================================

**Events Generated**

The host will send the CommandStatus Event to indicate the parameter has been set.

GapAdv_destroy
--------------
:Opcode: 0xFE41
:Command Description: Delete an advertising set. This will free any memory associated with the advertising set.

**Command Parameters**

:handle: handle of the advertisement set to handle

 :Size: 1 byte(s)
 :Default: 0x00
 :Range: 0x00-0xFE

**Events Generated**

The host will send the CommandStatus Event to indicate the set has been destroyed.

GapAdv_getParam
---------------
:Opcode: 0xFE43
:Command Description: Get an advertising parameter for an advertising set.

**Command Parameters**

:handle: handle of the advertisement set to handle

 :Size: 1 byte(s)
 :Default: 0x00
 :Range: 0x00 - 0xFE

:paramId: parameter ID to get

 :Size: 1 byte(s)
 :Default: 0x00
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0                     GAP_ADV_PARAM_PROPS
         1                     GAP_ADV_PARAM_PRIMARY_INTERVAL_MIN
         2                     GAP_ADV_PARAM_PRIMARY_INTERVAL_MAX
         3                     GAP_ADV_PARAM_PRIMARY_CHANNEL_MAP
         4                     GAP_ADV_PARAM_PEER_ADDRESS_TYPE
         5                     GAP_ADV_PARAM_PEER_ADDRESS
         6                     GAP_ADV_PARAM_FILTER_POLICY
         7                     GAP_ADV_PARAM_TX_POWER
         8                     GAP_ADV_PARAM_PRIMARY_PHY
         9                     GAP_ADV_PARAM_SECONDARY_PHY
         10                    GAP_ADV_PARAM_SID
         11                    GAP_ADV_PARAM_OWN_ADDRESS_TYPE
         12                    GAP_ADV_PARAM_ZERODELAY
         ===================== ========================================================

**Events Generated**

The host will send the CommandStatus Event to return the parameter value in question.

**Additional Command Status Return Parameters**

:length: 

 :Size: 1 byte(s)
 :Range: 

:paramId: 

 :Condition: ( StatStatus==0x00)
 :Size: 1 byte(s)
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0                     GAP_ADV_PARAM_PROPS
         1                     GAP_ADV_PARAM_PRIMARY_INTERVAL_MIN
         2                     GAP_ADV_PARAM_PRIMARY_INTERVAL_MAX
         3                     GAP_ADV_PARAM_PRIMARY_CHANNEL_MAP
         4                     GAP_ADV_PARAM_PEER_ADDRESS_TYPE
         5                     GAP_ADV_PARAM_PEER_ADDRESS
         6                     GAP_ADV_PARAM_FILTER_POLICY
         7                     GAP_ADV_PARAM_TX_POWER
         8                     GAP_ADV_PARAM_PRIMARY_PHY
         9                     GAP_ADV_PARAM_SECONDARY_PHY
         10                    GAP_ADV_PARAM_SID
         11                    GAP_ADV_PARAM_OWN_ADDRESS_TYPE
         12                    GAP_ADV_PARAM_ZERODELAY
         ===================== ========================================================

:GAP_ADV_PARAM_PROPS: 

 :Condition: ( StatStatus==0x00 paramId==0x00)
 :Size: 2 byte(s)
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x0001                GAP_ADV_PROP_CONNECTABLE
         0x0002                GAP_ADV_PROP_SCANNABLE
         0x0004                GAP_ADV_PROP_DIRECTED
         0x0008                GAP_ADV_PROP_HDC
         0x0010                GAP_ADV_PROP_LEGACY
         0x0020                GAP_ADV_PROP_ANONYMOUS
         0x0040                GAP_ADV_PROP_TX_POWER
         ===================== ========================================================

:GAP_ADV_PARAM_PRIMARY_INTERVAL_MIN: 

 :Condition: ( StatStatus==0x00 paramId==0x01)
 :Size: 3 byte(s)
 :Range: 

:GAP_ADV_PARAM_PRIMARY_INTERVAL_MAX: 

 :Condition: ( StatStatus==0x00 paramId==0x02)
 :Size: 3 byte(s)
 :Range: 

:GAP_ADV_PARAM_PRIMARY_CHANNEL_MAP: 

 :Condition: ( StatStatus==0x00 paramId==0x03)
 :Size: 1 byte(s)
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x01                  GAP_ADV_CHAN_37
         0x02                  GAP_ADV_CHAN_38
         0x04                  GAP_ADV_CHAN_39
         ===================== ========================================================

:GAP_ADV_PARAM_PEER_ADDRESS_TYPE: 

 :Condition: ( StatStatus==0x00 paramId==0x04)
 :Size: 1 byte(s)
 :Range: 

:GAP_ADV_PARAM_PEER_ADDRESS: Note! The value is byte-reversed.

 :Condition: ( StatStatus==0x00 paramId==0x05)
 :Size: 6 byte(s)
 :Range: 

:GAP_ADV_PARAM_FILTER_POLICY: 

 :Condition: ( StatStatus==0x00 paramId==0x06)
 :Size: 1 byte(s)
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x00                  GAP_ADV_AL_POLICY_ANY_REQ
         0x01                  GAP_ADV_AL_POLICY_AL_SCAN_REQ
         0x02                  GAP_ADV_AL_POLICY_AL_CONNECT_IND
         0x03                  GAP_ADV_AL_POLICY_AL_ALL_REQ
         ===================== ========================================================

:GAP_ADV_PARAM_TX_POWER: 

 :Condition: ( StatStatus==0x00 paramId==0x07)
 :Size: 1 byte(s)
 :Range: 

:GAP_ADV_PARAM_PRIMARY_PHY: 

 :Condition: ( StatStatus==0x00 paramId==0x08)
 :Size: 1 byte(s)
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x01                  GAP_ADV_PRIM_PHY_1_MBPS
         0x03                  GAP_ADV_PRIM_PHY_CODED_S8
         0x83                  GAP_ADV_PRIM_PHY_CODED_S2
         ===================== ========================================================

:GAP_ADV_PARAM_SECONDARY_PHY: 

 :Condition: ( StatStatus==0x00 paramId==0x09)
 :Size: 1 byte(s)
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x01                  GAP_ADV_SEC_PHY_1_MBPS
         0x02                  GAP_ADV_SEC_PHY_2_MBPS
         0x03                  GAP_ADV_SEC_PHY_CODED_S8
         0x83                  GAP_ADV_SEC_PHY_CODED_S2
         ===================== ========================================================

:GAP_ADV_PARAM_SID: 

 :Condition: ( StatStatus==0x00 paramId==0x0A)
 :Size: 1 byte(s)
 :Range: 

:GAP_ADV_PARAM_OWN_ADDRESS_TYPE: 

 :Condition: ( StatStatus==0x00 paramId==0x0B)
 :Size: 1 byte(s)
 :Range: 

:GAP_ADV_PARAM_ZERODELAY: 

 :Condition: ( StatStatus==0x00 paramId==0x0C)
 :Size: 1 byte(s)
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0                     Disable
         1                     Enable
         ===================== ========================================================


GapAdv_loadData
---------------
:Opcode: 0xFE44
:Command Description: Load advertising or scan response data to an advertising set by handle.

**Command Parameters**

:Layer: 

 :Size: 1 byte(s)
 :Value: 9

:Event Opcode: 

 :Size: 2 byte(s)
 :Value: 0xFE44

:Payload Length: 

 :Size: 2 byte(s)
 :Value: size(HandleLen)+size(type)+size(LengthLen)+size(dataLen)

:Handle: Handle of the advertisement set

 :Size: 1 byte(s)
 :Default: 0x00
 :Range: 0x00 - 0xFE

:type: Type of Data to Load

 :Size: 1 byte(s)
 :Default: 0x00
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0                     GAP_ADV_DATA_TYPE_ADV
         1                     GAP_ADV_DATA_TYPE_SCAN_RSP
         ===================== ========================================================

:Data length: The number of bytesthe Advertising Data parameter

 :Size: 2 byte(s)
 :Default: 16
 :Range: 0-251

:Adv Data: Data

 :Size: input byte(s)
 :Default: "00:01:02:03:04:05:06:07:08:09:0A:0B:0C:0D:0E:0F"
 :Range: This parameter has a variable length.

**Events Generated**

The host will send the CommandStatus Event to indicate the data has been loaded.

GapAdv_setEventMask
-------------------
:Opcode: 0xFE45
:Command Description: Set the per-advertising set event mask to select which events are sent

**Command Parameters**

:handle: handle of the advertisement set to handle

 :Size: 1 byte(s)
 :Default: 0x00
 :Range: 0x00 - 0xFE

:Event Mask: Bitfield to enable / disable callback events:

 :Size: 2 byte(s)
 :Default: 0x0000
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x01                  GAP_EVT_SCAN_REQ_RECEIVED
         0x02                  GAP_EVT_ADV_SET_TERMINATED
         0x10                  GAP_EVT_ADV_START_AFTER_ENABLE
         0x20                  GAP_EVT_ADV_START
         0x40                  GAP_EVT_ADV_END
         0x80                  GAP_EVT_ADV_END_AFTER_DISABLE
         ===================== ========================================================

**Events Generated**

The host will send the CommandStatus Event to indicate the event mask has been set.

GapAdv_setVirtualAdvAddr
------------------------
:Opcode: 0xFE4B
:Command Description: Set the advertiser's virtual public address. This api shuold be used after a handle was created using GapAdv_create and before enabling the advertise set using GapAdv_enable. Setting virtual address is allowed only for Legacy Non-Connectable and Non-Scanable PDUs.

**Command Parameters**

:Handle: Adv handle to which address will be assigned

 :Size: 1 byte(s)
 :Default: "0"
 :Range: From 0 to 20 sets

:BDADDR: Advertiser's virtual public address

 :Size: 6 byte(s)
 :Default: "00:00:00:00:00:00"
 :Range: Any 6 byte value

**Events Generated**

The host will send the CommandStatus Event to indicate that the virtual address was associated

GapScan_enable
--------------
:Opcode: 0xFE51
:Command Description: Start scanning.

**Command Parameters**

:period: scan period in 1.28 sec. Ignore if duration is 0

 :Size: 2 byte(s)
 :Default: 0
 :Range: 1-65535

:duration: scan duration in 10 ms. If 0, scanning will not end until GapScan_disable is called. the time of scan duration shall be greater than the time of scan window.

 :Size: 2 byte(s)
 :Default: 500
 :Range: 1-65535

:max number of records: if non-zero, up to this number of adv reports will be recoreded during scanning

 :Size: 1 byte(s)
 :Default: 40
 :Range: 1-65535 or until the heap is exhausted

**Events Generated**

The host will send the CommandStatus Event to indicate the scan has started

GapScan_disable
---------------
:Opcode: 0xFE52
:Command Description: Stop the currently running scanning operation.

**Events Generated**

The host will send the CommandStatus Event to indicate the scan has ended.

GapScan_setPhyParams
--------------------
:Opcode: 0xFE53
:Command Description: Set parameters dependent on PHY. Note that if primPhys contains more than one PHY, the same parameters of those PHYs will be set with the same values.

**Command Parameters**

:primPhy: PHY(s) to use on primary advertising channels

 :Size: 1 byte(s)
 :Default: 0x01
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x01                  SCAN_PRIM_PHY_1M
         0x04                  SCAN_PRIM_PHY_CODED
         ===================== ========================================================

:type: scan type

 :Size: 1 byte(s)
 :Default: 0x00
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x00                  SCAN_TYPE_PASSIVE
         0x01                  SCAN_TYPE_ACTIVE
         ===================== ========================================================

:interval: scan interval in 625-us unit. shall be equal to or greater than window.

 :Size: 2 byte(s)
 :Default: 800
 :Range: 4-16384

:window: scan window in 625-us unit

 :Size: 2 byte(s)
 :Default: 800
 :Range: 4-16384

**Events Generated**

The host will send the CommandStatus Event to indicate the phy parameters have been set.

GapScan_getPhyParams
--------------------
:Opcode: 0xFE54
:Command Description: Get parameters of the specified PHY. Note that primPhy shall indicate only one PHY.

**Command Parameters**

:primPhy: PHY to retrieve parameters relevant to

 :Size: 1 byte(s)
 :Default: 0x01
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x01                  SCAN_PRIM_PHY_1M
         0x04                  SCAN_PRIM_PHY_CODED
         ===================== ========================================================

**Events Generated**

The host will send the CommandStatus Event to return the parameter value in question.

**Additional Command Status Return Parameters**

:length: Length of data

 :Size: 1 byte(s)
 :Range: 

:type: Scan type

 :Size: 1 byte(s)
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x00                  SCAN_TYPE_PASSIVE
         0x01                  SCAN_TYPE_ACTIVE
         ===================== ========================================================

:interval: Scan Interval

 :Size: 2 byte(s)
 :Range: 

:window: Scan window

 :Size: 2 byte(s)
 :Range: 


GapScan_setParam
----------------
:Opcode: 0xFE55
:Command Description: Set a scan parameter.

**Command Parameters**

:paramID: Parameter ID

 :Size: 1 byte(s)
 :Default: 0x00
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x00                  SCAN_PARAM_RPT_FIELDS
         0x01                  SCAN_PARAM_PRIM_PHYS
         0x02                  SCAN_PARAM_FLT_POLICY
         0x03                  SCAN_PARAM_FLT_PDU_TYPE
         0x04                  SCAN_PARAM_FLT_MIN_RSSI
         0x05                  SCAN_PARAM_FLT_DISC_MODE
         0x06                  SCAN_PARAM_FLT_DUP
         0x07                  SCAN_PARAM_NUM_ADV_RPT (Read-only)
         ===================== ========================================================

:SCAN_PARAM_RPT_FIELDS: Fields of advertising report to keep in the list

 :Condition: ( paramID == 0x0)
 :Size: 2 byte(s)
 :Default: 0x08a7
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x0001                SCAN_ADVRPT_FLD_EVENTTYPE
         0x0002                SCAN_ADVRPT_FLD_ADDRTYPE
         0x0004                SCAN_ADVRPT_FLD_ADDRESS
         0x0008                SCAN_ADVRPT_FLD_PRIMPHY
         0x0010                SCAN_ADVRPT_FLD_SECPHY
         0x0020                SCAN_ADVRPT_FLD_ADVSID
         0x0040                SCAN_ADVRPT_FLD_TXPOWER
         0x0080                SCAN_ADVRPT_FLD_RSSI
         0x0100                SCAN_ADVRPT_FLD_DIRADDRTYPE
         0x0200                SCAN_ADVRPT_FLD_DIRADDRESS
         0x0400                SCAN_ADVRPT_FLD_PRDADVINTERVAL
         0x0800                SCAN_ADVRPT_FLD_DATALEN
         ===================== ========================================================

:SCAN_PARAM_PRIM_PHYS: PHY to scan for on the primary channels

 :Condition: ( paramID == 0x1)
 :Size: 1 byte(s)
 :Default: 0x01
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x01                  SCAN_PRIM_PHY_1M
         0x04                  SCAN_PRIM_PHY_CODED
         ===================== ========================================================

:SCAN_PARAM_FLT_POLICY: Acceptlist filter policy

 :Condition: ( paramID == 0x2)
 :Size: 1 byte(s)
 :Default: 0x00
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x00                  SCAN_FLT_POLICY_ALL
         0x01                  SCAN_FLT_POLICY_AL
         0x02                  SCAN_FLT_POLICY_ALL_RPA
         0x03                  SCAN_FLT_POLICY_AL_RPA
         ===================== ========================================================

:SCAN_PARAM_FLT_PDU_TYPE: Filter by PDU types

 :Condition: ( paramID == 0x3)
 :Size: 2 byte(s)
 :Default: 0x0800
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x0001                SCAN_FLT_PDU_NONCONNECTABLE_ONLY
         0x0002                SCAN_FLT_PDU_CONNECTABLE_ONLY
         0x0004                SCAN_FLT_PDU_NONSCANNABLE_ONLY
         0x0008                SCAN_FLT_PDU_SCANNABLE_ONLY
         0x0010                SCAN_FLT_PDU_UNDIRECTED_ONLY
         0x0020                SCAN_FLT_PDU_DIRECTED_ONLY
         0x0040                SCAN_FLT_PDU_ADV_ONLY
         0x0080                SCAN_FLT_PDU_SCANRSP_ONLY
         0x0100                SCAN_FLT_PDU_EXTENDED_ONLY
         0x0200                SCAN_FLT_PDU_LEGACY_ONLY
         0x0400                SCAN_FLT_PDU_TRUNCATED_ONLY
         0x0800                SCAN_FLT_PDU_COMPLETE_ONLY
         ===================== ========================================================

:SCAN_PARAM_FLT_MIN_RSSI: Filter by RSSI. Note this is a signed one-byte value.

 :Condition: ( paramID == 0x4)
 :Size: 1 byte(s)
 :Default: -128
 :Range: -128 - 127

:SCAN_PARAM_FLT_DISC_MODE: Filter by discoverable mode

 :Condition: ( paramID == 0x5)
 :Size: 1 byte(s)
 :Default: 0x04
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x00                  SCAN_FLT_DISC_NONE
         0x01                  SCAN_FLT_DISC_GENERAL
         0x02                  SCAN_FLT_DISC_LIMITED
         0x03                  SCAN_FLT_DISC_ALL
         0x04                  SCAN_FLT_DISC_DISABLE
         ===================== ========================================================

:SCAN_PARAM_FLT_DUP: Duplicate Filter

 :Condition: ( paramID == 0x6)
 :Size: 1 byte(s)
 :Default: 0x01
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x00                  SCAN_FLT_DUP_DISABLE
         0x01                  SCAN_FLT_DUP_ENABLE
         0x02                  SCAN_FLT_DUP_RESET (Duplicate filtering enabled, reset for each scan period)
         ===================== ========================================================

**Events Generated**

The host will send the CommandStatus Event to indicate the parameter has been set.

GapScan_getParam
----------------
:Opcode: 0xFE56
:Command Description: Set a scan parameter.

**Command Parameters**

:paramID: Parameter ID

 :Size: 1 byte(s)
 :Default: 0x00
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x00                  SCAN_PARAM_RPT_FIELDS
         0x01                  SCAN_PARAM_PRIM_PHYS
         0x02                  SCAN_PARAM_FLT_POLICY
         0x03                  SCAN_PARAM_FLT_PDU_TYPE
         0x04                  SCAN_PARAM_FLT_MIN_RSSI
         0x05                  SCAN_PARAM_FLT_DISC_MODE
         0x06                  SCAN_PARAM_FLT_DUP
         0x07                  SCAN_PARAM_NUM_ADV_RPT (Read-only)
         ===================== ========================================================

**Events Generated**

The host will send the CommandStatus Event to return the parameter value in question.

**Additional Command Status Return Parameters**

:length: Length of data

 :Size: 1 byte(s)
 :Range: 

:paramId: 

 :Condition: ( StatStatus==0x00)
 :Size: 1 byte(s)
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x00                  SCAN_PARAM_RPT_FIELDS
         0x01                  SCAN_PARAM_PRIM_PHYS
         0x02                  SCAN_PARAM_FLT_POLICY
         0x03                  SCAN_PARAM_FLT_PDU_TYPE
         0x04                  SCAN_PARAM_FLT_MIN_RSSI
         0x05                  SCAN_PARAM_FLT_DISC_MODE
         0x06                  SCAN_PARAM_FLT_DUP
         0x07                  SCAN_PARAM_NUM_ADV_RPT (Read-only)
         ===================== ========================================================

:SCAN_PARAM_RPT_FIELDS: 

 :Condition: ( StatStatus==0x00 paramId==0x00)
 :Size: 2 byte(s)
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x0001                SCAN_ADVRPT_FLD_EVENTTYPE
         0x0002                SCAN_ADVRPT_FLD_ADDRTYPE
         0x0004                SCAN_ADVRPT_FLD_ADDRESS
         0x0008                SCAN_ADVRPT_FLD_PRIMPHY
         0x0010                SCAN_ADVRPT_FLD_SECPHY
         0x0020                SCAN_ADVRPT_FLD_ADVSID
         0x0040                SCAN_ADVRPT_FLD_TXPOWER
         0x0080                SCAN_ADVRPT_FLD_RSSI
         0x0100                SCAN_ADVRPT_FLD_DIRADDRTYPE
         0x0200                SCAN_ADVRPT_FLD_DIRADDRESS
         0x0400                SCAN_ADVRPT_FLD_PRDADVINTERVAL
         0x0800                SCAN_ADVRPT_FLD_DATALEN
         ===================== ========================================================

:SCAN_PARAM_PRIM_PHYS: 

 :Condition: ( StatStatus==0x00 paramId==0x01)
 :Size: 1 byte(s)
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x01                  SCAN_PRIM_PHY_1M
         0x04                  SCAN_PRIM_PHY_CODED
         ===================== ========================================================

:SCAN_PARAM_FLT_POLICY: 

 :Condition: ( StatStatus==0x00 paramId==0x02)
 :Size: 1 byte(s)
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x00                  SCAN_FLT_POLICY_ALL
         0x01                  SCAN_FLT_POLICY_AL
         0x02                  SCAN_FLT_POLICY_ALL_RPA
         0x03                  SCAN_FLT_POLICY_AL_RPA
         ===================== ========================================================

:SCAN_PARAM_FLT_PDU_TYPE: 

 :Condition: ( StatStatus==0x00 paramId==0x03)
 :Size: 2 byte(s)
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x0001                SCAN_FLT_PDU_NONCONNECTABLE_ONLY
         0x0002                SCAN_FLT_PDU_CONNECTABLE_ONLY
         0x0004                SCAN_FLT_PDU_NONSCANNABLE_ONLY
         0x0008                SCAN_FLT_PDU_SCANNABLE_ONLY
         0x0010                SCAN_FLT_PDU_UNDIRECTED_ONLY
         0x0020                SCAN_FLT_PDU_DIRECTED_ONLY
         0x0040                SCAN_FLT_PDU_ADV_ONLY
         0x0080                SCAN_FLT_PDU_SCANRSP_ONLY
         0x0100                SCAN_FLT_PDU_EXTENDED_ONLY
         0x0200                SCAN_FLT_PDU_LEGACY_ONLY
         0x0400                SCAN_FLT_PDU_TRUNCATED_ONLY
         0x0800                SCAN_FLT_PDU_COMPLETE_ONLY
         ===================== ========================================================

:SCAN_PARAM_FLT_MIN_RSSI: 

 :Condition: ( StatStatus==0x00 paramId==0x04)
 :Size: 1 byte(s)
 :Range: 

:SCAN_PARAM_FLT_DISC_MODE: 

 :Condition: ( StatStatus==0x00 paramId==0x05)
 :Size: 1 byte(s)
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x00                  SCAN_FLT_DISC_NONE
         0x01                  SCAN_FLT_DISC_GENERAL
         0x02                  SCAN_FLT_DISC_LIMITED
         0x03                  SCAN_FLT_DISC_ALL
         0x04                  SCAN_FLT_DISC_DISABLE
         ===================== ========================================================

:SCAN_PARAM_FLT_DUP: 

 :Condition: ( StatStatus==0x00 paramId==0x06)
 :Size: 1 byte(s)
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x00                  SCAN_FLT_DUP_DISABLE
         0x01                  SCAN_FLT_DUP_ENABLE
         0x02                  SCAN_FLT_DUP_RESET (Duplicate filtering enabled, reset for each scan period)
         ===================== ========================================================

:SCAN_PARAM_NUM_ADV_RPT: 

 :Condition: ( StatStatus==0x00 paramId==0x07)
 :Size: 1 byte(s)
 :Range: 


GapScan_setEventMask
--------------------
:Opcode: 0xFE57
:Command Description: Set which events to receive through the callback. One bit per event. If a bit is set to 1, the callback provided by GapScan_registerCb() will be called upon corresponding event.

**Command Parameters**

:eventMask: The mask receive the wanted scan events

 :Size: 4 byte(s)
 :Default: 0x00C30000
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x00010000            GAP_EVT_SCAN_ENABLED
         0x00020000            GAP_EVT_SCAN_DISABLED
         0x00040000            GAP_EVT_SCAN_PRD_ENDED
         0x00080000            GAP_EVT_SCAN_DUR_ENDED
         0x00100000            GAP_EVT_SCAN_INT_ENDED
         0x00200000            GAP_EVT_SCAN_WND_ENDED
         0x00400000            GAP_EVT_ADV_REPORT
         0x00800000            GAP_EVT_ADV_REPORT_FULL
         0x01000000            GAP_EVT_PRD_ADV_SYNC_ESTABLISHED
         0x02000000            GAP_EVT_PRD_ADV_REPORT
         0x04000000            GAP_EVT_PRD_ADV_SYNC_LOST
         ===================== ========================================================

**Events Generated**

The host will send the CommandStatus Event to indicate the event mask has been set.

GapScan_getAdvReport
--------------------
:Opcode: 0xFE58
:Command Description: Get a specific advertising report from the advertising report list. Only the fields specified by GapScan_setParam(SCAN_PARAM_RPT_FIELDS, ..) will be filled out. All other fields will be filled with 0s.

**Command Parameters**

:rptIdx: the index of the report to retrieve (number of reports available is returned by the GapScan_disable)

 :Size: 1 byte(s)
 :Default: 0
 :Range: 0-maxNumReport as set by GapScan_enable

**Events Generated**

The host will send the CommandStatus Event to return the advertising report.

**Additional Command Status Return Parameters**

:length: Length of data

 :Size: 1 byte(s)
 :Range: 

:evtType: 

 :Size: 1 byte(s)
 :Range: 

:addrType: 

 :Size: 1 byte(s)
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x00                  ADDRTYPE_PUBLIC
         0x01                  ADDRTYPE_RANDOM
         0x02                  ADDRTYPE_PUBLIC_ID
         0x03                  ADDRTYPE_RANDOM_ID
         0xFE                  ADDRTYPE_RANDOM_NR
         0xFF                  ADDRTYPE_NONE
         ===================== ========================================================

:addr: 

 :Size: 6 byte(s)
 :Range: 

:primPhy: 

 :Size: 1 byte(s)
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x00                  SCANNED_PHY_NONE
         0x01                  SCANNED_PHY_1M
         0x02                  SCANNED_PHY_2M
         0x03                  SCANNED_PHY_CODED
         ===================== ========================================================

:secPhy: 

 :Size: 1 byte(s)
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x00                  SCANNED_PHY_NONE
         0x01                  SCANNED_PHY_1M
         0x02                  SCANNED_PHY_2M
         0x03                  SCANNED_PHY_CODED
         ===================== ========================================================

:advSid: 

 :Size: 1 byte(s)
 :Range: 

:txPower: 

 :Size: 1 byte(s)
 :Range: 

:rssi: 

 :Size: 1 byte(s)
 :Range: 

:directAddrType: 

 :Size: 1 byte(s)
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x00                  ADDRTYPE_PUBLIC
         0x01                  ADDRTYPE_RANDOM
         0x02                  ADDRTYPE_PUBLIC_ID
         0x03                  ADDRTYPE_RANDOM_ID
         0xFE                  ADDRTYPE_RANDOM_NR
         0xFF                  ADDRTYPE_NONE
         ===================== ========================================================

:directAddr: 

 :Size: 6 byte(s)
 :Range: 


GapInit_setPhyParam
-------------------
:Opcode: 0xFE60
:Command Description: Set parameters dependent on PHY. Note that if phys contains more than one PHY, the same parameter of those PHYs will be set with the same value.

**Command Parameters**

:phy: PHY(s) to set parameter of

 :Size: 1 byte(s)
 :Default: 0x01
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x01                  INIT_PHY_1M
         0x02                  INIT_PHY_2M
         0x04                  INIT_PHY_CODED
         ===================== ========================================================

:paramId: parameter ID

 :Size: 1 byte(s)
 :Default: 0x00
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x00                  INIT_PHYPARAM_SCAN_INTERVAL
         0x01                  INIT_PHYPARAM_SCAN_WINDOW
         0x02                  INIT_PHYPARAM_CONN_INT_MIN
         0x03                  INIT_PHYPARAM_CONN_INT_MAX
         0x04                  INIT_PHYPARAM_CONN_LATENCY
         0x05                  INIT_PHYPARAM_SUP_TIMEOUT
         ===================== ========================================================

:INIT_PHYPARAM_SCAN_INTERVAL: scan interval in 625-us unit

 :Condition: ( paramID == 0x0)
 :Size: 2 byte(s)
 :Default: 16
 :Range: 4-16384

:INIT_PHYPARAM_SCAN_WINDOW: scan window in 625-us unit

 :Condition: ( paramID == 0x1)
 :Size: 2 byte(s)
 :Default: 16
 :Range: 4-16384

:INIT_PHYPARAM_CONN_INT_MIN: minimum connection interval in 1.25-ms unit

 :Condition: ( paramID == 0x2)
 :Size: 2 byte(s)
 :Default: 80
 :Range: 6-3200

:INIT_PHYPARAM_CONN_INT_MAX: maximum connection interval in 1.25-ms unit

 :Condition: ( paramID == 0x3)
 :Size: 2 byte(s)
 :Default: 80
 :Range: 0 - 499

:INIT_PHYPARAM_CONN_LATENCY: connection latency

 :Condition: ( paramID == 0x4)
 :Size: 2 byte(s)
 :Default: 0
 :Range: 10 - 3200

:INIT_PHYPARAM_SUP_TIMEOUT: supervision timeout in 10-ms unit

 :Condition: ( paramID == 0x5)
 :Size: 2 byte(s)
 :Default: 2000
 :Range: 0 - 0xFFFF

**Events Generated**

The host will send the CommandStatus Event to indicate the parameter has been set.

GapInit_getPhyParam
-------------------
:Opcode: 0xFE61
:Command Description: Get parameters of the specified PHY. Note that phy shall indicate only one PHY.

**Command Parameters**

:phy: PHY to get parameter of

 :Size: 1 byte(s)
 :Default: 0x01
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x01                  INIT_PHY_1M
         0x02                  INIT_PHY_2M
         0x04                  INIT_PHY_CODED
         ===================== ========================================================

:paramId: Parameter ID

 :Size: 1 byte(s)
 :Default: 0x00
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x00                  INIT_PHYPARAM_SCAN_INTERVAL
         0x01                  INIT_PHYPARAM_SCAN_WINDOW
         0x02                  INIT_PHYPARAM_CONN_INT_MIN
         0x03                  INIT_PHYPARAM_CONN_INT_MAX
         0x04                  INIT_PHYPARAM_CONN_LATENCY
         0x05                  INIT_PHYPARAM_SUP_TIMEOUT
         ===================== ========================================================

**Events Generated**

The host will send the CommandStatus Event to return the parameter value in question.

**Additional Command Status Return Parameters**

:length: Length of data

 :Size: 1 byte(s)
 :Range: 

:paramId: Parameter ID

 :Size: 1 byte(s)
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x00                  INIT_PHYPARAM_SCAN_INTERVAL
         0x01                  INIT_PHYPARAM_SCAN_WINDOW
         0x02                  INIT_PHYPARAM_CONN_INT_MIN
         0x03                  INIT_PHYPARAM_CONN_INT_MAX
         0x04                  INIT_PHYPARAM_CONN_LATENCY
         0x05                  INIT_PHYPARAM_SUP_TIMEOUT
         ===================== ========================================================

:INIT_PHYPARAM_SCAN_INTERVAL: Phy 

 :Condition: ( paramId==0x00)
 :Size: 2 byte(s)
 :Range: 

:INIT_PHYPARAM_SCAN_WINDOW: 

 :Condition: ( paramId==0x01)
 :Size: 2 byte(s)
 :Range: 

:INIT_PHYPARAM_CONN_INT_MIN: 

 :Condition: ( paramId==0x02)
 :Size: 2 byte(s)
 :Range: 

:INIT_PHYPARAM_CONN_INT_MAX: 

 :Condition: ( paramId==0x03)
 :Size: 2 byte(s)
 :Range: 

:INIT_PHYPARAM_CONN_LATENCY: 

 :Condition: ( paramId==0x04)
 :Size: 2 byte(s)
 :Range: 

:INIT_PHYPARAM_SUP_TIMEOUT: 

 :Condition: ( paramId==0x05)
 :Size: 2 byte(s)
 :Range: 


GapInit_connect
---------------
:Opcode: 0xFE62
:Command Description: Initiate connection with the specified peer device

**Command Parameters**

:peerAddrType: peer device's address type

 :Size: 1 byte(s)
 :Default: 0x00
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x00                  PEER_ADDRTYPE_PUBLIC_OR_PUBLIC_ID
         0x01                  PEER_ADDRTYPE_RANDOM_OR_RANDOM_ID
         ===================== ========================================================

:pPeerAddress: peer device's address

 :Size: 6 byte(s)
 :Default: "00:00:00:00:00:00"
 :Range: Any 6 byte value

:phys: PHY(s) to use for connection

 :Size: 1 byte(s)
 :Default: 0x01
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x01                  INIT_PHY_1M
         0x02                  INIT_PHY_2M
         0x04                  INIT_PHY_CODED
         ===================== ========================================================

:timeout: initiating timeout in ms

 :Size: 2 byte(s)
 :Default: 0
 :Range: Any 32-bit number

**Events Generated**

The host will send the CommandStatus Event to indicate whether the connect process has started successfully. If a connection is formed, the GAP_LinkEstablished event will be returned.

GapInit_connectAl
-----------------
:Opcode: 0xFE63
:Command Description: Initiate connection with a device in the acceptlist.

**Command Parameters**

:phys: PHY(s) to use for connection

 :Size: 1 byte(s)
 :Default: 0x01
 :Range:
         ===================== ========================================================
         Value                 Description
         ===================== ========================================================
         0x01                  INIT_PHY_1M
         0x02                  INIT_PHY_2M
         0x04                  INIT_PHY_CODED
         ===================== ========================================================

:timeout: initiating timeout in ms

 :Size: 2 byte(s)
 :Default: 0
 :Range: Any 32-bit number

**Events Generated**

The host will send the CommandStatus Event to indicate whether the connect process has started successfully. If a connection is formed, the GAP_LinkEstablished event will be returned

GapInit_cancelConnect
---------------------
:Opcode: 0xFE64
:Command Description: Cancel the ongoing connection process.

**Events Generated**

The host will send the CommandStatus Event to indicate whether the connect cancel process has started successfully. If the cancel completes, the GAP_ConnectingCancelled event will be returned.

