1bae4d13cSopenharmony_ci/*
2bae4d13cSopenharmony_ci * Copyright (c) 2021 Huawei Device Co., Ltd.
3bae4d13cSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4bae4d13cSopenharmony_ci * you may not use this file except in compliance with the License.
5bae4d13cSopenharmony_ci * You may obtain a copy of the License at
6bae4d13cSopenharmony_ci *
7bae4d13cSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8bae4d13cSopenharmony_ci *
9bae4d13cSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10bae4d13cSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11bae4d13cSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12bae4d13cSopenharmony_ci * See the License for the specific language governing permissions and
13bae4d13cSopenharmony_ci * limitations under the License.
14bae4d13cSopenharmony_ci */
15bae4d13cSopenharmony_ci
16bae4d13cSopenharmony_ci#ifndef FIFO_CACHE_DATA_H
17bae4d13cSopenharmony_ci#define FIFO_CACHE_DATA_H
18bae4d13cSopenharmony_ci
19bae4d13cSopenharmony_ci#include <vector>
20bae4d13cSopenharmony_ci
21bae4d13cSopenharmony_ci#include "nocopyable.h"
22bae4d13cSopenharmony_ci#include "refbase.h"
23bae4d13cSopenharmony_ci#include "sensor_data_event.h"
24bae4d13cSopenharmony_ci#include "sensor_basic_data_channel.h"
25bae4d13cSopenharmony_ci
26bae4d13cSopenharmony_cinamespace OHOS {
27bae4d13cSopenharmony_cinamespace Sensors {
28bae4d13cSopenharmony_ciclass FifoCacheData : public RefBase {
29bae4d13cSopenharmony_cipublic:
30bae4d13cSopenharmony_ci    FifoCacheData();
31bae4d13cSopenharmony_ci    virtual ~FifoCacheData();
32bae4d13cSopenharmony_ci    void SetPeriodCount(uint64_t periodCount);
33bae4d13cSopenharmony_ci    uint64_t GetPeriodCount() const;
34bae4d13cSopenharmony_ci    void SetFifoCacheData(const std::vector<SensorData> &fifoCacheData);
35bae4d13cSopenharmony_ci    std::vector<SensorData> GetFifoCacheData() const;
36bae4d13cSopenharmony_ci    void SetChannel(const sptr<SensorBasicDataChannel> &channel);
37bae4d13cSopenharmony_ci    sptr<SensorBasicDataChannel> GetChannel() const;
38bae4d13cSopenharmony_ci    void InitFifoCache();
39bae4d13cSopenharmony_ci
40bae4d13cSopenharmony_ciprivate:
41bae4d13cSopenharmony_ci    DISALLOW_COPY_AND_MOVE(FifoCacheData);
42bae4d13cSopenharmony_ci    uint64_t periodCount_;
43bae4d13cSopenharmony_ci    wptr<SensorBasicDataChannel> channel_;
44bae4d13cSopenharmony_ci    std::vector<SensorData> fifoCacheData_;
45bae4d13cSopenharmony_ci};
46bae4d13cSopenharmony_ci} // namespace Sensors
47bae4d13cSopenharmony_ci} // namespace OHOS
48bae4d13cSopenharmony_ci#endif // FIFO_CACHE_DATA_H