Merge pull request #26148 from ksooo/fix-secondstotimestring-warning
[xbmc.git] / xbmc / addons / Service.h
blob38f1d1edd26ac8b8734b0d72a40602b5cfd4da27
1 /*
2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #pragma once
11 #include "addons/Addon.h"
12 #include "addons/AddonEvents.h"
13 #include "threads/CriticalSection.h"
15 namespace ADDON
17 class CService: public CAddon
19 public:
20 explicit CService(const AddonInfoPtr& addonInfo);
23 class CServiceAddonManager
25 public:
26 explicit CServiceAddonManager(CAddonMgr& addonMgr);
27 ~CServiceAddonManager();
29 /**
30 * Start all services.
32 void Start();
34 /**
35 * Start service by add-on id.
37 void Start(const AddonPtr& addon);
38 void Start(const std::string& addonId);
40 /**
41 * Stop all services.
43 void Stop();
45 /**
46 * Stop service by add-on id.
48 void Stop(const std::string& addonId);
50 private:
51 void OnEvent(const AddonEvent& event);
53 void Stop(const std::map<std::string, int>::value_type& service);
55 CAddonMgr& m_addonMgr;
56 CCriticalSection m_criticalSection;
57 /** add-on id -> script id */
58 std::map<std::string, int> m_services;