📄 readme.txt
字号:
BtServices
===============
Revision 1.0, December 2003
Author: Thomas Lovell, Graduate Technical Consultant, Symbian
Introduction
------------
BtServices is a Bluetooth tool which allows the user to find nearby devices, then using the Bluetooth Service Discovery Protocol (SDP), find out about the services offered by each device, and the attributes of these services.
BtServices runs on the UIQ interface. A standard .SIS file is provided for installation.
Usage
-----
When the application starts, a dialog appears prompting the user to select a device. It is possible to limit the types of devices shown (e.g. phones, PCs, etc).
Once a device has been selected, the SDP is used to find the services it offers, and the names shown in a list. There are now several options:
- Display attributes for a given service - tap on the service name, and a dialog appears showing all available attributes, and their values. Tap continue to return to the main service list.
- Filter the services shown - select "UUIDs" from the "Settings" menu. A dialog is shown, where a UUID filter can be selected from the choice-list, or alternatively a UUID value entered (in hexadecimal).
- Display information about the selected device - select "Device Info" from the "BtServices" menu. A dialog shows the name, address, and class ID (including service class, and major / minor device classes) of the current device.
- Choose a new device - use the "Select Device" button (or "Select Device" from the "BtServices" menu) to return to the initial dialog and select a new device.
- If an error occurs while searching for services, tapping the "Refresh" button (or choosing "Refresh" from the "BtServices" menu) will start the search again. It may be necessary to "Cancel" the current search before choosing "Refresh".
Operation
---------
The application consists of the following classes:
CBtServicesApplication }
CBtServicesDocument } - standard GUI app classes
CBtServicesAppUI }
CBtServicesListView }
CBtServicesEng - application engine
CBtAttributeBuilder - parses attribute details received from device (inherited from MSdpElementBuilder)
CAttributeDisplayDialog }
CDeviceInfoDialog } - dialog classes
CUUIDSettingsDialog }
The dialog for selecting a device is the standard UIQ dialog CQBTUISelectDialog. This returns a device name, address and classID.
A new SDP agent (CSdpAgent) is created whenever a new device is selected, as the device address is one of the required construction parameters. If a previous SDP Agent existed it is deleted.
An SDP search pattern (CSdpSearchPattern) is used to specify a UUID filter when searching for services. This is set to the required UUID (iUUIDFilter - set as L2CAP by default).
Two steps are required to obtain the list of serivces. Firstly, the SDP agent function NextRecordRequestL is used to get Service Record Handles of the available services - the response is a call to NextRecordRequestComplete (a member of CBtServicesEng, inherited from MSdpAgentNotifier) which builds an array of record handles (iHandleArray), and requests the next record, until all have been obtained, indicated by KErrEof.
Secondly, the handles are converted to service names by iterating through iHandleArray, making attribute requests for the name, and creating a second array (iTextArray) which is used as the Model (data) for the ListBox (control in CBtServicesListView). The attribute requests use the SDP agent function AttributeRequestL, with a TSdpAttributeID parameter of KSdpAttrIdOffsetServiceName + KDefaultLanguage. The response is a call to AttributeRequestResult (a member of CBtServicesEng, inherited from MSdpAgentNotifier), which adds the name to iTextArray, and a call to AttributeRequestComplete (also inherited from MSdpAgentNotifier) which requests the name for the next service record handle.
When a service is selected from the list, its attributes are displayed in a dialog. The attributes are requested using AttributeRequestL, but this time with a CSdpAttrIdMatchList parameter with an ID range of zero to KMaxTUint16 - i.e. all possible attributes are checked. Additionally, an MSdpElementBuilder reference is passed (pointing to a CBtAttributeBuilder object) which means the response from the SDP agent is a series of calls to MSdpElementBuilder functions, and a single call to AttributeRequestComplete (as before) upon completion. The MSdpElementBuilder functions create an attribute list line by line, which are added to an array (iAttributeArray). When AttributeRequestComplete is called, iAttributeArray is displayed in a dialog.
Notes
-----
Currently, attribute UUIDs of 16, 32, or 128 bits will be displayed. However only 16/32bit UUIDs can be used for filtering the service records received.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -