I want to have the led on my phone show it is being charged or it's battery is full.
One of the core developers on telegram pointed out that this could be done by extending repowerd. So I tried to do that.
2019/11/09 made a PR for unity8
2019/11/07 I am now changing IndicatorsLight.qml. You can already try it. No need to build anything, just replace the qml file (keep a copy).
This is my first step in ubports and I have absolutely no clue of the architecture of ubports or the direction it is going into. So any development related reactions are welcome.
What I did:
Created a LightControl that does two things. Control the led (on/off/color etc) and manage the led. With managing I mean show a certain event charging, full, etc.
The battery state is monitored by UPowerPowerSource. I made it pass the BatteryInfo in its changed callback and have DefaultStateMachine pass it along.
Furthermore DefaultStateMachine also notifies display on/off.
Led styles are now hardcoded but could be made to use DeviceConfig.
Currently the led is off when the display is on. It can show charging (white pulsing) and full (solid lime green).
Choice to make
- Currently the led shows dark green when a message is 'new'. This is handled by a qml file in Unity.
There cannot be two captains on this ship so either Unity must take care of managing the led or repowerd. I opt for repowerd.
- Should the led be controllable through dbus?
- I need information on how to know the state (or keep track of it) of pending new messages and missed calls.
- I don't have sim card in my phone. How can I test 'pending new message'?
My work can be found in the add-light branch of repo https://github.com/wdehoog/repowerd
Development is done using cross-builder. I test it on my oneplus one.
When interested to test see: https://gist.github.com/wdehoog/c7c09a792799d03e6880e10dbc19ab33
I have very strong feelings about the testing framework of repowerd. The COC probably forbids me to express them.