libupnpp  0.16.0
A C++ wrapper for the Portable UPnP reference library
ohproduct.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 _OHPRODUCT_HXX_INCLUDED_
19 #define _OHPRODUCT_HXX_INCLUDED_
20 
21 #include <unordered_map>
22 #include <string>
23 #include <vector>
24 
25 #include "service.hxx"
26 
27 
28 namespace UPnPClient {
29 
30 class OHProduct;
31 class UPnPDeviceDesc;
32 class UPnPServiceDesc;
33 
34 typedef std::shared_ptr<OHProduct> OHPRH;
35 
40 class UPNPP_API OHProduct : public Service {
41 public:
42 
43  OHProduct(const UPnPDeviceDesc& device, const UPnPServiceDesc& service)
44  : Service(device, service) {
45  }
46  OHProduct() {}
47  ~OHProduct() {}
48 
50  static bool isOHPrService(const std::string& st);
51  virtual bool serviceTypeMatch(const std::string& tp);
52 
53  struct Source {
54  std::string name;
55  std::string type;
56  bool visible;
57  Source() : visible(false) {}
58  void clear() {
59  name.clear();
60  type.clear();
61  visible = false;
62  }
63  };
64 
66  int getSources(std::vector<Source>& sources);
67  int sourceIndex(int *index);
68  int setSourceIndex(int index);
69  int setSourceIndexByName(const std::string& name);
70  int standby(bool *value);
71  int setStanby(bool value);
72 
73 protected:
74  /* My service type string */
75  static const std::string SType;
76 private:
77  void UPNPP_LOCAL evtCallback(
78  const std::unordered_map<std::string, std::string>&);
79  void UPNPP_LOCAL registerCallback();
80 };
81 
82 } // namespace UPnPClient
83 
84 #endif /* _OHPRODUCT_HXX_INCLUDED_ */
Definition: service.hxx:82
Data holder for a UPnP service, parsed from the device XML description.
Definition: description.hxx:46
OHProduct Service client class.
Definition: ohproduct.hxx:40
Definition: ohproduct.hxx:53
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