开发者

Is a bluetooth keyboard or remote a client or a server

开发者 https://www.devze.com 2023-02-20 19:43 出处:网络
Basic bluetooth question here. Is a blutetooth keyboard, remote(wiimote, PS3 remote, etc..) considered a client or a serve开发者_如何学Gor?

Basic bluetooth question here.

Is a blutetooth keyboard, remote(wiimote, PS3 remote, etc..) considered a client or a serve开发者_如何学Gor?

The reason I ask is that I am developing an Android application and I am having trouble connecting to these devices.

I assumed the devices were servers because if they were clients that would mean they are initiating a connection & I don't see how they'd do that especially since my Android device is not discoverable.

Thanks


These are HID devices and HID devices have 2 roles - A host role and device role, Typically PCs, Mobile Phones, Tablets etc implement the host role, allowing keyboards, mice etc to connect to it. The devices roles are are typically in keyboards, mice etc.

So the answer is - bluetooth keyboard, remote(wiimote, PS3 remote, etc..) implement the Bluetooth HID device roles.


HID uses the L2CAP protocol which is lower in the Bluetooth stack than the one we normally use in our applications (that's RFCOMM/SPP). So it may well be that you need to change the class/method you use in your Bluetooth API to try to connect.

Also it might not apply in your case, but most OSs have built-in support for Bluetooth HID so there is no need for an application to connect directly to the HID service, instead the OS connects directly and one then uses the OS's HID API to get the data from the device.

As to the direction connections are made. The answer is both. When the user adds the device to the PC/games-console the PC/console (host) will connect to the device. After the point normally the device connects to the host, for instance when it goes to sleep and wakes up when the user hits a button, it can connect immediately then. Otherwise the host would have to keep trying to connect just in case it had woken up...

Note that once a device knows a remote device's address there's no need for either to be in discoverable mode.


Bloototh is basically a personal area networks technology, so both devices in a pairing procedure can act as server or a client.

I am pretty confident that Wii is locket to a specific pairing codes, so you cannot connect to it from Android just like that.

Are you sure both devices has discovery on? (http://developer.android.com/guide/topics/wireless/bluetooth.html#FindingDevices )


According to Bluetooth SIG,

 A Bluetooth HID device is a device providing the service of human or other data input and output to and from a Bluetooth HID Host. Examples of Bluetooth HID devices are keyboards, mice, joysticks, gamepads, remote controls, and also voltmeters and temperature sensors.

 A Bluetooth HID Host is a device using or requesting the services of a Bluetooth HID device. Examples would be a personal computer, handheld computer, gaming console, industrial machine, or data-recording device.

Since keyboards and mice are providing the service you can call it as Server.

But believe it or not, there is no need to call it as Server simply call it as HID devices.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号