mirror of
https://github.com/openharmony/powermgr_powermgr_lite.git
synced 2026-06-30 22:17:53 -04:00
fix:Modify file permission information specification
Signed-off-by: toutes <zhaoruiyuan2@huawei.com>
This commit is contained in:
@@ -102,7 +102,7 @@ DestroyRunningLock(lock); // Must release runninglock before destroyed
|
||||
|
||||
[powermgr_power_manager](https://gitee.com/openharmony/powermgr_power_manager)
|
||||
|
||||
[**powermgr_display_manager](https://gitee.com/openharmony/powermgr_display_manager)
|
||||
[powermgr_display_manager](https://gitee.com/openharmony/powermgr_display_manager)
|
||||
|
||||
[powermgr_battery_manager](https://gitee.com/openharmony/powermgr_battery_manager)
|
||||
|
||||
@@ -112,5 +112,5 @@ DestroyRunningLock(lock); // Must release runninglock before destroyed
|
||||
|
||||
[powermgr_battery_lite](https://gitee.com/openharmony/powermgr_battery_lite)
|
||||
|
||||
**powermgr_powermgr_lite**
|
||||
[powermgr_powermgr_lite](https://gitee.com/openharmony/powermgr_powermgr_lite)
|
||||
|
||||
|
||||
Executable → Regular
|
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 43 KiB |
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@@ -71,6 +71,8 @@ static void *CreatClient(const char *service, const char *feature, uint32_t size
|
||||
|
||||
static void DestroyClient(const char *service, const char *feature, void *iproxy)
|
||||
{
|
||||
(void)service;
|
||||
(void)feature;
|
||||
free(iproxy);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
# Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//build/ohos.gni")
|
||||
|
||||
ohos_static_library("libnativeapi_battery_simulator") {
|
||||
public_configs = [ ":nativeapi_battery_simulator_config" ]
|
||||
|
||||
sources = [ "src/battery_module.cpp" ]
|
||||
include_dirs = [
|
||||
"//third_party/bounds_checking_function/include",
|
||||
"include",
|
||||
"//foundation/ace/ace_engine_lite/interfaces/innerkits/builtin/jsi",
|
||||
"//foundation/ace/ace_engine_lite/interfaces/innerkits/builtin/base",
|
||||
]
|
||||
cflags = [ "-Wno-unused-variable" ]
|
||||
deps = []
|
||||
}
|
||||
|
||||
config("nativeapi_battery_simulator_config") {
|
||||
include_dirs = [
|
||||
"//base/powermgr/powermgr_lite/interfaces/kits/battery/js/builtin/include",
|
||||
]
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
# Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
cmake_minimum_required(VERSION 3.16.5)
|
||||
|
||||
project(nativeapi_battery)
|
||||
|
||||
set(MODULE_NAME nativeapi_battery)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
# header files
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../../third_party/bounds_checking_function/include)
|
||||
|
||||
# source files
|
||||
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/src BATTERY)
|
||||
|
||||
add_library(${MODULE_NAME} STATIC
|
||||
${BATTERY}
|
||||
)
|
||||
target_link_libraries(${MODULE_NAME} ui jsfwk)
|
||||
target_include_directories(${MODULE_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef BATTERY_IMPL_H
|
||||
#define BATTERY_IMPL_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif /* __cplusplus */
|
||||
|
||||
int32_t GetBatteryStatus(bool* charging, double* level);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* BATTERY_IMPL_H */
|
||||
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef BATTERY_MODULE_H
|
||||
#define BATTERY_MODULE_H
|
||||
|
||||
#include "jsi.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace ACELite {
|
||||
using namespace OHOS::ACELite;
|
||||
class BatteryModule {
|
||||
public:
|
||||
BatteryModule() {}
|
||||
~BatteryModule() {}
|
||||
static JSIValue GetStatus(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum);
|
||||
};
|
||||
|
||||
void InitBatteryModule(JSIValue exports);
|
||||
} // namespace ACELite
|
||||
} // namespace OHOS
|
||||
|
||||
#endif // BATTERY_MODULE_H
|
||||
@@ -1,65 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "battery_module.h"
|
||||
#include "battery_impl.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace ACELite {
|
||||
using namespace OHOS::ACELite;
|
||||
void SuccessCallBack(const JSIValue thisVal, const JSIValue args, JSIValue jsiValue)
|
||||
{
|
||||
if (JSI::ValueIsUndefined(args)) {
|
||||
return;
|
||||
}
|
||||
JSIValue success = JSI::GetNamedProperty(args, CB_SUCCESS);
|
||||
JSIValue complete = JSI::GetNamedProperty(args, CB_COMPLETE);
|
||||
if (!JSI::ValueIsUndefined(success)) {
|
||||
if (JSI::ValueIsUndefined(jsiValue)) {
|
||||
JSI::CallFunction(success, thisVal, nullptr, 0);
|
||||
} else {
|
||||
JSI::CallFunction(success, thisVal, &jsiValue, ARGC_ONE);
|
||||
}
|
||||
}
|
||||
if (!JSI::ValueIsUndefined(complete)) {
|
||||
JSI::CallFunction(complete, thisVal, nullptr, 0);
|
||||
}
|
||||
JSI::ReleaseValueList(success, complete, ARGS_END);
|
||||
}
|
||||
|
||||
JSIValue BatteryModule::GetStatus(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum)
|
||||
{
|
||||
JSIValue undefValue = JSI::CreateUndefined();
|
||||
if ((args == nullptr) || (argsNum == 0) || JSI::ValueIsUndefined(args[0])) {
|
||||
return undefValue;
|
||||
}
|
||||
|
||||
double level = 0;
|
||||
bool charging = false;
|
||||
(void)GetBatteryStatus(&charging, &level);
|
||||
JSIValue result = JSI::CreateObject();
|
||||
JSI::SetBooleanProperty(result, "charging", charging);
|
||||
JSI::SetNumberProperty(result, "level", level);
|
||||
SuccessCallBack(thisVal, args[0], result);
|
||||
JSI::ReleaseValue(result);
|
||||
return undefValue;
|
||||
}
|
||||
|
||||
void InitBatteryModule(JSIValue exports)
|
||||
{
|
||||
JSI::SetModuleAPI(exports, "getStatus", BatteryModule::GetStatus);
|
||||
}
|
||||
} // namespace ACELite
|
||||
} // namespace OHOS
|
||||
Executable → Regular
+1
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@@ -32,6 +32,8 @@ const char *GetScreenSaverFeatureName(Feature *feature)
|
||||
|
||||
void OnScreenSaverFeatureInitialize(Feature *feature, Service *parent, Identity identity)
|
||||
{
|
||||
(void)parent;
|
||||
(void)identity;
|
||||
if (feature == NULL) {
|
||||
POWER_HILOGE("Invalid feature");
|
||||
return;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@@ -85,7 +85,7 @@ PowerTimer *PowerMgrCreateTimer(int64_t whenMsec, int64_t intervalMsec, PowerTim
|
||||
info->timerCb = cb;
|
||||
|
||||
struct sigevent evp;
|
||||
memset_s(&evp, sizeof(evp), 0, sizeof(evp));
|
||||
(void)memset_s(&evp, sizeof(evp), 0, sizeof(evp));
|
||||
evp.sigev_value.sival_ptr = info;
|
||||
evp.sigev_notify = SIGEV_THREAD;
|
||||
evp.sigev_notify_function = TimerHandle;
|
||||
|
||||
Reference in New Issue
Block a user