Add-on main instance class
This is the addon main class, similar to an int main()
in executable and carries out initial work and later management of it.
◆ CAddonBase()
Addon base class constructor.
◆ ~CAddonBase()
◆ Create()
Main addon creation function.
With this function addon can carry out necessary work which is required at later points or start necessary processes.
This function is optional and necessary work can also be carried out using CreateInstance (if it concerns any instance types).
- Returns
- ADDON_STATUS_OK if correct, for possible errors see ADDON_STATUS
- Note
- Terminating the add-on must be carried out using the class destructor given by child.
◆ SetSetting()
To inform addon about changed settings values.
This becomes called for every entry defined inside his settings.xml and as last call the one where last in xml (to identify end of calls).
The following table contains values that can be set with class CSettingValue :
Name | Type | Get call |
Settings value as string | std::string | GetString |
Settings value as integer | int | GetInt |
Settings value as unsigned integer | unsigned int | GetUInt |
Settings value as boolean | bool | GetBoolean |
Settings value as floating point | float | GetFloat |
Settings value as enum | enum | GetEnum |
Here is a code example how this is used:
#include <kodi/AddonBase.h>
{
};
{
}
Definition AddonBase.h:245
Definition PeripheralUtils.h:48
ADDON_STATUS
Definition addon_base.h:138
- Note
- The asked type should match the type used on settings.xml.
◆ CreateInstance()
Instance created.
- Parameters
-
[in] | instance | Instance informations about |
[out] | hdl | The pointer to instance class created in addon. Needed to be able to identify them on calls. |
- Returns
- ADDON_STATUS_OK if correct, for possible errors see ADDON_STATUS
Here is a code example how this is used:
#include <kodi/AddonBase.h>
...
KODI_ADDON_INSTANCE_HDL& hdl)
{
{
}
{
}
else if (...)
{
...
}
}
...
Definition AddonBase.h:306
@ ADDON_LOG_INFO
1 : To include information messages in the log file.
Definition addon_base.h:187
@ ADDON_STATUS_OK
For everything OK and no error.
Definition addon_base.h:140
@ ADDON_STATUS_UNKNOWN
Unknown and incomprehensible error.
Definition addon_base.h:152
@ ADDON_INSTANCE_VISUALIZATION
Music visualization instance, see kodi::addon::CInstanceVisualization.
Definition versions.h:239
@ ADDON_INSTANCE_SCREENSAVER
Screen saver instance, see kodi::addon::CInstanceScreensaver.
Definition versions.h:236
bool IsType(KODI_ADDON_INSTANCE_TYPE type) const
Check asked type used on this class.
Definition AddonBase.h:333
void ATTR_DLL_LOCAL Log(const ADDON_LOG loglevel, const char *format,...)
Add a message to Kodi's log.
Definition AddonBase.h:1746
◆ DestroyInstance()
Instance destroy.
This function is optional and intended to notify addon that the instance is terminating.
- Parameters
-
[in] | instance | Instance informations about |
[in] | hdl | The pointer to instance class created in addon. |
- Warning
- This call is only used to inform that the associated instance is terminated. The deletion is carried out in the background.