mirror of
https://github.com/chararomandroid/android_device_samsung_a20
synced 2026-08-23 04:25:33 -04:00
universal7885: run clang-format based on system-clang-format
* On every *.cpp *.h files Signed-off-by: roynatech2544 <whiteshell2544@naver.com>
This commit is contained in:
parent
6bc1c25485
commit
098179eabb
47 changed files with 1545 additions and 1709 deletions
|
|
@ -13,98 +13,98 @@
|
|||
// limitations under the License.
|
||||
|
||||
#include "Flashlight.h"
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
namespace vendor::eureka::hardware::flashlight::V1_0 {
|
||||
|
||||
// Methods from ::android::hardware::flashlight::V1_0::IFlashlight follow.
|
||||
Return<int32_t> Flashlight::setFlashlightEnable(flashlight::V1_0::Enable enable) {
|
||||
std::ofstream file;
|
||||
std::string writevalue;
|
||||
switch (enable){
|
||||
case Enable::ENABLE:
|
||||
writevalue = "1";
|
||||
break;
|
||||
case Enable::DISABLE:
|
||||
writevalue = "0";
|
||||
break;
|
||||
default:
|
||||
writevalue = "";
|
||||
break;
|
||||
}
|
||||
file.open("/sys/class/camera/flash/torch_brightness_lvl_enable");
|
||||
file << writevalue;
|
||||
file.close();
|
||||
return 0;
|
||||
std::ofstream file;
|
||||
std::string writevalue;
|
||||
switch (enable) {
|
||||
case Enable::ENABLE:
|
||||
writevalue = "1";
|
||||
break;
|
||||
case Enable::DISABLE:
|
||||
writevalue = "0";
|
||||
break;
|
||||
default:
|
||||
writevalue = "";
|
||||
break;
|
||||
}
|
||||
file.open("/sys/class/camera/flash/torch_brightness_lvl_enable");
|
||||
file << writevalue;
|
||||
file.close();
|
||||
return 0;
|
||||
}
|
||||
|
||||
Return<int32_t> Flashlight::setFlashlightWritable(flashlight::V1_0::Number value) {
|
||||
std::ofstream file;
|
||||
std::string writevalue;
|
||||
switch (value){
|
||||
case Number::ONEUI:
|
||||
writevalue = "1";
|
||||
break;
|
||||
case Number::TWOUI:
|
||||
writevalue = "2";
|
||||
break;
|
||||
case Number::THREEUI:
|
||||
writevalue = "3";
|
||||
break;
|
||||
case Number::FOURUI:
|
||||
writevalue = "4";
|
||||
break;
|
||||
case Number::FIVEUI:
|
||||
writevalue = "5";
|
||||
break;
|
||||
case Number::SIXUI:
|
||||
writevalue = "6";
|
||||
break;
|
||||
case Number::SEVENUI:
|
||||
writevalue = "7";
|
||||
break;
|
||||
case Number::EIGHTUI:
|
||||
writevalue = "8";
|
||||
break;
|
||||
case Number::NINEUI:
|
||||
writevalue = "9";
|
||||
break;
|
||||
case Number::TENUI:
|
||||
writevalue = "10";
|
||||
break;
|
||||
default:
|
||||
writevalue = "";
|
||||
break;
|
||||
}
|
||||
file.open("/sys/class/camera/flash/torch_brightness_lvl");
|
||||
file << writevalue;
|
||||
file.close();
|
||||
return 0;
|
||||
std::ofstream file;
|
||||
std::string writevalue;
|
||||
switch (value) {
|
||||
case Number::ONEUI:
|
||||
writevalue = "1";
|
||||
break;
|
||||
case Number::TWOUI:
|
||||
writevalue = "2";
|
||||
break;
|
||||
case Number::THREEUI:
|
||||
writevalue = "3";
|
||||
break;
|
||||
case Number::FOURUI:
|
||||
writevalue = "4";
|
||||
break;
|
||||
case Number::FIVEUI:
|
||||
writevalue = "5";
|
||||
break;
|
||||
case Number::SIXUI:
|
||||
writevalue = "6";
|
||||
break;
|
||||
case Number::SEVENUI:
|
||||
writevalue = "7";
|
||||
break;
|
||||
case Number::EIGHTUI:
|
||||
writevalue = "8";
|
||||
break;
|
||||
case Number::NINEUI:
|
||||
writevalue = "9";
|
||||
break;
|
||||
case Number::TENUI:
|
||||
writevalue = "10";
|
||||
break;
|
||||
default:
|
||||
writevalue = "";
|
||||
break;
|
||||
}
|
||||
file.open("/sys/class/camera/flash/torch_brightness_lvl");
|
||||
file << writevalue;
|
||||
file.close();
|
||||
return 0;
|
||||
}
|
||||
|
||||
Return<int32_t> Flashlight::readFlashlightstats(flashlight::V1_0::Device device) {
|
||||
std::ifstream file;
|
||||
std::string value;
|
||||
int32_t intvalue;
|
||||
file.open("/sys/class/camera/flash/torch_brightness_lvl");
|
||||
if (file.is_open()) {
|
||||
getline(file, value);
|
||||
file.close();
|
||||
std::stringstream val(value);
|
||||
val >> intvalue;
|
||||
if (device == Device::A10){
|
||||
return intvalue;
|
||||
}else if (device == Device::NOTA10){
|
||||
return intvalue / 21;
|
||||
}
|
||||
// Never Here
|
||||
return -1;
|
||||
}
|
||||
return -1;
|
||||
std::ifstream file;
|
||||
std::string value;
|
||||
int32_t intvalue;
|
||||
file.open("/sys/class/camera/flash/torch_brightness_lvl");
|
||||
if (file.is_open()) {
|
||||
getline(file, value);
|
||||
file.close();
|
||||
std::stringstream val(value);
|
||||
val >> intvalue;
|
||||
if (device == Device::A10) {
|
||||
return intvalue;
|
||||
} else if (device == Device::NOTA10) {
|
||||
return intvalue / 21;
|
||||
}
|
||||
// Never Here
|
||||
return -1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
IFlashlight *Flashlight::getInstance(void){
|
||||
return new Flashlight();
|
||||
IFlashlight* Flashlight::getInstance(void) {
|
||||
return new Flashlight();
|
||||
}
|
||||
} // namespace android::hardware::flashlight::implementation
|
||||
} // namespace vendor::eureka::hardware::flashlight::V1_0
|
||||
|
|
|
|||
|
|
@ -14,19 +14,19 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <vendor/eureka/hardware/flashlight/1.0/IFlashlight.h>
|
||||
#include <hidl/MQDescriptor.h>
|
||||
#include <hidl/Status.h>
|
||||
#include <vendor/eureka/hardware/flashlight/1.0/IFlashlight.h>
|
||||
|
||||
namespace vendor::eureka::hardware::flashlight::V1_0 {
|
||||
|
||||
using ::android::sp;
|
||||
using ::android::hardware::hidl_array;
|
||||
using ::android::hardware::hidl_memory;
|
||||
using ::android::hardware::hidl_string;
|
||||
using ::android::hardware::hidl_vec;
|
||||
using ::android::hardware::Return;
|
||||
using ::android::hardware::Void;
|
||||
using ::android::sp;
|
||||
|
||||
struct Flashlight : public IFlashlight {
|
||||
// Methods from ::vendor::eureka::hardware::flashlight::V1_0::IFlashlight follow.
|
||||
|
|
@ -35,6 +35,5 @@ struct Flashlight : public IFlashlight {
|
|||
Return<int32_t> readFlashlightstats(Device device);
|
||||
// Methods from ::android::hidl::base::V1_0::IBase follow.
|
||||
static IFlashlight* getInstance(void);
|
||||
|
||||
};
|
||||
} // namespace android::hardware::flashlight::implementation
|
||||
} // namespace vendor::eureka::hardware::flashlight::V1_0
|
||||
|
|
|
|||
|
|
@ -12,38 +12,37 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
|
||||
#define LOG_TAG "vendor.eureka.hardware.flashlight@1.0-service"
|
||||
|
||||
|
||||
#include <vendor/eureka/hardware/flashlight/1.0/IFlashlight.h>
|
||||
|
||||
|
||||
#include <hidl/LegacySupport.h>
|
||||
|
||||
|
||||
#include "Flashlight.h"
|
||||
|
||||
using vendor::eureka::hardware::flashlight::V1_0::IFlashlight;
|
||||
using vendor::eureka::hardware::flashlight::V1_0::Flashlight;
|
||||
|
||||
using android::sp;
|
||||
using android::hardware::configureRpcThreadpool;
|
||||
using android::hardware::joinRpcThreadpool;
|
||||
using android::sp;
|
||||
|
||||
using vendor::eureka::hardware::flashlight::V1_0::Flashlight;
|
||||
using vendor::eureka::hardware::flashlight::V1_0::IFlashlight;
|
||||
|
||||
int main() {
|
||||
int ret;
|
||||
android::sp<IFlashlight> service = Flashlight::getInstance();
|
||||
configureRpcThreadpool(1, true /*callerWillJoin*/);
|
||||
|
||||
if (service != nullptr) {
|
||||
ret = service->registerAsService();
|
||||
if(ret != 0) {
|
||||
ALOGE("Can't register instance of Flashlight HAL, nullptr");
|
||||
}else{
|
||||
ALOGI("registered Flashlight HAL");
|
||||
}
|
||||
} else {
|
||||
ALOGE("Can't create instance of Flashlight HAL, nullptr");
|
||||
}
|
||||
|
||||
joinRpcThreadpool();
|
||||
|
||||
return -1; // should never get here
|
||||
int ret;
|
||||
android::sp<IFlashlight> service = Flashlight::getInstance();
|
||||
configureRpcThreadpool(1, true /*callerWillJoin*/);
|
||||
|
||||
if (service != nullptr) {
|
||||
ret = service->registerAsService();
|
||||
if (ret != 0) {
|
||||
ALOGE("Can't register instance of Flashlight HAL, nullptr");
|
||||
} else {
|
||||
ALOGI("registered Flashlight HAL");
|
||||
}
|
||||
} else {
|
||||
ALOGE("Can't create instance of Flashlight HAL, nullptr");
|
||||
}
|
||||
|
||||
joinRpcThreadpool();
|
||||
|
||||
return -1; // should never get here
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue