4#ifndef SIGNAL_REGISTRY_H
5#define SIGNAL_REGISTRY_H
9#include <unordered_map>
10#include <unordered_set>
69 std::vector<std::string>* mDerivatives;
86 static std::shared_ptr<SignalRegistry> signalRegistryInstance;
87 int32_t mTotalSignals;
88 std::vector<SignalInfo*> mSignalsConfigs;
90 std::unordered_map<uint32_t, int32_t> mSystemIndependentLayerMappings;
105 int8_t isSignalConfigMalformed(
SignalInfo* sConf);
107 std::vector<SignalInfo*> getSignalConfigs();
118 int32_t getSignalsConfigCount();
119 int32_t getSignalTableIndex(uint32_t signalCode);
120 void displaySignals();
122 static std::shared_ptr<SignalRegistry> getInstance() {
123 if(signalRegistryInstance ==
nullptr) {
125 signalRegistryInstance = std::shared_ptr<SignalRegistry>(
new SignalRegistry());
126 }
catch(
const std::bad_alloc& e) {
127 LOGE(
"RESTUNE_SIGNAL_REGISTRY",
128 "Failed to allocate memory for SignalRegistry instance: " + std::string(e.what()));
132 return signalRegistryInstance;
136class SignalInfoBuilder {
142 ~SignalInfoBuilder();
144 ErrCode setSignalID(
const std::string& signalOpIdString);
145 ErrCode setSignalCategory(
const std::string& categoryString);
146 ErrCode setName(
const std::string& signalName);
147 ErrCode setTimeout(
const std::string& timeoutString);
148 ErrCode setIsEnabled(
const std::string& isEnabledString);
149 ErrCode addTargetEnabled(
const std::string& target);
150 ErrCode addTargetDisabled(
const std::string& target);
151 ErrCode addPermission(
const std::string& permissionString);
152 ErrCode addDerivative(
const std::string& derivative);
158class ResourceBuilder {
165 ErrCode setResCode(
const std::string& resCodeString);
166 ErrCode setResInfo(
const std::string& resInfoString);
167 ErrCode setNumValues(int32_t valuesCount);
168 ErrCode addValue(
const std::string& value);
ErrCode
Custom Error Codes used by Resource Tuner APIs and Internal Functions.
Used to store information regarding Resources / Tunables which need to be Provisioned as part of the ...
SignalInfo * getSignalConfigById(uint32_t signalCode)
Get the SignalInfo object corresponding to the given Resource ID.
void registerSignal(SignalInfo *signalInfo, int8_t isBuSpecified=false)
Used to register a Config specified (through YAML) Signal with Resource Tuner.
Representation of a single Signal Configuration.
int8_t mIsEnabled
Boolean flag which is set if Signal is available for Provisioning.
uint16_t mSignalID
16-bit Signal ID
std::unordered_set< std::string > * mTargetsEnabled
Pointer to a vector, storing the list of targets for which the signal is enabled.
uint8_t mSignalCategory
Category of the Signal.
std::string mSignalName
Signal Name, for ex: EARLY_WAKEUP.
int32_t mTimeout
Default Signal Timeout, to be used if Client specifies a duration of 0 in the tuneSignal API call.
std::vector< enum Permissions > * mPermissions
Pointer to a list of Permissions, i.e. only Clients with one of these permissions can provision the s...
std::vector< Resource * > * mSignalResources
List of Actual Resource which will be Provisioned and the Values to be configured for the Resources.
std::unordered_set< std::string > * mTargetsDisabled
Pointer to a vector, storing the list of targets for which the signal is not eligible for Provisionin...