bebob: improve support for PreSonus Inspire1394
[ffado.git] / libffado / src / bebob / presonus / inspire1394_avdevice.h
blob69744acf9fc7b4d6e77f30432e860b3e0bfdf127
1 /*
2 * Copyright (C) 2014 by Takashi Sakamoto
3 * Copyright (C) 2005-2008 by Daniel Wagner
4 * Copyright (C) 2005-2008 by Pieter Palmers
6 * This file is part of FFADO
7 * FFADO = Free Firewire (pro-)audio drivers for linux
9 * FFADO is based upon FreeBoB.
11 * This program is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation, either version 2 of the License, or
14 * (at your option) version 3 of the License.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program. If not, see <http://www.gnu.org/licenses/>.
26 #ifndef BEBOB_PRESONUS_INSPIRE1394_DEVICE_H
27 #define BEBOB_PRESONUS_INSPIRE1394_DEVICE_H
29 #include "debugmodule/debugmodule.h"
30 #include "bebob/bebob_avdevice.h"
32 #include "libavc/general/avc_vendor_dependent_cmd.h"
34 namespace BeBoB {
35 namespace Presonus {
37 enum EInspire1394CmdSubfunc {
38 EInspire1394CmdSubfuncPhono = 0,
39 EInspire1394CmdSubfuncPhantom,
40 EInspire1394CmdSubfuncBoost,
41 EInspire1394CmdSubfuncLimit
44 class Inspire1394Device : public BeBoB::Device {
45 public:
46 Inspire1394Device( DeviceManager& d, std::auto_ptr<ConfigRom>( configRom ));
47 virtual ~Inspire1394Device();
49 virtual void showDevice();
51 bool setSpecificValue(EInspire1394CmdSubfunc subfunc,
52 int idx, uint8_t val);
53 bool getSpecificValue(EInspire1394CmdSubfunc subfunc,
54 int idx, uint8_t *val);
55 private:
56 bool addSpecificControls(void);
59 class Inspire1394Cmd : public AVC::VendorDependentCmd
61 public:
62 Inspire1394Cmd( Ieee1394Service& ieee1394service );
63 virtual ~Inspire1394Cmd() {};
65 virtual bool serialize( Util::Cmd::IOSSerialize& se);
66 virtual bool deserialize( Util::Cmd::IISDeserialize& de );
68 virtual const char* getCmdName() const
69 { return "Inspire1394Cmd"; }
71 virtual void setSubfunc(uint8_t subfunc)
72 { m_subfunc = subfunc; }
73 virtual void setIdx(int idx)
74 { m_idx = idx; }
75 virtual void setArg(int arg)
76 { m_arg = arg; }
78 virtual int getArg(void)
79 { return m_arg; }
81 protected:
82 uint8_t m_subfunc;
83 uint8_t m_idx;
84 uint8_t m_arg;
87 class BinaryControl : public Control::Discrete
89 public:
90 BinaryControl(Inspire1394Device& parent,
91 EInspire1394CmdSubfunc subfunc,
92 std::string name, std::string label, std::string desc);
94 virtual bool setValue(int idx, int val);
95 virtual int getValue(int idx);
96 virtual bool setValue(int val)
97 { return setValue(0, val); }
98 virtual int getValue(void)
99 { return getValue(0); }
101 virtual int getMinimum() { return 0; };
102 virtual int getMaximum() { return 1; };
104 private:
105 Inspire1394Device& m_Parent;
106 EInspire1394CmdSubfunc m_subfunc;
109 } // namespace Presonus
110 } // namespace BeBoB
112 #endif