-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathappInterface.h
More file actions
89 lines (65 loc) · 1.65 KB
/
Copy pathappInterface.h
File metadata and controls
89 lines (65 loc) · 1.65 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
// Interface used by the android app.
#pragma once
#include <map>
#include <string>
#include <vector>
#include <boost/property_tree/ptree.hpp>
#include <Denon/network/http.h>
#include <Denon/serial.h>
namespace Denon {
// https://blue-pc.net/2013/12/28/denon-av-reciever-ueber-http-steuern/
//
// Connect to
// http://192.168.4.7:8080/goform/Deviceinfo.xml
struct DeviceCapabilities
{
};
struct ZoneCapabilities
{
};
struct DeviceInfo
{
int version;
int commApiVersion;
std::string catName;
std::string modelName;
std::string manualModelName;
std::string mac;
DeviceCapabilities capabilities;
std::vector<ZoneCapabilities> zoneCapabilities;
};
struct ZoneStatus
{
std::string power;
std::string source;
double volume;
std::string mute;
};
struct DeviceStatus
{
std::map<std::string, ZoneStatus> zones;
std::string surround;
};
class AppInterface:
public CommandConnection
{
public:
//AppInterface(std::string host, int port=8080);
AppInterface(std::unique_ptr<Http::BlockingConnection>&& con);
~AppInterface() = default;
DeviceInfo GetDeviceInfo();
DeviceStatus GetDeviceStatus();
/// Movie, Pure, Music, Game
void SetSoundMode(int mode);
/// CommandConnection
void Send(const std::string&) override;
private:
const Http::Response& Get(std::string path);
const Http::Response& Post(std::string path, std::string body);
boost::property_tree::ptree Parse(const Http::Response&);
// Application Command
const Http::Response& AppCommand(std::vector<std::string> attributes);
const Http::Response& AppCommand3(std::vector<boost::property_tree::ptree> commands);
std::unique_ptr<Http::BlockingConnection> m_http;
};
} // namespace Denon