michelcandido / btstack

Automatically exported from code.google.com/p/btstack
0 stars 0 forks source link

[minorIssue: L2CAP_CONNECTION_RESPONSE_RESULT_SUCCESSFUL but zero (0) is used for success #216

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?

Please provide any additional information below.

Original issue reported on code.google.com by alanj...@yahoo.com on 23 Nov 2011 at 4:44

GoogleCodeExporter commented 8 years ago
Arghh, what keypress caused that to submit itself!!!!!

Title: [MINOR] L2CAP_CONNECTION_RESPONSE_RESULT_SUCCESSFUL but zero (0) is used 
for success

Text:
When an L2CAP client connection fails due to there being no listener on the 
peer device for the specified PSM we see:
    HCI_EVENT_PACKET, L2CAP_EVENT_CHANNEL_OPENED, status: 0x65
Where 0x65 is L2CAP_CONNECTION_RESPONSE_RESULT_REFUSED_PSM, so that’s correct.

However when a connection is successful we see:
    HCI_EVENT_PACKET, L2CAP_EVENT_CHANNEL_OPENED, status: 0x00
That case does _not_ use:
    #define L2CAP_CONFIG_RESPONSE_RESULT_SUCCESSFUL            0x66

Two solutions:
1)  Rename that macro to be _BASE or similar, and continue to use zero for 
success.
2)  Change the (two or so) places in btstack where an event for successful 
connection is raised to use that macro.  However this likely a breaking change; 
existing user code might be using 0 (zero) for success…

RFCOMM appears _not_ to have a corresponding _SUCCESSFUL macro, which adds 
weight to #1.

Original comment by alanj...@yahoo.com on 23 Nov 2011 at 4:46