17
2011 Embedded Systems Software Training Center BluRapport SDK

Embedded Systems Software Training Center

  • Upload
    juana

  • View
    40

  • Download
    0

Embed Size (px)

DESCRIPTION

Embedded Systems Software Training Center. BluRapport SDK. Agenda. BluRapport SDK basic Learn how to work with SDK , referring to the demo project Implement Inquire request using the Demo project's functions Implement additional Inquiry functions. BluRapport SDK basics. - PowerPoint PPT Presentation

Citation preview

Page 1: Embedded Systems Software Training Center

2011

Embedded Systems Software Training Center

BluRapport SDK

Page 2: Embedded Systems Software Training Center

Agenda

lBluRapport SDK basic lLearn how to work with SDK, referring to the demo projectl Implement Inquire request using the Demo project's functionsl Implement additional Inquiry functions

Page 3: Embedded Systems Software Training Center

BluRapport SDK basics

SDK provides API procedures which are used for management BluRapport Bluetooth stack kernel. SDK contains functions for working with following protocols:- HCI (Host Controller Interface)- L2CAP (Logical Link Control and Adaptation

Protocol)- GAP (SDK for access to Generic Access Profile)

Page 4: Embedded Systems Software Training Center

BluRapport SDK basics

Generic Access ProfileThe main purpose of this profile is to describe the use of the lower layers of the Bluetooth protocol stack (LC and LMP). To describe security related alternatives, also higher layers (L2CAP, RFCOMM and OBEX) are included.

Page 5: Embedded Systems Software Training Center

BluRapport SDK basics

SDK contains functions for all profiles and protocols in BluRapport. For each layer is used special prefixes:• HCI – prefix `rx_hci_`• L2CAP – prefix `rx_l2cap_`• RFCOM – prefix `rx_rfcom_`• SDP – prefix `rx_sdp_`• OBEX – prefix `rx_obex_`• etc

Page 6: Embedded Systems Software Training Center

BluRapport SDK basics

SDK structure:

rxbt/SDK/include – contains list of headers. These headers describes all API functions and required structures (i.e. rx_errors and etc) of BluRapport SDKrxbt/SDK/lib – compiled static and dynamic librariesrxbt/bin – kernel of BluRapport Bluetooth stackrxbt/samples – samples of applications

Page 7: Embedded Systems Software Training Center

Common RXBT SDK API

Common procedures and structures in RXBT API:rx_ret_t rx_sdk_init() - function initializes conection between your application and BluRapport Kernel

int rx_socket(rx_socktype_t sock_type, rx_sockproto_t proto) - function creates socket for required type and protocol and returns error code or created socket- sock_type – determinate type of socket. See structure rx_socktype_t in rx_sdk.h- proto – type of protocol. See structure rx_sockproto_t in rx_sdk.h

rx_ret_t rx_close(int sock) — close socket.- sock - socket created by rx_socket() call

rx_string_to_sockaddr_no_type(TRS_CALL &serv_addr, in_buf, RX_PF_HCI);

Page 8: Embedded Systems Software Training Center

Demo of Inquiry process

Main Functions that are used to work with HCI Inquiry:rx_ret_t rx_start_inquiry(int sock, hci_access_code_t LAP, unsigned duration_ms, ex_uint8_t num_resp, rx_bool_t purge_list_before_inquiry) — function starts inquiry process for HCI socket.- sock : HCI socket identifier- LAP: either General or Limited Inquiry- num_resp: max # of responses, 0 means infinite- purge_list_before_inquiry – if true, clear devices list before inquiryrx_renew_remote_names(TRS_CALL sock) – perform inquiry request and getting symbolic name of devicesrx_ret_t rx_get_next_inquiry_result(int sock, rx_remote_device_user_t *info) — get next Discovery iteration results.- sock : HCI socket identifier- info: remote device info see structure rx_remote_device_user_t in rx_sdk.h

Page 9: Embedded Systems Software Training Center

SDP common

Service Discovery Protocol (SDP) is the layer in the Bluetooth protocol stack where programs query for device information, the services those devices provide, and their characteristics (or attributes). The querying unit then uses this information to establish connections between devices, and ad-hoc networking gets underway. SDP enables network devices, applications, and services to seek out and find other complementary network devices, applications, and services needed to properly complete specified tasks. SDP allows developers to:- query a Bluetooth device for the services hosted by this device- browse the services hosted by a Bluetooth device- advertise the availability of a service- provide self service information.

Page 10: Embedded Systems Software Training Center

Demo of SDP process

Main Functions that are used to work with SDP:rx_ret_t rx_sdp_create_connection_handle(rx_sdp_handle_t *sdp_handle, rx_sockaddr_t *addr) - Create a handle of a remote SDP database- sdp_handle - pointer to a place to put the handle.- serv_addr - remote SDP server address.See rx_sdp_sdk.h

Types of services (full list see in rx_sdp_sdk.h), we use it for create SDP request to remote sideRX_SDP_UUID16_PUBLIC_BROWSE_ROOTRX_SDP_UUID16_SERIAL_PORTRX_SDP_UUID16_LAN_ACCESS_USING_PPPRX_SDP_UUID16_NAPRX_SDP_UUID16_PANURX_SDP_UUID16_OBEX_OBJECT_PUSHRX_SDP_UUID16_OBEX_FILE_TRANSFERRX_SDP_UUID16_HEADSETRX_SDP_UUID16_HEADSET_AUDIO_GATEWAYRX_SDP_UUID16_HCR_PRINTRX_SDP_UUID16_HUMAN_INTERFACE_DEVICE_SERVICE

Page 11: Embedded Systems Software Training Center

Demo of SDP process

Main Functions that are used to work with SDP:rx_ret_t rx_sdp_service_search_attribute_request(rx_sdp_handle_t sdp_handle, rx_sdp_iterator_t *sdp_iterator, rx_sdp_uuid_t search_pattern[], rx_uint32_t search_pattern_element_count, rx_uint32_t attribute_id_list[], rx_uint32_t attribute_id_list_element_count) - Generates an SDP_ServiceSearchAttributeRequest to retrieve specified attribute values from a service records that match the service search pattern given in the parameters of function. If request successfully executed then ServiceIterator will be created and pointered on first service. (see rx_sdp_sdk.h)- sdp_handle - connection handle.- sdp_iterator - pointer to a place to put the ServiceIterator.- search_pattern –UUID of requested service.- search_pattern_element_count - count of elemens in search_pattern.- attribute_id_list - list of desired attribute IDs (see next slide).- attribute_id_list_element_count - count elements in list.NOTE: rx_sdp_delete_iterator() should be called to free the ServiceIterator handle, when it is no longer needed.

Page 12: Embedded Systems Software Training Center

Demo of SDP process

Main Functions that are used to work with SDP:NOTE: The AttributeIDList is a data element sequence where each element in the list is either an attribute ID or a range of attribute IDs. Each attribute ID is encoded as a 16-bit unsigned integer data element. Each attribute ID range is encoded as a 32-bit unsigned integer data element, where the high order 16 bits are interpreted as the beginning attribute ID of the range and the low order 16 bits are interpreted as the ending attribute ID of the range. The attribute IDs contained in the AttributeIDList must be listed in ascending order without duplication of any attribute ID values.

rx_ret_t rx_sdp_create_attribute_iterator(rx_sdp_iterator_t service_iterator, rx_sdp_iterator_t *attribute_iterator) - Create AttributeIterator from ServiceIterator and point it to first attribute for Service on which currently pointered ServiceIterator- service_iterator - ServiceIterator handle (see sdp_iterator from

rx_sdp_service_search_attribute_request).- attribute_iterator - pointer to a place to put the AttributeIterator.

Page 13: Embedded Systems Software Training Center

Demo of SDP process

Main Functions that are used to work with SDP:rx_ret_t rx_sdp_next(rx_sdp_iterator_t iterator) - Put iterator to next element (record, attribute, service or element in list).- iterator - iterator which should be changed.

rx_ret_t rx_sdp_delete_iterator(rx_sdp_iterator_t iterator) - Delete the existing iterator.- iterator - iterator which should be deleted. - serv_addr - remote SDP server address.See rx_sdp_sdk.h

rx_ret_t rx_sdp_close_handle(rx_sdp_handle_t sdp_handle) - Close SDP handle created earlier in rx_sdp_create_connection_handle() or in rx_sdp_create_database_handle(). See rx_sdp_sdk.h- sdp_handle - handle which should be closed.

Page 14: Embedded Systems Software Training Center

Demo of SDP process

Main Functions that are used to work with SDP:rx_ret_t rx_sdp_goto_attribute_by_id(rx_sdp_iterator_t iterator, rx_sdp_attribute_id_t attribute_id) - Put AttributeIterator on attribute with desired ID.- iterator - AttributeIterator handle.- attribute_id - desired attribute ID.

rx_ret_t rx_sdp_get_value_as_string(rx_sdp_iterator_t iterator, char *string, rx_uint32_t max_string_size) - Get STRING value.- iterator - either AttributeIterator or ListIterator handle.- string - pointer to a place to put the STRING value.- max_string_size - buffer size, if string is more than the size of buffer string will be cut down.

NOTE:- This function accept AttributeIterator or ListIterator.- String will be returned without Null terminate character.

Page 15: Embedded Systems Software Training Center

Your Task 1

Use Demo project functions to create simple scan application (Inquiry) to getting remote devices info. So you must sending inquire request and create list with information about devices.

Page 16: Embedded Systems Software Training Center

Your Task 2

Use SDP and HCI API procedures for searching OBEX File Transport Server. Getting RFCOMM channel for OBEX File Transportrx_uint32_t range = RX_SDP_BUILD_ATTRIBUTE_RANGE(0, RX_SDP_ATTRIBUTE_ID_PROTOCOL_DESCRIPTOR_LIST);ret = rx_sdp_create_connection_handle(TRS_CALL &sdp_handle, &address);ret = rx_sdp_service_search_attribute_request(TRS_CALL sdp_handle, &service_iterator, RX_SDP_BUILD_UUID16(&uuid, service), 1, &range, 1);ret = rx_sdp_get_pdl_parameter_by_protocol_as_integer(TRS_CALL service_iterator, &ch, 0, RX_SDP_BUILD_UUID16(&uuid, RX_SDP_UUID16_RFCOMM_PROTOCOL), 0);if (ret == RET_OK) *channel = ch;rx_sdp_delete_iterator(TRS_CALL service_iterator);rx_sdp_close_handle(TRS_CALL sdp_handle);

Page 17: Embedded Systems Software Training Center

THANK YOU