1 /*
2 * Copyright (c) 2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include "sensor_client_info.h"
17 #include "sensor_uhdf_log.h"
18
19 #define HDF_LOG_TAG uhdf_sensor_client_info
20
21 namespace OHOS {
22 namespace HDI {
23 namespace Sensor {
24 namespace V2_0 {
25
SensorClientInfo()26 SensorClientInfo::SensorClientInfo()
27 {
28 }
29
~SensorClientInfo()30 SensorClientInfo::~SensorClientInfo()
31 {
32 sensorConfigMap_.clear();
33 periodCountMap_.clear();
34 curCountMap_.clear();
35 }
36
SetReportDataCb(const sptr<ISensorCallback> & callbackObj)37 void SensorClientInfo::SetReportDataCb(const sptr<ISensorCallback> &callbackObj)
38 {
39 pollCallback_ = callbackObj;
40 }
41
PrintClientMapInfo(int32_t serviceId,int32_t sensorId)42 void SensorClientInfo::PrintClientMapInfo(int32_t serviceId, int32_t sensorId)
43 {
44 HDF_LOGD("%{public}s: service = %{public}d, sensorId = %{public}d, curCount/periodCount = %{public}d/%{public}d",
45 __func__, serviceId, sensorId, curCountMap_[sensorId], periodCountMap_[sensorId]);
46 }
47
GetReportDataCb()48 const sptr<ISensorCallback> SensorClientInfo::GetReportDataCb()
49 {
50 return pollCallback_;
51 }
52
53 } // V2_0
54 } // Sensor
55 } // HDI
56 } // OHOS