aidl: light: Make rgb a normal struct

No need to typedef in C++

Change-Id: I949c4319eb8f116d6cd2903a294757bacc7751a7
This commit is contained in:
Luca Stefani 2023-11-13 01:39:17 +01:00 committed by Sebastiano Barezzi
parent 2154cee0ec
commit 69f546cc9b
No known key found for this signature in database
GPG Key ID: 763BD3AE91A7A13F
2 changed files with 6 additions and 6 deletions

View File

@ -59,8 +59,8 @@ Lights::Lights() {
}
ndk::ScopedAStatus Lights::setLightState(int32_t id, const HwLightState& state) {
rgb_t color(state.color);
rgb_t batteryStateColor;
rgb color(state.color);
rgb batteryStateColor;
LightType type = static_cast<LightType>(id);
switch (type) {
@ -77,7 +77,7 @@ ndk::ScopedAStatus Lights::setLightState(int32_t id, const HwLightState& state)
mLastBatteryState = state;
else
mLastNotificationState = state;
batteryStateColor = rgb_t(mLastBatteryState.color);
batteryStateColor = rgb(mLastBatteryState.color);
setLED(batteryStateColor.isLit() ? mLastBatteryState : mLastNotificationState);
mLEDMutex.unlock();
break;
@ -97,7 +97,7 @@ ndk::ScopedAStatus Lights::getLights(std::vector<HwLight>* _aidl_return) {
void Lights::setLED(const HwLightState& state) {
bool rc = true;
rgb_t color(state.color);
rgb color(state.color);
uint8_t blink = (state.flashOnMs != 0 && state.flashOffMs != 0);
switch (state.flashMode) {

View File

@ -13,7 +13,7 @@ namespace android {
namespace hardware {
namespace light {
typedef struct rgb {
struct rgb {
rgb(uint8_t r, uint8_t g, uint8_t b) : red(r), green(g), blue(b){};
rgb(uint32_t color);
rgb() : red(0), green(0), blue(0){};
@ -24,7 +24,7 @@ typedef struct rgb {
bool isLit();
uint8_t toBrightness();
} rgb_t;
};
bool fileWriteable(const std::string& file);
bool readFromFile(const std::string& file, std::string* content);