• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef HDI_SENSOR_CLIENT_H
17 #define HDI_SENSOR_CLIENT_H
18 
19 #include <mutex>
20 #include <unordered_map>
21 #include "v2_1/isensor_interface.h"
22 #include "isensor_interface_vdi.h"
23 
24 namespace OHOS {
25 namespace HDI {
26 namespace Sensor {
27 namespace V2_1 {
28 
29 class SensorClientInfo {
30 public:
31     SensorClientInfo();
32     ~SensorClientInfo();
SensorClientInfo(const sptr<V2_0::ISensorCallback> & callbackObj)33     explicit SensorClientInfo(const sptr<V2_0::ISensorCallback> &callbackObj)
34         : pollCallback_(callbackObj) {};
35     void SetReportDataCb(const sptr<V2_0::ISensorCallback> &callbackObj);
36     const sptr<V2_0::ISensorCallback> GetReportDataCb();
37     std::unordered_map<int32_t, struct SensorConfig> sensorConfigMap_;
38     std::unordered_map<int32_t, int32_t> periodCountMap_;
39     std::unordered_map<int32_t, int32_t> curCountMap_;
40     void PrintClientMapInfo(int32_t serviceId, int32_t sensorId);
41     bool oneway = false;
42 private:
43     sptr<V2_0::ISensorCallback> pollCallback_;
44 };
45 
46 struct SensorConfig {
47     int32_t samplingInterval;
48     int32_t reportInterval;
49 };
50 
51 } // V2_1
52 } // Sensor
53 } // HDI
54 } // OHOS
55 
56 #endif // HDI_SENSOR_CLIENT_H