mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-23 09:41:03 +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>
|
#include <btstack/btstack.h>
|
||||||
|
|
||||||
|
#define INQUIRY_INTERVAL 3
|
||||||
|
|
||||||
static BTInquiryViewController *inqView;
|
static BTInquiryViewController *inqView;
|
||||||
static btstack_packet_handler_t clientHandler;
|
static btstack_packet_handler_t clientHandler;
|
||||||
static uint8_t remoteNameIndex;
|
static uint8_t remoteNameIndex;
|
||||||
@ -52,8 +54,19 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
|
|||||||
return self;
|
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 {
|
- (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;
|
bd_addr_t event_addr;
|
||||||
switch (packet_type) {
|
switch (packet_type) {
|
||||||
|
|
||||||
@ -67,16 +80,8 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
|
|||||||
[[self tableView] reloadData];
|
[[self tableView] reloadData];
|
||||||
|
|
||||||
// set BT state
|
// set BT state
|
||||||
if (!inquiryDone && packet[2] == HCI_STATE_WORKING) {
|
if (bluetoothState == HCI_STATE_WORKING) {
|
||||||
inquiryDone = true;
|
[self 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, 15, 0);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -192,6 +197,9 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
|
|||||||
} else {
|
} else {
|
||||||
inquiryState = kInquiryInactive;
|
inquiryState = kInquiryInactive;
|
||||||
// inquiry done.
|
// inquiry done.
|
||||||
|
|
||||||
|
[self myStartInquiry];
|
||||||
|
|
||||||
}
|
}
|
||||||
[[self tableView] reloadData];
|
[[self tableView] reloadData];
|
||||||
|
|
||||||
|
3
TODO.txt
3
TODO.txt
@ -2,9 +2,6 @@
|
|||||||
|
|
||||||
NEXT:
|
NEXT:
|
||||||
- on applicationWillResignActive: just disconnect, power off and push "Not clear yet"
|
- 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
|
- prepend all source files with 'new BSD' copyright header
|
||||||
- provide test version by setting up APT repository within BTstack SVN
|
- provide test version by setting up APT repository within BTstack SVN
|
||||||
|
Loading…
x
Reference in New Issue
Block a user