Add a few missing headers

Fixes build with gcc 4.3.2

Signed-off-by: Alexey Zaytsev <alexey.zaytsev@gmail.com>
Add a few missing headers.

Fixes build with gcc 4.3.2 on Debian.

Signed-off-by: Alexey Zaytsev <alexey.zaytsev@gmail.com>
Added broadcasts for external power events.
Change values of ACTION_POWER constants to better match established practice.

Trim code to 100 lines to match style guide.