Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 28 additions & 12 deletions apis/LEDControl/ILEDControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,26 +33,42 @@ namespace WPEFramework

using IStringIterator = RPC::IIteratorType<string, RPC::ID_STRINGITERATOR>;

struct EXTERNAL LEDControlState {
string state;
virtual ~ILEDControl() = default;

enum LEDControlState : uint8_t {
LEDSTATE_NONE = 0 /* @text NONE */,
LEDSTATE_ACTIVE /* @text ACTIVE */,
LEDSTATE_STANDBY /* @text STANDBY */,
LEDSTATE_WPS_CONNECTING /* @text WPS_CONNECTING */,
LEDSTATE_WPS_CONNECTED /* @text WPS_CONNECTED */,
LEDSTATE_WPS_ERROR /* @text WPS_ERROR */,
LEDSTATE_FACTORY_RESET /* @text FACTORY_RESET */,
LEDSTATE_USB_UPGRADE /* @text USB_UPGRADE */,
LEDSTATE_DOWNLOAD_ERROR /* @text DOWNLOAD_ERROR */,
LEDSTATE_MAX /* @text MAX */
};

// Struct to wrap LEDControlState for API compatibility
struct EXTERNAL LEDState {
LEDControlState state;
};

// @text getSupportedLEDStates
// @brief Returns all the LED states supported by the platform
// @param supportedLEDStates - out - string [] of supported LED states
// @param success - out - boolean
// @details Returns the list of LED states that are actually supported by the platform at runtime. Possible values include `NONE`, `ACTIVE`, `STANDBY`, `WPS_CONNECTING`, `WPS_CONNECTED`, `WPS_ERROR`, `FACTORY_RESET`, `USB_UPGRADE` and `DOWNLOAD_ERROR`.
// @param supportedLEDStates: string [] of supported LED states. e.g. "['ACTIVE', 'STANDBY', 'WPS_CONNECTING', 'WPS_CONNECTED', 'WPS_ERROR', 'FACTORY_RESET', 'USB_UPGRADE', 'DOWNLOAD_ERROR']"
// @param success: boolean
virtual Core::hresult GetSupportedLEDStates(IStringIterator*& supportedLEDStates /* @out */, bool& success /* @out */) = 0;

// @text getLEDState
// @brief Returns current LED state.
// @param LEDControlState - out
virtual Core::hresult GetLEDState(LEDControlState& ledState /* @out */) = 0;
// @brief Retrieves current state of the LED. e.g. {"state":"WPS_CONNECTING"}
// @param ledState: LEDState
virtual Core::hresult GetLEDState(LEDState& ledState /* @out */) = 0;

// @text setLEDState
// @brief Change the device LED state to one mentioned in the input argument.
// @param state - in - string
// @param success - out - boolean
virtual Core::hresult SetLEDState(const string& state, bool& success /* @out */) = 0;
// @brief Sets the device LED to a requested state from those available in `GetSupportedLEDStates`.
// @param state: LEDControlState. e.g. "FACTORY_RESET"
// @param success: boolean
virtual Core::hresult SetLEDState(const LEDControlState& state, bool& success /* @out */) = 0;
};
} // namespace Exchange
} // namespace WPEFramework
Loading
Loading