libupnpp 0.16.0
A C++ wrapper for the Portable UPnP reference library
ohplaylist.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 _OHPLAYLIST_HXX_INCLUDED_
19#define _OHPLAYLIST_HXX_INCLUDED_
20
21#include <unordered_map>
22#include <string>
23#include <vector>
24
25#include "libupnpp/control/service.hxx"
26#include "libupnpp/control/cdircontent.hxx"
27
28
29namespace UPnPClient {
30
31class OHPlaylist;
32class UPnPDeviceDesc;
33class UPnPServiceDesc;
34
35typedef std::shared_ptr<OHPlaylist> OHPLH;
36
41class UPNPP_API OHPlaylist : public Service {
42public:
43 using Service::Service;
44
46 static bool isOHPlService(const std::string& st);
47 bool serviceTypeMatch(const std::string& tp) override;
48
49 int play();
50 int pause();
51 int stop();
52 int next();
53 int previous();
54 int setRepeat(bool onoff);
55 int repeat(bool *on);
56 int setShuffle(bool onoff);
57 int shuffle(bool *on);
58 int seekSecondAbsolute(int value);
59 int seekSecondRelative(int value);
60 int seekId(int value);
61 int seekIndex(int value);
62 enum TPState {TPS_Unknown, TPS_Buffering, TPS_Paused, TPS_Playing,
63 TPS_Stopped
64 };
65 int transportState(TPState *tps);
66 int id(int *value, int timeoutms = -1);
67 int read(int id, std::string* uri, UPnPDirObject *dirent);
68
70 int id;
71 std::string url;
72 UPnPDirObject dirent;
73 void clear() {
74 id = -1;
75 url.clear();
76 dirent.clear();
77 }
78 };
79 int readList(const std::vector<int>& ids,
80 std::vector<TrackListEntry>* entsp);
81
82 int insert(int afterid, const std::string& uri, const std::string& didl,
83 int *nid);
84 int deleteId(int id);
85 int deleteAll();
86 int tracksMax(int *);
87 int idArray(std::vector<int> *ids, int *tokp);
88 int idArrayChanged(int token, bool *changed);
89 int protocolInfo(std::string *proto);
90
91 static int stringToTpState(const std::string& va, TPState *tpp);
92
93protected:
94 /* My service type string */
95 static const std::string SType;
96
97private:
98 void UPNPP_LOCAL evtCallback(
99 const std::unordered_map<std::string, std::string>&);
100 void UPNPP_LOCAL registerCallback() override;
101};
102
103} // namespace UPnPClient
104
105#endif /* _OHPLAYLIST_HXX_INCLUDED_ */
OHPlaylist Service client class.
Definition ohplaylist.hxx:41
Definition service.hxx:88
UPnP Media Server directory entry, converted from XML data.
Definition cdircontent.hxx:60
UPnP Description phase: interpreting the device description which we downloaded from the URL obtained...
Definition avlastchg.cxx:28
Definition ohplaylist.hxx:69