Register
Site Login
Site Search
Forums
Advertisement
Welcome to PocketMatrix. PocketMatrix is dedicated to providing the best online community for mobile device developers and enthusiests. What's new?

how to capture buttons from Bluetooth headsets?


how to capture buttons from Bluetooth headsets?

Postby The PocketTV Team » May 17, 2007 @ 10:38pm

Some Bluetooth headsets (with profile AVRCP) have control buttons such as forward/play/pause typically used to control a media player.

How can applications capture those buttons?

Do they send WM_KEYDOWN messages to the active application?

if yes, what are the virtual-keys for those various buttons? Are they standardized? Are they non-standard and depend on the BT device or Bluetooth stack of the device?

A user reported that those buttons continue to control the Windows Media Player in the background, so apparently WMP can capture those buttons and react to them even when is it is not active or does not have the focus. How can another application do the same? What is the API to use in order to capture those buttons?
User avatar
The PocketTV Team
pm Member
 
Posts: 43
Joined: Apr 5, 2004 @ 10:39am
Location: San Francisco, CA


Postby mm40 » May 17, 2007 @ 11:26pm

I was just looking at the WM5 SDK help file bluetooth stuff, my guess is you have to open up a winsock connection to the stack and listen for the button changes to come in. It would be nice if windows forwarded them as WM_ messages. Otherwise you could use a Spy++ type program on the PPC if such a thing exists and see if the messages are being sent.
User avatar
mm40
pm Member
 
Posts: 135
Joined: Feb 21, 2003 @ 9:11pm


Postby The PocketTV Team » May 17, 2007 @ 11:38pm

mm40 wrote:It would be nice if windows forwarded them as WM_ messages.


Definitely.

If so much device-specific hacking must be done to capture those buttons (and nothing is standardized), it's probably not worth the trouble. And also it might depend on the BT stack in the device.
User avatar
The PocketTV Team
pm Member
 
Posts: 43
Joined: Apr 5, 2004 @ 10:39am
Location: San Francisco, CA


Postby Dan East » May 18, 2007 @ 12:07am

open up a winsock connection to the stack


That will only work with the MS stack, which is the minority. I would assume the headset would expose a bluetooth service which interfaces the buttons.

Dan East
User avatar
Dan East
Site Admin
 
Posts: 5264
Joined: Jan 25, 2001 @ 5:19pm
Location: Virginia, USA


Postby The PocketTV Team » May 18, 2007 @ 12:15am

Dan East wrote:
open up a winsock connection to the stack


That will only work with the MS stack, which is the minority. I would assume the headset would expose a bluetooth service which interfaces the buttons.


is there a documentation on that (and on how to interface with it)?
User avatar
The PocketTV Team
pm Member
 
Posts: 43
Joined: Apr 5, 2004 @ 10:39am
Location: San Francisco, CA


Postby Dan East » May 18, 2007 @ 12:58am

I'm sort of replying to your other thread here too (about the notification broker).

Probably the only way to pull off the level of control you require is to implement A2DP via both types of stacks within your app. You would search for and find headsets, connect to them, and stream the data yourself. That might solve your latency issue too, if the problem is on the PPC side.

Well, I would have to say it would be really, really tough to pull off. Try finding some sources dealing with A2DP. Keep in mind anything you implement will have to be done for both the MS and Widcomm bluetooth APIs, which are as different as they could be.

I don't know what type of service the headphones would expose for the buttons, or if perhaps that is included in A2DP.

Sorry, but I have zero experience when it comes to A2DP specifics, and can only provide the most rudimentary BT advice. In my case, I've implemented a PC based custom BT service (a crude TCP/IP proxy server) running on the MS stack, and a client end on the PPC supporting both MS and Widcomm stacks, that allows me to transfer data back and forth between the two. The PDA initiates the connection, and will iterate all BT devices and find one running my service, and make a connection if one is found.

So I don't have experience using any of the standardized BT services at all. I use the RFCOMM protocol (which is one of the few the MS stack supports), and am proprietary on both ends.

You can read my lamentations over the two BT APIs if you want more specifics on how they differ.

Dan East
User avatar
Dan East
Site Admin
 
Posts: 5264
Joined: Jan 25, 2001 @ 5:19pm
Location: Virginia, USA


Return to Windows Mobile


Sort


Forum Description

A discussion forum for mobile device developers on the Windows Mobile platform. Any platform specific topics are welcome.

Moderators:

Dan East, sponge, Digby, David Horn, Kevin Gelso, RICoder

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron