libupnpp  0.16.0
A C++ wrapper for the Portable UPnP reference library
ohvolume.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 _OHVOLUME_HXX_INCLUDED_
19 #define _OHVOLUME_HXX_INCLUDED_
20 
21 #include <unordered_map>
22 #include <memory>
23 #include <string>
24 #include <vector>
25 
26 #include "service.hxx"
27 
28 
29 namespace UPnPClient {
30 
31 class OHVolume;
32 class UPnPDeviceDesc;
33 class UPnPServiceDesc;
34 
35 typedef std::shared_ptr<OHVolume> OHVLH;
36 
39  int volumeMax;;
42  int volumeUnity;
54  int fadeMax;
55 };
56 
61 class UPNPP_API OHVolume : public Service {
62 public:
63 
64  OHVolume(const UPnPDeviceDesc& device, const UPnPServiceDesc& service)
65  : Service(device, service) {
66  }
67  virtual ~OHVolume() {}
68 
69  OHVolume() {}
70 
72  static bool isOHVLService(const std::string& st);
73  virtual bool serviceTypeMatch(const std::string& tp);
74 
75  int characteristics(OHVCharacteristics* c);
80  int volume(int *value);
85  int setVolume(int value);
86  int volumeLimit(int *value);
87  int mute(bool *value);
88  int setMute(bool value);
89 
90 protected:
91  /* My service type string */
92  static const std::string SType;
93 
94 private:
95  void UPNPP_LOCAL evtCallback(
96  const std::unordered_map<std::string, std::string>&);
97  void UPNPP_LOCAL registerCallback();
98  int UPNPP_LOCAL devVolTo0100(int);
99  int UPNPP_LOCAL vol0100ToDev(int vol);
100  int UPNPP_LOCAL maybeInitVolmax();
101 
102  int m_volmax{-1};
103 };
104 
105 } // namespace UPnPClient
106 
107 #endif /* _OHVOLUME_HXX_INCLUDED_ */
int volumeMax
VolumeMax defines the absolute maximum Volume setting.
Definition: ohvolume.hxx:39
int volumeUnity
VolumeUnity defines the value of Volume that will result in unity system gain (i.e.
Definition: ohvolume.hxx:39
OHVolume Service client class.
Definition: ohvolume.hxx:61
Definition: service.hxx:82
int volumeMilliDbPerStep
VolumeMilliDbPerStep defines the size of each volume step in binary milli decibels (mibi dB)...
Definition: ohvolume.hxx:48
int volumeSteps
VolumeSteps defines the number of step increments required to increase the Volume from zero to Volume...
Definition: ohvolume.hxx:45
int fadeMax
FadeMax defines the maximum Fade setting.
Definition: ohvolume.hxx:54
Definition: ohvolume.hxx:37
Data holder for a UPnP service, parsed from the device XML description.
Definition: description.hxx:46
Data holder for a UPnP device, parsed from the XML description obtained during discovery.
Definition: description.hxx:142
UPnP Description phase: interpreting the device description which we downloaded from the URL obtained...
Definition: avlastchg.cxx:27
int balanceMax
BalanceMax defines the maximum Balance setting.
Definition: ohvolume.hxx:51