언어 설정

Menu
Sites
Language
Can't Connect to Bluetooth Server Using RFCOMM in Tizen 2.3

Hello,

I wrote a code taking help from Bluetooth Tutorial for Tizen 2.3

https://developer.tizen.org/dev-guide/2.3.0/org.tizen.mobile.native.appprogramming/html/tutorials/net_tutorial/bluetooth_tutorial.htm#connect

When I worked my application as Server, It can listen to other connecting device perfectly.

But, I can not connect to the server.

Sockect COnnection State Change Listener is same as in the tutorial.

Here is my code to connect to the server side applicaiton:

bt_error_e ret;
    const char* my_uuid="00001101-0000-1000-8000-00805F9B34FB";  //My Application's UUID

    ret = bt_socket_set_connection_state_changed_cb(socket_connection_state_changed, NULL);
        if (ret != BT_ERROR_NONE)
        {
           dlog_print(DLOG_ERROR, LOG_TAG, "[bt_socket_set_connection_state_changed_cb] failed.");
           return;
        }

    ret = bt_socket_create_rfcomm(my_uuid, &server_socket_fd);
    if (ret != BT_ERROR_NONE)
    {
       dlog_print(DLOG_ERROR, LOG_TAG, "bt_socket_create_rfcomm() failed.");
    }

    const char* bt_server_address="B8:03:05:B0:3E:B0";   // Server to which I am connecting
    const char* service_uuid="27012f0c68af4fbf8dbe6bbaf7aa432a";      // UUID of the application running on the server


    ret = bt_socket_connect_rfcomm(bt_server_address, service_uuid);
    if (ret != BT_ERROR_NONE)
    {
       dlog_print(DLOG_ERROR, LOG_TAG, "[bt_socket_connect_rfcomm] failed.");
       return;
    }
    else
    {
       dlog_print(DLOG_INFO, LOG_TAG, "[bt_socket_connect_rfcomm] Succeeded. bt_socket_connection_state_changed_cb will be called.");
    }

Log Result:

[bt_socket_connect_rfcomm] Succeeded. bt_socket_connection_state_changed_cb will be called.

[socket_connection_state_changed_cb] Failed. result = -29359868

 

What does this error result id mean? From where can I check the error description against result id?

Kindly help to solve the problem.

Responses

3 댓글
Seemanta Saha

I was getting the above error when I was trying to connect a bluetooth server in Windows PC in which the service is running which is written in Java.

But, when I used server as a Tizen device by a native application, First time, I could connect and get the server information. After the first time, I get the same error.

After connecting once, When I tried to send some data to the server, again I get following error:
[bt_socket_send_data] regist to fail.

Here is my code:

    bt_error_e ret;
    char message[] = "Sending test";

    ret = bt_socket_send_data(server_socket_fd, message, sizeof(message));
    if (ret != BT_ERROR_NONE)
    {
       dlog_print(DLOG_ERROR, LOG_TAG, "[bt_socket_send_data] regist to fail.");
    }

//server_socket_fd value is 34 which I am getting after connecting to the server.

 

Thanks in Advance

Seemanta Saha

Seemanta Saha

Problem : Client device was connecting to Server device only once.

After that error was showing: [socket_connection_state_changed_cb] Failed. result = -29359868

Solution: When, client device was trying to connect the server device second time it failed, because it was already connected. When, I disconnect and again connect, the problem is solved.

 

Need help regarding the following problems which I still have:

1. I still can not connect to java based service in windows pc.

2. Can't send message to server PC.

Error shows: [bt_socket_send_data] regist to fail.

Jan Gründling

Thank you for posting your solution! have you solved the other problems in the meantime?