![]() |
Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
|
#include <WeatherManager.h>
Classes | |
struct | CaseInsensitiveCompare |
Public Types | |
using | WeatherInfoV2 = std::map<std::string, std::string, CaseInsensitiveCompare> |
Public Member Functions | |
CWeatherManager (ADDON::CAddonMgr &addonManager) | |
~CWeatherManager () override | |
std::string | GetProperty (const std::string &property) const |
Retrieve the value for the given weather property. | |
std::string | GetDayProperty (unsigned int index, const std::string &property) const |
Retrieve the value for the given "day" weather property. | |
int | GetLocation () const |
Get the index for currently active location. | |
void | SetLocation (int location) |
Set the active location. Will trigger a data refresh if current location is different from the given location. | |
std::vector< std::string > | GetLocations () const |
Get the city names of all available locations, sorted by location index. | |
std::string | GetLocation (int iLocation) const |
Retrieve the city name for the specified location from the settings. | |
std::string | GetLastUpdateTime () const |
ForecastDay | GetForecast (int day) const |
bool | IsFetched () |
![]() | |
CInfoLoader (unsigned int timeToRefresh=5 *60 *1000) | |
~CInfoLoader () override | |
std::string | GetInfo (int info) |
void | Refresh () |
bool | IsUpdating () const |
![]() | |
virtual | ~IJobCallback ()=default |
Destructor for job call back objects. | |
virtual void | OnJobAbort (unsigned int jobID, CJob *job) |
An optional callback function used when a job will be aborted. | |
virtual void | OnJobProgress (unsigned int jobID, unsigned int progress, unsigned int total, const CJob *job) |
An optional callback function that a job may call while processing. | |
![]() | |
virtual | ~ISettingCallback ()=default |
virtual bool | OnSettingChanging (const std::shared_ptr< const CSetting > &setting) |
The value of the given setting is being changed. | |
virtual bool | OnSettingUpdate (const std::shared_ptr< CSetting > &setting, const char *oldSettingId, const TiXmlNode *oldSettingNode) |
The given setting needs to be updated. | |
virtual void | OnSettingPropertyChanged (const std::shared_ptr< const CSetting > &setting, const char *propertyName) |
The given property of the given setting has changed. | |
Static Public Attributes | |
static constexpr int | WEATHER_REFRESH_INTERVAL_MS = 30 * 60 * 1000 |
The intervall for refreshing weather data. | |
Protected Member Functions | |
CJob * | GetJob () const override |
std::string | TranslateInfo (int info) const override |
std::string | BusyInfo (int info) const override |
void | OnJobComplete (unsigned int jobID, bool success, CJob *job) override |
The callback used when a job completes. | |
void | OnSettingChanged (const std::shared_ptr< const CSetting > &setting) override |
The value of the given setting has changed. | |
void | OnSettingAction (const std::shared_ptr< const CSetting > &setting) override |
The given setting has been activated. | |
![]() | |
bool | RefreshIfNeeded () |
using CWeatherManager::WeatherInfoV2 = std::map<std::string, std::string, CaseInsensitiveCompare> |
|
explicit |
|
override |
|
overrideprotectedvirtual |
Reimplemented from CInfoLoader.
std::string CWeatherManager::GetDayProperty | ( | unsigned int | index, |
const std::string & | property ) const |
Retrieve the value for the given "day" weather property.
index | the index for the day, (can be in the range [0..6]) |
property | the name of the property (e.g. HighTemp) |
ForecastDay CWeatherManager::GetForecast | ( | int | day | ) | const |
|
overrideprotectedvirtual |
Implements CInfoLoader.
std::string CWeatherManager::GetLastUpdateTime | ( | ) | const |
int CWeatherManager::GetLocation | ( | ) | const |
Get the index for currently active location.
std::string CWeatherManager::GetLocation | ( | int | iLocation | ) | const |
Retrieve the city name for the specified location from the settings.
iLocation | the location index (can be in the range [1..MAXLOCATION]) |
std::vector< std::string > CWeatherManager::GetLocations | ( | ) | const |
Get the city names of all available locations, sorted by location index.
std::string CWeatherManager::GetProperty | ( | const std::string & | property | ) | const |
Retrieve the value for the given weather property.
property | the full name of the property (e.g. Current.Temperature, Hourly.1.Temperature) |
bool CWeatherManager::IsFetched | ( | ) |
|
overrideprotectedvirtual |
The callback used when a job completes.
OnJobComplete is called at the completion of the job's DoWork() function, and is used to return information to the caller on the result of the job. On returning form this function the CJobManager will destroy this job.
jobID | the unique id of the job (as retrieved from CJobManager::AddJob) |
success | the result from the DoWork call |
job | the job that has been processed. The job will be destroyed after this function returns |
Reimplemented from CInfoLoader.
|
overrideprotectedvirtual |
The given setting has been activated.
This callback is triggered whenever the given setting has been activated. This callback is only fired for CSettingAction settings.
setting | The setting which has been activated. |
Reimplemented from ISettingCallback.
|
overrideprotectedvirtual |
The value of the given setting has changed.
This callback is triggered whenever the value of a setting has been successfully changed (i.e. none of the OnSettingChanging() handlers) has reverted the change.
setting | The setting whose value has been changed |
Reimplemented from ISettingCallback.
Set the active location. Will trigger a data refresh if current location is different from the given location.
location | the location index (can be in the range [1..MAXLOCATION]) |
|
overrideprotectedvirtual |
Reimplemented from CInfoLoader.
|
staticconstexpr |
The intervall for refreshing weather data.