Question

I'm trying to write simple app, which sends short text message to cellphones in bluetooth adapter range.

My first try is sending files: I can send file from PC to cellphone, but i must enter PIN on cellphone, and on PC.

I would rather to send text messages (something like push message) - is it possible to send it without paring devices?

If isn't possible to send push messages, maybe I can send simple file without requesting PIN ?

I use 32feet library.

Sample code (used to send files to selected device)

static int BTSendFile(string adres, string FileName)                            
        {
            Uri uri = new Uri("obex://" + adres + '/' + Path.GetFileName(FileName));
            ObexWebRequest req = new ObexWebRequest(uri);

            req.ReadFile(FileName);

            ObexWebResponse rsp = (ObexWebResponse)req.GetResponse();

            return (int)rsp.StatusCode;

        }
Était-ce utile?

La solution

A quick answer would be; NO, you will ALWAYS need some kind of pairing.

But if you take a look at the different kinds of pairing out there, you would see that BT 2.1 supports Secure Simple Pairing (SSP) with the Just Works-mode. This allows you to pair devices (almost) without any user interaction. From Wikipedia:

Just works: As implied by the name, this method just works. No user interaction is required; however, a device may prompt the user to confirm the pairing process. This method is typically used by headsets with very limited IO capabilities, and is more secure than the fixed PIN mechanism which is typically used for legacy pairing by this set of limited devices. This method provides no man in the middle protection.

However, since "This method is typically used by headsets with very limited IO capabilities", it would probably not apply to the cellphones you are talking about, but I thought you should know :)

Autres conseils

According to the offical Bluetooth Message Access Profile, i.e. the specific Bluetooth profile that deals with accessing SMS/MMS systems on phones via a remote device:

'The MCE device shall use the services of the MSE device only after successfully creating a secure connection. This includes exchanging of security initialization messages, creation of link keys, and enabling encryption'

From: https://developer.bluetooth.org/TechnologyOverview/Pages/MAP.aspx

There is also a link to the full spec there if you are interested.

This certtainly suggests that secure pairing is required, which I'd assume to involve the passkey. My experience is that once a device has been paired a connection can be made without repeating the pairing as long as that pairing is remembered by the devices (i.e. I've paired a device once and not had to do it again). As to simpler, non-keyed pairing mentioned by khellang above, I've not seen anything about this - if it is purely for devices like headsets then the security requirements may be lower due to their not likely wanting write access to a device?

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top