-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathiio_channel_impl.h
59 lines (41 loc) · 1.7 KB
/
iio_channel_impl.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Copyright 2019 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef LIBMEMS_IIO_CHANNEL_IMPL_H_
#define LIBMEMS_IIO_CHANNEL_IMPL_H_
#include <iio.h>
#include <memory>
#include <string>
#include "libmems/export.h"
#include "libmems/iio_channel.h"
namespace libmems {
class IioDevice;
class LIBMEMS_EXPORT IioChannelImpl : public IioChannel {
public:
// iio_channel objects are kept alive by the IioContextImpl.
IioChannelImpl(iio_channel* channel, int device_id, const char* device_name);
IioChannelImpl(const IioChannelImpl&) = delete;
IioChannelImpl& operator=(const IioChannelImpl&) = delete;
~IioChannelImpl() override = default;
const char* GetId() const override;
bool IsEnabled() const override;
void SetEnabled(bool en) override;
bool SetScanElementsEnabled(bool en) override;
base::Optional<std::string> ReadStringAttribute(
const std::string& name) const override;
base::Optional<int64_t> ReadNumberAttribute(
const std::string& name) const override;
base::Optional<double> ReadDoubleAttribute(
const std::string& name) const override;
bool WriteStringAttribute(const std::string& name,
const std::string& value) override;
bool WriteNumberAttribute(const std::string& name, int64_t value) override;
bool WriteDoubleAttribute(const std::string& name, double value) override;
base::Optional<int64_t> Convert(const uint8_t* src) const;
base::Optional<uint64_t> Length() const;
private:
iio_channel* const channel_; // non-owned
std::string log_prefix_;
};
} // namespace libmems
#endif // LIBMEMS_IIO_CHANNEL_IMPL_H_