libupnpp  0.16.0
A C++ wrapper for the Portable UPnP reference library
typedservice.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 _TYPEDSERVICE_H_X_INCLUDED_
19 #define _TYPEDSERVICE_H_X_INCLUDED_
20 
21 #include <string>
22 #include <vector>
23 #include <map>
24 
25 #include "libupnpp/control/service.hxx"
26 
27 namespace UPnPClient {
28 
40 class UPNPP_API TypedService : public Service {
41 public:
42 
48  TypedService(const std::string& tp);
49 
50  virtual ~TypedService();
51 
53  virtual bool serviceTypeMatch(const std::string& tp);
54 
63  virtual int runAction(const std::string& name,
64  std::vector<std::string> args,
65  std::map<std::string, std::string>& retdata);
66 
67 protected:
71  virtual bool serviceInit(const UPnPDeviceDesc& device,
72  const UPnPServiceDesc& service);
73 
74 private:
75  // Suppress warning about the normal Service class runAction being
76  // hidden. Maybe it could be used, but we don't really need it
77  // (it's called by our own runAction()).
78  using Service::runAction;
79  class UPNPP_LOCAL Internal;
80  Internal *m{0};
81  TypedService();
82  void UPNPP_LOCAL evtCallback(
83  const std::unordered_map<std::string, std::string>&);
84  void UPNPP_LOCAL registerCallback();
85 };
86 
87 
104 TypedService UPNPP_API *findTypedService(
105  const std::string& devname, const std::string& servicetype, bool fuzzy);
106 
107 } // namespace UPnPClient
108 
109 #endif // _TYPEDSERVICE_H_X_INCLUDED_
Definition: service.hxx:82
Access an UPnP service actions through a string based interface.
Definition: typedservice.hxx:40
Data holder for a UPnP service, parsed from the device XML description.
Definition: description.hxx:46
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
virtual int runAction(const UPnPP::SoapOutgoing &args, UPnPP::SoapIncoming &data)
Call Soap action and return resulting data.
Definition: service.cxx:160
TypedService * findTypedService(const std::string &devname, const std::string &servicetype, bool fuzzy)
Find specified service inside specified device, and build a TypedService object.
Definition: typedservice.cxx:188