mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-07 19:01:06 +00:00
check bt_open and show alert if not accessible
This commit is contained in:
parent
6bc81084c3
commit
95ce774257
5
TODO.txt
5
TODO.txt
@ -1,14 +1,11 @@
|
||||
/* new todo file for BTstack */
|
||||
|
||||
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
|
||||
|
||||
- CocoaTouch user interface
|
||||
- on iPhone sleep, just turn off Bluetooth and disconnect all connections
|
||||
- and figure out why stack doesn't shut Bluetooth off when in sleep for a while/after wakeup
|
||||
|
||||
- prepend all source files with 'new BSD' copyright header
|
||||
- provide test version by setting up APT repository within BTstack SVN
|
||||
- instructions: http://www.saurik.com/id/7
|
||||
|
@ -122,11 +122,22 @@ void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint
|
||||
|
||||
- (void)applicationDidFinishLaunching:(UIApplication *)application {
|
||||
NSLog(@"Started");
|
||||
|
||||
bool btOK = false;
|
||||
|
||||
#ifdef USE_BLUETOOTH
|
||||
run_loop_init(RUN_LOOP_COCOA);
|
||||
bt_open();
|
||||
bt_register_packet_handler(packet_handler);
|
||||
if ( bt_open() ){
|
||||
UIAlertView* alertView = [[UIAlertView alloc] init];
|
||||
alertView.title = @"Bluetooth not accessible!";
|
||||
alertView.message = @"Connection to BTstack failed!\n"
|
||||
"Please make sure that BTstack is installed correctly.";
|
||||
NSLog(@"Alert: %@ - %@", alertView.title, alertView.message);
|
||||
[alertView addButtonWithTitle:@"Dismiss"];
|
||||
[alertView show];
|
||||
} else {
|
||||
bt_register_packet_handler(packet_handler);
|
||||
btOK = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
// create window
|
||||
@ -149,10 +160,10 @@ void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint
|
||||
|
||||
theMainApp = self;
|
||||
|
||||
#ifdef USE_BLUETOOTH
|
||||
[inqViewControl setDelegate:self];
|
||||
[inqViewControl startInquiry];
|
||||
#endif
|
||||
if (btOK) {
|
||||
[inqViewControl setDelegate:self];
|
||||
[inqViewControl startInquiry];
|
||||
}
|
||||
|
||||
glView = (EAGLView *) [glViewControl view];
|
||||
glView.animationInterval = 1.0 / 60.0;
|
||||
|
Loading…
Reference in New Issue
Block a user