|
a/src/ohreceiver.hxx |
|
b/src/ohreceiver.hxx |
|
... |
|
... |
23 |
#include <memory>
|
23 |
#include <memory>
|
24 |
|
24 |
|
25 |
#include "libupnpp/device/device.hxx" // for UpnpService
|
25 |
#include "libupnpp/device/device.hxx" // for UpnpService
|
26 |
#include "libupnpp/soaphelp.hxx" // for SoapIncoming, SoapOutgoing
|
26 |
#include "libupnpp/soaphelp.hxx" // for SoapIncoming, SoapOutgoing
|
27 |
|
27 |
|
|
|
28 |
#include "ohservice.hxx"
|
28 |
#include "execmd.h"
|
29 |
#include "execmd.h"
|
29 |
|
30 |
|
30 |
using namespace UPnPP;
|
31 |
using namespace UPnPP;
|
31 |
class UpMpd;
|
32 |
class UpMpd;
|
32 |
class OHPlaylist;
|
33 |
class OHPlaylist;
|
|
... |
|
... |
38 |
int httpport;
|
39 |
int httpport;
|
39 |
std::string sc2mpdpath;
|
40 |
std::string sc2mpdpath;
|
40 |
OHReceiverParams() : pm(OHRP_MPD), httpport(8768) {}
|
41 |
OHReceiverParams() : pm(OHRP_MPD), httpport(8768) {}
|
41 |
};
|
42 |
};
|
42 |
|
43 |
|
43 |
class OHReceiver : public UPnPProvider::UpnpService {
|
44 |
class OHReceiver : public OHService {
|
44 |
public:
|
45 |
public:
|
45 |
OHReceiver(UpMpd *dev, const OHReceiverParams& parms);
|
46 |
OHReceiver(UpMpd *dev, const OHReceiverParams& parms);
|
46 |
|
|
|
47 |
virtual bool getEventData(bool all, std::vector<std::string>& names,
|
|
|
48 |
std::vector<std::string>& values);
|
|
|
49 |
|
47 |
|
50 |
bool iStop();
|
48 |
bool iStop();
|
51 |
bool iPlay();
|
49 |
bool iPlay();
|
52 |
bool iSetSender(const std::string& uri, const std::string& meta);
|
50 |
bool iSetSender(const std::string& uri, const std::string& meta);
|
53 |
OHReceiverParams::PlayMethod playMethod() {return m_pm;}
|
51 |
OHReceiverParams::PlayMethod playMethod() {return m_pm;}
|
54 |
|
52 |
|
55 |
// Source active ?
|
53 |
// Source active ?
|
56 |
void setActive(bool onoff) {
|
54 |
void setActive(bool onoff) {
|
57 |
m_active = onoff;
|
55 |
m_active = onoff;
|
58 |
}
|
56 |
}
|
59 |
|
57 |
|
|
|
58 |
protected:
|
|
|
59 |
virtual bool makestate(std::unordered_map<std::string, std::string> &st);
|
60 |
private:
|
60 |
private:
|
61 |
int play(const SoapIncoming& sc, SoapOutgoing& data);
|
61 |
int play(const SoapIncoming& sc, SoapOutgoing& data);
|
62 |
int stop(const SoapIncoming& sc, SoapOutgoing& data);
|
62 |
int stop(const SoapIncoming& sc, SoapOutgoing& data);
|
63 |
int setSender(const SoapIncoming& sc, SoapOutgoing& data);
|
63 |
int setSender(const SoapIncoming& sc, SoapOutgoing& data);
|
64 |
int sender(const SoapIncoming& sc, SoapOutgoing& data);
|
64 |
int sender(const SoapIncoming& sc, SoapOutgoing& data);
|
65 |
int protocolInfo(const SoapIncoming& sc, SoapOutgoing& data);
|
65 |
int protocolInfo(const SoapIncoming& sc, SoapOutgoing& data);
|
66 |
int transportState(const SoapIncoming& sc, SoapOutgoing& data);
|
66 |
int transportState(const SoapIncoming& sc, SoapOutgoing& data);
|
67 |
|
67 |
|
68 |
bool makestate(std::unordered_map<std::string, std::string> &st);
|
|
|
69 |
void maybeWakeUp(bool ok);
|
68 |
void maybeWakeUp(bool ok);
|
70 |
|
69 |
|
71 |
// State variable storage (previous state)
|
|
|
72 |
std::unordered_map<std::string, std::string> m_state;
|
|
|
73 |
// Current
|
70 |
// Current
|
74 |
std::string m_uri;
|
71 |
std::string m_uri;
|
75 |
std::string m_metadata;
|
72 |
std::string m_metadata;
|
76 |
|
73 |
|
77 |
UpMpd *m_dev;
|
|
|
78 |
bool m_active;
|
74 |
bool m_active;
|
79 |
std::shared_ptr<ExecCmd> m_cmd;
|
75 |
std::shared_ptr<ExecCmd> m_cmd;
|
80 |
int m_httpport;
|
76 |
int m_httpport;
|
81 |
std::string m_sc2mpdpath;
|
77 |
std::string m_sc2mpdpath;
|
82 |
std::string m_httpuri;
|
78 |
std::string m_httpuri;
|