×
Namespaces

Variants
Actions
(Difference between revisions)

Bluetooth discovery in Qt Mobility may not report devices (Nokia C6)

From Nokia Developer Wiki
Jump to: navigation, search
Devnull (Talk | contribs)
m (Devnull -)
hamishwillee (Talk | contribs)
m (Hamishwillee - Subedit)
Line 1: Line 1:
[[Category:Qt Mobility]][[Category:Connectivity]][[Category:Qt]]
+
[[Category:Qt Mobility]][[Category:Connectivity]][[Category:Bluetooth]]
{{Abstract| Qt Bluetooth discovery omit the devices in the cache from the results }}  
+
{{Abstract|Bluetooth discovery in Qt Mobility does not report devices in the cache. }}  
 
+
 
{{ArticleMetaData
 
{{ArticleMetaData
 
|sourcecode= http://doc.qt.nokia.com/qtmobility-1.2/btscanner.html
 
|sourcecode= http://doc.qt.nokia.com/qtmobility-1.2/btscanner.html
 
|installfile=  
 
|installfile=  
 
|devices= Nokia C6-01  
 
|devices= Nokia C6-01  
|sdk= [http://qt.nokia.com/downloads/ Nokia Qt SDK 1.1.4] -->
+
|sdk= [http://qt.nokia.com/downloads/ Nokia Qt SDK 1.1.4]
|platform=  Qt mobility 1.2.1 and later -->
+
|platform=  Qt mobility 1.2.1 and later
|devicecompatability= must have internal bluetooth -->
+
|devicecompatability=All with internal Bluetooth
|signing=
+
|signing=DevCert required
 
|capabilities= ReadDeviceData LocalServices WriteDeviceData
 
|capabilities= ReadDeviceData LocalServices WriteDeviceData
 
|keywords= QBluetoothDeviceDiscoveryAgent, BluetoothLinkManagerDeviceDiscoverer
 
|keywords= QBluetoothDeviceDiscoveryAgent, BluetoothLinkManagerDeviceDiscoverer
Line 18: Line 17:
 
|update-by=<!-- After significant update: [[User:username]]-->
 
|update-by=<!-- After significant update: [[User:username]]-->
 
|update-timestamp=<!-- After significant update: YYYYMMDD -->
 
|update-timestamp=<!-- After significant update: YYYYMMDD -->
|creationdate= <!-- Format YYYYMMDD -->
+
|creationdate=20111124
|author= <!-- Display as link [[User:username]] -->
+
|author=[[User:Devnull]]
 
}}
 
}}
  
 
== Description==
 
== Description==
  
Bluetooth devices which are listed in the cache cannot be retrieved with Qt mobility APIs
+
Qt Bluetooth device discovery is achieved using the Qt Mobility API [http://doc.qt.nokia.com/qtmobility-1.2/qbluetoothdevicediscoveryagent.html QBluetoothDeviceDiscoveryAgent] {{Icode|start()}} method. On Symbian this will only discover ''new'' devices, ignoring those that have been previously cached.
  
== How to reproduce ==
+
The reason for this is that the Symbian implementation explicitly ignores cached results by setting the {{Icode|KHostResIgnoreCache}} flag:
 
+
<code cpp>
Bluetooth device names are cached after each inquiry. Upon a new paired device process is initiated, these cached devices shown first to the user for convinience.
+
 
+
Similar inquiry can be initiated with Qt mobility APIs using QBluetoothDeviceDiscoveryAgent::start() method.
+
 
+
The result that this Qt mobility APIs provide can be shorter however. It is possible to receive the following output in Qt creator before all of the available devices shown:
+
<code>
+
[Qt Message] void QtMobility::BluetoothLinkManagerDeviceDiscoverer::RunL() 0
+
[Qt Message] void QtMobility::BluetoothLinkManagerDeviceDiscoverer::RunL() -25
+
</code>
+
 
+
Where -25 means KErrHostResNoMoreResults after the first device is reported. The reason for such short list is devices which were previusly cached are ignored by the API by using explicitly the KHostResIgnoreCache flag upon the discovery:
+
 
+
<code>
+
 
void BluetoothLinkManagerDeviceDiscoverer::startDiscovery(const uint discoveryType)
 
void BluetoothLinkManagerDeviceDiscoverer::startDiscovery(const uint discoveryType)
 
{
 
{
Line 48: Line 34:
 
}
 
}
 
</code>
 
</code>
 +
 +
== How to reproduce ==
 +
 +
Pair with all local devices. Then attempt to discover the devices again. No devices are discovered - and in the Qt Creator debug window you can see the following messages
 +
<code text>
 +
[Qt Message] void QtMobility::BluetoothLinkManagerDeviceDiscoverer::RunL() 0
 +
[Qt Message] void QtMobility::BluetoothLinkManagerDeviceDiscoverer::RunL() -25
 +
</code>
 +
Where -25 means {{Icode|KErrHostResNoMoreResults}}.
  
 
== Solution ==
 
== Solution ==
  
There is no known solution or workaround for the problem.
+
There is no known solution or workaround for the problem.

Revision as of 02:53, 29 November 2011

Bluetooth discovery in Qt Mobility does not report devices in the cache.

Article Metadata
Code ExampleTested with
Devices(s): Nokia C6-01
Compatibility
Platform(s): Qt mobility 1.2.1 and later
Symbian
Device(s): All with internal Bluetooth
Platform Security
Signing Required: DevCert required
Capabilities: ReadDeviceData LocalServices WriteDeviceData
Article
Keywords: QBluetoothDeviceDiscoveryAgent, BluetoothLinkManagerDeviceDiscoverer
Created: Devnull (24 Nov 2011)
Last edited: hamishwillee (29 Nov 2011)

Description

Qt Bluetooth device discovery is achieved using the Qt Mobility API QBluetoothDeviceDiscoveryAgent start() method. On Symbian this will only discover new devices, ignoring those that have been previously cached.

The reason for this is that the Symbian implementation explicitly ignores cached results by setting the KHostResIgnoreCache flag:

void BluetoothLinkManagerDeviceDiscoverer::startDiscovery(const uint discoveryType)
{
...
m_addr.SetAction(KHostResInquiry | KHostResName | KHostResIgnoreCache);
...
}

How to reproduce

Pair with all local devices. Then attempt to discover the devices again. No devices are discovered - and in the Qt Creator debug window you can see the following messages

[Qt Message] void QtMobility::BluetoothLinkManagerDeviceDiscoverer::RunL() 0 
[Qt Message] void QtMobility::BluetoothLinkManagerDeviceDiscoverer::RunL() -25

Where -25 means KErrHostResNoMoreResults.

Solution

There is no known solution or workaround for the problem.

124 page views in the last 30 days.