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#include "fifo_cache_data.h"
17namespace OHOS {
18namespace Sensors {
19
20FifoCacheData::FifoCacheData() : periodCount_(0), channel_(nullptr)
21{}
22
23FifoCacheData::~FifoCacheData()
24{
25    fifoCacheData_.clear();
26}
27
28void FifoCacheData::InitFifoCache()
29{
30    periodCount_ = 0;
31    fifoCacheData_.clear();
32}
33
34void FifoCacheData::SetPeriodCount(uint64_t periodCount)
35{
36    periodCount_ = periodCount;
37}
38
39uint64_t FifoCacheData::GetPeriodCount() const
40{
41    return periodCount_;
42}
43
44void FifoCacheData::SetFifoCacheData(const std::vector<SensorData> &fifoCacheData)
45{
46    fifoCacheData_ = fifoCacheData;
47}
48
49std::vector<SensorData> FifoCacheData::GetFifoCacheData() const
50{
51    return fifoCacheData_;
52}
53
54void FifoCacheData::SetChannel(const sptr<SensorBasicDataChannel> &channel)
55{
56    channel_ = channel;
57}
58
59sptr<SensorBasicDataChannel> FifoCacheData::GetChannel() const
60{
61    return channel_.promote();
62}
63} // namespace Sensors
64} // namespace OHOS
65