updated autogenerated tex apis

This commit is contained in:
Milanka Ringwald 2015-04-09 14:49:03 +02:00
parent 5e6d58c471
commit ad34000efe
8 changed files with 269 additions and 123 deletions

View File

@ -1,21 +1,91 @@
% !TEX root = btstack_gettingstarted.tex
\section{GATT Client API}
\section{GATT Client}
\label{appendix:api_gatt_client}
$ $
\begin{lstlisting}
typedef struct le_event {
uint8_t type;
uint16_t handle;
} le_event_t;
typedef struct gatt_complete_event{
uint8_t type;
uint16_t handle;
uint16_t attribute_handle;
uint8_t status;
} gatt_complete_event_t;
typedef struct le_service{
uint16_t start_group_handle;
uint16_t end_group_handle;
uint16_t uuid16;
uint8_t uuid128[16];
} le_service_t;
typedef struct le_service_event{
uint8_t type;
uint16_t handle;
le_service_t service;
} le_service_event_t;
typedef struct le_characteristic{
uint16_t start_handle;
uint16_t value_handle;
uint16_t end_handle;
uint16_t properties;
uint16_t uuid16;
uint8_t uuid128[16];
} le_characteristic_t;
typedef struct le_characteristic_event{
uint8_t type;
uint16_t handle;
le_characteristic_t characteristic;
} le_characteristic_event_t;
typedef struct le_characteristic_value_event{
uint8_t type;
uint16_t handle;
uint16_t value_handle;
uint16_t value_offset;
uint16_t blob_length;
uint8_t * blob;
} le_characteristic_value_event_t;
typedef struct le_characteristic_descriptor{
uint16_t handle;
uint16_t uuid16;
uint8_t uuid128[16];
} le_characteristic_descriptor_t;
typedef struct le_characteristic_descriptor_event{
uint8_t type;
uint16_t handle;
le_characteristic_descriptor_t characteristic_descriptor;
uint16_t value_length;
uint16_t value_offset;
uint8_t * value;
} le_characteristic_descriptor_event_t;
typedef void (*gatt_client_callback_t)(le_event_t * event);
// Set up GATT client.
void gatt_client_init();
// Register callback (packet handler) for gatt client. Returns gatt client ID.
// Register callback (packet handler) for GATT client. Returns GATT
// client ID.
uint16_t gatt_client_register_packet_handler (gatt_client_callback_t callback);
// Unregister callback (packet handler) for gatt client.
// Unregister callback (packet handler) for GATT client.
void gatt_client_unregister_packet_handler(uint16_t gatt_client_id);
// Returns the GATT client context for the specified handle.
// gatt_client_t * get_gatt_client_context_for_handle(uint16_t con_handle);
// MTU is available after the first query has completed.
// If status is equal to BLE_PERIPHERAL_OK, it returns the real
// value, otherwise the default value of 23.
le_command_status_t gatt_client_get_mtu(uint16_t handle, uint16_t * mtu);
// Returns if the gatt client is ready to receive a query. It is used with daemon.
// Returns if the GATT client is ready to receive a query. It is
// used with daemon.
int gatt_client_is_ready(uint16_t handle);
// Discovers all primary services. For each found service, an
@ -102,7 +172,7 @@ le_command_status_t gatt_client_write_value_of_characteristic_without_response(u
// Writes the authenticated characteristic value using the
// characteristic's value handle without an acknowledgement
// that the write was successfully performed.
le_command_status_t gatt_client_signed_write_without_response(uint16_t gatt_client_id, uint16_t con_handle, uint16_t handle, uint16_t message_len, uint8_t * message, sm_key_t csrk, uint32_t sgn_counter);
le_command_status_t gatt_client_signed_write_without_response(uint16_t gatt_client_id, uint16_t con_handle, uint16_t handle, uint16_t message_len, uint8_t * message);
// Writes the characteristic value using the characteristic's value
// handle. The gatt_complete_event_t with type set to
@ -151,4 +221,4 @@ le_command_status_t gatt_client_write_long_characteristic_descriptor(uint16_t ga
// as configuration value.
le_command_status_t gatt_client_write_client_characteristic_configuration(uint16_t gatt_client_id, uint16_t con_handle, le_characteristic_t * characteristic, uint16_t configuration);
\end{lstlisting}
\pagebreak
\pagebreak

View File

@ -1,18 +1,49 @@
% !TEX root = btstack_gettingstarted.tex
\section{Host Controller Interface (HCI) API}
\section{Host Controller Interface (HCI)}
\label{appendix:api_hci}
$ $
\begin{lstlisting}
// Set up HCI.
le_connection_parameter_range_t gap_le_get_connection_parameter_range();
void gap_le_set_connection_parameter_range(le_connection_parameter_range_t range);
/* LE Client Start */
le_command_status_t le_central_start_scan(void);
le_command_status_t le_central_stop_scan(void);
le_command_status_t le_central_connect(bd_addr_t addr, bd_addr_type_t addr_type);
le_command_status_t le_central_connect_cancel(void);
le_command_status_t gap_disconnect(hci_con_handle_t handle);
void le_central_set_scan_parameters(uint8_t scan_type, uint16_t scan_interval, uint16_t scan_window);
/* LE Client End */
void hci_connectable_control(uint8_t enable);
void hci_close(void);
// new functions replacing:
// hci_can_send_packet_now[_using_packet_buffer]
int hci_can_send_command_packet_now(void);
// gets local address
void hci_local_bd_addr(bd_addr_t address_buffer);
// Set up HCI. Needs to be called before any other function.
void hci_init(hci_transport_t *transport, void *config, bt_control_t *control, remote_device_db_t const* remote_device_db);
// Used if L2CAP is not used (rarely).
// Set class of device that will be set during Bluetooth init.
void hci_set_class_of_device(uint32_t class_of_device);
// Set Public BD ADDR - passed on to Bluetooth chipset if supported
// in bt_control_h
void hci_set_bd_addr(bd_addr_t addr);
// Registers a packet handler. Used if L2CAP is not used (rarely).
void hci_register_packet_handler(void (*handler)(uint8_t packet_type, uint8_t *packet, uint16_t size));
// Requests the change of BTstack power mode.
int hci_power_control(HCI_POWER_MODE mode);
// Allows to control if device is dicoverable. OFF by default.
// Allows to control if device is discoverable. OFF by default.
void hci_discoverable_control(uint8_t enable);
// Creates and sends HCI command packets based on a template and
@ -22,5 +53,22 @@ int hci_send_cmd(const hci_cmd_t *cmd, ...);
// Deletes link key for remote device with baseband address.
void hci_drop_link_key_for_bd_addr(bd_addr_t addr);
/* Configure Secure Simple Pairing */
// Enable will enable SSP during init.
void hci_ssp_set_enable(int enable);
// If set, BTstack will respond to io capability request using
// authentication requirement.
void hci_ssp_set_io_capability(int ssp_io_capability);
void hci_ssp_set_authentication_requirement(int authentication_requirement);
// If set, BTstack will confirm a numberic comparion and enter
// '000000' if requested.
void hci_ssp_set_auto_accept(int auto_accept);
// Get addr type and address used in advertisement packets.
void hci_le_advertisement_address(uint8_t * addr_type, bd_addr_t addr);
\end{lstlisting}
\pagebreak
\pagebreak

View File

@ -1,40 +1,64 @@
% !TEX root = btstack_gettingstarted.tex
\section{L2CAP API}
\section{L2CAP}
\label{appendix:api_l2cap}
$ $
\begin{lstlisting}
// Set up L2CAP and register L2CAP with HCI layer.
void l2cap_init(void);
// Registers a packet handler that handles HCI and general BTstack
// Registers a packet handler that handles HCI and general BTstack
// events.
void l2cap_register_packet_handler(void (*handler)(void * connection, uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size));
// Creates L2CAP channel to the PSM of a remote device with baseband
// address. A new baseband connection will be initiated if needed.
// Creates L2CAP channel to the PSM of a remote device with baseband
// address. A new baseband connection will be initiated if necessary.
void l2cap_create_channel_internal(void * connection, btstack_packet_handler_t packet_handler, bd_addr_t address, uint16_t psm, uint16_t mtu);
// Disconencts L2CAP channel with given identifier.
void l2cap_disconnect_internal(uint16_t local_cid, uint8_t reason);
// Queries the maximal transfer unit (MTU) for L2CAP channel with
// Queries the maximal transfer unit (MTU) for L2CAP channel with
// given identifier.
uint16_t l2cap_get_remote_mtu_for_local_cid(uint16_t local_cid);
// Sends L2CAP data packet to the channel with given identifier.
int l2cap_send_internal(uint16_t local_cid, uint8_t *data, uint16_t len);
// Registers L2CAP service with given PSM and MTU, and assigns a
// Registers L2CAP service with given PSM and MTU, and assigns a
// packet handler. On embedded systems, use NULL for connection
// parameter.
void l2cap_register_service_internal(void *connection, btstack_packet_handler_t packet_handler, uint16_t psm, uint16_t mtu);
void l2cap_register_service_internal(void *connection, btstack_packet_handler_t packet_handler, uint16_t psm, uint16_t mtu, gap_security_level_t security_level);
// Unregisters L2CAP service with given PSM. On embedded systems,
// Unregisters L2CAP service with given PSM. On embedded systems,
// use NULL for connection parameter.
void l2cap_unregister_service_internal(void *connection, uint16_t psm);
// Accepts/Deny incoming L2CAP connection.
void l2cap_accept_connection_internal(uint16_t local_cid);
void l2cap_decline_connection_internal(uint16_t local_cid, uint8_t reason);
// Request LE connection parameter update
int l2cap_le_request_connection_parameter_update(uint16_t handle, uint16_t interval_min, uint16_t interval_max, uint16_t slave_latency, uint16_t timeout_multiplier);
// Non-blocking UART write
int l2cap_can_send_packet_now(uint16_t local_cid);
int l2cap_reserve_packet_buffer(void);
void l2cap_release_packet_buffer(void);
// Get outgoing buffer and prepare data.
uint8_t *l2cap_get_outgoing_buffer(void);
int l2cap_send_prepared(uint16_t local_cid, uint16_t len);
int l2cap_send_prepared_connectionless(uint16_t handle, uint16_t cid, uint16_t len);
// Bluetooth 4.0 - allows to register handler for Attribute Protocol
// and Security Manager Protocol
void l2cap_register_fixed_channel(btstack_packet_handler_t packet_handler, uint16_t channel_id);
uint16_t l2cap_max_mtu(void);
uint16_t l2cap_max_le_mtu(void);
int l2cap_send_connectionless(uint16_t handle, uint16_t cid, uint8_t *data, uint16_t len);
\end{lstlisting}
\pagebreak
\pagebreak

View File

@ -1,43 +1,46 @@
% !TEX root = btstack_gettingstarted.tex
\section{RFCOMM API}
\section{RFCOMM}
\label{appendix:api_rfcomm}
$ $
\begin{lstlisting}
// Set up RFCOMM.
void rfcomm_init(void);
// Set security level required for incoming connections, need to be
// called before registering services.
void rfcomm_set_required_security_level(gap_security_level_t security_level);
// Register packet handler.
void rfcomm_register_packet_handler(void (*handler)(void *connection, uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size));
void rfcomm_register_packet_handler(void (*handler)(void * connection, uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size));
// Creates RFCOMM connection (channel) to a given server channel on
// a remote device with baseband address. A new baseband connection
// will be initiated if necessary.
// This connection is an RFCOMM channel. The channel will
// automatically provide enough credits to the remote side.
void rfcomm_create_channel_internal(void *connection, bd_addr_t addr, uint8_t channel);
// will be initiated if necessary. This channel will automatically
// provide enough credits to the remote side
void rfcomm_create_channel_internal(void * connection, bd_addr_t addr, uint8_t channel);
// Creates RFCOMM connection (channel) to a given server channel on
// a remote device with baseband address. A new baseband connection
// will be initiated if necessary.
// This channel will use explicit credit management. During channel
// establishment, an initial amount of credits is provided.
void rfcomm_create_channel_with_initial_credits_internal(void *connection, bd_addr_t addr, uint8_t server_channel, uint8_t initial_credits);
// Creates RFCOMM connection (channel) to a given server channel on
// a remote device with baseband address. new baseband connection
// will be initiated if necessary. This channel will use explicit
// credit management. During channel establishment, an initial
// amount of credits is provided.
void rfcomm_create_channel_with_initial_credits_internal(void * connection, bd_addr_t addr, uint8_t server_channel, uint8_t initial_credits);
// Disconencts RFCOMM channel with given identifier.
void rfcomm_disconnect_internal(uint16_t rfcomm_cid);
// Registers RFCOMM service for a server channel and a maximum frame
// size, and assigns a packet handler. On embedded systems, use NULL
// for connection parameter. This channel will automatically provide
// for connection parameter. This channel provides automatically
// enough credits to the remote side.
void rfcomm_register_service_internal(void *connection, uint8_t channel, uint16_t max_frame_size);
void rfcomm_register_service_internal(void * connection, uint8_t channel, uint16_t max_frame_size);
// Registers RFCOMM service for a server channel and a maximum frame
// Registers RFCOMM service for a server channel and a maximum frame
// size, and assigns a packet handler. On embedded systems, use NULL
// for connection parameter. This channel will use explicit credit
// management. During channel establishment, an initial amount of
// for connection parameter. This channel will use explicit credit
// management. During channel establishment, an initial amount of
// credits is provided.
void rfcomm_register_service_with_initial_credits_internal(void *connection, uint8_t channel, uint16_t max_frame_size, uint8_t initial_credits);
void rfcomm_register_service_with_initial_credits_internal(void * connection, uint8_t channel, uint16_t max_frame_size, uint8_t initial_credits);
// Unregister RFCOMM service.
void rfcomm_unregister_service_internal(uint8_t service_channel);
@ -46,13 +49,35 @@ void rfcomm_unregister_service_internal(uint8_t service_channel);
void rfcomm_accept_connection_internal(uint16_t rfcomm_cid);
void rfcomm_decline_connection_internal(uint16_t rfcomm_cid);
// Grant more incoming credits to the remote side for the given
// RFCOMM channel identifier.
void rfcomm_grant_credits(uint16_t rfcomm_cid, uint8_t credits);
// Sends RFCOMM data packet to the RFCOMM channel with given
// Checks if RFCOMM can send packet. Returns yes if packet can be
// sent.
int rfcomm_can_send_packet_now(uint16_t rfcomm_cid);
// Sends RFCOMM data packet to the RFCOMM channel with given
// identifier.
int rfcomm_send_internal(uint16_t rfcomm_cid, uint8_t *data, uint16_t len);
int rfcomm_send_internal(uint16_t rfcomm_cid, uint8_t *data, uint16_t len);
// Sends Local Lnie Status, see LINE_STATUS_..
int rfcomm_send_local_line_status(uint16_t rfcomm_cid, uint8_t line_status);
// Sned local modem status. see MODEM_STAUS_..
int rfcomm_send_modem_status(uint16_t rfcomm_cid, uint8_t modem_status);
// Configure remote port
int rfcomm_send_port_configuration(uint16_t rfcomm_cid, rpn_baud_t baud_rate, rpn_data_bits_t data_bits, rpn_stop_bits_t stop_bits, rpn_parity_t parity, rpn_flow_control_t flow_control);
// Query remote port
int rfcomm_query_port_configuration(uint16_t rfcomm_cid);
// Allow to create rfcomm packet in outgoing buffer.
int rfcomm_reserve_packet_buffer(void);
void rfcomm_release_packet_buffer(void);
uint8_t * rfcomm_get_outgoing_buffer(void);
uint16_t rfcomm_get_max_frame_size(uint16_t rfcomm_cid);
int rfcomm_send_prepared(uint16_t rfcomm_cid, uint16_t len);
\end{lstlisting}
\pagebreak
\pagebreak

View File

@ -1,5 +1,5 @@
% !TEX root = btstack_gettingstarted.tex
\section{Run Loop API}
\section{Run Loop}
\label{appendix:api_run_loop}
$ $
\begin{lstlisting}
@ -27,16 +27,28 @@ int run_loop_remove_data_source(data_source_t *dataSource);
// Execute configured run loop. This function does not return.
void run_loop_execute(void);
// Sets how many milliseconds has one tick.
// hack to fix HCI timer handling
#ifdef HAVE_TICK
// Sets how many miliseconds has one tick.
uint32_t embedded_ticks_for_ms(uint32_t time_in_ms);
// Queries the current time in ticks.
uint32_t embedded_get_ticks(void);
// Queries the current time in ms
uint32_t embedded_get_time_ms(void);
// Allows to update BTstack system ticks based on another already
// existing clock.
void embedded_set_ticks(uint32_t ticks);
#endif
#ifdef EMBEDDED
// Sets an internal flag that is checked in the critical section
// just before entering sleep mode. Has to be called by the
// interrupt handler of a data source to signal the run loop that
// a new data is available.
void embedded_trigger(void);
// just before entering sleep mode. Has to be called by the interupt
// handler of a data source to signal the run loop that a new data
// is available.
void embedded_trigger(void);
// Execute run_loop once. It can be used to integrate BTstack's
// timer and data source processing into a foreign run runloop
// (it is not recommended).
void embedded_execute_once(void);
#endif
\end{lstlisting}
\pagebreak
\pagebreak

View File

@ -1,20 +1,32 @@
% !TEX root = btstack_gettingstarted.tex
\section{SDP API}
\section{SDP}
\label{appendix:api_sdp}
$ $
\begin{lstlisting}
// Set up SDP.
void sdp_init(void);
// Register service record internally - this version does not copy
void sdp_register_packet_handler(void (*handler)(void * connection, uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size));
#ifdef EMBEDDED
// Register service record internally - this version doesn't copy
// the record therefore it must be forever accessible.
// Preconditions:
// - AttributeIDs are in ascending order;
// - ServiceRecordHandle is first attribute and valid.
// @returns ServiceRecordHandle or 0 if registration failed.
uint32_t sdp_register_service_internal(void *connection, service_record_item_t * record_item);
#endif
#ifndef EMBEDDED
// Register service record internally - this version creates a copy
// of the record precondition: AttributeIDs are in ascending order
// => ServiceRecordHandle is first attribute if present.
// @returns ServiceRecordHandle or 0 if registration failed
uint32_t sdp_register_service_internal(void *connection, uint8_t * service_record);
#endif
// Unregister service record internally.
void sdp_unregister_service_internal(void *connection, uint32_t service_record_handle);
\end{lstlisting}
\pagebreak
\pagebreak

View File

@ -1,48 +1,18 @@
% !TEX root = btstack_gettingstarted.tex
\section{SDP Client API}
\section{SDP Client}
\label{appendix:api_sdp_client}
$ $
\begin{lstlisting}
/* SDP Client */
// Queries the SDP service of the remote device given a service
// search pattern and a list of attribute IDs. The remote data is
// Queries the SDP service of the remote device given a service
// search pattern and a list of attribute IDs. The remote data is
// handled by the SDP parser. The SDP parser delivers attribute
// values and done event via a registered callback.
void sdp_client_query(bd_addr_t remote, uint8_t * des_serviceSearchPattern, uint8_t * des_attributeIDList);
/* SDP Parser */
// Basic SDP Parser event type.
typedef enum sdp_parser_event_type {
SDP_PARSER_ATTRIBUTE_VALUE = 1,
SDP_PARSER_COMPLETE,
} sdp_parser_event_type_t;
typedef struct sdp_parser_event {
uint8_t type;
} sdp_parser_event_t;
// SDP Parser event to deliver an attribute value byte by byte.
typedef struct sdp_parser_attribute_value_event {
uint8_t type;
int record_id;
uint16_t attribute_id;
uint32_t attribute_length;
int data_offset;
uint8_t data;
} sdp_parser_attribute_value_event_t;
// SDP Parser event to indicate that parsing is complete.
typedef struct sdp_parser_complete_event {
uint8_t type;
uint8_t status; // 0 == OK
} sdp_parser_complete_event_t;
// Registers a callback to receive attribute value data and parse
// complete event.
void sdp_parser_register_callback(void (*sdp_callback)(sdp_parser_event_t* event));
#ifdef HAVE_SDP_EXTRA_QUERIES
void sdp_client_service_attribute_search(bd_addr_t remote, uint32_t search_serviceRecordHandle, uint8_t * des_attributeIDList);
void sdp_client_service_search(bd_addr_t remote, uint8_t * des_serviceSearchPattern);
#endif
\end{lstlisting}
\pagebreak
\pagebreak

View File

@ -1,43 +1,28 @@
% !TEX root = btstack_gettingstarted.tex
\section{SDP RFCOMM Query API}
\label{appendix:api_sdp_query}
\section{SDP RFCOMM Query}
\label{appendix:api_sdp_queries}
$ $
\begin{lstlisting}
/* SDP Queries */
// Basic SDP Query event type.
typedef struct sdp_query_event {
uint8_t type;
} sdp_query_event_t;
// SDP Query event to indicate that query is complete.
typedef struct sdp_query_complete_event {
uint8_t type;
uint8_t status; // 0 == OK
} sdp_query_complete_event_t;
/* SDP Query for RFCOMM */
// SDP Query RFCOMM event to deliver channel number and service
// name byte by byte.
\begin{lstlisting}
// SDP Query RFCOMM event to deliver channel number and service name
// byte by byte.
typedef struct sdp_query_rfcomm_service_event {
uint8_t type;
uint8_t channel_nr;
uint8_t * service_name;
} sdp_query_rfcomm_service_event_t;
// Registers a callback to receive RFCOMM service and query complete
// event.
void sdp_query_rfcomm_register_callback(void(*sdp_app_callback)(sdp_query_event_t * event, void * context), void * context);
void sdp_query_rfcomm_deregister_callback();
// Searches SDP records on a remote device for RFCOMM services with
// a given UUID.
void sdp_query_rfcomm_channel_and_name_for_uuid(bd_addr_t remote, uint16_t uuid);
// Searches SDP records on a remote device for RFCOMM services with
// Searches SDP records on a remote device for RFCOMM services with
// a given service search pattern.
void sdp_query_rfcomm_channel_and_name_for_search_pattern(bd_addr_t remote, uint8_t * des_serviceSearchPattern);
// Registers a callback to receive RFCOMM service and query complete
// event.
void sdp_query_rfcomm_register_callback(void(*sdp_app_callback)(sdp_query_event_t * event, void * context), void * context);
\end{lstlisting}
\pagebreak
\pagebreak