handle transition for HCI_POWER_SLEEP and all HCI state transitions

This commit is contained in:
matthias.ringwald 2011-01-07 20:54:57 +00:00
parent fe19fafb3a
commit b546ac5469
2 changed files with 22 additions and 10 deletions

View File

@ -26,6 +26,7 @@ NEXT:
- decide on configure flags
- clean up components
- store HCI_POWER_ON/HCI_POWER_OFF per client, and only turn off when all are turned off
- decide what to do with the CocoaTouch code.
- do nothing
- add it to libBTstack.dylib

View File

@ -611,7 +611,7 @@ int hci_power_control(HCI_POWER_MODE power_mode){
// do nothing
break;
case HCI_POWER_SLEEP:
// TODO ...
// do nothing (with SLEEP == OFF)
break;
}
break;
@ -627,7 +627,9 @@ int hci_power_control(HCI_POWER_MODE power_mode){
hci_stack.state = HCI_STATE_OFF;
break;
case HCI_POWER_SLEEP:
// TODO ...
// no connections yet, just turn it off
hci_power_control_off();
hci_stack.state = HCI_STATE_SLEEPING;
break;
}
break;
@ -642,7 +644,8 @@ int hci_power_control(HCI_POWER_MODE power_mode){
hci_stack.state = HCI_STATE_HALTING;
break;
case HCI_POWER_SLEEP:
// TODO ...
// see hci_run
hci_stack.state = HCI_STATE_FALLING_ASLEEP;
break;
}
break;
@ -658,7 +661,8 @@ int hci_power_control(HCI_POWER_MODE power_mode){
// do nothing
break;
case HCI_POWER_SLEEP:
// TODO ...
// see hci_run
hci_stack.state = HCI_STATE_FALLING_ASLEEP;
break;
}
break;
@ -666,13 +670,17 @@ int hci_power_control(HCI_POWER_MODE power_mode){
case HCI_STATE_FALLING_ASLEEP:
switch (power_mode){
case HCI_POWER_ON:
// TODO ...
// set up state machine
hci_stack.num_cmd_packets = 1; // assume that one cmd can be sent
hci_stack.state = HCI_STATE_INITIALIZING;
hci_stack.substate = 0;
break;
case HCI_POWER_OFF:
// TODO ...
// see hci_run
hci_stack.state = HCI_STATE_HALTING;
break;
case HCI_POWER_SLEEP:
// TODO ...
// do nothing
break;
}
break;
@ -680,13 +688,16 @@ int hci_power_control(HCI_POWER_MODE power_mode){
case HCI_STATE_SLEEPING:
switch (power_mode){
case HCI_POWER_ON:
// TODO ...
// set up state machine
hci_stack.num_cmd_packets = 1; // assume that one cmd can be sent
hci_stack.state = HCI_STATE_INITIALIZING;
hci_stack.substate = 0;
break;
case HCI_POWER_OFF:
// TODO ...
hci_stack.state = HCI_STATE_OFF;
break;
case HCI_POWER_SLEEP:
// TODO ...
// do nothing
break;
}
break;