Re: Digest for btstack-dev@googlegroups.com - 2 updates in 1 topic

7 views
Skip to first unread message

Justin John

unread,
Aug 9, 2021, 5:32:01 AM8/9/21
to btsta...@googlegroups.com
Hi Matthias,

I wanted to know the page/inquiry scan mode to satisfy the application state operation. Anyways, I can avoid that.
However on the successful connection I want to make the device undiscoverable. Currently I am doing it under the RFCOMM_EVENT_INCOMING_CONNECTION case.

 case RFCOMM_EVENT_INCOMING_CONNECTION:

                     // data: event (8), len(8), address(48), channel (8), rfcomm_cid (16)

                     rfcomm_event_incoming_connection_get_bd_addr(packet, event_addr);

                     rfcomm_channel_nr = rfcomm_event_incoming_connection_get_server_channel(packet);

                     rfcomm_channel_id = rfcomm_event_incoming_connection_get_rfcomm_cid(packet);

                     rfcomm_accept_connection(rfcomm_channel_id);

                     gap_discoverable_control(0); // make device undiscoverable to save power

                     break;


Is the above code right to make the device undiscoverable?

Thanks
Justin

On Sat, Aug 7, 2021 at 3:27 PM <btsta...@googlegroups.com> wrote:
Justin John <johnm...@gmail.com>: Aug 06 06:27PM +0530

Hi Matthias,
 
I am looking forward to BR/EDR (Classic) and the intention is to let
the application know that page scan has started after issuing
gap_discoverable_control(1) command.
In the same way I want to let the application know about the disconnection
after the gap_discoverable_control(0) command is issued.
 
From the BTStack Manual, Under profiles I see below code snippet
 
int main(void){ ... // make discoverable gap_discoverable_control(1);
btstack_run_loop_execute(); return 0; } void packet_handler (uint8_t
packet_type, uint8_t *packet, uint16_t size){ ... switch(state){ case
W4_CHANNEL_COMPLETE: // if connection is successful, make device
undiscoverable gap_discoverable_control(0); ... } }
 
However I am not able to trace W4_CHANNEL_COMPLETE in the source code.
 
Thanks
Justin
 
 
Matthias Ringwald <matthias...@gmail.com>: Aug 07 11:03AM +0200

Hi John
 
Could you tell why you want/need to know when the page/inquiry scan mode has changed?
 
When you call gap_discoverable_control, the stack will send the corresponding HCI Command immediately and the scan mode will change within a few milliseconds
 
Best
Matthias
 
Sent from my iPhone
 
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to btstack-dev...@googlegroups.com.

Matthias Ringwald

unread,
Aug 9, 2021, 6:15:14 AM8/9/21
to btsta...@googlegroups.com
Hi Justin

Yes, disabling discoverable (inquiry scan) will both safe a bit of energy as well as provide a tiny bit more bandwidth.

Your code below will work as intended.

Best
Matthias

> On 9 Aug 2021, at 11:31, Justin John <johnm...@gmail.com> wrote:
>
> Hi Matthias,
>
> I wanted to know the page/inquiry scan mode to satisfy the application state operation. Anyways, I can avoid that.
> However on the successful connection I want to make the device undiscoverable. Currently I am doing it under the RFCOMM_EVENT_INCOMING_CONNECTION case.
> case RFCOMM_EVENT_INCOMING_CONNECTION:
> // data: event (8), len(8), address(48), channel (8), rfcomm_cid (16)
> rfcomm_event_incoming_connection_get_bd_addr(packet, event_addr);
> rfcomm_channel_nr = rfcomm_event_incoming_connection_get_server_channel(packet);
> rfcomm_channel_id = rfcomm_event_incoming_connection_get_rfcomm_cid(packet);
> rfcomm_accept_connection(rfcomm_channel_id);
> gap_discoverable_control(0); // make device undiscoverable to save power
> break;
>
> Is the above code right to make the device undiscoverable?
>
> Thanks
> Justin
>
> On Sat, Aug 7, 2021 at 3:27 PM <btsta...@googlegroups.com> wrote:
> btsta...@googlegroups.com Google Groups
> --
> You received this message because you are subscribed to the Google Groups "btstack-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to btstack-dev...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/btstack-dev/CAGtH5dY%3DhN3SfBS1um7WfnVQBYrwW4_8Dz9%3D4XWxNS1%3DQAzR4w%40mail.gmail.com.

Reply all
Reply to author
Forward
0 new messages