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


Detailed Description

Defines general structs and variables.

Author:
Mathias Payer <payerm@student.ethz.ch>
Date:
2004/04/14 21:37:09

#include <sys/device.h>
#include <sys/mutex.h>
#include <hardware/btn-hardware.h>
#include <bt/bt_semaphore.h>
#include <bt/bt_hci_defs.h>
#include <stdio.h>

Data Structures

struct  bt_hci_uart
struct  bt_timestamp
struct  btstack
 Represents one entity of a running stack (more possible) Keeps all data for one stack, like devices, buffers, states, ... More...
struct  event_mask_high_low
struct  host_buffer_len_nr
struct  param_list

Defines

#define BT_HCI_CONNECTION   2
#define BT_HCI_CONNECTION_ACTIVE   0
#define BT_HCI_CONNECTION_PASSIVE   1
#define BT_HCI_DISCONNECTION   3
#define BT_HCI_MY_ROLE_MASTER   0
#define BT_HCI_MY_ROLE_SLAVE   1
#define BT_HCI_NR_WAIT_QUEUES   16
#define BT_HCI_WAIT_QUEUE_NONE   0xff
#define BTN_DEFAULT_PIN   "1234"
 Default pin code for the BTnode.
#define BTN_HI(A)   ((u_char)((A)>>8)&0xFF)
 returns the high byte of a u_short.
#define BTN_HI2(A)   ((u_char)((A)>>16)&0xFF)
 returns the 2nd high byte of a u_short.
#define BTN_LO(A)   ((u_char)((A)&0xFF))
 returns the low byte of a u_short.
#define BTN_NR_CONNECT_CALLBACK   5
 Nr of allowed connection callbacks.
#define HCI_ACL_CB   struct bt_hci_pkt_acl *(*hci_acl_cb) (void *arg, struct bt_hci_pkt_acl *pkt, bt_hci_con_handle_t con_handle, u_char pb_flag, u_char bc_flag, u_short len, u_long t_arrive)
#define HCI_ACL_CB_REGISTRATION   void (*acl_cb_reg)(struct btstack* stack, HCI_ACL_CB, void* cb_arg)
 Definition of the acl callback registration function.
#define HCI_CON_RQST_CB   void(*con_rqst_cb) (bt_addr_t addr, u_long cod, u_char type, void* arg)
 Callback to filter connection requests.
#define HCI_CON_TABLE_CB   void (*con_table_cb) (u_char type, u_char detail, bt_hci_con_handle_t con_handle, void* cb_arg)
 Callback for connection table changes.
#define HCI_CON_TABLE_CB_REGISTRATION   void (*con_table_cb_reg)(struct btstack* stack, HCI_CON_TABLE_CB, void* cb_arg)
 Definition of the con table change callback registration function.
#define HCI_LINK_KEY_NOTIFICATION_CB   void(*link_key_notification_cb) (bt_addr_t addr, link_key_t key, void* arg)
 Callback to retrieve link keys.
#define HCI_PIN_CODE_REQUEST_CB   u_char(*pin_code_request_cb) (bt_addr_t addr, void* arg)
 Callback to respond to Pin Code Requests.
#define HCI_SCO_CB   struct bt_hci_pkt_sco *(*hci_sco_cb) (void *arg, struct bt_hci_pkt_sco *pkt, bt_hci_con_handle_t con_handle, u_char len)
#define HCI_TRANSPORT   UART
#define NUT_DEFAULT_STACKSIZE   2048

Typedefs

typedef void(*) con_table_cb_t (u_char type, u_char detail, bt_hci_con_handle_t con_handle, void *cb_arg)
typedef bt_hci_pkt_acl *(*) hci_acl_cb_t (void *arg, struct bt_hci_pkt_acl *pkt, bt_hci_con_handle_t con_handle, u_char pb_flag, u_char bc_flag, u_short len, u_long t_arrive)


Define Documentation

#define BT_HCI_CONNECTION   2

Connection type

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

#define BT_HCI_CONNECTION_ACTIVE   0

Connection opened active, means this device triggered connection request

#define BT_HCI_CONNECTION_PASSIVE   1

Connection opened passive, means other device triggered connection request

#define BT_HCI_DISCONNECTION   3

Disconnection type

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

#define BT_HCI_MY_ROLE_MASTER   0

Indicates that the role of this device is master

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

#define BT_HCI_MY_ROLE_SLAVE   1

Indicates that the role of this device is slave

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

#define BT_HCI_NR_WAIT_QUEUES   16

The number of wait queues for synchronous running events, after completition these threads get woken up. Min: 8, max: 254.
Keep in mind that at most NR_WAIT_QUEUES commands can be running at a time, even if they are called asynchronous!

#define HCI_ACL_CB   struct bt_hci_pkt_acl *(*hci_acl_cb) (void *arg, struct bt_hci_pkt_acl *pkt, bt_hci_con_handle_t con_handle, u_char pb_flag, u_char bc_flag, u_short len, u_long t_arrive)

Callbacks for the acl data

#define HCI_CON_RQST_CB   void(*con_rqst_cb) (bt_addr_t addr, u_long cod, u_char type, void* arg)

Callback to filter connection requests.

This function is called whenever a connection request event is received from the controller. Connections can be accepted by using bt_hci_accept_connection_request or rejected by calling bt_hci_reject_connection_request.

Note: due to the current implementation of the bt-stack, connection requests must not be handled in the connection request callback - they have to be handled in a separate context.

Note: Connection requests are turned off by default (i.e. auto-acception of incoming connection requests is turned on). To change this policy, use bt_hci_set_event_filter.

For details, refer to the documentation of the Connection Request Event in the BT spec.

Parameters:
addr The address of the requesting device
cod The class of device of the requesting device
type Requested link type (0x00 for SCO, 0x01 for ACL, ...)
arg pointer to an optional argument that has been registered

#define HCI_CON_TABLE_CB   void (*con_table_cb) (u_char type, u_char detail, bt_hci_con_handle_t con_handle, void* cb_arg)

Callback for connection table changes.

To observe any connection, disconnection or role changes the application can register a callback function HCI_CON_TABLE_CB that will be called with two arguments: type of change, extra info for some changes and the changed connection It is important that the callback returns very fast!

For BT_HCI_CONNECTION details tells, if connection was opend by us BT_HCI_CONNECTION_ACTIVE or BT_HCI_CONNECTION_PASSIVE
For BT_HCI_DISCONNECTION, details tells the disconnect reason

#define HCI_LINK_KEY_NOTIFICATION_CB   void(*link_key_notification_cb) (bt_addr_t addr, link_key_t key, void* arg)

Callback to retrieve link keys.

This function is called whenever a link key notification is received from the controller.

Note: due to the current implementation of the bt-stack, the link key should not stored directly, e.g., with the hci_write_stored_link_key but rather tmporarily stored by the main application to be stored in the BT module later, e.g., after the connection is fully established and authenticated.

For details, refer to the documentation of the Link Key Notification Event in the BT spec.

Parameters:
addr The address of the requesting device
key The generated link key
arg pointer to an optional argument that has been registered

#define HCI_PIN_CODE_REQUEST_CB   u_char(*pin_code_request_cb) (bt_addr_t addr, void* arg)

Callback to respond to Pin Code Requests.

This function is called whenever a pin code requested is received from the controller. The callback can decide wheter the default pin should be send

The main aim of this callback is to provide an interactive application with the information that the PIN has to be entered on the remote device

Note: due to the current implementation of the bt-stack, a pin_code_request_reply should not be sent from the pin code request callback - they have to be handled in a separate context.

For details, refer to the documentation of the Pin Code Request Event in the BT spec.

Parameters:
addr The address of the requesting device
arg pointer to an optional argument that has been registered
Returns:
use_default_pin

#define HCI_SCO_CB   struct bt_hci_pkt_sco *(*hci_sco_cb) (void *arg, struct bt_hci_pkt_sco *pkt, bt_hci_con_handle_t con_handle, u_char len)

Callbacks for the sco data


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