mirror of
https://gitee.com/openharmony/msdp_device_status
synced 2024-11-23 07:29:52 +00:00
start msdp process Signed-off-by:li-bo-boblove<boblove.libo@huawei.com>
Signed-off-by: li-bo-boblove <boblove.libo@huawei.com>
This commit is contained in:
parent
0f86a4b4b4
commit
4a810ee8da
@ -18,6 +18,12 @@ declare_args() {
|
||||
fusion_interaction_coordination = false
|
||||
fusion_drag_enable_monitor = false
|
||||
fusion_drag_enable_interceptor = true
|
||||
device_status_sensor_enable = true
|
||||
if (defined(global_parts_info)) {
|
||||
if (!defined(global_parts_info.sensors_sensor)) {
|
||||
device_status_sensor_enable = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (fusion_interaction_coordination) {
|
||||
|
@ -44,10 +44,13 @@ ohos_shared_library("devicestatus_mock") {
|
||||
"//third_party/cJSON:cjson_static",
|
||||
]
|
||||
|
||||
external_deps = [
|
||||
"hilog:libhilog",
|
||||
"sensor:sensor_interface_native",
|
||||
]
|
||||
external_deps = [ "hilog:libhilog" ]
|
||||
|
||||
defines = []
|
||||
if (device_status_sensor_enable) {
|
||||
external_deps += [ "sensor:sensor_interface_native" ]
|
||||
defines += [ "DEVICE_STATUS_SENSOR_ENABLE" ]
|
||||
}
|
||||
|
||||
subsystem_name = "${device_status_subsystem_name}"
|
||||
part_name = "${device_status_part_name}"
|
||||
@ -93,8 +96,12 @@ ohos_shared_library("devicestatus_algo") {
|
||||
"ipc:ipc_single",
|
||||
"safwk:system_ability_fwk",
|
||||
"samgr:samgr_proxy",
|
||||
"sensor:sensor_interface_native",
|
||||
]
|
||||
defines = []
|
||||
if (device_status_sensor_enable) {
|
||||
external_deps += [ "sensor:sensor_interface_native" ]
|
||||
defines += [ "DEVICE_STATUS_SENSOR_ENABLE" ]
|
||||
}
|
||||
|
||||
subsystem_name = "${device_status_subsystem_name}"
|
||||
part_name = "${device_status_part_name}"
|
||||
|
@ -16,6 +16,7 @@
|
||||
#ifndef ALGO_ABSOLUTE_STILL_H
|
||||
#define ALGO_ABSOLUTE_STILL_H
|
||||
|
||||
#ifdef DEVICE_STATUS_SENSOR_ENABLE
|
||||
#include "algo_base.h"
|
||||
|
||||
namespace OHOS {
|
||||
@ -35,4 +36,5 @@ private:
|
||||
} // namespace DeviceStatus
|
||||
} // namespace Msdp
|
||||
} // namespace OHOS
|
||||
#endif // DEVICE_STATUS_SENSOR_ENABLE
|
||||
#endif // ALGO_ABSOLUTE_STILL_H
|
||||
|
@ -16,6 +16,7 @@
|
||||
#ifndef ALGO_BASE_H
|
||||
#define ALGO_BASE_H
|
||||
|
||||
#ifdef DEVICE_STATUS_SENSOR_ENABLE
|
||||
#include <cmath>
|
||||
#include <cstdio>
|
||||
#include <iostream>
|
||||
@ -75,4 +76,6 @@ protected:
|
||||
} // namespace DeviceStatus
|
||||
} // namespace Msdp
|
||||
} // namespace OHOS
|
||||
#endif // DEVICE_STATUS_SENSOR_ENABLE
|
||||
#endif // ALGO_BASE_H
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
#ifndef ALGO_HORIZONTAL_H
|
||||
#define ALGO_HORIZONTAL_H
|
||||
|
||||
#ifdef DEVICE_STATUS_SENSOR_ENABLE
|
||||
#include "algo_base.h"
|
||||
|
||||
namespace OHOS {
|
||||
@ -35,4 +36,5 @@ private:
|
||||
} // namespace DeviceStatus
|
||||
} // namespace Msdp
|
||||
} // namespace OHOS
|
||||
#endif // DEVICE_STATUS_SENSOR_ENABLE
|
||||
#endif // ALGO_HORIZONTAL_H
|
||||
|
@ -16,6 +16,7 @@
|
||||
#ifndef ALGO_VERTICAL_H
|
||||
#define ALGO_VERTICAL_H
|
||||
|
||||
#ifdef DEVICE_STATUS_SENSOR_ENABLE
|
||||
#include "algo_base.h"
|
||||
|
||||
namespace OHOS {
|
||||
@ -34,4 +35,5 @@ private:
|
||||
} // namespace DeviceStatus
|
||||
} // namespace Msdp
|
||||
} // namespace OHOS
|
||||
#endif // ALGO_VERTICAL_H
|
||||
#endif // DEVICE_STATUS_SENSOR_ENABLE
|
||||
#endif // ALGO_VERTICAL_H
|
@ -16,6 +16,7 @@
|
||||
#ifndef SENSOR_DATA_CALLBACK_H
|
||||
#define SENSOR_DATA_CALLBACK_H
|
||||
|
||||
#ifdef DEVICE_STATUS_SENSOR_ENABLE
|
||||
#include <atomic>
|
||||
#include <list>
|
||||
#include <map>
|
||||
@ -63,4 +64,6 @@ private:
|
||||
} // namespace DeviceStatus
|
||||
} // namespace Msdp
|
||||
} // namespace OHOS
|
||||
#endif // DEVICE_STATUS_SENSOR_ENABLE
|
||||
#endif // SENSOR_DATA_CALLBACK_H
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
#ifndef DEVICESTATUS_ALGORITHM_MANAGER_H
|
||||
#define DEVICESTATUS_ALGORITHM_MANAGER_H
|
||||
|
||||
#ifdef DEVICE_STATUS_SENSOR_ENABLE
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
@ -67,4 +68,5 @@ private:
|
||||
} // namespace DeviceStatus
|
||||
} // namespace Msdp
|
||||
} // namespace OHOS
|
||||
#endif // DEVICESTATUS_ALGORITHM_MANAGER_H
|
||||
#endif // DEVICE_STATUS_SENSOR_ENABLE
|
||||
#endif // DEVICESTATUS_ALGORITHM_MANAGER_H
|
@ -19,8 +19,9 @@
|
||||
#include <functional>
|
||||
|
||||
#include "cJSON.h"
|
||||
#ifdef DEVICE_STATUS_SENSOR_ENABLE
|
||||
#include "sensor_agent.h"
|
||||
|
||||
#endif // DEVICE_STATUS_SENSOR_ENABLE
|
||||
#include "stationary_data.h"
|
||||
|
||||
namespace OHOS {
|
||||
@ -57,7 +58,9 @@ struct JsonParser {
|
||||
}
|
||||
cJSON *json = nullptr;
|
||||
};
|
||||
#ifdef DEVICE_STATUS_SENSOR_ENABLE
|
||||
using SensorCallback = std::function<void(int32_t, AccelData*)>;
|
||||
#endif // DEVICE_STATUS_SENSOR_ENABLE
|
||||
} // namespace DeviceStatus
|
||||
} // namespace Msdp
|
||||
} // namespace OHOS
|
||||
|
@ -13,6 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifdef DEVICE_STATUS_SENSOR_ENABLE
|
||||
#include "algo_absolute_still.h"
|
||||
|
||||
#include "fi_log.h"
|
||||
@ -73,3 +74,4 @@ void AlgoAbsoluteStill::ExecuteOperation()
|
||||
} // namespace DeviceStatus
|
||||
} // namespace Msdp
|
||||
} // namespace OHOS
|
||||
#endif // DEVICE_STATUS_SENSOR_ENABLE
|
||||
|
@ -13,6 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifdef DEVICE_STATUS_SENSOR_ENABLE
|
||||
#include "algo_base.h"
|
||||
|
||||
#include "devicestatus_define.h"
|
||||
@ -73,3 +74,4 @@ void AlgoBase::UpdateStateAndReport(OnChangedValue value, int32_t state, Type ty
|
||||
} // namespace DeviceStatus
|
||||
} // namespace Msdp
|
||||
} // namespace OHOS
|
||||
#endif // DEVICE_STATUS_SENSOR_ENABLE
|
||||
|
@ -13,6 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifdef DEVICE_STATUS_SENSOR_ENABLE
|
||||
#include "algo_horizontal.h"
|
||||
|
||||
#include "devicestatus_define.h"
|
||||
@ -74,3 +75,4 @@ void AlgoHorizontal::ExecuteOperation()
|
||||
} // namespace DeviceStatus
|
||||
} // namespace Msdp
|
||||
} // namespace OHOS
|
||||
#endif // DEVICE_STATUS_SENSOR_ENABLE
|
||||
|
@ -13,6 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifdef DEVICE_STATUS_SENSOR_ENABLE
|
||||
#include "algo_vertical.h"
|
||||
|
||||
#include "devicestatus_define.h"
|
||||
@ -76,3 +77,4 @@ void AlgoVertical::ExecuteOperation()
|
||||
} // namespace DeviceStatus
|
||||
} // namespace Msdp
|
||||
} // namespace OHOS
|
||||
#endif // DEVICE_STATUS_SENSOR_ENABLE
|
@ -13,6 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifdef DEVICE_STATUS_SENSOR_ENABLE
|
||||
#include "sensor_data_callback.h"
|
||||
|
||||
#include <cmath>
|
||||
@ -215,3 +216,4 @@ void SensorDataCallback::HandleSensorEvent()
|
||||
} // namespace DeviceStatus
|
||||
} // namespace Msdp
|
||||
} // namespace OHOS
|
||||
#endif // DEVICE_STATUS_SENSOR_ENABLE
|
||||
|
@ -12,7 +12,8 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
#ifdef DEVICE_STATUS_SENSOR_ENABLE
|
||||
#include "devicestatus_algorithm_manager.h"
|
||||
|
||||
#include <cerrno>
|
||||
@ -261,3 +262,4 @@ extern "C" void Destroy(const IMsdp* algorithm)
|
||||
} // namespace DeviceStatus
|
||||
} // namespace Msdp
|
||||
} // namespace OHOS
|
||||
#endif // DEVICE_STATUS_SENSOR_ENABLE
|
||||
|
@ -62,8 +62,12 @@ ohos_unittest("device_status_algorithm_test") {
|
||||
"ipc:ipc_single",
|
||||
"safwk:system_ability_fwk",
|
||||
"samgr:samgr_proxy",
|
||||
"sensor:sensor_interface_native",
|
||||
]
|
||||
defines = []
|
||||
if (device_status_sensor_enable) {
|
||||
external_deps += [ "sensor:sensor_interface_native" ]
|
||||
defines += [ "DEVICE_STATUS_SENSOR_ENABLE" ]
|
||||
}
|
||||
}
|
||||
|
||||
ohos_unittest("device_status_datahub_test") {
|
||||
@ -96,8 +100,12 @@ ohos_unittest("device_status_datahub_test") {
|
||||
"ipc:ipc_single",
|
||||
"safwk:system_ability_fwk",
|
||||
"samgr:samgr_proxy",
|
||||
"sensor:sensor_interface_native",
|
||||
]
|
||||
defines = []
|
||||
if (device_status_sensor_enable) {
|
||||
external_deps += [ "sensor:sensor_interface_native" ]
|
||||
defines += [ "DEVICE_STATUS_SENSOR_ENABLE" ]
|
||||
}
|
||||
}
|
||||
|
||||
ohos_unittest("device_status_mock_test") {
|
||||
@ -131,8 +139,12 @@ ohos_unittest("device_status_mock_test") {
|
||||
"relational_store:native_rdb",
|
||||
"safwk:system_ability_fwk",
|
||||
"samgr:samgr_proxy",
|
||||
"sensor:sensor_interface_native",
|
||||
]
|
||||
defines = []
|
||||
if (device_status_sensor_enable) {
|
||||
external_deps += [ "sensor:sensor_interface_native" ]
|
||||
defines += [ "DEVICE_STATUS_SENSOR_ENABLE" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
|
@ -99,6 +99,10 @@ ohos_shared_library("devicestatus_service") {
|
||||
"${device_status_root_path}/intention/services/device_manager:intention_device_manager",
|
||||
]
|
||||
|
||||
defines = []
|
||||
if (device_status_sensor_enable) {
|
||||
defines += [ "DEVICE_STATUS_SENSOR_ENABLE" ]
|
||||
}
|
||||
external_deps = external_deps_set
|
||||
if (fusion_interaction_coordination) {
|
||||
external_deps += [
|
||||
@ -136,6 +140,11 @@ ohos_static_library("devicestatus_static_service") {
|
||||
deps += [ "interaction/coordination:coordination" ]
|
||||
}
|
||||
|
||||
defines = []
|
||||
if (device_status_sensor_enable) {
|
||||
defines += [ "DEVICE_STATUS_SENSOR_ENABLE" ]
|
||||
}
|
||||
|
||||
public_deps = [
|
||||
"${device_status_root_path}/intention/common/epoll:intention_epoll",
|
||||
"${device_status_root_path}/intention/prototype:intention_prototype",
|
||||
|
@ -54,10 +54,14 @@ ErrCode DeviceStatusMsdpClientImpl::InitMsdpImpl(Type type)
|
||||
FI_HILOGI("GetSensorHdi is support");
|
||||
return RET_OK;
|
||||
}
|
||||
#ifdef DEVICE_STATUS_SENSOR_ENABLE
|
||||
if (AlgoHandle(type) == RET_OK) {
|
||||
FI_HILOGI("AlgoHandle is support");
|
||||
return RET_OK;
|
||||
}
|
||||
#else
|
||||
FI_HILOGE("Enable:sensor is not exist");
|
||||
#endif // DEVICE_STATUS_SENSOR_ENABLE
|
||||
if (MockHandle(type) == RET_OK) {
|
||||
FI_HILOGI("MockHandle is support");
|
||||
return RET_OK;
|
||||
@ -174,6 +178,7 @@ ErrCode DeviceStatusMsdpClientImpl::SensorHdiDisable(Type type)
|
||||
|
||||
ErrCode DeviceStatusMsdpClientImpl::AlgoDisable(Type type)
|
||||
{
|
||||
#ifdef DEVICE_STATUS_SENSOR_ENABLE
|
||||
CALL_DEBUG_ENTER;
|
||||
CHKPR(iAlgo_, RET_ERR);
|
||||
auto iter = algoCallCounts_.find(type);
|
||||
@ -200,6 +205,10 @@ ErrCode DeviceStatusMsdpClientImpl::AlgoDisable(Type type)
|
||||
}
|
||||
FI_HILOGI("algoCallCounts_:%{public}d", algoCallCounts_[type]);
|
||||
return RET_OK;
|
||||
#else
|
||||
FI_HILOGE("Disable:sensor is not exist");
|
||||
return RET_ERR;
|
||||
#endif // DEVICE_STATUS_SENSOR_ENABLE
|
||||
}
|
||||
|
||||
ErrCode DeviceStatusMsdpClientImpl::MockDisable(Type type)
|
||||
|
Loading…
Reference in New Issue
Block a user