however, the question remains - what is the best way to reset the whole shebang and reconnect.
> --
> You received this message because you are subscribed to the Google Groups "btstack-dev" group.
> To post to this group, send email to btsta...@googlegroups.com.
> To unsubscribe from this group, send email to btstack-dev...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/btstack-dev?hl=en.
>
most stuff you'll need in an application is defined in include/btstack/hci_cmd.h
(The 0x73 is actually used internally to check if there are baseband connections that don't have any l2cap connection and thus can be closed)
If you get an L2CAP/RFCOMM close event, then the stack considers this connection as gone. If you don't get that, there's a different problem around.
To be honest, I never looked at automatic reconnection. But... the state machines should be/are robust enough that you can just initiate the L2CAP or RFCOMM connection as you did the first time. If this fails, please have a look at the /tmp/hci_dump.pklg (on iOS) and browse that. If you get a valid error case, I'm happy to investigate further.
Best
Matthias
What version of BTstack are you using. Please use the latest from Cydia together with the current SVN version for the headers.
I've provided full RFCOMM support in May. Before there was a buggy quick & dirty implementation available as example/rfcomm.c. If you're using that, there won't be a RFCOMM close event.
Please try the current examples, e.g. rfcomm-cat to see if you get a consistent connection.
With the current version, ou don't need to do anything special to receive L2CAP/RFCOMM close events.
Best
Matthias
If you don't get such an event, at least BTstack thinks that the connection is intact. How do your
I recommend iFile to retrieve it for non-ssh/terminal users
Best
Matthias
> --
> You received this message because you are subscribed to the Google Groups "btstack-dev" group.
> To post to this group, send email to btsta...@googlegroups.com.
> To unsubscribe from this group, send email to btstack-dev...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/btstack-dev?hl=en.
>
On 06.09.2011, at 13:39, kimo wrote:
> Hi Matthias,
>
> To avoid using my previous mentioned pseudo-solution for reconnecting,
> I would like to better understand how the BTstack manages a
> disconnection (or a link connection loss).
If the Bluetooth module detects that a link is gone, it emits a HCI_EVENT_DISCONNECTION_COMPLETE event, upon which BTstack closes all L2CAP channels on that baseband connection, which in turn also closes all RFCOMM multiplexers on that connection and finally closes all RFCOMM connections.
> Usually, in the Bluetooth
> spec there is a fixed timeout period after which if there is no packet
> between both devices the connection get disconnect (supervision
> timeout period), so I am trying to reproduce this on the BTstack but
> without a real success.
>
> Here is what I did:
>
> I connected both devices (RFCOM), Then I hide the iPhone from the
> second devices for a while and then I put back the iPhone close to the
> connected device. I notices 3 different scenarios:
>
> scenario 1 : The iPhone continue to receive data even after severals
> successive L2CAP_EVENT_TIMEOUT_CHECK. (depends from an execution to
> another )
> scenario 2 : The iPhone receive RFCOMM_EVENT_CHANNEL_CLOSED after 2
> successive L2CAP_EVENT_TIMEOUT_CHECK (2*10 seconds) (seems to be the
> right scenario)
> scenario 3 : The iPhone will stop receive data but without a close
> event, it will continue to raise L2CAP_EVENT_TIMEOUT_CHECK (The
> connection is stuck here)
>
> Based on what I have seen, I could not really find a way to detect a
> connection loss since it differs from an execution to another one, Do
> you have any idea why I have these different scenarios ? How the
> BTstack is managing this part ? when the BTstack is supposed to raise
> an RFCOMM_EVENT_CHANNEL_CLOSED event ?
>
> Thank you very much for your help and your support ;)
>
Please check if you get HCI_EVENT_DISCONNECTION_COMPLETE if you remove the remote device.
If you post hci_dump.pklg, please send the binary version. It is much easier to read than all the textual clutter.
Best
Matthias