blob: 290c97f435202513fd596d32c2e28f41a8143342 [file] [log] [blame]
Andrew Jefferye185efb2018-05-24 12:59:06 +09301/**
2 * Copyright © 2019 IBM Corporation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#pragma once
18#include <experimental/filesystem>
19
20namespace phosphor
21{
22namespace led
23{
24class SysfsLed
25{
26 public:
27 SysfsLed(std::experimental::filesystem::path&& root) : root(std::move(root))
28 {
29 }
30 SysfsLed() = delete;
31 SysfsLed(const SysfsLed& other) = delete;
32
33 virtual ~SysfsLed() = default;
34
35 virtual unsigned long getBrightness();
36 virtual void setBrightness(unsigned long value);
37 virtual unsigned long getMaxBrightness();
38 virtual std::string getTrigger();
39 virtual void setTrigger(const std::string& trigger);
40 virtual unsigned long getDelayOn();
41 virtual void setDelayOn(unsigned long ms);
42 virtual unsigned long getDelayOff();
43 virtual void setDelayOff(unsigned long ms);
44
45 protected:
46 static constexpr char BRIGHTNESS[] = "brightness";
47 static constexpr char MAX_BRIGHTNESS[] = "max_brightness";
48 static constexpr char TRIGGER[] = "trigger";
49 static constexpr char DELAY_ON[] = "delay_on";
50 static constexpr char DELAY_OFF[] = "delay_off";
51
52 std::experimental::filesystem::path root;
53};
54} // namespace led
55} // namespace phosphor