How to accept incoming bluetooth connections silently?

Login to reply to this topic.
Wed, 2005-08-03 18:14
Joined: 2005-07-26
Forum posts: 12
The problem I am facing right now is that : How to accept incoming
bluetooth connections on my Symbian mobile phone silently (i.e without
the prompt). I am running a OBEX server which listens for incomming
connections - when a linux machine starts to setup a RFCOMM channel
with the phone on the port of the OBEX server - the user gets a prompt
to accept the incoming connection - how to avoid it and accept that
connection transparently??

Thanks in advance,

Archit Gupta


Thu, 2005-08-04 06:54
Forum Nokia Champion
Joined: 2003-06-10
Forum posts: 727
Re: How to accept incoming bluetooth connections silently?
Pair the devices and set the Linux machine as authorized on the phone. For security reasons, I think, no other way is possible (i.e., no malicious app can accept Bluetooth connections without the phone user seeing/allowing it).
Thu, 2005-08-04 11:28
Joined: 2005-07-26
Forum posts: 12
Re: How to accept incoming bluetooth connections silently?
Hi
Thanks for replying Smiley

I have already been able to find solution - actually you can allow other devices to connect without authorization (and malice prevails) - by setting the RBTSecurity parameter of authorization to EFalse. And the pairing technique also works. But I don't want the user to be prompted.

Thanks
Archit
Thu, 2005-08-04 12:55
Forum Nokia Champion
Joined: 2004-05-26
Forum posts: 732
Re: How to accept incoming bluetooth connections silently?
Quote from: architgupta
- by setting the RBTSecurity parameter of authorization to EFalse.

Thanks
Archit

I am using the BTPMP exaple code:

Code:
void CListener::SetSecurityL(TInt aChannel)
{
// setup channel security
TRequestStatus status;
RBTMan secManager;
RBTSecuritySettings secDatabase;
TBTServiceSecurity secSettings;
// connect to security manager
User::LeaveIfError(secManager.Connect());
CleanupClosePushL(secManager);
User::LeaveIfError(secDatabase.Open(secManager));
CleanupClosePushL(secDatabase);
// setup security
TUid settingsUID;
settingsUID.iUid = KMyApp_serviceID;
secSettings.SetUid(settingsUID);
secSettings.SetChannelID(aChannel);
secSettings.SetProtocolID(KSolBtRFCOMM);
secSettings.SetAuthentication(EFalse);
secSettings.SetAuthorisation(EFalse);
secSettings.SetEncryption(EFalse);
// register settings with security
secDatabase.RegisterService(secSettings, status);
User::WaitForRequest(status);
CleanupStack::PopAndDestroy();  //  secManager
CleanupStack::PopAndDestroy();  //  secSettings
}

Here already set all the authorization to false, even though when ever I try to connect
other device its asking for the passcode. how to resolve this problem. I want to connect
other device silently. Is there any problem with the above code?

Fri, 2005-08-05 10:13
Joined: 2005-07-26
Forum posts: 12
Re: How to accept incoming bluetooth connections silently?
Hmm...
For me in the example - btobject exchange - when i set the setting of the obex server to Efalse - the phone no longer prompted for manual authorization. I don't know what is wrong in ur code - seems correct. The only change i made to the application for this is the Efalse setting.

Fri, 2005-08-05 10:32
Joined: 2005-03-04
Forum posts: 176
Re: How to accept incoming bluetooth connections silently?
I'm looking for a solution, too. It seems that it differs by devices (SX1 & 6630 woul't ask, 6600 will)  Angry.

Any suggestions, solutions?
CG
Fri, 2005-08-05 14:17
Joined: 2005-07-26
Forum posts: 12
Re: How to accept incoming bluetooth connections silently?
For me in the object exchange - the setting worked properly for 6600 - so I don't know what might be the issue.
Fri, 2005-08-05 15:40
venkatreddy (not verified)
Forum posts: 2043
Re: How to accept incoming bluetooth connections silently?
Quote from: architgupta
For me in the object exchange - the setting worked properly for 6600 - so I don't know what might be the issue.


if it working means... can u post some sample code of that security settings... even iam also need that functionality .... i tried by making settings to false but it was not working .... if u can post means it will help to others also in future...hope for the positive repply from you....
Wed, 2005-08-10 19:38
Joined: 2005-07-26
Forum posts: 12
Re: How to accept incoming bluetooth connections silently?
Sorry for not replying sooner. I am on vacation - and haven't got code with me here. I will post it in a couple of days. -- But the only change I made in the btobjectexchange example code - was to change the setting to Efalse.
Anyway will post it soon Smiley

Good luck!

Archit
Thu, 2005-08-11 03:59
Forum Nokia Champion
Joined: 2004-05-26
Forum posts: 732
Re: How to accept incoming bluetooth connections silently?
I changed my function as follows, after that it's not authenticating and silently connecting to the device if the other device is also running my application. Otherwise still it's asking authentication passcode from other device.

Code:
void CListener::SetSecurityL(TInt aChannel)
{
RBTMan secManager;
RBTSecuritySettings secDatabase;
// connect to security manager
User::LeaveIfError(secManager.Connect());
CleanupClosePushL(secManager);
User::LeaveIfError(secDatabase.Open(secManager));
CleanupClosePushL(secDatabase);
// the security settings
TBTServiceSecurity secSettings(KUidMyApplication, KSolBtRFCOMM, 0);

//Define security requirements
secSettings.SetAuthentication(EFalse);
secSettings.SetEncryption(EFalse);
secSettings.SetAuthorisation(EFalse);

secSettings.SetChannelID(aChannel);
TRequestStatus status;
// register settings with security
secDatabase.RegisterService(secSettings, status);

User::WaitForRequest(status); // wait until the security settings are set
User::LeaveIfError(status.Int());

CleanupStack::PopAndDestroy();  //  secManager
CleanupStack::PopAndDestroy();  //  secSettings
}

Anybody have a hint?

Thu, 2005-08-11 05:35
Joined: 2005-06-27
Forum posts: 22
Re: How to accept incoming bluetooth connections silently?
Hi Guys
I am using BluetoothPMP code for bluetooth connection but i m getting error in RBTSecuritySettings "undeclared identifier" so any one can help me & tells me whts should i do for resolve this problem.
With regards
brajendra
Thu, 2005-08-11 05:56
Forum Nokia Champion
Joined: 2004-05-26
Forum posts: 732
Re: How to accept incoming bluetooth connections silently?
Check whether you are included btmanclient.h header file in.

Thu, 2005-08-11 06:13
Joined: 2005-06-27
Forum posts: 22
Re: How to accept incoming bluetooth connections silently?
Hi
I have included btmanclient.h &  BTManClient.lib after all i m getting this error....
Thu, 2005-08-11 08:12
Forum Nokia Champion
Joined: 2004-05-26
Forum posts: 732
Re: How to accept incoming bluetooth connections silently?
Quote from: brajendra
I have included btmanclient.h &  BTManClient.lib after all i m getting this error....

Can you post some code snippet from where you are getting this error and the error message here?

Thu, 2005-08-11 09:27
Joined: 2005-06-27
Forum posts: 22
Re: How to accept incoming bluetooth connections silently?
ya i m sending u my error's code with errors
when i call this function SetSecurityL(channel);


void CListener::SetSecurityL(TInt aChannel)
   {
   // setup channel security
   TRequestStatus status;
    RBTMan secManager;
   
   RBTSecuritySettings secDatabase;
    RBTSecuritySettings secDatabase;                  //comments
   TBTServiceSecurity secSettings;
   // connect to security manager
   User::LeaveIfError(secManager.Connect());
    CleanupClosePushL(secManager);
   User::LeaveIfError(secDatabase.Open(secManager));      //comments
    CleanupClosePushL(secDatabase);                  //comments
   // setup security
   TUid settingsUID;
   settingsUID.iUid = KBT_serviceID;
   secSettings.SetUid(settingsUID);
   secSettings.SetChannelID(aChannel);               //comments
   secSettings.SetProtocolID(KSolBtRFCOMM);         //comments
   secSettings.SetAuthentication(EFalse);
   secSettings.SetAuthorisation(EFalse);
   secSettings.SetEncryption(EFalse);
   // register settings with security
   secDatabase.RegisterService(secSettings, status);
   User::WaitForRequest(status);
    CleanupStack::PopAndDestroy();  //  secManager
    CleanupStack::PopAndDestroy();  //  secSettings   
   }

now in this code i m getting 7 errors


Listener.cpp
C:\WORK\BLUETOOTHPMP\SRC\Listener.cpp(139) : error C2065: 'RBTSecuritySettings' : undeclared identifier
C:\WORK\BLUETOOTHPMP\SRC\Listener.cpp(139) : error C2146: syntax error : missing ';' before identifier 'secDatabase'
C:\WORK\BLUETOOTHPMP\SRC\Listener.cpp(139) : error C2065: 'secDatabase' : undeclared identifier
C:\WORK\BLUETOOTHPMP\SRC\Listener.cpp(145) : error C2228: left of '.Open' must have class/struct/union type
C:\WORK\BLUETOOTHPMP\SRC\Listener.cpp(151) : error C2039: 'SetChannelID' : is not a member of 'TBTServiceSecurity'
        \Symbian\8.0a\S60_2nd_FP2\EPOC32\INCLUDE\bt_sock.h(117) : see declaration of 'TBTServiceSecurity'
C:\WORK\BLUETOOTHPMP\SRC\Listener.cpp(152) : error C2039: 'SetProtocolID' : is not a member of 'TBTServiceSecurity'
        \Symbian\8.0a\S60_2nd_FP2\EPOC32\INCLUDE\bt_sock.h(117) : see declaration of 'TBTServiceSecurity'
C:\WORK\BLUETOOTHPMP\SRC\Listener.cpp(157) : error C2228: left of '.RegisterService' must have class/struct/union type
Error executing cl.exe.

BT.APP - 7 error(s), 0 warning(s)


plz if u find out problem then plz let me know
thanks fot it...

Fri, 2005-08-12 02:20
Forum Nokia Champion
Joined: 2004-05-26
Forum posts: 732
Re: How to accept incoming bluetooth connections silently?
Hi in your code the variable secDatabase is redefined. But I doubt you are using Series 60 SDK 2 Ed FP 2. If that is the case then RBTSecuritySettings class is removed from FP2, but this class is available in the earlier version of SDKs.

Read the file called README_BLUETOOTH.txt that comes with the FP2 setup for more information. If you cant find that text file then I can mail you the same.

  • Login to reply to this topic.