Changes to lightsctl-huawei tool
For https://github.com/phhusson/treble_experimentations/issues/1204 Change-Id: I70655264003190de6c8624e9f63bfea75a09cf61
This commit is contained in:
parent
ce62c4117d
commit
2d6225cce3
@ -1,21 +1,38 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <vendor/huawei/hardware/light/2.0/IHwLight.h>
|
#include <vendor/huawei/hardware/light/2.0/ILight.h>
|
||||||
#include <android/hardware/light/2.0/types.h>
|
#include <android/hardware/light/2.0/types.h>
|
||||||
|
|
||||||
using ::vendor::huawei::hardware::light::V2_0::IHwLight;
|
using ::vendor::huawei::hardware::light::V2_0::ILight;
|
||||||
using ::android::sp;
|
using ::android::sp;
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
auto svc = IHwLight::getService();
|
auto svc = ILight::getService();
|
||||||
svc->HWgetSupportedTypes([](auto types) {
|
svc->HWgetSupportedTypes([](auto types) {
|
||||||
for(const auto& type: types) {
|
for(const auto& type: types) {
|
||||||
std::cout << "Got type " << type << std::endl;
|
std::cout << "Got type " << type << std::endl;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
uint32_t a = (uint32_t)strtoll(argv[1], NULL, 10);
|
uint32_t a = (uint32_t)strtoll(argv[1], NULL, 10);
|
||||||
uint32_t b = (uint32_t)strtoll(argv[2], NULL, 10);
|
|
||||||
auto ret = svc->HWsetLightBrightness(a, b);
|
android::hardware::light::V2_0::LightState state;
|
||||||
std::cout << "Set light brightness returned " << toString(ret) << std::endl;
|
state.color = (uint32_t)strtoll(argv[2], NULL, 16);
|
||||||
|
state.flashMode = android::hardware::light::V2_0::Flash::NONE;
|
||||||
|
state.brightnessMode = android::hardware::light::V2_0::Brightness::USER;
|
||||||
|
|
||||||
|
if(argc == 6) {
|
||||||
|
std::string flashArg(argv[3]);
|
||||||
|
if(flashArg == "NONE")
|
||||||
|
state.flashMode = android::hardware::light::V2_0::Flash::NONE;
|
||||||
|
if(flashArg == "TIMED")
|
||||||
|
state.flashMode = android::hardware::light::V2_0::Flash::TIMED;
|
||||||
|
if(flashArg == "HARDWARE")
|
||||||
|
state.flashMode = android::hardware::light::V2_0::Flash::HARDWARE;
|
||||||
|
|
||||||
|
state.flashOnMs = atoi(argv[4]);
|
||||||
|
state.flashOffMs = atoi(argv[5]);
|
||||||
|
}
|
||||||
|
std::cout << "Set flash type to " << toString(state.flashMode) << std::endl;
|
||||||
|
|
||||||
|
svc->HWsetLight(a, state);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user