MPD  0.20.18
ContentDirectoryService.hxx
Go to the documentation of this file.
1 /*
2  * Copyright 2003-2017 The Music Player Daemon Project
3  * http://www.musicpd.org
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #ifndef _UPNPDIR_HXX_INCLUDED_
21 #define _UPNPDIR_HXX_INCLUDED_
22 
23 #include "Compiler.h"
24 
25 #include <upnp.h>
26 
27 #include <string>
28 #include <list>
29 
30 class UPnPDevice;
31 struct UPnPService;
32 class UPnPDirContent;
33 
51  std::string m_actionURL;
52  std::string m_serviceType;
53  std::string m_deviceId;
54  std::string m_friendlyName;
55  std::string m_manufacturer;
56  std::string m_modelName;
57 
58  int m_rdreqcnt; // Slice size to use when reading
59 
60 public:
67  ContentDirectoryService(const UPnPDevice &device,
68  const UPnPService &service);
69 
71  ContentDirectoryService() = default;
72 
74 
79  UPnPDirContent readDir(UpnpClient_Handle handle,
80  const char *objectId) const;
81 
82  void readDirSlice(UpnpClient_Handle handle,
83  const char *objectId, unsigned offset,
84  unsigned count, UPnPDirContent& dirbuf,
85  unsigned &didread, unsigned &total) const;
86 
96  UPnPDirContent search(UpnpClient_Handle handle,
97  const char *objectId,
98  const char *searchstring) const;
99 
104  UPnPDirContent getMetadata(UpnpClient_Handle handle,
105  const char *objectId) const;
106 
114  std::list<std::string> getSearchCapabilities(UpnpClient_Handle handle) const;
115 
116  gcc_pure
117  std::string GetURI() const noexcept {
118  return "upnp://" + m_deviceId + "/" + m_serviceType;
119  }
120 
122  const char *getFriendlyName() const noexcept {
123  return m_friendlyName.c_str();
124  }
125 };
126 
127 #endif /* _UPNPDIR_HXX_INCLUDED_ */
UPnP Description phase: interpreting the device description which we downloaded from the URL obtained...
Definition: Device.hxx:35
void readDirSlice(UpnpClient_Handle handle, const char *objectId, unsigned offset, unsigned count, UPnPDirContent &dirbuf, unsigned &didread, unsigned &total) const
gcc_pure std::string GetURI() const noexcept
Data holder for a UPnP device, parsed from the XML description obtained during discovery.
Definition: Device.hxx:53
std::list< std::string > getSearchCapabilities(UpnpClient_Handle handle) const
Retrieve search capabilities.
ContentDirectoryService()=default
An empty one.
UPnPDirContent search(UpnpClient_Handle handle, const char *objectId, const char *searchstring) const
Search the content directory service.
const char * getFriendlyName() const noexcept
Retrieve the "friendly name" for this server, useful for display.
UPnPDirContent getMetadata(UpnpClient_Handle handle, const char *objectId) const
Read metadata for a given node.
Content Directory Service class.
UPnPDirContent readDir(UpnpClient_Handle handle, const char *objectId) const
Read a container&#39;s children list into dirbuf.
#define gcc_pure
Definition: Compiler.h:116
Image of a MediaServer Directory Service container (directory), possibly containing items and subordi...
Definition: Directory.hxx:33