• 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 "v3_0/isensor_interface.h"
22 #include "v1_0/isensor_interface_vdi.h"
23 namespace OHOS {
24 namespace HDI {
25 namespace Sensor {
26 namespace V3_0 {
27 class SensorClientInfo {
28 public:
29     SensorClientInfo();
30     ~SensorClientInfo();
31     void SetReportDataCb(const sptr<V3_0::ISensorCallback> &callbackObj);
32     std::unordered_map<SensorHandle, struct SensorConfig> sensorConfigMap_;
33     std::unordered_map<SensorHandle, int32_t> periodCountMap_;
34     std::unordered_map<SensorHandle, int32_t> curCountMap_;
35     void PrintClientMapInfo(int32_t serviceId, SensorHandle sensorHandle);
36     sptr<V3_0::ISensorCallback> callbackObj_;
37     bool oneway = false;
38 };
39 
40 struct SensorConfig {
41     int32_t samplingInterval;
42     int32_t reportInterval;
43 };
44 
45 } // V3_0
46 } // Sensor
47 } // HDI
48 } // OHOS
49 
50 #endif // HDI_SENSOR_CLIENT_H