mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-23 10:21:12 +00:00
add enum POWER_EVENTS {POWER_WILL_SLEEP, POWER_WILL_WAKE_UP), add register_for_power_management_notifictations( void (*callback)(POWER_EVENTS event)); to bt_control.h
This commit is contained in:
parent
a8d66173c1
commit
0df774e2ac
4
TODO.txt
4
TODO.txt
@ -26,8 +26,8 @@ NEXT:
|
|||||||
- DONE: power down Bluetooth on sleep notifcation / turn on, if clients are connected
|
- DONE: power down Bluetooth on sleep notifcation / turn on, if clients are connected
|
||||||
- DONE: keep list of clients that requested Blueooth to be active
|
- DONE: keep list of clients that requested Blueooth to be active
|
||||||
- DONE: Bluetooth is on iff at least one client did request it. delay off by 10 seconds
|
- DONE: Bluetooth is on iff at least one client did request it. delay off by 10 seconds
|
||||||
- add enum POWER_EVENTS {POWER_WILL_SLEEP, POWER_WILL_WAKE_UP);
|
- DONE: add enum POWER_EVENTS {POWER_WILL_SLEEP, POWER_WILL_WAKE_UP);
|
||||||
- add register_for_power_management_notifictations( void (*callback)(POWER_EVENTS event)); to bt_control.h
|
- DONE: add register_for_power_management_notifictations( void (*callback)(POWER_EVENTS event)); to bt_control.h
|
||||||
- move core foundation power event code to bt_control_iphone.m
|
- move core foundation power event code to bt_control_iphone.m
|
||||||
- add sleep() to bt_control.h (assumption: no off -> sleep transition)
|
- add sleep() to bt_control.h (assumption: no off -> sleep transition)
|
||||||
|
|
||||||
|
@ -42,9 +42,15 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
POWER_WILL_SLEEP = 1,
|
||||||
|
POWER_WILL_WAKE_UP
|
||||||
|
} POWER_NOTIFICATION_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int (*on)(void *config); // <-- turn BT module on and configure
|
int (*on)(void *config); // <-- turn BT module on and configure
|
||||||
int (*off)(void *config); // <-- turn BT module off
|
int (*off)(void *config); // <-- turn BT module off
|
||||||
|
int (*sleep)(void *config); // <-- put BT module to sleep - only to be called after ON
|
||||||
int (*valid)(void *config); // <-- test if hardware can be supported
|
int (*valid)(void *config); // <-- test if hardware can be supported
|
||||||
const char * (*name)(void *config); // <-- return hardware name
|
const char * (*name)(void *config); // <-- return hardware name
|
||||||
|
|
||||||
@ -53,4 +59,6 @@ typedef struct {
|
|||||||
*/
|
*/
|
||||||
uint8_t * (*next_command)(void *config);
|
uint8_t * (*next_command)(void *config);
|
||||||
|
|
||||||
|
void (*register_for_power_notifications)(void (*cb)(POWER_NOTIFICATION_t event));
|
||||||
|
|
||||||
} bt_control_t;
|
} bt_control_t;
|
||||||
|
@ -500,12 +500,17 @@ static int iphone_off (void *config){
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int iphone_sleep(void *config){
|
||||||
|
return iphone_off(config);
|
||||||
|
}
|
||||||
|
|
||||||
// single instance
|
// single instance
|
||||||
bt_control_t bt_control_iphone = {
|
bt_control_t bt_control_iphone = {
|
||||||
iphone_on,
|
iphone_on,
|
||||||
iphone_off,
|
iphone_off,
|
||||||
|
iphone_sleep,
|
||||||
iphone_valid,
|
iphone_valid,
|
||||||
iphone_name,
|
iphone_name,
|
||||||
NULL
|
NULL, // custom init sequence
|
||||||
|
NULL // register_for_power_notifications
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user