Parent: [a1d62b] (diff)

Child: [5997b7] (diff)

Download this file

linnsongcast.hxx    134 lines (113 with data), 4.2 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/* Copyright (C) 2015 J.F.Dockes
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _LINNSONGCAST_H_X_INCLUDED_
#define _LINNSONGCAST_H_X_INCLUDED_
#include <string>
#include <vector>
#include "libupnpp/control/device.hxx"
#include "libupnpp/control/ohsender.hxx"
#include "libupnpp/control/ohreceiver.hxx"
#include "libupnpp/control/ohproduct.hxx"
/**
* Helper functions for dealing with Linn Songcast Sender and Receiver
* UPnP services. These deal with plumbing set up, and do not touch the
* audio stream at all.
*/
namespace UPnPClient {
namespace Songcast {
/**
* Search the device for a Sender service and, if found, create and
* return a service object.
*/
extern OHSNH senderService(DVCH dev);
/**
* Find device with given name (try friendly, then uuid), and
* return the result of senderService()
*/
extern OHSNH getSender(const std::string& nm, std::string& reason);
/** Everything you need to know about a Sender */
struct SenderState {
std::string nm;
std::string UDN;
std::string uri;
std::string meta;
std::string reason;
bool has_sender;
OHSNH sender;
SenderState() : has_sender(false) { }
void reset() {
nm = UDN = uri = meta = reason = std::string();
has_sender = false;
sender.reset();
}
};
/** Retrieve the Sender service status for device nm (friendly or uuid)
*
* @param live if true, if the service is found, the 'sender'
* field will hold a handle to it on return
*/
extern void getSenderState(const std::string& nm, SenderState& st,
bool live = true);
/** Retrieve status data for all found Senders */
extern void listSenders(std::vector<SenderState>& vscs);
/** Everything you need to know about a Receiver */
struct ReceiverState {
enum SCState {SCRS_GENERROR, SCRS_NOOH, SCRS_NOTRECEIVER,
SCRS_STOPPED, SCRS_PLAYING};
SCState state;
int receiverSourceIndex;
std::string nm;
std::string UDN;
std::string uri;
std::string meta;
std::string reason;
OHPRH prod;
OHRCH rcv;
ReceiverState()
: state(SCRS_GENERROR), receiverSourceIndex(-1) {
}
void reset() {
state = ReceiverState::SCRS_GENERROR;
receiverSourceIndex = -1;
nm = UDN = uri = meta = reason = std::string();
prod.reset();
rcv.reset();
}
};
/** Retrieve the Receiver service status for device nm (friendly or uuid)
*
* @param live if true, if the service is found, the 'prod' and 'rcv'
* field will hold Service handles on return
*/
extern void getReceiverState(const std::string& nm, ReceiverState& st,
bool live = true);
/** Get status for all found Receiver services */
extern void listReceivers(std::vector<ReceiverState>& vscs);
extern bool setReceiverPlaying(ReceiverState st,
const std::string& uri,
const std::string& meta);
extern bool stopReceiver(ReceiverState st);
extern void setReceiversFromSender(const std::string& sendernm,
const std::vector<std::string>&
rcvnms);
extern void setReceiversFromReceiver(const std::string& rcvnm,
const std::vector<std::string>&
rcvnms);
extern void stopReceivers(const std::vector<std::string>& rcvnms);
}
}
#endif /* _LINNSONGCAST_H_X_INCLUDED_ */