blob: 752bc57813a62941e63cb61aa1db57d8012b0787 [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
George Liu45eba6f2021-05-18 14:32:20 +080018#include <filesystem>
Andrew Jefferye185efb2018-05-24 12:59:06 +093019
20namespace phosphor
21{
22namespace led
23{
24class SysfsLed
25{
26 public:
George Liu1f2b9322021-12-28 10:32:49 +080027 explicit SysfsLed(std::filesystem::path&& root) : root(std::move(root))
George Liu61b90632020-06-22 10:55:13 +080028 {}
Andrew Jefferye185efb2018-05-24 12:59:06 +093029 SysfsLed() = delete;
30 SysfsLed(const SysfsLed& other) = delete;
31
32 virtual ~SysfsLed() = default;
33
34 virtual unsigned long getBrightness();
35 virtual void setBrightness(unsigned long value);
36 virtual unsigned long getMaxBrightness();
37 virtual std::string getTrigger();
38 virtual void setTrigger(const std::string& trigger);
39 virtual unsigned long getDelayOn();
40 virtual void setDelayOn(unsigned long ms);
41 virtual unsigned long getDelayOff();
42 virtual void setDelayOff(unsigned long ms);
43
44 protected:
45 static constexpr char BRIGHTNESS[] = "brightness";
46 static constexpr char MAX_BRIGHTNESS[] = "max_brightness";
47 static constexpr char TRIGGER[] = "trigger";
48 static constexpr char DELAY_ON[] = "delay_on";
49 static constexpr char DELAY_OFF[] = "delay_off";
50
George Liu45eba6f2021-05-18 14:32:20 +080051 std::filesystem::path root;
Andrew Jefferye185efb2018-05-24 12:59:06 +093052};
53} // namespace led
54} // namespace phosphor