| 1 |
/* |
| 2 |
* Copyright (C) 2010-2021 Team Kodi (https://kodi.tv) |
| 3 |
* Copyright (C) 2010 Alwin Esch (Team Kodi) |
| 4 |
* |
| 5 |
* SPDX-License-Identifier: GPL-2.0-or-later |
| 6 |
* See LICENSE.md for more information. |
| 7 |
*/ |
| 8 |
|
| 9 |
#pragma once |
| 10 |
|
| 11 |
#include "ClientInstance.h" |
| 12 |
|
| 13 |
#include <atomic> |
| 14 |
#include <kodi/gui/ListItem.h> |
| 15 |
#include <kodi/gui/Window.h> |
| 16 |
#include <kodi/gui/controls/Progress.h> |
| 17 |
#include <kodi/gui/controls/RadioButton.h> |
| 18 |
#include <kodi/gui/controls/Spin.h> |
| 19 |
#include <map> |
| 20 |
#include <string> |
| 21 |
#include <thread> |
| 22 |
|
| 23 |
typedef enum scantype |
| 24 |
{ |
| 25 |
DVB_TERR = 0, |
| 26 |
DVB_CABLE = 1, |
| 27 |
DVB_SAT = 2, |
| 28 |
PVRINPUT = 3, |
| 29 |
PVRINPUT_FM = 4, |
| 30 |
DVB_ATSC = 5, |
| 31 |
} scantype_t; |
| 32 |
|
| 33 |
class CPVRAddon; |
| 34 |
|
| 35 |
class ATTR_DLL_LOCAL cVNSIChannelScan : public cVNSISession, public kodi::gui::CWindow |
| 36 |
{ |
| 37 |
public: |
| 38 |
cVNSIChannelScan(kodi::addon::CInstancePVRClient& instance); |
| 39 |
~cVNSIChannelScan() = default; |
| 40 |
|
| 41 |
bool Open(const std::string& hostname, |
| 42 |
int port, |
| 43 |
const std::string& mac, |
| 44 |
const char* name = "XBMC channel scanner"); |
| 45 |
|
| 46 |
bool OnInit() override; |
| 47 |
bool OnFocus(int controlId) override; |
| 48 |
bool OnClick(int controlId) override; |
| 49 |
bool OnAction(ADDON_ACTION actionId) override; |
| 50 |
|
| 51 |
protected: |
| 52 |
void Process(); |
| 53 |
|
| 54 |
private: |
| 55 |
bool ReadCountries(); |
| 56 |
bool ReadSatellites(); |
| 57 |
void SetControlsVisible(scantype_t type); |
| 58 |
void StartScan(); |
| 59 |
void StopScan(); |
| 60 |
void ReturnFromProcessView(); |
| 61 |
void SetProgress(int procent); |
| 62 |
void SetSignal(int procent, bool locked); |
| 63 |
bool OnResponsePacket(cResponsePacket* resp); |
| 64 |
|
| 65 |
std::string m_header; |
| 66 |
std::string m_Signal; |
| 67 |
bool m_running = false; |
| 68 |
bool m_stopped = false; |
| 69 |
bool m_Canceled = false; |
| 70 |
bool m_progressActive = false; |
| 71 |
std::string m_wolMac; |
| 72 |
|
| 73 |
kodi::gui::controls::CSpin* m_spinSourceType = nullptr; |
| 74 |
kodi::gui::controls::CSpin* m_spinCountries = nullptr; |
| 75 |
kodi::gui::controls::CSpin* m_spinSatellites = nullptr; |
| 76 |
kodi::gui::controls::CSpin* m_spinDVBCInversion = nullptr; |
| 77 |
kodi::gui::controls::CSpin* m_spinDVBCSymbolrates = nullptr; |
| 78 |
kodi::gui::controls::CSpin* m_spinDVBCqam = nullptr; |
| 79 |
kodi::gui::controls::CSpin* m_spinDVBTInversion = nullptr; |
| 80 |
kodi::gui::controls::CSpin* m_spinATSCType = nullptr; |
| 81 |
kodi::gui::controls::CRadioButton* m_radioButtonTV = nullptr; |
| 82 |
kodi::gui::controls::CRadioButton* m_radioButtonRadio = nullptr; |
| 83 |
kodi::gui::controls::CRadioButton* m_radioButtonFTA = nullptr; |
| 84 |
kodi::gui::controls::CRadioButton* m_radioButtonScrambled = nullptr; |
| 85 |
kodi::gui::controls::CRadioButton* m_radioButtonHD = nullptr; |
| 86 |
kodi::gui::controls::CProgress* m_progressDone = nullptr; |
| 87 |
kodi::gui::controls::CProgress* m_progressSignal = nullptr; |
| 88 |
|
| 89 |
std::atomic<bool> m_threadRunning = {false}; |
| 90 |
std::thread m_thread; |
| 91 |
}; |