btnut/btnode/include/bt/bt_hci_cmds.h File Reference


Detailed Description

HCI commands (definition).

Author:
Mathias Payer <payerm@student.ethz.ch>
Date:
2004/04/18 22:22:09

#include <bt/bt_hci_api.h>
#include <bt/bt_hci_defs.h>
#include <bt/bt_defs.h>

VendorSpecific HCI Commands

#define BT_HCI_B115200   2
#define BT_HCI_B19200   5
#define BT_HCI_B230400   1
#define BT_HCI_B38400   4
#define BT_HCI_B460800   0
#define BT_HCI_B57600   3
long bt_hci_set_baudrate (struct btstack *stack, u_char baudrate)

HostControl HCI Commands (sync & async)

Tries to send a HCI_COMMAND_DATA_PACKET, the OpcodeGroup is HCI_OGF_HOST_CONTROL

#define BT_HCI_DEFAULT_EVENT_MASK_HIGH   0x00001FFF
#define BT_HCI_DEFAULT_EVENT_MASK_LOW   0xFFFFFFFF
#define BT_HCI_EVENT_LINK_KEY_REQUEST   0x00400000
#define BT_HCI_FLOWCONTROL_ACL   0x01
#define BT_HCI_FLOWCONTROL_ACL_SCO   0x03
#define BT_HCI_FLOWCONTROL_OFF   0x00
#define BT_HCI_FLOWCONTROL_SCO   0x02
#define BT_HCI_INQUIRY_MODE_RSSI   0x01
#define BT_HCI_INQUIRY_MODE_STD   0x00
#define BT_HCI_INQUIRY_SCAN_INTERLACED   0x01
#define BT_HCI_INQUIRY_SCAN_STD   0x00
#define BT_HCI_PIN_TYPE_FIXED   0x01
#define BT_HCI_PIN_TYPE_VARIABLE   0x00
#define BT_HCI_SCAN_MODE_INQUIRY   0x01
#define BT_HCI_SCAN_MODE_INQUIRY_PAGE   0x03
#define BT_HCI_SCAN_MODE_OFF   0x00
#define BT_HCI_SCAN_MODE_PAGE   0x02
long _bt_hci_set_event_filter_bytearray (struct btstack *stack, struct bt_hci_cmd_response *response, u_char *byte_array)
long bt_hci_acl_free_buffer (struct btstack *stack, bt_hci_con_handle_t con_handle, u_short nr)
 This cmd tells the module that one or more acl buffer has been freed again.
long bt_hci_delete_stored_link_key (struct btstack *stack, struct bt_hci_cmd_response *response, bt_addr_t addr)
 This cmd deletes the link key for a given bd addr or all link keys.
long bt_hci_host_buffer_size (struct btstack *stack, struct bt_hci_cmd_response *response, u_short acl_max_len, u_char sco_max_len, u_short nr_acl_pkts, u_short nr_sco_pkts)
 This cmd sets the max. number of {acl|sco}-data-pkts and the max. size of an {acl|sco}-data-pkt the bt-stack can handle.
long bt_hci_read_connection_accept_timeout (struct btstack *stack, struct bt_hci_cmd_response *response)
 This reads the max. time the controller will wait for the stack after a connection request event is sent.
long bt_hci_read_inquiry_mode (struct btstack *stack, struct bt_hci_cmd_response *response)
 This cmd reads the inquiry mode (with or wihtout RSSI).
long bt_hci_read_inquiry_scan_type (struct btstack *stack, struct bt_hci_cmd_response *response)
 This cmd reads the inquiry scan type.
long bt_hci_read_link_supervision_timeout (struct btstack *stack, struct bt_hci_cmd_response *response, bt_hci_con_handle_t con_handle)
 This cmd reads the supervision timeout (timeout that will be triggered if the link is lost).
long bt_hci_read_local_cod (struct btstack *stack, struct bt_hci_cmd_response *response)
 Reads the local class of device.
long bt_hci_read_local_name (struct btstack *stack, struct bt_hci_cmd_response *response, u_char *name, u_char maxlen)
 This cmd gets the local name of the bt-device referenced by the stack.
long bt_hci_read_page_timeout (struct btstack *stack, struct bt_hci_cmd_response *response)
 This reads the max. time the local link manager will wait for a baseband page response from the remote device at a locally initiated connection attempt.
long bt_hci_read_pin_type (struct btstack *stack, struct bt_hci_cmd_response *response)
 This parameter controls wether the PIN (for pairing) is fixed or variable.
long bt_hci_read_scan_enable (struct btstack *stack, struct bt_hci_cmd_response *response)
 This parameter controls wether or not the bt-device will periodically scan for page attemps and/or inquiry requests from other devices.
long bt_hci_reset (struct btstack *stack, struct bt_hci_cmd_response *response)
 Resets the controller (but not the stack!), no parameters needed.
long bt_hci_set_event_filter (struct btstack *stack, struct bt_hci_cmd_response *response, u_char param,...)
 Sets the HCI event filter.
long bt_hci_set_event_mask (struct btstack *stack, struct bt_hci_cmd_response *response, u_long mask_high, u_long mask_low)
 Sets the HCI event mask.
long bt_hci_set_flowcontrol (struct btstack *stack, struct bt_hci_cmd_response *response, u_char type)
 This parameter sets the flow-control to the given type.
long bt_hci_write_authentication_enable (struct btstack *stack, struct bt_hci_cmd_response *response, u_char enable)
 Writes the authentication the value for the Authentication_Enable configuration parameter.
long bt_hci_write_connection_accept_timeout (struct btstack *stack, struct bt_hci_cmd_response *response, u_short time)
 This writes the max. time the controller will wait for the stack after a connection request event is sent.
long bt_hci_write_encryption_mode (struct btstack *stack, struct bt_hci_cmd_response *response, u_char encryption_mode)
 Writes the value for the encrytption configuration parameter.
long bt_hci_write_inquiry_mode (struct btstack *stack, struct bt_hci_cmd_response *response, u_char mode)
 This cmd writes the inquiry mode (with or wihtout RSSI).
long bt_hci_write_inquiry_scan_type (struct btstack *stack, struct bt_hci_cmd_response *response, u_char mode)
 This cmd writes the inquiry scan type.
long bt_hci_write_link_supervision_timeout (struct btstack *stack, struct bt_hci_cmd_response *response, bt_hci_con_handle_t con_handle, u_short timeout)
 This cmd writes the supervision timeout (timeout that will be triggered if the link is lost).
long bt_hci_write_local_cod (struct btstack *stack, struct bt_hci_cmd_response *response, u_long cod)
 Writes the local calss of device.
long bt_hci_write_local_name (struct btstack *stack, struct bt_hci_cmd_response *response, u_char *name)
 This cmd sets the local name of the bt-device referenced by the stack.
long bt_hci_write_page_timeout (struct btstack *stack, struct bt_hci_cmd_response *response, u_short time)
 This defines the max. time the local link manager will wait for a baseband page response from the remote device at a locally initiated connection attempt.
long bt_hci_write_pin_type (struct btstack *stack, struct bt_hci_cmd_response *response, u_char type)
 * This parameter controls wether the PIN (for pairing) is fixed or variable.
long bt_hci_write_scan_enable (struct btstack *stack, struct bt_hci_cmd_response *response, u_char type)
 This parameter controls wether or not the bt-device will periodically scan for page attemps and/or inquiry requests from other devices.
long bt_hci_write_stored_link_key (struct btstack *stack, struct bt_hci_cmd_response *response, bt_addr_t addr, link_key_t link_key)
 This cmd stores the link key for a given bd addr.

LinkControl HCI Commands (sync & async)

Tries to send a HCI_COMMAND_DATA_PACKET, the OpcodeGroup is HCI_OGF_LINK_CONTROL

#define BT_HCI_DISCONNECT_AUTH_FAILURE   0x05
#define BT_HCI_DISCONNECT_LOW_RESOURCES   0x14
#define BT_HCI_DISCONNECT_PAIRING_UNSUPP   0x29
#define BT_HCI_DISCONNECT_POWER_DOWN   0x15
#define BT_HCI_DISCONNECT_UNSUPP_FEATURE   0x1A
#define BT_HCI_DISCONNECT_USER_ENDED   0x13
#define BT_HCI_ROLE_SWITCH_CHANGE   0x01
#define BT_HCI_ROLE_SWITCH_MASTER   0x00
long bt_hci_accept_connection_request (struct btstack *stack, bt_addr_t addr, u_char role)
long bt_hci_authentication_requested (struct btstack *stack, bt_hci_con_handle_t con_handle)
 The Authentication_Requested command is used to try to authenticate the remote device associated with the specified Connection Handle. On an authentication failure, the Controller or Link Manager shall not automatically detach the link. The Host is responsible for issuing a Disconnect command to terminate the link if the action is appropriate.
long bt_hci_change_con_pkt_type (struct btstack *stack, struct bt_hci_cmd_response *response, bt_hci_con_handle_t con_handle, u_short packet_type)
 To change the connection packet type of a certain connection.
long bt_hci_create_connection (struct btstack *stack, struct bt_hci_cmd_response *response, bt_addr_t addr, u_short packet_type, u_char page_scan_rep_mode, u_short clock_offset, u_char allow_role_switch)
 This function opens a connection to a bluetooth device.
long bt_hci_create_connection_cancel (struct btstack *stack, struct bt_hci_cmd_response *response, bt_addr_t addr)
long bt_hci_disconnect (struct btstack *stack, struct bt_hci_cmd_response *response, bt_hci_con_handle_t con_handle, u_char reason)
 Tries to disconnect a hci-connection with the given handle.
long bt_hci_inquiry (struct btstack *stack, struct bt_hci_cmd_response *response, u_char time, u_char number, struct bt_hci_inquiry_result *res)
 Does an inquiry and looks for other bluetooth devices near by.
long bt_hci_inquiry_cancel (struct btstack *stack, struct bt_hci_cmd_response *response)
long bt_hci_link_key_request_negative_reply (struct btstack *stack, bt_addr_t addr)
 The Link_Key_Request_Negative_Reply command is used to reply to a Link Key Request event from the Controller if the Host does not have a stored Link Key for the connection with the other Bluetooth Device specified by BD_ADDR.
long bt_hci_link_key_request_reply (struct btstack *stack, bt_hci_con_handle_t con_handle, bt_addr_t addr, link_key_t link_key)
 The Link_Key_Request_Reply command is used to reply to a Link Key Request event from the Controller, and specifies the Link Key stored on the Host to be used as the link key for the connection with the other Bluetooth Device specified by BD_ADDR. The Link Key Request event will be generated when the Controller needs a Link Key for a connection.
long bt_hci_pin_code_request_reply (struct btstack *stack, bt_hci_con_handle_t con_handle, bt_addr_t addr, u_char pin_length, char *pin_code)
 The PIN_Code_Request_Reply command is used to reply to a PIN Code request event from the Controller, and specifies the PIN code to use for a connection. The PIN Code Request event will be generated when a connection with remote initiating device has requested pairing.
long bt_hci_read_clock_offset (struct btstack *stack, struct bt_hci_cmd_response *response, bt_hci_con_handle_t app_con_handle)
long bt_hci_remote_name_request (struct btstack *stack, bt_addr_t addr, u_short clock_offset, u_char page_scan_repetition_mode, char *name, u_char maxlen)
 Looks for the human-readable name of a given bd-address.

LinkPolicy HCI Commands (sync & async)

#define BT_HCI_LINK_POLICY_ALL_DISABLED   0x0000
#define BT_HCI_LINK_POLICY_HOLD_MODE   0x0002
#define BT_HCI_LINK_POLICY_PARK_STATE   0x0008
#define BT_HCI_LINK_POLICY_ROLE_SWITCH   0x0001
#define BT_HCI_LINK_POLICY_SNIFF_MODE   0x0004
long bt_hci_exit_park_state (struct btstack *stack, struct bt_hci_cmd_response *response, bt_hci_con_handle_t app_con_handle)
 Exits park state for a given connection.
long bt_hci_exit_sniff_mode (struct btstack *stack, struct bt_hci_cmd_response *response, bt_hci_con_handle_t app_con_handle)
 Exits sniff mode for a given connection.
long bt_hci_hold_mode (struct btstack *stack, struct bt_hci_cmd_response *response, bt_hci_con_handle_t app_con_handle, u_short max_interval, u_short min_interval)
 Sets hold mode for a given connection.
long bt_hci_park_state (struct btstack *stack, struct bt_hci_cmd_response *response, bt_hci_con_handle_t app_con_handle, u_short beacon_max_interval, u_short beacon_min_interval)
 Sets park state for a given connection.
long bt_hci_read_default_link_policy_settings (struct btstack *stack, struct bt_hci_cmd_response *response)
 Reads the default link policy settings for all connections.
long bt_hci_read_link_policy_settings (struct btstack *stack, struct bt_hci_cmd_response *response, bt_hci_con_handle_t con_handle)
 Reads the link policy settings for a given connection.
long bt_hci_role_discovery (struct btstack *stack, struct bt_hci_cmd_response *response, bt_hci_con_handle_t con_handle)
 Returns the Role of the specified con_handle.
long bt_hci_role_set (struct btstack *stack, struct bt_hci_cmd_response *response, bt_hci_con_handle_t con_handle, u_char role)
 Sends the role change request to the connected device with con_handle.
long bt_hci_sniff_mode (struct btstack *stack, struct bt_hci_cmd_response *response, bt_hci_con_handle_t app_con_handle, u_short max_interval, u_short min_interval, u_short attempt, u_short timeout)
 Sets sniff mode for a given connection.
long bt_hci_write_default_link_policy_settings (struct btstack *stack, struct bt_hci_cmd_response *response, u_short settings)
 Sets the new link policy settings for all connections.
long bt_hci_write_link_policy_settings (struct btstack *stack, struct bt_hci_cmd_response *response, bt_hci_con_handle_t con_handle, u_short settings)
 Sets the new link policy settings for a given connection.

Defines

#define BT_HCI_SYNC   0x0
#define SET_OGF_OCF(ogf, ocf)   ((ocf<<8)|(ogf<<2))

Functions

long bt_hci_read_abs_rssi (struct btstack *stack, struct bt_hci_cmd_response *response, bt_hci_con_handle_t con_handle, char *abs_rssi)
 This command reads the absolute rssi value of an active connection.
long bt_hci_read_clock (struct btstack *stack, struct bt_hci_cmd_response *response, u_char which_clock, bt_hci_con_handle_t app_con_handle, u_short *accuracy, u_long *nut_millis)
 This command will read the estimate of the value of the Bluetooth Clock and get a nut/os system clock timestamp at the same time The BT Clock ticks every 0.3125 ms = 3.2 kHz.
long bt_hci_read_rssi (struct btstack *stack, struct bt_hci_cmd_response *response, bt_hci_con_handle_t con_handle, short *rssi)
 This command reads the rssi value of an active connection.
StatusParameters HCI Commands
Tries to send a HCI_COMMAND_DATA_PACKET, the OpcodeGroup is HCI_OGF_HOST_CONTROL

long bt_hci_get_link_quality (struct btstack *stack, struct bt_hci_cmd_response *response, bt_hci_con_handle_t con_handle, u_char *link_quality)
 This command gets the link quality of an active connection.
InformationalParameters HCI Commands
Tries to send a HCI_COMMAND_DATA_PACKET, the OpcodeGroup is HCI_OGF_INFORMATIONAL_PARAMS

long bt_hci_read_bt_addr (struct btstack *stack, struct bt_hci_cmd_response *response, bt_addr_t addr)
 This cmd reads the local bluetooth address.
long bt_hci_read_buffer_size (struct btstack *stack, struct bt_hci_cmd_response *response)
 This cmd reads the max. number of {acl|sco}-data-pkts, the controller can handle and the max. size of an {acl|sco}-data-pkt the controller will ever send!
long bt_hci_read_local_extended_features (struct btstack *stack, struct bt_hci_cmd_response *response)
 The HCI_Read_Local_Extended_Features command returns the requested page of the extended LMP features.
long bt_hci_read_local_supported_commands (struct btstack *stack, struct bt_hci_cmd_response *response)
 This command reads the list of HCI commands supported for the local device (if suported).
long bt_hci_read_local_supported_features (struct btstack *stack, struct bt_hci_cmd_response *response, u_char *features)
 This command requests a list of the supported features for the local device. This command will return a list of the LMP features.
long bt_hci_read_local_version_information (struct btstack *stack, struct bt_hci_cmd_response *response, struct bt_hci_local_version_result *version)
 This command will read the values for the version information for the local Bluetooth device. The HCI Version information defines the version information of the HCI layer. The LMP Version information defines the version of the LMP. The Manufacturer_Name information indicates the manufacturer of the local device.


Define Documentation

#define BT_HCI_B115200   2

Defines baud rate of 115200

#define BT_HCI_B19200   5

Defines baud rate of 19200

#define BT_HCI_B230400   1

Defines baud rate of 230400

#define BT_HCI_B38400   4

Defines baud rate of 38400

#define BT_HCI_B460800   0

Defines baud rate of 460800

#define BT_HCI_B57600   3

Defines baud rate of 57600

#define BT_HCI_DISCONNECT_AUTH_FAILURE   0x05

We disconnect/were disconnected because of an authentication failure

#define BT_HCI_DISCONNECT_LOW_RESOURCES   0x14

We disconnect/were disconnected because of low resources

#define BT_HCI_DISCONNECT_PAIRING_UNSUPP   0x29

We disconnect/were disconnected because the pairing with unit key was not supported

#define BT_HCI_DISCONNECT_POWER_DOWN   0x15

We disconnect/were disconnected because of a power down

#define BT_HCI_DISCONNECT_UNSUPP_FEATURE   0x1A

We disconnect/were disconnected because of an unsupported remote feature

#define BT_HCI_DISCONNECT_USER_ENDED   0x13

We disconnect/were disconnected because the user terminated the connection

Examples:
btstreamer/streamer/btstreamer.c.

#define BT_HCI_FLOWCONTROL_ACL   0x01

flowcontrol for acl-pkts

See also:
bt_hci_set_flowcontrol

#define BT_HCI_FLOWCONTROL_ACL_SCO   0x03

flowcontrol for acl & sco

See also:
bt_hci_set_flowcontrol

#define BT_HCI_FLOWCONTROL_OFF   0x00

no flowcontrol

See also:
bt_hci_set_flowcontrol

#define BT_HCI_FLOWCONTROL_SCO   0x02

flowcontrol for sco-pkts

See also:
bt_hci_set_flowcontrol

#define BT_HCI_INQUIRY_MODE_RSSI   0x01

Extended inquiry mode (with RSSI)

#define BT_HCI_INQUIRY_MODE_STD   0x00

Standard inquiry mode (without RSSI)

#define BT_HCI_INQUIRY_SCAN_INTERLACED   0x01

Interlaced scan

#define BT_HCI_INQUIRY_SCAN_STD   0x00

Standard scan

#define BT_HCI_LINK_POLICY_ALL_DISABLED   0x0000

All options disabled

#define BT_HCI_LINK_POLICY_HOLD_MODE   0x0002

Enables hold mode

#define BT_HCI_LINK_POLICY_PARK_STATE   0x0008

Enables park state

#define BT_HCI_LINK_POLICY_ROLE_SWITCH   0x0001

Enables role switch

Examples:
btstreamer/receiver/btreceiver.c, and btstreamer/streamer/btstreamer.c.

#define BT_HCI_LINK_POLICY_SNIFF_MODE   0x0004

Enables sniff mode

#define BT_HCI_PIN_TYPE_FIXED   0x01

Fixed PIN-Type

See also:
bt_hci_read_pin_type, bt_hci_write_pin_type

#define BT_HCI_PIN_TYPE_VARIABLE   0x00

Variable PIN-Type

See also:
bt_hci_read_pin_type, bt_hci_write_pin_type

#define BT_HCI_ROLE_SWITCH_CHANGE   0x01

After the connection completes, this device may be slave (but needn't be!)

Examples:
bt-lego/bt-lego.c.

#define BT_HCI_ROLE_SWITCH_MASTER   0x00

After the connection completes, this device will be master

Examples:
btstreamer/streamer/btstreamer.c.

#define BT_HCI_SCAN_MODE_INQUIRY   0x01

only inquiry allowed

See also:
bt_hci_read_scan_enable, bt_hci_write_scan_enable
Examples:
btstreamer/streamer/btstreamer.c.

#define BT_HCI_SCAN_MODE_INQUIRY_PAGE   0x03

both inquiry & page scans allowd

See also:
bt_hci_read_scan_enable, bt_hci_write_scan_enable
Examples:
btstreamer/streamer/btstreamer.c.

#define BT_HCI_SCAN_MODE_OFF   0x00

this device is hidden

See also:
bt_hci_read_scan_enable, bt_hci_write_scan_enable
Examples:
btstreamer/streamer/btstreamer.c.

#define BT_HCI_SCAN_MODE_PAGE   0x02

only page scans allowed

See also:
bt_hci_read_scan_enable, bt_hci_write_scan_enable
Examples:
btstreamer/streamer/btstreamer.c.

#define BT_HCI_SYNC   0x0

Use this define instead of a pointer to a response struct to proccess a bluetooth stack command call synchronously.

Examples:
bt-lego/bt-lego.c, bt-remoteprog/demo-rprog.c, btstreamer/receiver/btreceiver.c, btstreamer/streamer/btstreamer.c, l2cap-cmd/l2cap-cmd.c, and rfcomm-cmd/rfcomm-cmd.c.


Function Documentation

long bt_hci_accept_connection_request ( struct btstack stack,
bt_addr_t  addr,
u_char  role 
)

Accepts a connection request from a remote device

This function may only be used by the stack internally!

Parameters:
stack The bt-stack to use
addr BT-Addr to look for
role Master or slave ( BT_HCI_MY_ROLE_MASTER | BT_HCI_MY_ROLE_SLAVE )
Returns:
0 or possible errors:

long bt_hci_acl_free_buffer ( struct btstack stack,
bt_hci_con_handle_t  con_handle,
u_short  nr 
)

This cmd tells the module that one or more acl buffer has been freed again.

(using the Host Number of Completed Packets Command) this is used to prevent overflow on our side

Parameters:
stack The bt-stack to use
con_handle The con_handle where pkgs were completed
nr The number of completed packages
Returns:
0 or possible errors:
Examples:
btstreamer/receiver/btreceiver.c.

long bt_hci_authentication_requested ( struct btstack stack,
bt_hci_con_handle_t  con_handle 
)

The Authentication_Requested command is used to try to authenticate the remote device associated with the specified Connection Handle. On an authentication failure, the Controller or Link Manager shall not automatically detach the link. The Host is responsible for issuing a Disconnect command to terminate the link if the action is appropriate.

Parameters:
stack The bt-stack to use
con_handle The connection handle to use

long bt_hci_change_con_pkt_type ( struct btstack stack,
struct bt_hci_cmd_response response,
bt_hci_con_handle_t  con_handle,
u_short  packet_type 
)

To change the connection packet type of a certain connection.

With the response the application can observe explicitly the change of the packet type.

To use this function as a synchronous call, pass a BT_HCI_SYNC as name_response.

Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
con_handle The con. handle to change the packet type
packet_type,: 
Returns:
Packet type that is set now if the call was sync or possible errors:
Examples:
btstreamer/receiver/btreceiver.c.

long bt_hci_create_connection ( struct btstack stack,
struct bt_hci_cmd_response response,
bt_addr_t  addr,
u_short  packet_type,
u_char  page_scan_rep_mode,
u_short  clock_offset,
u_char  allow_role_switch 
)

This function opens a connection to a bluetooth device.

Tries to open a hci-connection to the given address.

This function opens a connection to a bluetooth device with address addr and a flag indicating if role switch allowed (means this device might be slave after the connection has been opened) or not (this device will be master).
With the con_response the application can observe explicitly the opening of THIS connection!
To speed up the connection establishment the clock offset and the to the device retrieved during inquiry can be passed.

To use this function as a synchronous call, pass a BT_HCI_SYNC as name_response.

If there is already an open connection to this address, it immediately retures with the connection handle

This function can also correctly handle multiple connection requests to the same device and/or connection requests to devices from whom an incoming connection request is pending

Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
addr Bluetooth address to connect to
packet_type The packet-types to accept. Multiple values can be or'ed (|)
page_scan_rep_mode (found during inquiry) (pass 0 if unknown)
clock_offset Offset to this device (found during inquiry). pass 0 if unknown
allow_role_switch Indicates if a roleswitch is possible (BT_HCI_ROLE_SWITCH_MASTER or BT_HCI_ROLE_SWITCH_CHANGE)
Returns:
The connection-handle if the call was sync or possible errors:
Examples:
bt-lego/bt-lego.c, and btstreamer/streamer/btstreamer.c.

long bt_hci_delete_stored_link_key ( struct btstack stack,
struct bt_hci_cmd_response response,
bt_addr_t  addr 
)

This cmd deletes the link key for a given bd addr or all link keys.

Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
addr of the link key to delete or NULL to delete all link keys
Returns:
0 or possible errors:

long bt_hci_disconnect ( struct btstack stack,
struct bt_hci_cmd_response response,
bt_hci_con_handle_t  con_handle,
u_char  reason 
)

Tries to disconnect a hci-connection with the given handle.

With the con_response the application can observe explicitly the opening of THIS connection!

To use this function as a synchronous call, pass a BT_HCI_SYNC as name_response.

Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
con_handle The con. handle to disconnect
reason The reason for the disconnect:
Returns:
0 if everything is fine and the call was sync or possible errors:
Examples:
btstreamer/streamer/btstreamer.c.

long bt_hci_exit_park_state ( struct btstack stack,
struct bt_hci_cmd_response response,
bt_hci_con_handle_t  app_con_handle 
)

Exits park state for a given connection.

Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
con_handle the application connection handle
Returns:
0 or possible errors:

long bt_hci_exit_sniff_mode ( struct btstack stack,
struct bt_hci_cmd_response response,
bt_hci_con_handle_t  app_con_handle 
)

Exits sniff mode for a given connection.

Parameters:
stack The bt-stack to use
con_handle the application connection handle
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
Returns:
0 or possible errors:

long bt_hci_get_link_quality ( struct btstack stack,
struct bt_hci_cmd_response response,
bt_hci_con_handle_t  con_handle,
u_char link_quality 
)

This command gets the link quality of an active connection.

Note: The link quality is between 0x00 and 0xff, higher values are better quality

Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
con_handle The (internal) connection handle
link_quality Pointer where the link_quality will be filled in!
Returns:
0 or possible errors:

long bt_hci_hold_mode ( struct btstack stack,
struct bt_hci_cmd_response response,
bt_hci_con_handle_t  app_con_handle,
u_short  max_interval,
u_short  min_interval 
)

Sets hold mode for a given connection.

remark: the controller will return the actual hold interval in the interval parameter of the mode change event.

mandatory range for interval: 0x0014-0x8000

Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
con_handle the application connection handle
max_interval maximum acceptable number of baseband slots to wait in hold mode (range: 0x0002-0xfffe, only even values are valid)
min_interval minimum acceptable number of baseband slots to wait in hold mode (range: 0x0002-0xff00, only even values are valid)
Returns:
0 or possible errors:

long bt_hci_host_buffer_size ( struct btstack stack,
struct bt_hci_cmd_response response,
u_short  acl_max_len,
u_char  sco_max_len,
u_short  nr_acl_pkts,
u_short  nr_sco_pkts 
)

This cmd sets the max. number of {acl|sco}-data-pkts and the max. size of an {acl|sco}-data-pkt the bt-stack can handle.

According to the max. size the bt-controller will fragment all sco and acl Data-pkts.

Attention:
This command may NOT be called from an application !
It is internal for the stack and is called when the acl- and/or sco-layer is initialized.
ACL and SCO-Layer must cooperate and set all params at once!
(With one call, both acl and sco max-size and number of buffers is set!)
This funtion MUST be called by the acl and/or sco layer to initialize the bt-controller!
Note:
This command specifies the max length for the data part of acl-data pkts If an application provides acl buffers, 5 additional bytes are required for packet type (1) and the ACL header (Connection Handle (2), Data Size (2))
Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
acl_max_len Max. length for the data part in any acl-data pkt
sco_max_len Max. length for any sco-data pkt
nr_acl_pkts Max. number of acl-buffers the stack can handle
nr_sco_pkts Max. number of sco-buffers the stack can handle
Returns:
0 or possible errors:
Examples:
btstreamer/receiver/btreceiver.c.

long bt_hci_inquiry ( struct btstack stack,
struct bt_hci_cmd_response response,
u_char  time,
u_char  number,
struct bt_hci_inquiry_result res 
)

Does an inquiry and looks for other bluetooth devices near by.

This function triggers an inquiry with max_time in seconds, a pointer to an array of type struct bt_hci_inquiry_result to fill in the found devices and a maximal number of devices number. The event will be set as soon as number found or the timeout max_time reached!
The result will be stored in the array res.

Example:

	struct bt_hci_inquiry_result inqres[2];
	retval = bt_hci_inquiry(&stack, BT_HCI_SYNC, 0x03, 0x02, inqres);
(This inquiry runs for 3*1.28 seconds (max.) and looks for at most 2 devs.)

Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
time Time to wait for the inquiry to complete, min: 0x00, max: 0x30, the actual waiting time is x*1.28 seconds
number Estimed number of deviced to find, min: 0x01, max: 0xFF
res Pointer to the array were the discovered devices will be stored (has to be of size number!)
Returns:
the # of found devices if the call was sync or possible errors:
Examples:
btstreamer/streamer/btstreamer.c.

long bt_hci_link_key_request_negative_reply ( struct btstack stack,
bt_addr_t  addr 
)

The Link_Key_Request_Negative_Reply command is used to reply to a Link Key Request event from the Controller if the Host does not have a stored Link Key for the connection with the other Bluetooth Device specified by BD_ADDR.

Parameters:
stack The bt-stack to use
addr BD_ADDR for this pin code
Returns:
0 on success

long bt_hci_link_key_request_reply ( struct btstack stack,
bt_hci_con_handle_t  con_handle,
bt_addr_t  addr,
link_key_t  link_key 
)

The Link_Key_Request_Reply command is used to reply to a Link Key Request event from the Controller, and specifies the Link Key stored on the Host to be used as the link key for the connection with the other Bluetooth Device specified by BD_ADDR. The Link Key Request event will be generated when the Controller needs a Link Key for a connection.

Parameters:
stack The bt-stack to use
con_handle The connection handle to use
addr BD_ADDR for this pin code
link_key 
Returns:
BD_ADDR that completed the pin code request

long bt_hci_park_state ( struct btstack stack,
struct bt_hci_cmd_response response,
bt_hci_con_handle_t  app_con_handle,
u_short  beacon_max_interval,
u_short  beacon_min_interval 
)

Sets park state for a given connection.

remark: the controller will return the actual beacon interval in the interval parameter of the mode change event.

it is possible for the controller to do an automatic unpark to transmit data and then park the connection again! the optional feature of automatic unpark/park can also be used for link supervision.

so its possible to have until 255 parked slaves in one piconet.

mandatory range for beacon interval: 0x000e-0x1000

Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
con_handle the application connection handle
max_interval maximum acceptable number of baseband slots for beacon period (range: 0x000E-0xfffe, only even values are valid)
min_interval minimum acceptable number of baseband slots for beacon period (range: 0x000E-0xfffe, only even values are valid)
Returns:
0 or possible errors:

long bt_hci_pin_code_request_reply ( struct btstack stack,
bt_hci_con_handle_t  con_handle,
bt_addr_t  addr,
u_char  pin_length,
char *  pin_code 
)

The PIN_Code_Request_Reply command is used to reply to a PIN Code request event from the Controller, and specifies the PIN code to use for a connection. The PIN Code Request event will be generated when a connection with remote initiating device has requested pairing.

Parameters:
stack The bt-stack to use
con_handle The connection handle to use
addr BD_ADDR for this pin code
pin_length 
pin_code 
Returns:
BD_ADDR that completed the pin code request

long bt_hci_read_abs_rssi ( struct btstack stack,
struct bt_hci_cmd_response response,
bt_hci_con_handle_t  con_handle,
char *  abs_rssi 
)

This command reads the absolute rssi value of an active connection.

Note: The absolute rssi value-range: -127 to +20, Units: dBm.

The absolute rssi-value will be stored in the abs_rssi-Pointer

Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
con_handle The (internal) connection handle
abs_rssi Pointer where the absolute rssi-value will be filled in!
Returns:
0 or possible errors:

long bt_hci_read_bt_addr ( struct btstack stack,
struct bt_hci_cmd_response response,
bt_addr_t  addr 
)

This cmd reads the local bluetooth address.

Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
addr a pointer to the struct where the address will be stored
Returns:
0 or possible errors:

long bt_hci_read_buffer_size ( struct btstack stack,
struct bt_hci_cmd_response response 
)

This cmd reads the max. number of {acl|sco}-data-pkts, the controller can handle and the max. size of an {acl|sco}-data-pkt the controller will ever send!

Attention:
This command may NOT be called from an application !
It is internal for the stack and is only used after a reset to get these informational parameters and must be called before any data is sent!
Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
Returns:
0 if everything is fine, or possible errors: TODO: where are the return values??

long bt_hci_read_clock ( struct btstack stack,
struct bt_hci_cmd_response response,
u_char  which_clock,
bt_hci_con_handle_t  app_con_handle,
u_short accuracy,
u_long nut_millis 
)

This command will read the estimate of the value of the Bluetooth Clock and get a nut/os system clock timestamp at the same time The BT Clock ticks every 0.3125 ms = 3.2 kHz.

Note:
The BTnode Rev 3 Zeevo returns the BT Clock divided by four. The returned time therefore has a precision of 1.25 ms. To somehow match the BT specifiation, the returned number is multiplied by four in the stack hence resulting in the two lowest bits always being zero.

The BTnode Rev 3 Zeevo does not support retrieval of a remote clock but this can be accomplished by using bt_hci_read_clock( local ), bt_hci_read_clock_offset( remote device ) and receiving one packet with the complete BT clock from the remote device. The BT Clock offset is within 0-2^14 * 1.25 ms ~ 30 seconds

Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
which_clock The clock to use. 0 = Internal, 1 = Remote
con_handle The (internal) connection handle if remote clock is read
accuracy a u_short to store the retrieved accuracy if not NULL
nut_millis a u_long to store NutGetMillis()
Returns:
BT Clock (28 bit) or possible errors:
Examples:
btstreamer/receiver/btreceiver.c, and btstreamer/streamer/btstreamer.c.

long bt_hci_read_clock_offset ( struct btstack stack,
struct bt_hci_cmd_response response,
bt_hci_con_handle_t  app_con_handle 
)

Read clock offset to remove device

The clock offset is specified as Bit 16-2 of CLKslabe-CLKmaster (MOD 32768) which means that the clock difference is always possitive and has a 1.25 ms resolution.

Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
con_handle The con. handle of remote device
Returns:
clock offset or possible errors:
Examples:
btstreamer/receiver/btreceiver.c, and btstreamer/streamer/btstreamer.c.

long bt_hci_read_connection_accept_timeout ( struct btstack stack,
struct bt_hci_cmd_response response 
)

This reads the max. time the controller will wait for the stack after a connection request event is sent.

If the stack does not respond in the given time, the connections is rejected. The default value is 0x1F40 (=5.00 s)

Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
Returns:
Waittime = time * 0.625msec (1 Baseband slot) range: 0x0001 - 0xB540 if everything is fine and the call was sync or possible errors:
Examples:
btstreamer/streamer/btstreamer.c.

long bt_hci_read_default_link_policy_settings ( struct btstack stack,
struct bt_hci_cmd_response response 
)

Reads the default link policy settings for all connections.

Multiple settings may be or'ed!
Possible Settings:

Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
Returns:
setting or possible errors:

long bt_hci_read_inquiry_mode ( struct btstack stack,
struct bt_hci_cmd_response response 
)

This cmd reads the inquiry mode (with or wihtout RSSI).

Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
Returns:
BT_HCI_INQUIRY_MODE_STD or BT_HCI_INQUIRY_MODE_RSSI or possible errors:

long bt_hci_read_inquiry_scan_type ( struct btstack stack,
struct bt_hci_cmd_response response 
)

This cmd reads the inquiry scan type.

Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
Returns:
BT_HCI_INQUIRY_SCAN_STD or BT_HCI_INQUIRY_SCAN_INTERLACED or possible errors:

long bt_hci_read_link_policy_settings ( struct btstack stack,
struct bt_hci_cmd_response response,
bt_hci_con_handle_t  con_handle 
)

Reads the link policy settings for a given connection.

Multiple settings may be or'ed (|)!
Possible Settings:

Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
con_handle the application connection handle
Returns:
setting or possible errors:

long bt_hci_read_link_supervision_timeout ( struct btstack stack,
struct bt_hci_cmd_response response,
bt_hci_con_handle_t  con_handle 
)

This cmd reads the supervision timeout (timeout that will be triggered if the link is lost).

Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
con_handle The con_handle for which link supervision timeout is to be read
Returns:
link supervions timeout x 0.625 ms or possible errors:

long bt_hci_read_local_cod ( struct btstack stack,
struct bt_hci_cmd_response response 
)

Reads the local class of device.

Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
Returns:
cod (lower 24 Bit) or possible errors:

long bt_hci_read_local_extended_features ( struct btstack stack,
struct bt_hci_cmd_response response 
)

The HCI_Read_Local_Extended_Features command returns the requested page of the extended LMP features.

If the stack does not respond in the given time, the connections is rejected. The default value is 0x1F40 (=5.00 s)

Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
Returns:
Waittime = time * 0.625msec (1 Baseband slot) range: 0x0001 - 0xB540 if everything is fine and the call was sync or possible errors:

long bt_hci_read_local_name ( struct btstack stack,
struct bt_hci_cmd_response response,
u_char name,
u_char  maxlen 
)

This cmd gets the local name of the bt-device referenced by the stack.

Max. length of name is 248 chars.

Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
name Pointer to a free char array for the local name
maxlen Length of the free char array
Returns:
len of name if everything is fine and the call was sync or possible errors:
Examples:
btstreamer/streamer/btstreamer.c.

long bt_hci_read_local_supported_commands ( struct btstack stack,
struct bt_hci_cmd_response response 
)

This command reads the list of HCI commands supported for the local device (if suported).

If the stack does not respond in the given time, the connections is rejected. The default value is 0x1F40 (=5.00 s)

Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
Returns:
Waittime = time * 0.625msec (1 Baseband slot) range: 0x0001 - 0xB540 if everything is fine and the call was sync or possible errors:

long bt_hci_read_local_supported_features ( struct btstack stack,
struct bt_hci_cmd_response response,
u_char features 
)

This command requests a list of the supported features for the local device. This command will return a list of the LMP features.

If the stack does not respond in the given time, the connections is rejected. The default value is 0x1F40 (=5.00 s)

Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
Returns:
Waittime = time * 0.625msec (1 Baseband slot) range: 0x0001 - 0xB540 if everything is fine and the call was sync or possible errors:

long bt_hci_read_local_version_information ( struct btstack stack,
struct bt_hci_cmd_response response,
struct bt_hci_local_version_result version 
)

This command will read the values for the version information for the local Bluetooth device. The HCI Version information defines the version information of the HCI layer. The LMP Version information defines the version of the LMP. The Manufacturer_Name information indicates the manufacturer of the local device.

The HCI Revision and LMP Subversion are implementation dependant.

If the stack does not respond in the given time, the connections is rejected. The default value is 0x1F40 (=5.00 s)

Parameters:
stack The bt-stack to use
response A bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
version A bt_hci_local_information_result struct that holds the return parameters
version->hciversion version->hcirevision version->lmpversion version->manufacturername version->lmpsubversion

Returns:
Waittime = time * 0.625msec (1 Baseband slot) range: 0x0001 - 0xB540 if everything is fine and the call was sync or possible errors:

long bt_hci_read_page_timeout ( struct btstack stack,
struct bt_hci_cmd_response response 
)

This reads the max. time the local link manager will wait for a baseband page response from the remote device at a locally initiated connection attempt.

The default value is 0x2000 (=5.12 s)

Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
time 
Returns:
the read-page-timeout
Waittime = time * 0.625msec (1 Baseband slot) range: 0x0001 - 0xEFFF
if the call was sync or possible errors:
Examples:
btstreamer/streamer/btstreamer.c.

long bt_hci_read_pin_type ( struct btstack stack,
struct bt_hci_cmd_response response 
)

This parameter controls wether the PIN (for pairing) is fixed or variable.

Possible values for type:

Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
Returns:
0 (async), BT_HCI_PIN_TYPE_VARIABLE, BT_HCI_PIN_TYPE_FIXED or possible errors:

long bt_hci_read_rssi ( struct btstack stack,
struct bt_hci_cmd_response response,
bt_hci_con_handle_t  con_handle,
short *  rssi 
)

This command reads the rssi value of an active connection.

Note: The rssi value-range: -127 to +20, Units: dBm. Since the char type is not necessarily defined as signed we pass a pointer of type short (signed)!

The rssi-value will be stored in the rssi-Pointer This is done because the rssi value is signed and this does not complies with the default return police

Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
con_handle The (internal) connection handle
rssi Pointer where the rssi-value will be filled in!
Returns:
0 or possible errors:

long bt_hci_read_scan_enable ( struct btstack stack,
struct bt_hci_cmd_response response 
)

This parameter controls wether or not the bt-device will periodically scan for page attemps and/or inquiry requests from other devices.

Possible values for type:

Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
Returns:
the type or possible errors:
Examples:
btstreamer/streamer/btstreamer.c.

long bt_hci_remote_name_request ( struct btstack stack,
bt_addr_t  addr,
u_short  clock_offset,
u_char  page_scan_repetition_mode,
char *  name,
u_char  maxlen 
)

Looks for the human-readable name of a given bd-address.

Max. length of name is 248 chars.

If the returned length is larger than the passed maxlen, then one knows, that the name did not fit into the array.

This command is only available in a synchronized version!

Parameters:
stack The bt-stack to use
addr BT-Addr to look for
clock_offset Offset to this device (found during inquiry). pass 0 if unknown
page_scan_repetition_mode also found during inquiry, pass 0 if unsure
name The name of this device, '\0' terminated
maxlen The length of the string passed in the name parameter (nr. of allocated bytes)
Returns:
the len of the name if everything is find and the call was sync or possible errors:
Examples:
btstreamer/streamer/btstreamer.c.

long bt_hci_reset ( struct btstack stack,
struct bt_hci_cmd_response response 
)

Resets the controller (but not the stack!), no parameters needed.

Attention:
You have to reset the stack manually before!
The hci-cmd itself takes no parameters!
Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
Returns:
0 or possible errors:

long bt_hci_role_discovery ( struct btstack stack,
struct bt_hci_cmd_response response,
bt_hci_con_handle_t  con_handle 
)

Returns the Role of the specified con_handle.

Do not confuse this command with bt_hci_local_role_discovery(...) that gets the information only from the entry in the connection table!

This cmd actually asks the bluetooth module.

Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
con_handle The pointer where the result will be stored
Returns:
BT_HCI_MY_ROLE_MASTER, BT_HCI_MY_ROLE_SLAVE if everything was ok and the call was sync or possible errors:

long bt_hci_role_set ( struct btstack stack,
struct bt_hci_cmd_response response,
bt_hci_con_handle_t  con_handle,
u_char  role 
)

Sends the role change request to the connected device with con_handle.

This request can be observed explicitly with passing a role_response. To use this function as a synchronous call, pass BT_HCI_SYNC as role_response and and the new role will be passed as return value. Otherwise the new role will be set in the role_response struct!

Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
con_handle The pointer where the result will be stored
role The new role of this device: BT_HCI_MY_ROLE_MASTER or BT_HCI_MY_ROLE_SLAVE
Returns:
the new role if the call was sync or possible errors:

long bt_hci_set_baudrate ( struct btstack stack,
u_char  baudrate 
)

Sets the desired baudrate. This command is specific for the uart layer!

Possible Baudrate:

Parameters:
stack The bt-stack to use
baudrate A possible Baudrate
Returns:
0 if everything was ok, or an errorcode on error

long bt_hci_set_event_filter ( struct btstack stack,
struct bt_hci_cmd_response response,
u_char  param,
  ... 
)

Sets the HCI event filter.

HCI_OCF_HC_SET_EVENT_FILTER:
The Set Event Filter command is used by the Host to specify different event filters. This command looks like a little messed up - the number and size of the parameters depend on various previous parameters...

Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
param OpenParameter-List, depends on cmd (see below)
 		first parameter: Filter type.
 		0x00 - No filter (clear all filter)
 		0x01 - Inquiry Filter
 			second parameter: inq. result filter condition:
 			0x00: return all events
 			0x01: filter on device class
 				third parameter: class of device (u_long)
 				forth parameter: device-mask (active bits, u_long)
 			0x02: show only one spec. device
 				third parameter: device (bt_addr_t)
 		0x02 - Connection Filter
 			second parameter: conn. setup filter type:
 			0x00: allow connections from all devices
 				third parameter: auto_accept_flag (u_char)
 				0x01 - no auto accept
 				0x02 - auto accept / no role switch
 				0x03 - auto accept & role switch
 			0x01: allow connect from device class
 				third parameter: class of device (u_long)
 				forth parameter: device-mask (active bits, u_long)
 				fifth parameter: auto_accept_flag (u_char)
 				0x01 - no auto accept
 				0x02 - auto accept / no role switch
 				0x03 - auto accept & role switch
 			0x02: show only one spec. device
 				third parameter: device (bt_addr_t)
 				forth parameter: auto_accept_flag (u_char)
 				0x01 - no auto accept
 				0x02 - auto accept / no role switch
 				0x03 - auto accept & role switch
Returns:
0 or possible errors:
Note: if setting up a connection filter and auto accept is turned off (i.e. the auto-accept flag is set to 0x01), handling connection requests must be done by the application itself. This has to be done by registering a connection request callback using bt_hci_register_con_request_cb.

long bt_hci_set_event_mask ( struct btstack stack,
struct bt_hci_cmd_response response,
u_long  mask_high,
u_long  mask_low 
)

Sets the HCI event mask.

Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
mask_high The higher 32 bit of the event mask
mask_low The lower 32 bit of the event mask
Returns:
0 on success

long bt_hci_set_flowcontrol ( struct btstack stack,
struct bt_hci_cmd_response response,
u_char  type 
)

This parameter sets the flow-control to the given type.

If the flow-control is active the host must send host_number_of_completed_pkts!

The default is BT_HCI_FLOWCONTROL_ACL, because SCO is not supported by the bt-controller!

Attention:
This command may NOT be called from an application !
It is internal for the stack and is only used after a reset to get these informational parameters and must be called only if no connections are open!
Possible values for type:

Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
type One of the possible values for type
Returns:
0 or possible errors:

long bt_hci_sniff_mode ( struct btstack stack,
struct bt_hci_cmd_response response,
bt_hci_con_handle_t  app_con_handle,
u_short  max_interval,
u_short  min_interval,
u_short  attempt,
u_short  timeout 
)

Sets sniff mode for a given connection.

remark: the controller will return the actual sniff interval in the interval parameter of the mode change event.

it is possible for the master to transmit data to a slave without exiting sniff mode!

limitations by Zeevo ZV4002:

the max_interval shall be less than the link supervision timeout configuration parameter.

mandatory range for interval: 0x0006-0x0540 mandatory range for attempt: 0x0001-(interval/2) mandatory range for timout: 0x0000-0x0028

Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
con_handle the application connection handle
max_interval maximum acceptable number of baseband slots for sniff period (range: 0x0002-0xfffe, only even values are valid)
min_interval minimum acceptable number of baseband slots for sniff period (range: 0x0002-0xfffe, only even values are valid)
attempt number of baseband receive slots for sniff attempt (range: 0x0001-0x7fff)
timeout number of baseband receive slots for sniff timeout (range: 0x0001-0x7fff)
Returns:
0 or possible errors:

long bt_hci_write_authentication_enable ( struct btstack stack,
struct bt_hci_cmd_response response,
u_char  enable 
)

Writes the authentication the value for the Authentication_Enable configuration parameter.

Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
enable flag
Returns:
0 or possible errors:

long bt_hci_write_connection_accept_timeout ( struct btstack stack,
struct bt_hci_cmd_response response,
u_short  time 
)

This writes the max. time the controller will wait for the stack after a connection request event is sent.

If the stack does not respond in the given time, the connections is rejected. The default value is 0x1F40 (=5.00 s)

Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
time Waittime = time * 0.625msec (1 Baseband slot) range: 0x0001 - 0xB540
Returns:
0 or possible errors:

long bt_hci_write_default_link_policy_settings ( struct btstack stack,
struct bt_hci_cmd_response response,
u_short  settings 
)

Sets the new link policy settings for all connections.

Multiple settings may be or'ed!
Possible Settings:

remark: ROLE_SWITCH only works for slave role, somehow master is not allowed to change the role at the first time. after one role switch, master and slave are able to change the role!

Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
settings The new default settings
Returns:
0 or possible errors:

long bt_hci_write_encryption_mode ( struct btstack stack,
struct bt_hci_cmd_response response,
u_char  encryption_mode 
)

Writes the value for the encrytption configuration parameter.

Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
encryption mode
Returns:
0 or possible errors:

long bt_hci_write_inquiry_mode ( struct btstack stack,
struct bt_hci_cmd_response response,
u_char  mode 
)

This cmd writes the inquiry mode (with or wihtout RSSI).

Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
mode BT_HCI_INQUIRY_MODE_STD or BT_HCI_INQUIRY_MODE_RSSI
Returns:
0 or possible errors:

long bt_hci_write_inquiry_scan_type ( struct btstack stack,
struct bt_hci_cmd_response response,
u_char  mode 
)

This cmd writes the inquiry scan type.

Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
mode BT_HCI_INQUIRY_SCAN_STD or BT_HCI_INQUIRY_SCAN_INTERLACED
Returns:
0 or possible errors:

long bt_hci_write_link_policy_settings ( struct btstack stack,
struct bt_hci_cmd_response response,
bt_hci_con_handle_t  con_handle,
u_short  settings 
)

Sets the new link policy settings for a given connection.

Multiple settings may be or'ed (|)!
Possible Settings:

Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
con_handle the application connection handle
settings The new settings
Returns:
0 or possible errors:
Examples:
btstreamer/receiver/btreceiver.c, and btstreamer/streamer/btstreamer.c.

long bt_hci_write_link_supervision_timeout ( struct btstack stack,
struct bt_hci_cmd_response response,
bt_hci_con_handle_t  con_handle,
u_short  timeout 
)

This cmd writes the supervision timeout (timeout that will be triggered if the link is lost).

Parameters:
stack The bt-stack to use
con_handle The con_handle for which link supervision timeout is to be set
timeout The link supervision timeout x 0.625ms
Returns:
0 or possible errors:

long bt_hci_write_local_cod ( struct btstack stack,
struct bt_hci_cmd_response response,
u_long  cod 
)

Writes the local calss of device.

Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
cod Pointer to the local class of device (lower 24 Bit)
Returns:
0 or possible errors:
Examples:
bt-remoteprog/demo-rprog.c, l2cap-cmd/l2cap-cmd.c, and rfcomm-cmd/rfcomm-cmd.c.

long bt_hci_write_local_name ( struct btstack stack,
struct bt_hci_cmd_response response,
u_char name 
)

This cmd sets the local name of the bt-device referenced by the stack.

Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
name The name of this device terminated with '\0'
Returns:
0 or possible errors:
Examples:
bt-remoteprog/demo-rprog.c, btstreamer/receiver/btreceiver.c, and btstreamer/streamer/btstreamer.c.

long bt_hci_write_page_timeout ( struct btstack stack,
struct bt_hci_cmd_response response,
u_short  time 
)

This defines the max. time the local link manager will wait for a baseband page response from the remote device at a locally initiated connection attempt.

The default value is 0x2000 (=5.12 s)

Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
time Waittime = time * 0.625msec (1 Baseband slot) range: 0x0001 - 0xEFFF
Returns:
0 or possible errors:

long bt_hci_write_pin_type ( struct btstack stack,
struct bt_hci_cmd_response response,
u_char  type 
)

* This parameter controls wether the PIN (for pairing) is fixed or variable.

Possible values for type:

Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
type BT_HCI_PIN_TYPE_VARIABLE or BT_HCI_PIN_TYPE_FIXED
Returns:
0 or possible errors:

long bt_hci_write_scan_enable ( struct btstack stack,
struct bt_hci_cmd_response response,
u_char  type 
)

This parameter controls wether or not the bt-device will periodically scan for page attemps and/or inquiry requests from other devices.

Possible values for type:

Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
type One of the possible values for type
Returns:
0 or possible errors:

long bt_hci_write_stored_link_key ( struct btstack stack,
struct bt_hci_cmd_response response,
bt_addr_t  addr,
link_key_t  link_key 
)

This cmd stores the link key for a given bd addr.

Parameters:
stack The bt-stack to use
response a bt_hci_cmd_response struct for async. calls or BT_HCI_SYNC
addr of the link key to store
link_key the 128 bit (16 byte) link key
Returns:
0 or possible errors:


Generated on Wed Apr 29 11:12:28 2009 for BTnut System Software by doxygen 1.5.1