• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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 FIFO_CACHE_DATA_H
17 #define FIFO_CACHE_DATA_H
18 
19 #include <vector>
20 
21 #include "nocopyable.h"
22 #include "refbase.h"
23 #include "sensor_agent_type.h"
24 #include "sensor_basic_data_channel.h"
25 
26 namespace OHOS {
27 namespace Sensors {
28 class FifoCacheData : public RefBase {
29 public:
30     FifoCacheData();
31     virtual ~FifoCacheData();
32     void SetPeriodCount(uint64_t periodCount);
33     uint64_t GetPeriodCount() const;
34     void SetFifoCacheData(const std::vector<SensorEvent> &fifoCacheData);
35     std::vector<SensorEvent> GetFifoCacheData() const;
36     void SetChannel(const sptr<SensorBasicDataChannel> &channel);
37     sptr<SensorBasicDataChannel> GetChannel() const;
38     void InitFifoCache();
39 
40 private:
41     DISALLOW_COPY_AND_MOVE(FifoCacheData);
42     uint64_t periodCount_;
43     wptr<SensorBasicDataChannel> channel_;
44     std::vector<SensorEvent> fifoCacheData_;
45 };
46 }  // namespace Sensors
47 }  // namespace OHOS
48 #endif  // FIFO_CACHE_DATA_H