Signed-off-by:hhh2<pengfei.hou@huawei.com>

Signed-off-by: hhh2 <pengfei.hou@huawei.com>
This commit is contained in:
hhh2 2022-07-28 09:17:01 +08:00
parent f619c4c125
commit 97cacd4353
4 changed files with 0 additions and 57 deletions

View File

@ -41,7 +41,6 @@ ohos_shared_library("devicestatus_sensorhdi") {
deps = [
"${device_status_interfaces_path}/innerkits:devicestatus_client",
"//drivers/peripheral/sensor/hal:hdi_sensor",
"//third_party/jsoncpp",
]
external_deps = [
@ -53,7 +52,6 @@ ohos_shared_library("devicestatus_sensorhdi") {
"relational_store:native_rdb",
"safwk:system_ability_fwk",
"samgr_standard:samgr_proxy",
"sensor:sensor_interface_native",
]
part_name = "${device_status_part_name}"
@ -72,7 +70,6 @@ ohos_shared_library("devicestatus_msdp") {
deps = [
"${device_status_interfaces_path}/innerkits:devicestatus_client",
"//drivers/peripheral/sensor/hal:hdi_sensor",
"//third_party/jsoncpp",
]
external_deps = [

View File

@ -30,8 +30,6 @@
#include "rdb_store_config.h"
#include "values_bucket.h"
#include "result_set.h"
#include "sensor_agent.h"
#include "sensor_agent_type.h"
#include "devicestatus_data_utils.h"
#include "devicestatus_sensor_interface.h"
@ -68,7 +66,6 @@ public:
std::unique_lock lock(mutex_);
return callbacksImpl_;
}
void HandleHallSensorEvent(SensorEvent *event);
void SubscribeHallSensor();
void UnSubscribeHallSensor();
@ -81,7 +78,6 @@ private:
int32_t devicestatusStatus_ = -1;
bool notifyFlag_ = false;
int32_t timerInterval_ = -1;
int32_t curLidStatus = -1;
int32_t timerFd_ = -1;
int32_t epFd_ = -1;
std::map<DevicestatusDataUtils::DevicestatusType, DevicestatusDataUtils::DevicestatusValue> rdbDataMap_;

View File

@ -32,23 +32,9 @@ const std::string DATABASE_NAME = "/data/MsdpStub.db";
constexpr int32_t TIMER_INTERVAL = 3;
constexpr int32_t ERR_INVALID_FD = -1;
constexpr int32_t READ_RDB_WAIT_TIME = 30;
constexpr int32_t SENSOR_SAMPLING_INTERVAL = 100000000;
constexpr int32_t HALL_SENSOR_ID = 10;
std::unique_ptr<DevicestatusSensorRdb> g_msdpRdb = std::make_unique<DevicestatusSensorRdb>();
constexpr int32_t ERR_NG = -1;
DevicestatusSensorRdb* g_rdb;
SensorUser user;
}
static void OnReceivedSensorEvent(SensorEvent *event)
{
if (event == nullptr) {
DEV_HILOGE(SERVICE, "event is nullptr");
}
if (g_rdb == nullptr) {
DEV_HILOGE(SERVICE, "g_rdb is nullptr");
return;
}
g_rdb->HandleHallSensorEvent(event);
}
bool DevicestatusSensorRdb::Init()
@ -234,39 +220,9 @@ int32_t DevicestatusSensorRdb::TrigerDatabaseObserver()
return ERR_OK;
}
void DevicestatusSensorRdb::HandleHallSensorEvent(SensorEvent *event)
{
if (event == nullptr) {
DEV_HILOGE(SERVICE, "HandleHallSensorEvent event is null");
return;
}
DEV_HILOGI(SERVICE, "HandleHallSensorEvent sensorTypeId: %{public}d, version: %{public}d, mode: %{public}d",
event->sensorTypeId, event->version, event->mode);
DevicestatusDataUtils::DevicestatusData data;
float *tmpData = (float *)(event->data);
int32_t hallData = (int32_t)(*tmpData);
if (event->sensorTypeId == SENSOR_TYPE_ID_HALL) {
DEV_HILOGI(SERVICE, "HandleHallSensorEvent sensor_data: %{public}d", hallData);
int32_t eventFilter = hallData & 1;
if (eventFilter != curLidStatus) {
curLidStatus = eventFilter;
data.type = DevicestatusDataUtils::DevicestatusType::TYPE_LID_OPEN;
data.value = DevicestatusDataUtils::DevicestatusValue(curLidStatus);
NotifyMsdpImpl(data);
}
}
}
void DevicestatusSensorRdb::SubscribeHallSensor()
{
DEV_HILOGI(SERVICE, "Enter");
user.callback = OnReceivedSensorEvent;
DEV_HILOGI(SERVICE, "SubcribeHallSensor");
SubscribeSensor(HALL_SENSOR_ID, &user);
SetBatch(HALL_SENSOR_ID, &user, SENSOR_SAMPLING_INTERVAL, 0);
ActivateSensor(HALL_SENSOR_ID, &user);
DEV_HILOGI(SERVICE, "Exit");
}
@ -274,11 +230,6 @@ void DevicestatusSensorRdb::SubscribeHallSensor()
void DevicestatusSensorRdb::UnSubscribeHallSensor()
{
DEV_HILOGI(SERVICE, "Enter");
user.callback = OnReceivedSensorEvent;
DEV_HILOGI(SERVICE, "UnsubcribeHallSensor");
DeactivateSensor(HALL_SENSOR_ID, &user);
UnsubscribeSensor(HALL_SENSOR_ID, &user);
DEV_HILOGI(SERVICE, "Exit");
}

View File

@ -50,7 +50,6 @@ ohos_shared_library("devicestatus_service") {
deps = [
"${device_status_interfaces_path}/innerkits:devicestatus_client",
"//drivers/peripheral/sensor/hal:hdi_sensor",
"//third_party/jsoncpp",
]
external_deps = [