Vishwanatha Subbanna | 75b5510 | 2016-11-30 14:20:53 +0530 | [diff] [blame^] | 1 | /** |
| 2 | * Copyright © 2016 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 | #include <iostream> |
| 18 | #include <string> |
| 19 | #include "physical.hpp" |
| 20 | namespace phosphor |
| 21 | { |
| 22 | namespace led |
| 23 | { |
| 24 | |
| 25 | /** @brief Populates key parameters */ |
| 26 | void Physical::setInitialState() |
| 27 | { |
| 28 | // 1. read /sys/class/leds/name/trigger |
| 29 | // 2. If its 'timer', then its blinking. |
| 30 | // 2.1: On blink, use delay_on and delay_off into dutyOn |
| 31 | // 3. If its 'none', then read brightness. 255 means, its ON, else OFF. |
| 32 | // Implementation in the next patchset. |
| 33 | } |
| 34 | |
| 35 | /** @brief Overloaded State Property Setter function */ |
| 36 | auto Physical::state(Action value) -> Action |
| 37 | { |
| 38 | // Set the base class's state to actuals since the getter |
| 39 | // operation is handled there. |
| 40 | auto action = sdbusplus::xyz::openbmc_project::Led::server |
| 41 | ::Physical::state(value); |
| 42 | |
| 43 | // Apply the action. |
| 44 | driveLED(); |
| 45 | |
| 46 | return action; |
| 47 | } |
| 48 | |
| 49 | /** @brief apply action on the LED */ |
| 50 | void Physical::driveLED() |
| 51 | { |
| 52 | // Replace with actual code. |
| 53 | std::cout << " Drive LED STUB :: \n"; |
| 54 | return; |
| 55 | } |
| 56 | |
| 57 | } // namespace led |
| 58 | } // namespace phosphor |