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 #include "libupnpp/config.h"
21 
22 #include <string>
23 #include <vector>
24 #include <map>
25 
26 #include "libupnpp/control/service.hxx"
27 
28 namespace UPnPClient {
29 
41 class TypedService : public Service {
42 public:
43 
49  TypedService(const std::string& tp);
50 
51  virtual ~TypedService();
52 
54  virtual bool serviceTypeMatch(const std::string& tp);
55 
64  virtual int runAction(const std::string& name,
65  std::vector<std::string> args,
66  std::map<std::string, std::string>& retdata);
67 
68 protected:
72  virtual bool serviceInit(const UPnPDeviceDesc& device,
73  const UPnPServiceDesc& service);
74 
75 private:
76  class Internal;
77  Internal *m{0};
78  TypedService();
79  void evtCallback(const std::unordered_map<std::string, std::string>&);
80  void registerCallback();
81 };
82 
83 
100 extern TypedService *findTypedService(const std::string& devname,
101  const std::string& servicetype,
102  bool fuzzy);
103 
104 } // namespace UPnPClient
105 
106 #endif // _TYPEDSERVICE_H_X_INCLUDED_
virtual bool serviceInit(const UPnPDeviceDesc &device, const UPnPServiceDesc &service)
Service-specific part of initialization.
Definition: typedservice.cxx:79
virtual int runAction(const std::string &name, std::vector< std::string > args, std::map< std::string, std::string > &retdata)
Run an action specified by name, with specified input return output.
Definition: typedservice.cxx:85
Definition: typedservice.cxx:40
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:186
Definition: service.hxx:73
Access an UPnP service actions through a string based interface.
Definition: typedservice.hxx:41
virtual bool serviceTypeMatch(const std::string &tp)
Check if the input matches our service type.
Definition: typedservice.cxx:66
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:28