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 "libupnpp/config.h"
22 
23 #include <unordered_map>
24 #include <memory> // for shared_ptr
25 #include <string> // for string
26 #include <vector> // for vector
27 
28 #include "service.hxx" // for Service
29 
30 
31 namespace UPnPClient {
32 
33 class OHVolume;
34 class UPnPDeviceDesc;
35 class UPnPServiceDesc;
36 
37 typedef std::shared_ptr<OHVolume> OHVLH;
38 
41  int volumeMax;;
44  int volumeUnity;
56  int fadeMax;
57 };
58 
63 class OHVolume : public Service {
64 public:
65 
66  OHVolume(const UPnPDeviceDesc& device, const UPnPServiceDesc& service)
67  : Service(device, service) {
68  }
69  virtual ~OHVolume() {}
70 
71  OHVolume() {}
72 
74  static bool isOHVLService(const std::string& st);
75  virtual bool serviceTypeMatch(const std::string& tp);
76 
77  int characteristics(OHVCharacteristics* c);
78  int volume(int *value);
79  int setVolume(int value);
80  int volumeLimit(int *value);
81  int mute(bool *value);
82  int setMute(bool value);
83 
84 protected:
85  /* My service type string */
86  static const std::string SType;
87 
88 private:
89  void evtCallback(const std::unordered_map<std::string, std::string>&);
90  void registerCallback();
91  int devVolTo0100(int);
92  int vol0100ToDev(int vol);
93  int maybeInitVolmax();
94 
95  int m_volmax{-1};
96 };
97 
98 } // namespace UPnPClient
99 
100 #endif /* _OHVOLUME_HXX_INCLUDED_ */
int volumeMax
VolumeMax defines the absolute maximum Volume setting.
Definition: ohvolume.hxx:41
int volumeUnity
VolumeUnity defines the value of Volume that will result in unity system gain (i.e.
Definition: ohvolume.hxx:41
OHVolume Service client class.
Definition: ohvolume.hxx:63
Definition: service.hxx:73
int volumeMilliDbPerStep
VolumeMilliDbPerStep defines the size of each volume step in binary milli decibels (mibi dB)...
Definition: ohvolume.hxx:50
int volumeSteps
VolumeSteps defines the number of step increments required to increase the Volume from zero to Volume...
Definition: ohvolume.hxx:47
int fadeMax
FadeMax defines the maximum Fade setting.
Definition: ohvolume.hxx:56
Definition: ohvolume.hxx:39
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:28
int balanceMax
BalanceMax defines the maximum Balance setting.
Definition: ohvolume.hxx:53