mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-22 15:40:16 +00:00
improve user experience of BTstack Inquiry View: shorter inquiry interval, repeat inquiry while BT on
This commit is contained in:
parent
95ce774257
commit
d2e91376b2
@ -9,6 +9,8 @@
|
||||
|
||||
#include <btstack/btstack.h>
|
||||
|
||||
#define INQUIRY_INTERVAL 3
|
||||
|
||||
static BTInquiryViewController *inqView;
|
||||
static btstack_packet_handler_t clientHandler;
|
||||
static uint8_t remoteNameIndex;
|
||||
@ -52,8 +54,19 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) myStartInquiry{
|
||||
if (inquiryState != kInquiryInactive) {
|
||||
NSLog(@"Inquiry already active");
|
||||
return;
|
||||
}
|
||||
NSLog(@"Inquiry started");
|
||||
inquiryState = kInquiryActive;
|
||||
[[self tableView] reloadData];
|
||||
|
||||
bt_send_cmd(&hci_inquiry, HCI_INQUIRY_LAP, INQUIRY_INTERVAL, 0);
|
||||
}
|
||||
|
||||
- (void) handlePacket:(uint8_t) packet_type channel:(uint16_t) channel packet:(uint8_t*) packet size:(uint16_t) size {
|
||||
static bool inquiryDone = 0;
|
||||
bd_addr_t event_addr;
|
||||
switch (packet_type) {
|
||||
|
||||
@ -67,16 +80,8 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
|
||||
[[self tableView] reloadData];
|
||||
|
||||
// set BT state
|
||||
if (!inquiryDone && packet[2] == HCI_STATE_WORKING) {
|
||||
inquiryDone = true;
|
||||
if (inquiryState != kInquiryInactive) {
|
||||
NSLog(@"Inquiry already active");
|
||||
return;
|
||||
}
|
||||
NSLog(@"Inquiry started");
|
||||
inquiryState = kInquiryActive;
|
||||
[[self tableView] reloadData];
|
||||
bt_send_cmd(&hci_inquiry, HCI_INQUIRY_LAP, 15, 0);
|
||||
if (bluetoothState == HCI_STATE_WORKING) {
|
||||
[self myStartInquiry];
|
||||
}
|
||||
break;
|
||||
|
||||
@ -192,6 +197,9 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
|
||||
} else {
|
||||
inquiryState = kInquiryInactive;
|
||||
// inquiry done.
|
||||
|
||||
[self myStartInquiry];
|
||||
|
||||
}
|
||||
[[self tableView] reloadData];
|
||||
|
||||
|
3
TODO.txt
3
TODO.txt
@ -2,9 +2,6 @@
|
||||
|
||||
NEXT:
|
||||
- on applicationWillResignActive: just disconnect, power off and push "Not clear yet"
|
||||
- improve user experience of BTstack Inquiry View
|
||||
- shorter inquiry interval
|
||||
- repeat inquiry while BT on
|
||||
|
||||
- prepend all source files with 'new BSD' copyright header
|
||||
- provide test version by setting up APT repository within BTstack SVN
|
||||
|
Loading…
x
Reference in New Issue
Block a user