root/trunk/libffado/src/bebob/terratec/terratec_cmd.cpp

Revision 618, 5.5 kB (checked in by ppalmers, 17 years ago)

move serialization routines to libutil such that they can be used for non-AVC stuff too (fireworks EFC)

Line 
1 /*
2  * Copyright (C) 2005-2007 by Pieter Palmers
3  *
4  * This file is part of FFADO
5  * FFADO = Free Firewire (pro-)audio drivers for linux
6  *
7  * FFADO is based upon FreeBoB
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License version 2.1, as published by the Free Software Foundation;
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21  * MA 02110-1301 USA
22  */
23
24 #include "terratec_cmd.h"
25
26 #include <netinet/in.h>
27 #include <iostream>
28
29 using namespace std;
30 using namespace AVC;
31
32 namespace BeBoB {
33 namespace Terratec {
34
35 TerratecVendorDependentCmd::TerratecVendorDependentCmd(Ieee1394Service& ieee1394service)
36     : VendorDependentCmd( ieee1394service )
37     , m_subfunction ( 0x00 )
38 {
39     m_companyId=0x000aac;
40 }
41
42 bool
43 TerratecVendorDependentCmd::serialize( Util::IOSSerialize& se )
44 {
45     bool result=true;
46     result &= VendorDependentCmd::serialize( se );
47     result &= se.write(m_subfunction,"TerratecVendorDependentCmd subfunction");
48
49     return result;
50 }
51
52 bool
53 TerratecVendorDependentCmd::deserialize( Util::IISDeserialize& de )
54 {
55     bool result=true;
56     result &= VendorDependentCmd::deserialize( de );
57     result &= de.read(&m_subfunction);
58
59
60     return result;
61 }
62
63 //---------
64
65 TerratecSyncStateCmd::TerratecSyncStateCmd(Ieee1394Service& ieee1394service)
66     : TerratecVendorDependentCmd( ieee1394service )
67 {
68     m_subfunction=0x21;
69 }
70
71 bool
72 TerratecSyncStateCmd::serialize( Util::IOSSerialize& se )
73 {
74     bool result=true;
75     result &= TerratecVendorDependentCmd::serialize( se );
76     result &= se.write(m_syncstate,"TerratecSyncStateCmd m_syncstate");
77     return result;
78 }
79
80 bool
81 TerratecSyncStateCmd::deserialize( Util::IISDeserialize& de )
82 {
83     bool result=true;
84     result &= TerratecVendorDependentCmd::deserialize( de );
85     result &= de.read(&m_syncstate);
86     return result;
87 }
88
89 //---------
90
91 TerratecStoreMixerSettingsCmd::TerratecStoreMixerSettingsCmd(Ieee1394Service& ieee1394service)
92     : TerratecVendorDependentCmd( ieee1394service )
93 {
94     m_subfunction=0x22;
95 }
96
97 bool
98 TerratecStoreMixerSettingsCmd::serialize( Util::IOSSerialize& se )
99 {
100     return TerratecVendorDependentCmd::serialize( se );;
101 }
102
103 bool
104 TerratecStoreMixerSettingsCmd::deserialize( Util::IISDeserialize& de )
105 {
106     return TerratecVendorDependentCmd::deserialize( de );;
107 }
108
109
110 //---------
111
112 TerratecSetMidiRemoteChannelCmd::TerratecSetMidiRemoteChannelCmd(Ieee1394Service& ieee1394service)
113     : TerratecVendorDependentCmd( ieee1394service )
114 {
115     m_subfunction=0x23;
116 }
117
118 bool
119 TerratecSetMidiRemoteChannelCmd::serialize( Util::IOSSerialize& se )
120 {
121     bool result=true;
122     result &= TerratecVendorDependentCmd::serialize( se );
123     result &= se.write(m_midichannel,"TerratecSetMidiRemoteChannelCmd m_midichannel");
124     return result;
125 }
126
127 bool
128 TerratecSetMidiRemoteChannelCmd::deserialize( Util::IISDeserialize& de )
129 {
130     bool result=true;
131     result &= TerratecVendorDependentCmd::deserialize( de );
132     result &= de.read(&m_midichannel);
133     return result;
134 }
135
136 //---------
137
138 TerratecSetMidiControlCmd::TerratecSetMidiControlCmd(Ieee1394Service& ieee1394service)
139     : TerratecVendorDependentCmd( ieee1394service )
140 {
141     m_subfunction=0x24;
142 }
143
144 bool
145 TerratecSetMidiControlCmd::serialize( Util::IOSSerialize& se )
146 {
147     bool result=true;
148     result &= TerratecVendorDependentCmd::serialize( se );
149     result &= se.write(m_mixercontrol,"TerratecSetMidiControlCmd m_mixercontrol");
150     result &= se.write(m_midicontroller,"TerratecSetMidiControlCmd m_midicontroller");
151     return result;
152 }
153
154 bool
155 TerratecSetMidiControlCmd::deserialize( Util::IISDeserialize& de )
156 {
157     bool result=true;
158     result &= TerratecVendorDependentCmd::deserialize( de );
159     result &= de.read(&m_mixercontrol);
160     result &= de.read(&m_midicontroller);
161     return result;
162 }
163
164 //---------
165
166 TerratecSetDefaultRoutingCmd::TerratecSetDefaultRoutingCmd(Ieee1394Service& ieee1394service)
167     : TerratecVendorDependentCmd( ieee1394service )
168 {
169     m_subfunction=0x25;
170 }
171
172 bool
173 TerratecSetDefaultRoutingCmd::serialize( Util::IOSSerialize& se )
174 {
175     bool result=true;
176     result &= TerratecVendorDependentCmd::serialize( se );
177     result &= se.write(m_output,"TerratecSetDefaultRoutingCmd m_output");
178     result &= se.write(m_source,"TerratecSetDefaultRoutingCmd m_source");
179     return result;
180 }
181
182 bool
183 TerratecSetDefaultRoutingCmd::deserialize( Util::IISDeserialize& de )
184 {
185     bool result=true;
186     result &= TerratecVendorDependentCmd::deserialize( de );
187     result &= de.read(&m_output);
188     result &= de.read(&m_source);
189     return result;
190 }
191
192 //---------
193
194 TerratecDeviceIdCmd::TerratecDeviceIdCmd(Ieee1394Service& ieee1394service)
195     : TerratecVendorDependentCmd( ieee1394service )
196 {
197     m_subfunction=0x26;
198 }
199
200 bool
201 TerratecDeviceIdCmd::serialize( Util::IOSSerialize& se )
202 {
203     bool result=true;
204     result &= TerratecVendorDependentCmd::serialize( se );
205     result &= se.write(m_deviceid,"TerratecDeviceIdCmd m_deviceid");
206     return result;
207 }
208
209 bool
210 TerratecDeviceIdCmd::deserialize( Util::IISDeserialize& de )
211 {
212     bool result=true;
213     result &= TerratecVendorDependentCmd::deserialize( de );
214     result &= de.read(&m_deviceid);
215     return result;
216 }
217
218 }
219 }
Note: See TracBrowser for help on using the browser.