Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Linux Programming
  4. Implementing "accept" in Bluetooth / Linux ?

Implementing "accept" in Bluetooth / Linux ?

Scheduled Pinned Locked Moved Linux Programming
sysadminlinuxdebugginghelptutorial
1 Posts 1 Posters 10 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    Could some kind person help me to analyze this code ?

    It is a modification of

    http://people.csail.mit.edu/albert/bluez-intro/

    I have few basic concerns

    1. I am not sure how “client” server gels included in the FULL implementation.
      The resource , and many “free source code “ copies of it do not include the actual
      FULL implementations.

    2. I am not sure How EACH USAGE OF “so9cket” interacts.

    3, My code sort of works until

    //client = accept(server_socket, (struct sockaddr *)&rem_addr, &opt);

    When the above code is uncommented the code execution (in debug mode ) STOPS at that line.

    I have no reasonable description of the “”accept” function and NOT KNOW how to debug / step thru it – it is “bluez ?” library code.

    'I am not sure if "server_socket" belongs to this function...

    Part of code :

    //HERE
    // temporary initialize client to fail code 
    client = -1;
    // select SPC\_CA
    //rem\_addr  = "01:23:45:67:89:AB"; // ,SPP\_C\_addr\[19\];
    // accept one connection
    // verify passed paramaters ??
    text = "verify  server\_socket ";
    text += QString ::number(server\_socket);
    text += Q\_FUNC\_INFO;
    text += " @ line ";
    text += QString::number(\_\_LINE\_\_);
    qDebug() << text;
    

    #ifdef BYPASS
    text = " (struct sockaddr *)&rem_addr ";
    //text += QString ::number(server_socket);
    //text += rem_addr.rc_bdaddr.toString();
    text += Q_FUNC_INFO;
    text += " @ line ";
    text += QString::number(__LINE__);
    qDebug() << text;
    #endif

    //client = accept(server\_socket, (struct sockaddr \*)&rem\_addr, &opt);
    
    
    
    
    text = "verify  server\_socket ";
    text += QString ::number(server\_socket);
    text += Q\_FUNC\_INFO;
    text += " @ line ";
    text += QString::number(\_\_LINE\_\_);
    qDebug() << text;
    
    
    
    if(client < 0 )
    {
    

    //#ifdef C_CODE_TRACE
    text = " FAILED accept one connection";
    text += Q_FUNC_INFO;
    text += " @ line ";
    text += QString::number(__LINE__);
    text += " client ";
    text += QString::number(client );

    qDebug() << text;

    //#endif

    }
    else
    {
    

    #ifdef C_CODE_TRACE
    text = "SUCCESS accept one connection";
    text += Q_FUNC_INFO;
    text += " @ line ";
    text += QString::number(__LINE__);
    text += " client ";
    text += QString::number(client );

    qDebug() << text;
    #endif

    }
    
    
    
    
    
    ba2str( &rem\_addr.rc\_bdaddr, buf );
    fprintf(stderr, "Verify accepted rem address connection f
    
    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups