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 "libupnpp/config.h"
22 
23 #include <string>
24 #include <vector>
25 
26 #include "libupnpp/control/service.hxx"
27 #include "libupnpp/control/cdircontent.hxx"
28 #include "ohplaylist.hxx"
29 
30 namespace UPnPClient {
31 
32 class OHRadio;
33 class UPnPDeviceDesc;
34 class UPnPServiceDesc;
35 
36 typedef std::shared_ptr<OHRadio> OHRDH;
37 
42 class OHRadio : public Service {
43 public:
44 
45  OHRadio(const UPnPDeviceDesc& device, const UPnPServiceDesc& service)
46  : Service(device, service) {
47  }
48 
49  virtual ~OHRadio() {}
50 
51  OHRadio() {}
52 
54  static bool isOHRdService(const std::string& st);
55  virtual bool serviceTypeMatch(const std::string& tp);
56 
57  int channel(std::string* uri, UPnPDirObject *dirent);
58  int channelsMax(int *);
59  int id(int *value);
60  int idArray(std::vector<int> *ids, int *tokp);
61  int idArrayChanged(int token, bool *changed);
62  int pause();
63  int play();
64  int protocolInfo(std::string *proto);
65  int read(int id, UPnPDirObject *dirent);
66  int readList(const std::vector<int>& ids,
67  std::vector<OHPlaylist::TrackListEntry>* entsp);
68  int setChannel(const std::string& uri, const std::string& didl);
69  int setId(int id, const std::string& uri);
70  int stop();
71  int transportState(OHPlaylist::TPState *tps);
72 
73  // This is for the benefit of ohinfo, no outside use
74  static int decodeMetadata(const std::string& fromwho,
75  const std::string &rawdidl, UPnPDirObject *de);
76 
77 protected:
78  /* My service type string */
79  static const std::string SType;
80 
81 private:
82  void evtCallback(const std::unordered_map<std::string, std::string>&);
83  void registerCallback();
84 };
85 
86 } // namespace UPnPClient
87 
88 #endif /* _OHRADIO_HXX_INCLUDED_ */
Service()
Empty object.
Definition: service.cxx:127
Definition: service.hxx:73
OHRadio Service client class.
Definition: ohradio.hxx:42
static bool isOHRdService(const std::string &st)
Test service type from discovery message.
Definition: ohradio.cxx:48
Data holder for a UPnP service, parsed from the device XML description.
Definition: description.hxx:46
virtual bool serviceTypeMatch(const std::string &tp)
Perform a comparison to the service type string for this specific service.
Definition: ohradio.cxx:53
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:28