libupnpp  0.16.0
A C++ wrapper for the Portable UPnP reference library
ohradio.hxx
1 /* Copyright (C) 2006-2016 J.F.Dockes
2  *
3  * This library is free software; you can redistribute it and/or
4  * modify it under the terms of the GNU Lesser General Public
5  * License as published by the Free Software Foundation; either
6  * version 2.1 of the License, or (at your option) any later version.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public
14  * License along with this library; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
16  * 02110-1301 USA
17  */
18 #ifndef _OHRADIO_HXX_INCLUDED_
19 #define _OHRADIO_HXX_INCLUDED_
20 
21 #include <string>
22 #include <vector>
23 
24 #include "libupnpp/control/service.hxx"
25 #include "libupnpp/control/cdircontent.hxx"
26 #include "ohplaylist.hxx"
27 
28 namespace UPnPClient {
29 
30 class OHRadio;
31 class UPnPDeviceDesc;
32 class UPnPServiceDesc;
33 
34 typedef std::shared_ptr<OHRadio> OHRDH;
35 
40 class UPNPP_API OHRadio : public Service {
41 public:
42 
43  OHRadio(const UPnPDeviceDesc& device, const UPnPServiceDesc& service)
44  : Service(device, service) {
45  }
46 
47  virtual ~OHRadio() {}
48 
49  OHRadio() {}
50 
52  static bool isOHRdService(const std::string& st);
53  virtual bool serviceTypeMatch(const std::string& tp);
54 
55  int channel(std::string* uri, UPnPDirObject *dirent);
56  int channelsMax(int *);
57  int id(int *value);
58  int idArray(std::vector<int> *ids, int *tokp);
59  int idArrayChanged(int token, bool *changed);
60  int pause();
61  int play();
62  int protocolInfo(std::string *proto);
63  int read(int id, UPnPDirObject *dirent);
64  int readList(const std::vector<int>& ids,
65  std::vector<OHPlaylist::TrackListEntry>* entsp);
66  int setChannel(const std::string& uri, const std::string& didl);
67  int setId(int id, const std::string& uri);
68  int stop();
69  int transportState(OHPlaylist::TPState *tps);
70 
71  // This is for the benefit of ohinfo, no outside use
72  static int decodeMetadata(const std::string& fromwho,
73  const std::string &rawdidl, UPnPDirObject *de);
74 
75 protected:
76  /* My service type string */
77  static const std::string SType;
78 
79 private:
80  void UPNPP_LOCAL evtCallback(
81  const std::unordered_map<std::string, std::string>&);
82  void UPNPP_LOCAL registerCallback();
83 };
84 
85 } // namespace UPnPClient
86 
87 #endif /* _OHRADIO_HXX_INCLUDED_ */
Definition: service.hxx:82
OHRadio Service client class.
Definition: ohradio.hxx:40
Data holder for a UPnP service, parsed from the device XML description.
Definition: description.hxx:46
UPnP Media Server directory entry, converted from XML data.
Definition: cdircontent.hxx:62
Data holder for a UPnP device, parsed from the XML description obtained during discovery.
Definition: description.hxx:142
UPnP Description phase: interpreting the device description which we downloaded from the URL obtained...
Definition: avlastchg.cxx:27