MCP: stubbed device info file loading
[ardour.git] / libs / surfaces / mackie / device_info.cc
1 /*
2         Copyright (C) 2006,2007 John Anderson
3         Copyright (C) 2012 Paul Davis
4
5         This program is free software; you can redistribute it and/or modify
6         it under the terms of the GNU General Public License as published by
7         the Free Software Foundation; either version 2 of the License, or
8         (at your option) any later version.
9
10         This program is distributed in the hope that it will be useful,
11         but WITHOUT ANY WARRANTY; without even the implied warranty of
12         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13         GNU General Public License for more details.
14
15         You should have received a copy of the GNU General Public License
16         along with this program; if not, write to the Free Software
17         Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20 #include "pbd/xml++.h"
21
22 #include "device_info.h"
23
24 #include "i18n.h"
25
26 using namespace Mackie;
27 using namespace PBD;
28 using std::string;
29
30 DeviceInfo::DeviceInfo()
31         : _strip_cnt (8)
32         , _has_two_character_display (true)
33         , _has_master_fader (true)
34         , _has_segmented_display (false)
35         , _has_timecode_display (true)
36         , _name (X_("Mackie Control Universal Pro"))
37 {
38         
39 }
40
41 DeviceInfo::~DeviceInfo()
42 {
43 }
44
45 int
46 DeviceInfo::set_state (const XMLNode& node, int /* version */)
47 {
48         const XMLProperty* prop;
49
50         if ((prop = node.property ("strips")) != 0) {
51                 if ((_strip_cnt = atoi (prop->value())) == 0) {
52                         _strip_cnt = 8;
53                 }
54         }
55
56         if ((prop = node.property ("two-character-display")) != 0) {
57                 _has_two_character_display = string_is_affirmative (prop->value());
58         }
59
60         if ((prop = node.property ("master-fader")) != 0) {
61                 _has_master_fader = string_is_affirmative (prop->value());
62         }
63
64         if ((prop = node.property ("display-segmented")) != 0) {
65                 _has_segmented_display = string_is_affirmative (prop->value());
66         }
67
68         if ((prop = node.property ("timecode-display")) != 0) {
69                 _has_timecode_display = string_is_affirmative (prop->value());
70         }
71
72         if ((prop = node.property ("name")) != 0) {
73                 _name = prop->value();
74         }
75
76         return 0;
77 }
78
79 uint32_t
80 DeviceInfo::strip_cnt() const
81 {
82         return _strip_cnt;
83 }
84
85 bool
86 DeviceInfo::has_master_fader() const
87 {
88         return _has_master_fader;
89 }
90
91 bool
92 DeviceInfo::has_two_character_display() const
93 {
94         return _has_two_character_display;
95 }
96
97 bool
98 DeviceInfo::has_segmented_display() const
99 {
100         return _has_segmented_display;
101 }
102
103 bool
104 DeviceInfo::has_timecode_display () const
105 {
106         return _has_timecode_display;
107 }
108