Overview
The target of the Power Manager API is to provide the application user the power control, offering the common power control tools that are provided in any electronic device (reboot, shutdown, standby..). Moreover, every action which is taken, it will be done in a safe mode. It means that before an action, every alive service will know that it is going to be a change in the power status. Therefore, if any other critical action, such as an upgrade, is taking place, it is provided the possibility to abort the power transition. Finally, it also implements a debug mode, in order to disable the system power instructions. The structure of the API is explained in the next figure:
Due to most of services and applications uses this API and it is essential to have a knowledge about how the Power Manager works, in the next figure is shown the flow chart of the service, particularly explaining the function of the cancel and guard timers.
- Cancel timer: It specifies the time during the power transaction can be cancelled. It can be done using an abort action or receiving a critical battery request.
- Guard timer: It specifies the time before taking the requested action (After the first timer), since this point the action cannot be cancelled. The aim of this timer is to give enough time to the rest of the services in order to make a safe close.
Main functionalities
The Power Manager API provides the following functionalities:
- To get the current power status: It gives the current power status and its cause.
-
To subscribe to the power status publications: It allows the user to subscribe to the service publisher in order to receive the information messages. This kind of messages include the STARTED and COMPLETED type (Different announcements depending on power status level).Therefore, the user can choose which messages wants to receive:
- NONE
- STARTED
- COMPLETED
- STARTED and COMPLETED
- To unsubscribe to the power status publication: It allows to the user to unsubscribe to the Power Manager publication.
- To send a shutdown request: To switch off the system.
- To send a reboot request: To reboot the system.
- To send a standby request: To suspend to ram the system.
- To send a abort request: To abort any of the previous requests (shutdown, reboot or standby).
- To send a critical battery request: To warn a critical battery status, it switches off the system without delay.
- To set the debug mode: It allows to the user to enable/disable the debug mode.
- To get the debug mode status: It allows to the user to get the current status of the debug mode.
- To set the standby and shutdown wakeup timers: It allows to set timers in minutes for Standby and Shutdown States. These timers establish the interval of time for the board to be automatically woken up in the specified state.
- To get the values of the standby and shutdown wakeup timers: It allows to the user to get the current values of the timers.
- To set a custom wakeup time: It allows to set a date and time for the OBU to wake up from standby/shutdown states. This time must be allowed by the timers restrictions: i.e. a date prior to current one cannot be set
- To set/get/cancel an ignition OFF timeout: It allows to set a timeout for the OBU to turn off itself if Ignition button has remained in OFF state that amount of time. If a new timeout is set when IGNITION is still if OFF state, the time count starts again with the new configuration