libupnpp  0.16.0
A C++ wrapper for the Portable UPnP reference library
linnsongcast.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 _LINNSONGCAST_H_X_INCLUDED_
19 #define _LINNSONGCAST_H_X_INCLUDED_
20 
21 #include <string>
22 #include <vector>
23 
24 #include "libupnpp/control/device.hxx"
25 #include "libupnpp/control/ohsender.hxx"
26 #include "libupnpp/control/ohreceiver.hxx"
27 #include "libupnpp/control/ohproduct.hxx"
28 
35 namespace UPnPClient {
36 namespace Songcast {
37 
42 OHSNH UPNPP_API senderService(DVCH dev);
43 
48 OHSNH UPNPP_API getSender(const std::string& nm, std::string& reason);
49 
51 struct UPNPP_API SenderState {
52  std::string nm;
53  std::string UDN;
54  std::string uri;
55  std::string meta;
56  std::string reason;
57  bool has_sender;
58 
59  OHPRH prod;
60  OHSNH sender;
61 
62  SenderState() : has_sender(false) { }
63  void reset() {
64  nm = UDN = uri = meta = reason = std::string();
65  has_sender = false;
66  sender.reset();
67  }
68 };
69 
76 void UPNPP_API getSenderState(const std::string& nm, SenderState& st,
77  bool live = true);
78 
80 void UPNPP_API listSenders(std::vector<SenderState>& vscs);
81 
83 struct UPNPP_API ReceiverState {
84  enum SCState {SCRS_GENERROR, SCRS_NOOH, SCRS_NOTRECEIVER,
85  SCRS_STOPPED, SCRS_PLAYING
86  };
87  SCState state;
88  int receiverSourceIndex;
89  std::string nm;
90  std::string UDN;
91  std::string uri;
92  std::string meta;
93  std::string reason;
94 
95  OHPRH prod;
96  OHRCH rcv;
97 
99  : state(SCRS_GENERROR), receiverSourceIndex(-1) {
100  }
101 
102  void reset() {
103  state = ReceiverState::SCRS_GENERROR;
104  receiverSourceIndex = -1;
105  nm = UDN = uri = meta = reason = std::string();
106  prod.reset();
107  rcv.reset();
108  }
109 };
110 
117 bool UPNPP_API setSourceIndex(const std::string& rdrnm, int sourceindex);
118 
125 bool UPNPP_API setSourceIndexByName(const std::string& rdrnm,
126  const std::string& name);
127 
134 void UPNPP_API getReceiverState(const std::string& nm, ReceiverState& st,
135  bool live = true);
137 void UPNPP_API listReceivers(std::vector<ReceiverState>& vscs);
138 
139 bool UPNPP_API setReceiverPlaying(ReceiverState st);
140 bool UPNPP_API setReceiverPlaying(ReceiverState st,
141  const std::string& uri,
142  const std::string& meta);
143 bool UPNPP_API stopReceiver(ReceiverState st);
144 
145 void UPNPP_API setReceiversFromSender(const std::string& sendernm,
146  const std::vector<std::string>& rcvnms);
151 bool UPNPP_API setReceiversFromSenderWithStatus(
152  const std::string& sendernm,
153  const std::vector<std::string>& rcvnms,
154  std::vector<std::string>& reasons);
155 
156 void UPNPP_API setReceiversFromReceiver(const std::string& rcvnm,
157  const std::vector<std::string>& rcvnms);
162 bool UPNPP_API setReceiversFromReceiverWithStatus(
163  const std::string& rcvnm,
164  const std::vector<std::string>& rcvnms,
165  std::vector<std::string>& reasons);
166 
167 void UPNPP_API stopReceivers(const std::vector<std::string>& rcvnms);
172 bool UPNPP_API stopReceiversWithStatus(const std::vector<std::string>& rcvnms,
173  std::vector<std::string>& reasons);
174 
175 void UPNPP_API setReceiversPlaying(const std::vector<std::string>& rcvnms);
176 
177 bool UPNPP_API setReceiversPlayingWithStatus(
178  const std::vector<std::string>& rcvnms,
179  std::vector<std::string>& reasons);
180 
181 }
182 }
183 #endif /* _LINNSONGCAST_H_X_INCLUDED_ */
Everything you need to know about a Sender.
Definition: linnsongcast.hxx:51
Everything you need to know about a Receiver.
Definition: linnsongcast.hxx:83
UPnP Description phase: interpreting the device description which we downloaded from the URL obtained...
Definition: avlastchg.cxx:27