mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-10 15:44:32 +00:00
extracted iphone_os_at_least_40
This commit is contained in:
parent
c120f476eb
commit
2f84a6b35c
@ -42,6 +42,7 @@
|
|||||||
extern bt_control_t bt_control_iphone;
|
extern bt_control_t bt_control_iphone;
|
||||||
|
|
||||||
int bt_control_iphone_power_management_enabled(void);
|
int bt_control_iphone_power_management_enabled(void);
|
||||||
|
int bt_control_iphone_power_management_supported(void);
|
||||||
|
|
||||||
// control system Bluetooth
|
// control system Bluetooth
|
||||||
int iphone_system_bt_enabled();
|
int iphone_system_bt_enabled();
|
||||||
|
@ -152,6 +152,13 @@ static int power_management_active = 0;
|
|||||||
static char *os3xBlueTool = "BlueTool";
|
static char *os3xBlueTool = "BlueTool";
|
||||||
static char *os4xBlueTool = "/usr/local/bin/BlueToolH4";
|
static char *os4xBlueTool = "/usr/local/bin/BlueToolH4";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* check OS version for >= 4.0
|
||||||
|
*/
|
||||||
|
static int iphone_os_at_least_40(){
|
||||||
|
return kCFCoreFoundationVersionNumber >= 550.32;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get machine name
|
* get machine name
|
||||||
*/
|
*/
|
||||||
@ -473,8 +480,7 @@ static int iphone_on (void *transport_config){
|
|||||||
err = system ("launchctl unload /System/Library/LaunchDaemons/com.apple.BTServer.plist");
|
err = system ("launchctl unload /System/Library/LaunchDaemons/com.apple.BTServer.plist");
|
||||||
|
|
||||||
// check for os version >= 4.0
|
// check for os version >= 4.0
|
||||||
int os4x = kCFCoreFoundationVersionNumber >= 550.32;
|
int os4x = iphone_os_at_least_40();
|
||||||
log_info("CFVersion %f, >= 4.0 %u\n", kCFCoreFoundationVersionNumber, os4x);
|
|
||||||
|
|
||||||
// OS 4.0
|
// OS 4.0
|
||||||
char * bluetool = os3xBlueTool;
|
char * bluetool = os3xBlueTool;
|
||||||
@ -709,6 +715,14 @@ void iphone_register_for_power_notifications(void (*cb)(POWER_NOTIFICATION_t eve
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
int bt_control_iphone_power_management_supported(void){
|
||||||
|
// only supported on Broadcom chipsets with iOS 4.0+
|
||||||
|
if ( iphone_has_csr()) return 0;
|
||||||
|
if (!iphone_os_at_least_40()) return 0;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// single instance
|
// single instance
|
||||||
bt_control_t bt_control_iphone = {
|
bt_control_t bt_control_iphone = {
|
||||||
.on = iphone_on,
|
.on = iphone_on,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user