CPPMyth
Library to interoperate with MythTV server
mythprotomonitor.h
1 /*
2  * Copyright (C) 2014 Jean-Luc Barriere
3  *
4  * This Program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2, or (at your option)
7  * any later version.
8  *
9  * This Program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; see the file COPYING. If not, write to
16  * the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
17  * MA 02110-1301 USA
18  * http://www.gnu.org/copyleft/gpl.html
19  *
20  */
21 
22 #ifndef MYTHPROTOMONITOR_H
23 #define MYTHPROTOMONITOR_H
24 
25 #include "mythprotobase.h"
26 #include "mythprotorecorder.h"
27 
28 #include <vector>
29 
30 #define PROTO_MONITOR_RCVBUF 64000
31 
32 namespace Myth
33 {
34 
35  class ProtoMonitor : public ProtoBase
36  {
37  public:
38  ProtoMonitor(const std::string& server, unsigned port);
39  ProtoMonitor(const std::string& server, unsigned port, bool frontend);
40 
41  virtual bool Open();
42  virtual void Close();
43  virtual bool IsOpen();
44 
45  ProtoRecorderPtr GetRecorderFromNum(int rnum)
46  {
47  return GetRecorderFromNum75(rnum);
48  }
49  bool QueryFreeSpaceSummary(int64_t *total, int64_t *used)
50  {
51  return QueryFreeSpaceSummary75(total, used);
52  }
53  std::string GetSetting(const std::string& hostname, const std::string& setting)
54  {
55  return GetSetting75(hostname, setting);
56  }
57  bool SetSetting(const std::string& hostname, const std::string& setting, const std::string& value)
58  {
59  return SetSetting75(hostname, setting, value);
60  }
61  bool QueryGenpixmap(const Program& program)
62  {
63  return QueryGenpixmap75(program);
64  }
65  bool DeleteRecording(const Program& program, bool force = false, bool forget = false)
66  {
67  return DeleteRecording75(program, force, forget);
68  }
69  bool UndeleteRecording(const Program& program)
70  {
71  return UndeleteRecording75(program);
72  }
73  bool StopRecording(const Program& program)
74  {
75  return StopRecording75(program);
76  }
77  bool CancelNextRecording(int rnum, bool cancel)
78  {
79  return CancelNextRecording75(rnum, cancel);
80  }
81  StorageGroupFilePtr QuerySGFile(const std::string& hostname, const std::string& sgname, const std::string& filename)
82  {
83  return QuerySGFile75(hostname, sgname, filename);
84  }
85  MarkListPtr GetCutList(const Program& program)
86  {
87  return GetCutList75(program);
88  }
89  MarkListPtr GetCommBreakList(const Program& program)
90  {
91  return GetCommBreakList75(program);
92  }
93  bool BlockShutdown()
94  {
95  return BlockShutdown75();
96  }
97  bool AllowShutdown()
98  {
99  return AllowShutdown75();
100  }
106  CardInputListPtr GetFreeInputs(int rnum = 0)
107  {
108  if (m_protoVersion >= 91) return GetFreeInputs91(rnum);
109  if (m_protoVersion >= 90) return GetFreeInputs90(rnum);
110  if (m_protoVersion >= 89) return GetFreeInputs89(rnum);
111  if (m_protoVersion >= 87) return GetFreeInputs87(rnum);
112  if (m_protoVersion >= 81) return GetFreeInputs81();
113  if (m_protoVersion >= 79) return GetFreeInputs79();
114  return GetFreeInputs75();
115  }
116 
117  private:
118  bool m_frontend;
119 
120  bool Announce75();
121  bool Announce88();
122  ProtoRecorderPtr GetRecorderFromNum75(int rnum);
123  bool QueryFreeSpaceSummary75(int64_t *total, int64_t *used);
124  std::string GetSetting75(const std::string& hostname, const std::string& setting);
125  bool SetSetting75(const std::string& hostname, const std::string& setting, const std::string& value);
126  bool QueryGenpixmap75(const Program& program);
127  bool DeleteRecording75(const Program& program, bool force, bool forget);
128  bool UndeleteRecording75(const Program& program);
129  bool StopRecording75(const Program& program);
130  bool CancelNextRecording75(int rnum, bool cancel);
131  StorageGroupFilePtr QuerySGFile75(const std::string& hostname, const std::string& sgname, const std::string& filename);
132  MarkListPtr GetCutList75(const Program& program);
133  MarkListPtr GetCommBreakList75(const Program& program);
134  bool BlockShutdown75();
135  bool AllowShutdown75();
136  std::vector<int> GetFreeCardIdList75();
137  CardInputListPtr GetFreeInputs75();
138  CardInputListPtr GetFreeInputs79();
139  CardInputListPtr GetFreeInputs81();
140  CardInputListPtr GetFreeInputs87(int rnum);
141  CardInputListPtr GetFreeInputs89(int rnum);
142  CardInputListPtr GetFreeInputs90(int rnum);
143  CardInputListPtr GetFreeInputs91(int rnum);
144 
145  // Not implemented
146  //int64_t GetBookmark75(Program& program);
147  //bool SetBookmark75(Program& program, int64_t bookmark);
148  //bool UpdateSchedules75();
149  //bool UpdateSchedules75(uint32_t recordid);
150  };
151 
152 }
153 
154 #endif /* MYTHPROTOMONITOR_H */
CardInputListPtr GetFreeInputs(int rnum=0)
Asks the backend for a list of free inputs. A free input is one that is connected but not busy...
This is the main namespace that encloses all public classes.
Definition: mythcontrol.h:29