Search Posts Who's Online Log In
You are not logged in. Click here to log in.
If you are not a member, Sign up here for free!

how to programme with the bluetooth passcode?


Mobile Phones Forum / Cell Phone Manufacturer Forums / Nokia Forum

 

 


feiyinziiu
New User

Oct 19, 2009, 3:46 AM

Post #1 of 3 (574 views)
Can't Post

Hello,
I'm programming with bluez to use the bluetooth dongle under linux to connect to the remote bluetooth devices.But when the my PC run the programme,and try to connect to the bluetooth of my cellphone,it ask for passcode.and I don't know how to deal with it.after I put in passcode, the bluetooth says :connect refused.


how to programm with the passcode?

thank you!

my bluetooth test is this:

1 #include <stdio.h>
2 #include <unistd.h>
3 #include <sys/socket.h>
4 #include <bluetooth/bluetooth.h>
5 #include <bluetooth/rfcomm.h>
6 int main(int argc, char **argv)
7 {
8 struct sockaddr_rc addr = { 0 };
9 int s, status;
10 char dest[18] = "00:26:68:DB:2E:70";
11 // allocate a socket
12 s = socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);
13 // set the connection parameters (who to connect to)
14 addr.rc_family = AF_BLUETOOTH;
15 addr.rc_channel = (uint8_t) 1;
16 str2ba( dest, &addr.rc_bdaddr );
17 // connect to server
18 status = connect(s, (struct sockaddr *)&addr, sizeof(addr));
19 printf("return\n");
20 // send a message
21 //if( status == 0 ) {
22 status = write(s, "hello!", 6);
23 //}
24 if( status < 0 ) perror("uh oh");
25 close(s);
26 return 0;
27 }
28


amir90p
Novice

Dec 10, 2009, 1:42 AM

Post #2 of 3 (556 views)
Can't Post

Thanks


vijendrasnv
Novice

Dec 17, 2009, 6:55 PM

Post #3 of 3 (553 views)
Can't Post

Thanks for the code.
Really great stuff.I will try to excess the code.
Thanks.
uk phone deals

cheap phone deals

 
 
 



 
Close Note..