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:
matthias.ringwald 2011-01-08 22:12:03 +00:00
parent a8d66173c1
commit 0df774e2ac
3 changed files with 16 additions and 3 deletions

View File

@ -26,8 +26,8 @@ NEXT:
- 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: 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);
- add register_for_power_management_notifictations( void (*callback)(POWER_EVENTS event)); to bt_control.h
- DONE: add enum POWER_EVENTS {POWER_WILL_SLEEP, POWER_WILL_WAKE_UP);
- 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
- add sleep() to bt_control.h (assumption: no off -> sleep transition)

View File

@ -42,9 +42,15 @@
#include <stdint.h>
typedef enum {
POWER_WILL_SLEEP = 1,
POWER_WILL_WAKE_UP
} POWER_NOTIFICATION_t;
typedef struct {
int (*on)(void *config); // <-- turn BT module on and configure
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
const char * (*name)(void *config); // <-- return hardware name
@ -53,4 +59,6 @@ typedef struct {
*/
uint8_t * (*next_command)(void *config);
void (*register_for_power_notifications)(void (*cb)(POWER_NOTIFICATION_t event));
} bt_control_t;

View File

@ -500,12 +500,17 @@ static int iphone_off (void *config){
return 0;
}
static int iphone_sleep(void *config){
return iphone_off(config);
}
// single instance
bt_control_t bt_control_iphone = {
iphone_on,
iphone_off,
iphone_sleep,
iphone_valid,
iphone_name,
NULL
NULL, // custom init sequence
NULL // register_for_power_notifications
};