forked from FernetMenta/vdr-plugin-vnsiserver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vnsiclient.h
187 lines (154 loc) · 5.39 KB
/
vnsiclient.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
/*
* vdr-plugin-vnsi - XBMC server plugin for VDR
*
* Copyright (C) 2010 Alwin Esch (Team XBMC)
* Copyright (C) 2010, 2011 Alexander Pipelka
*
* http://www.xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XBMC; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
*/
#ifndef VNSI_CLIENT_H
#define VNSI_CLIENT_H
#include <vdr/thread.h>
#include <vdr/tools.h>
#include <vdr/receiver.h>
#include <vdr/status.h>
#include "config.h"
#include "cxsocket.h"
#include <map>
#include <string>
class cChannel;
class cDevice;
class cLiveStreamer;
class cRequestPacket;
class cResponsePacket;
class cRecPlayer;
class cCmdControl;
class cVnsiOsdProvider;
class cVNSIClient : public cThread
, public cStatus
{
private:
unsigned int m_Id;
cxSocket m_socket;
bool m_loggedIn;
bool m_StatusInterfaceEnabled;
cLiveStreamer *m_Streamer;
bool m_isStreaming;
cString m_ClientAddress;
cRecPlayer *m_RecPlayer;
cRequestPacket *m_req;
cResponsePacket *m_resp;
cCharSetConv m_toUTF8;
uint32_t m_protocolVersion;
cMutex m_msgLock;
static cMutex m_timerLock;
cVnsiOsdProvider *m_Osd;
std::map<int, time_t> m_epgUpdate;
protected:
bool processRequest(cRequestPacket* req);
virtual void Action(void);
virtual void TimerChange(const cTimer *Timer, eTimerChange Change);
virtual void Recording(const cDevice *Device, const char *Name, const char *FileName, bool On);
virtual void OsdStatusMessage(const char *Message);
virtual void ChannelChange(const cChannel *Channel);
public:
cVNSIClient(int fd, unsigned int id, const char *ClientAdr);
virtual ~cVNSIClient();
void ChannelsChange();
void RecordingsChange();
void TimerChange();
void EpgChange();
unsigned int GetID() { return m_Id; }
protected:
void SetLoggedIn(bool yesNo) { m_loggedIn = yesNo; }
void SetStatusInterface(bool yesNo) { m_StatusInterfaceEnabled = yesNo; }
bool StartChannelStreaming(const cChannel *channel, int32_t priority, uint8_t timeshift, uint32_t timeout);
void StopChannelStreaming();
private:
typedef struct {
bool automatic;
bool radio;
std::string name;
} ChannelGroup;
std::map<std::string, ChannelGroup> m_channelgroups[2];
bool process_Login();
bool process_GetTime();
bool process_EnableStatusInterface();
bool process_Ping();
bool process_GetSetup();
bool process_StoreSetup();
bool processChannelStream_Open();
bool processChannelStream_Close();
bool processChannelStream_Seek();
bool processRecStream_Open();
bool processRecStream_Close();
bool processRecStream_GetBlock();
bool processRecStream_PositionFromFrameNumber();
bool processRecStream_FrameNumberFromPosition();
bool processRecStream_GetIFrame();
bool processRecStream_GetLength();
bool processCHANNELS_GroupsCount();
bool processCHANNELS_ChannelsCount();
bool processCHANNELS_GroupList();
bool processCHANNELS_GetChannels();
bool processCHANNELS_GetGroupMembers();
bool processCHANNELS_GetCaids();
bool processCHANNELS_GetWhitelist();
bool processCHANNELS_GetBlacklist();
bool processCHANNELS_SetWhitelist();
bool processCHANNELS_SetBlacklist();
void CreateChannelGroups(bool automatic);
bool processTIMER_GetCount();
bool processTIMER_Get();
bool processTIMER_GetList();
bool processTIMER_Add();
bool processTIMER_Delete();
bool processTIMER_Update();
bool processRECORDINGS_GetDiskSpace();
bool processRECORDINGS_GetCount();
bool processRECORDINGS_GetList();
bool processRECORDINGS_GetInfo();
bool processRECORDINGS_Rename();
bool processRECORDINGS_Delete();
bool processRECORDINGS_Move();
bool processRECORDINGS_GetEdl();
bool processEPG_GetForChannel();
bool processSCAN_ScanSupported();
bool processSCAN_GetCountries();
bool processSCAN_GetSatellites();
bool processSCAN_Start();
bool processSCAN_Stop();
/** Static callback functions to interact with wirbelscan plugin over
the plugin service interface */
static void processSCAN_AddCountry(int index, const char *isoName, const char *longName);
static void processSCAN_AddSatellite(int index, const char *shortName, const char *longName);
static void processSCAN_SetPercentage(int percent);
static void processSCAN_SetSignalStrength(int strength, bool locked);
static void processSCAN_SetDeviceInfo(const char *Info);
static void processSCAN_SetTransponder(const char *Info);
static void processSCAN_NewChannel(const char *Name, bool isRadio, bool isEncrypted, bool isHD);
static void processSCAN_IsFinished();
static void processSCAN_SetStatus(int status);
static cResponsePacket *m_processSCAN_Response;
static cxSocket *m_processSCAN_Socket;
bool processOSD_Connect();
bool processOSD_Disconnect();
bool processOSD_Hitkey();
cString CreatePiconRef(cChannel* channel);
};
#endif // VNSI_CLIENT_H