1 |
/* |
---|
2 |
* Copyright (C) 2005-2007 by Daniel Wagner |
---|
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 program is free software: you can redistribute it and/or modify |
---|
10 |
* it under the terms of the GNU General Public License as published by |
---|
11 |
* the Free Software Foundation, either version 3 of the License, or |
---|
12 |
* (at your option) any later version. |
---|
13 |
* |
---|
14 |
* This program is distributed in the hope that it will be useful, |
---|
15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
17 |
* GNU General Public License for more details. |
---|
18 |
* |
---|
19 |
* You should have received a copy of the GNU General Public License |
---|
20 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
21 |
* |
---|
22 |
*/ |
---|
23 |
|
---|
24 |
#include "avc_extended_cmd_generic.h" |
---|
25 |
#include "libutil/cmd_serialize.h" |
---|
26 |
#include "libieee1394/ieee1394service.h" |
---|
27 |
|
---|
28 |
namespace AVC { |
---|
29 |
|
---|
30 |
UnitPlugAddress::UnitPlugAddress( EPlugType plugType, plug_type_t plugId ) |
---|
31 |
: m_plugType( plugType ) |
---|
32 |
, m_plugId( plugId ) |
---|
33 |
, m_reserved( 0xff ) |
---|
34 |
{ |
---|
35 |
} |
---|
36 |
|
---|
37 |
UnitPlugAddress::~UnitPlugAddress() |
---|
38 |
{ |
---|
39 |
} |
---|
40 |
|
---|
41 |
bool |
---|
42 |
UnitPlugAddress::serialize( Util::Cmd::IOSSerialize& se ) |
---|
43 |
{ |
---|
44 |
se.write( m_plugType, "UnitPlugAddress plugType" ); |
---|
45 |
se.write( m_plugId, "UnitPlugAddress plugId" ); |
---|
46 |
se.write( m_reserved, "UnitPlugAddress reserved" ); |
---|
47 |
return true; |
---|
48 |
} |
---|
49 |
|
---|
50 |
bool |
---|
51 |
UnitPlugAddress::deserialize( Util::Cmd::IISDeserialize& de ) |
---|
52 |
{ |
---|
53 |
de.read( &m_plugType ); |
---|
54 |
de.read( &m_plugId ); |
---|
55 |
de.read( &m_reserved ); |
---|
56 |
return true; |
---|
57 |
} |
---|
58 |
|
---|
59 |
UnitPlugAddress* |
---|
60 |
UnitPlugAddress::clone() const |
---|
61 |
{ |
---|
62 |
return new UnitPlugAddress( *this ); |
---|
63 |
} |
---|
64 |
|
---|
65 |
//////////////////////////////////////////////////////////// |
---|
66 |
|
---|
67 |
SubunitPlugAddress::SubunitPlugAddress( plug_id_t plugId ) |
---|
68 |
: m_plugId( plugId ) |
---|
69 |
, m_reserved0( 0xff ) |
---|
70 |
, m_reserved1( 0xff ) |
---|
71 |
{ |
---|
72 |
} |
---|
73 |
|
---|
74 |
SubunitPlugAddress::~SubunitPlugAddress() |
---|
75 |
{ |
---|
76 |
} |
---|
77 |
|
---|
78 |
bool |
---|
79 |
SubunitPlugAddress::serialize( Util::Cmd::IOSSerialize& se ) |
---|
80 |
{ |
---|
81 |
se.write( m_plugId, "SubunitPlugAddress plugId" ); |
---|
82 |
se.write( m_reserved0, "SubunitPlugAddress reserved0" ); |
---|
83 |
se.write( m_reserved1, "SubunitPlugAddress reserved1" ); |
---|
84 |
return true; |
---|
85 |
} |
---|
86 |
|
---|
87 |
bool |
---|
88 |
SubunitPlugAddress::deserialize( Util::Cmd::IISDeserialize& de ) |
---|
89 |
{ |
---|
90 |
de.read( &m_plugId ); |
---|
91 |
de.read( &m_reserved0 ); |
---|
92 |
de.read( &m_reserved1 ); |
---|
93 |
return true; |
---|
94 |
} |
---|
95 |
|
---|
96 |
SubunitPlugAddress* |
---|
97 |
SubunitPlugAddress::clone() const |
---|
98 |
{ |
---|
99 |
return new SubunitPlugAddress( *this ); |
---|
100 |
} |
---|
101 |
|
---|
102 |
//////////////////////////////////////////////////////////// |
---|
103 |
|
---|
104 |
FunctionBlockPlugAddress::FunctionBlockPlugAddress( function_block_type_t functionBlockType, |
---|
105 |
function_block_id_t functionBlockId, |
---|
106 |
plug_id_t plugId ) |
---|
107 |
: m_functionBlockType( functionBlockType ) |
---|
108 |
, m_functionBlockId( functionBlockId ) |
---|
109 |
, m_plugId( plugId ) |
---|
110 |
{ |
---|
111 |
} |
---|
112 |
|
---|
113 |
FunctionBlockPlugAddress::~FunctionBlockPlugAddress() |
---|
114 |
{ |
---|
115 |
} |
---|
116 |
|
---|
117 |
bool |
---|
118 |
FunctionBlockPlugAddress::serialize( Util::Cmd::IOSSerialize& se ) |
---|
119 |
{ |
---|
120 |
se.write( m_functionBlockType, "FunctionBlockPlugAddress functionBlockType" ); |
---|
121 |
se.write( m_functionBlockId, "FunctionBlockPlugAddress functionBlockId" ); |
---|
122 |
se.write( m_plugId, "FunctionBlockPlugAddress plugId" ); |
---|
123 |
return true; |
---|
124 |
} |
---|
125 |
|
---|
126 |
bool |
---|
127 |
FunctionBlockPlugAddress::deserialize( Util::Cmd::IISDeserialize& de ) |
---|
128 |
{ |
---|
129 |
de.read( &m_functionBlockType ); |
---|
130 |
de.read( &m_functionBlockId ); |
---|
131 |
de.read( &m_plugId ); |
---|
132 |
return true; |
---|
133 |
} |
---|
134 |
|
---|
135 |
FunctionBlockPlugAddress* |
---|
136 |
FunctionBlockPlugAddress:: clone() const |
---|
137 |
{ |
---|
138 |
return new FunctionBlockPlugAddress( *this ); |
---|
139 |
} |
---|
140 |
|
---|
141 |
//////////////////////////////////////////////////////////// |
---|
142 |
|
---|
143 |
UndefinedPlugAddress::UndefinedPlugAddress() |
---|
144 |
: m_reserved0( 0xff ) |
---|
145 |
, m_reserved1( 0xff ) |
---|
146 |
, m_reserved2( 0xff ) |
---|
147 |
{ |
---|
148 |
} |
---|
149 |
|
---|
150 |
UndefinedPlugAddress::~UndefinedPlugAddress() |
---|
151 |
{ |
---|
152 |
} |
---|
153 |
|
---|
154 |
bool |
---|
155 |
UndefinedPlugAddress::serialize( Util::Cmd::IOSSerialize& se ) |
---|
156 |
{ |
---|
157 |
se.write( m_reserved0, "UndefinedPlugAddress reserved0" ); |
---|
158 |
se.write( m_reserved1, "UndefinedPlugAddress reserved1" ); |
---|
159 |
se.write( m_reserved2, "UndefinedPlugAddress reserved2" ); |
---|
160 |
return true; |
---|
161 |
} |
---|
162 |
|
---|
163 |
bool |
---|
164 |
UndefinedPlugAddress::deserialize( Util::Cmd::IISDeserialize& de ) |
---|
165 |
{ |
---|
166 |
de.read( &m_reserved0 ); |
---|
167 |
de.read( &m_reserved1 ); |
---|
168 |
de.read( &m_reserved2 ); |
---|
169 |
return true; |
---|
170 |
} |
---|
171 |
|
---|
172 |
UndefinedPlugAddress* |
---|
173 |
UndefinedPlugAddress:: clone() const |
---|
174 |
{ |
---|
175 |
return new UndefinedPlugAddress( *this ); |
---|
176 |
} |
---|
177 |
|
---|
178 |
//////////////////////////////////////////////////////////// |
---|
179 |
//////////////////////////////////////////////////////////// |
---|
180 |
|
---|
181 |
UnitPlugSpecificDataPlugAddress::UnitPlugSpecificDataPlugAddress( EPlugType plugType, plug_type_t plugId ) |
---|
182 |
: m_plugType( plugType ) |
---|
183 |
, m_plugId( plugId ) |
---|
184 |
, m_reserved0( 0xff ) |
---|
185 |
, m_reserved1( 0xff ) |
---|
186 |
, m_reserved2( 0xff ) |
---|
187 |
{ |
---|
188 |
} |
---|
189 |
|
---|
190 |
UnitPlugSpecificDataPlugAddress::~UnitPlugSpecificDataPlugAddress() |
---|
191 |
{ |
---|
192 |
} |
---|
193 |
|
---|
194 |
bool |
---|
195 |
UnitPlugSpecificDataPlugAddress::serialize( Util::Cmd::IOSSerialize& se ) |
---|
196 |
{ |
---|
197 |
se.write( m_plugType, "UnitPlugSpecificDataPlugAddress plugType" ); |
---|
198 |
se.write( m_plugId, "UnitPlugSpecificDataPlugAddress plugId" ); |
---|
199 |
se.write( m_reserved0, "UnitPlugSpecificDataPlugAddress reserved0" ); |
---|
200 |
se.write( m_reserved1, "UnitPlugSpecificDataPlugAddress reserved1" ); |
---|
201 |
se.write( m_reserved2, "UnitPlugSpecificDataPlugAddress reserved2" ); |
---|
202 |
return true; |
---|
203 |
} |
---|
204 |
|
---|
205 |
bool |
---|
206 |
UnitPlugSpecificDataPlugAddress::deserialize( Util::Cmd::IISDeserialize& de ) |
---|
207 |
{ |
---|
208 |
de.read( &m_plugType ); |
---|
209 |
de.read( &m_plugId ); |
---|
210 |
de.read( &m_reserved0 ); |
---|
211 |
de.read( &m_reserved1 ); |
---|
212 |
de.read( &m_reserved2 ); |
---|
213 |
return true; |
---|
214 |
} |
---|
215 |
|
---|
216 |
UnitPlugSpecificDataPlugAddress* |
---|
217 |
UnitPlugSpecificDataPlugAddress::clone() const |
---|
218 |
{ |
---|
219 |
return new UnitPlugSpecificDataPlugAddress( *this ); |
---|
220 |
} |
---|
221 |
|
---|
222 |
//////////////////////////////////////////////////////////// |
---|
223 |
|
---|
224 |
SubunitPlugSpecificDataPlugAddress::SubunitPlugSpecificDataPlugAddress( |
---|
225 |
ESubunitType subunitType, |
---|
226 |
subunit_id_t subunitId, |
---|
227 |
plug_id_t plugId ) |
---|
228 |
: m_subunitType( subunitType ) |
---|
229 |
, m_subunitId( subunitId ) |
---|
230 |
, m_plugId( plugId ) |
---|
231 |
, m_reserved0( 0xff ) |
---|
232 |
, m_reserved1( 0xff ) |
---|
233 |
{ |
---|
234 |
} |
---|
235 |
|
---|
236 |
SubunitPlugSpecificDataPlugAddress::~SubunitPlugSpecificDataPlugAddress() |
---|
237 |
{ |
---|
238 |
} |
---|
239 |
|
---|
240 |
bool |
---|
241 |
SubunitPlugSpecificDataPlugAddress::serialize( Util::Cmd::IOSSerialize& se ) |
---|
242 |
{ |
---|
243 |
se.write( m_subunitType, "SubunitPlugSpecificDataPlugAddress subunitType" ); |
---|
244 |
se.write( m_subunitId, "SubunitPlugSpecificDataPlugAddress subunitId" ); |
---|
245 |
se.write( m_plugId, "SubunitPlugSpecificDataPlugAddress plugId" ); |
---|
246 |
se.write( m_reserved0, "SubunitPlugSpecificDataPlugAddress reserved0" ); |
---|
247 |
se.write( m_reserved1, "SubunitPlugSpecificDataPlugAddress reserved1" ); |
---|
248 |
return true; |
---|
249 |
} |
---|
250 |
|
---|
251 |
bool |
---|
252 |
SubunitPlugSpecificDataPlugAddress::deserialize( Util::Cmd::IISDeserialize& de ) |
---|
253 |
{ |
---|
254 |
de.read( &m_subunitType ); |
---|
255 |
de.read( &m_subunitId ); |
---|
256 |
de.read( &m_plugId ); |
---|
257 |
de.read( &m_reserved0 ); |
---|
258 |
de.read( &m_reserved1 ); |
---|
259 |
return true; |
---|
260 |
} |
---|
261 |
|
---|
262 |
SubunitPlugSpecificDataPlugAddress* |
---|
263 |
SubunitPlugSpecificDataPlugAddress::clone() const |
---|
264 |
{ |
---|
265 |
return new SubunitPlugSpecificDataPlugAddress( *this ); |
---|
266 |
} |
---|
267 |
|
---|
268 |
//////////////////////////////////////////////////////////// |
---|
269 |
|
---|
270 |
FunctionBlockPlugSpecificDataPlugAddress::FunctionBlockPlugSpecificDataPlugAddress( |
---|
271 |
ESubunitType subunitType, |
---|
272 |
subunit_id_t subunitId, |
---|
273 |
function_block_type_t functionBlockType, |
---|
274 |
function_block_id_t functionBlockId, |
---|
275 |
plug_id_t plugId ) |
---|
276 |
: m_subunitType( subunitType ) |
---|
277 |
, m_subunitId( subunitId ) |
---|
278 |
, m_functionBlockType( functionBlockType ) |
---|
279 |
, m_functionBlockId( functionBlockId ) |
---|
280 |
, m_plugId( plugId ) |
---|
281 |
{ |
---|
282 |
} |
---|
283 |
|
---|
284 |
FunctionBlockPlugSpecificDataPlugAddress::~FunctionBlockPlugSpecificDataPlugAddress() |
---|
285 |
{ |
---|
286 |
} |
---|
287 |
|
---|
288 |
bool |
---|
289 |
FunctionBlockPlugSpecificDataPlugAddress::serialize( Util::Cmd::IOSSerialize& se ) |
---|
290 |
{ |
---|
291 |
se.write( m_subunitType, "FunctionPlugSpecificDataBlockPlugAddress subunitType" ); |
---|
292 |
se.write( m_subunitId, "FunctionPlugSpecificDataBlockPlugAddress subunitId" ); |
---|
293 |
se.write( m_functionBlockType, "FunctionBlockPlugSpecificDataPlugAddress functionBlockType" ); |
---|
294 |
se.write( m_functionBlockId, "FunctionBlockPlugSpecificDataPlugAddress functionBlockId" ); |
---|
295 |
se.write( m_plugId, "FunctionBlockPlugSpecificDataPlugAddress plugId" ); |
---|
296 |
return true; |
---|
297 |
} |
---|
298 |
|
---|
299 |
bool |
---|
300 |
FunctionBlockPlugSpecificDataPlugAddress::deserialize( Util::Cmd::IISDeserialize& de ) |
---|
301 |
{ |
---|
302 |
de.read( &m_subunitType ); |
---|
303 |
de.read( &m_subunitId ); |
---|
304 |
de.read( &m_functionBlockType ); |
---|
305 |
de.read( &m_functionBlockId ); |
---|
306 |
de.read( &m_plugId ); |
---|
307 |
return true; |
---|
308 |
} |
---|
309 |
|
---|
310 |
FunctionBlockPlugSpecificDataPlugAddress* |
---|
311 |
FunctionBlockPlugSpecificDataPlugAddress:: clone() const |
---|
312 |
{ |
---|
313 |
return new FunctionBlockPlugSpecificDataPlugAddress( *this ); |
---|
314 |
} |
---|
315 |
|
---|
316 |
//////////////////////////////////////////////////////////// |
---|
317 |
|
---|
318 |
UndefinedPlugSpecificDataPlugAddress::UndefinedPlugSpecificDataPlugAddress() |
---|
319 |
: m_reserved0( 0xff ) |
---|
320 |
, m_reserved1( 0xff ) |
---|
321 |
, m_reserved2( 0xff ) |
---|
322 |
, m_reserved3( 0xff ) |
---|
323 |
, m_reserved4( 0xff ) |
---|
324 |
{ |
---|
325 |
} |
---|
326 |
|
---|
327 |
UndefinedPlugSpecificDataPlugAddress::~UndefinedPlugSpecificDataPlugAddress() |
---|
328 |
{ |
---|
329 |
} |
---|
330 |
|
---|
331 |
bool |
---|
332 |
UndefinedPlugSpecificDataPlugAddress::serialize( Util::Cmd::IOSSerialize& se ) |
---|
333 |
{ |
---|
334 |
se.write( m_reserved0, "UndefinedPlugAddress reserved0" ); |
---|
335 |
se.write( m_reserved1, "UndefinedPlugAddress reserved1" ); |
---|
336 |
se.write( m_reserved2, "UndefinedPlugAddress reserved2" ); |
---|
337 |
se.write( m_reserved3, "UndefinedPlugAddress reserved3" ); |
---|
338 |
se.write( m_reserved4, "UndefinedPlugAddress reserved4" ); |
---|
339 |
return true; |
---|
340 |
} |
---|
341 |
|
---|
342 |
bool |
---|
343 |
UndefinedPlugSpecificDataPlugAddress::deserialize( Util::Cmd::IISDeserialize& de ) |
---|
344 |
{ |
---|
345 |
de.read( &m_reserved0 ); |
---|
346 |
de.read( &m_reserved1 ); |
---|
347 |
de.read( &m_reserved2 ); |
---|
348 |
de.read( &m_reserved3 ); |
---|
349 |
de.read( &m_reserved4 ); |
---|
350 |
return true; |
---|
351 |
} |
---|
352 |
|
---|
353 |
UndefinedPlugSpecificDataPlugAddress* |
---|
354 |
UndefinedPlugSpecificDataPlugAddress:: clone() const |
---|
355 |
{ |
---|
356 |
return new UndefinedPlugSpecificDataPlugAddress( *this ); |
---|
357 |
} |
---|
358 |
|
---|
359 |
//////////////////////////////////////////////////////////// |
---|
360 |
//////////////////////////////////////////////////////////// |
---|
361 |
|
---|
362 |
PlugAddress::PlugAddress( EPlugDirection plugDirection, |
---|
363 |
EPlugAddressMode plugAddressMode, |
---|
364 |
UnitPlugAddress& unitPlugAddress ) |
---|
365 |
: m_plugDirection( plugDirection ) |
---|
366 |
, m_addressMode( plugAddressMode ) |
---|
367 |
, m_plugAddressData( new UnitPlugAddress( unitPlugAddress ) ) |
---|
368 |
{ |
---|
369 |
} |
---|
370 |
|
---|
371 |
PlugAddress::PlugAddress( EPlugDirection plugDirection, |
---|
372 |
EPlugAddressMode plugAddressMode, |
---|
373 |
SubunitPlugAddress& subUnitPlugAddress ) |
---|
374 |
: m_plugDirection( plugDirection ) |
---|
375 |
, m_addressMode( plugAddressMode ) |
---|
376 |
, m_plugAddressData( new SubunitPlugAddress( subUnitPlugAddress ) ) |
---|
377 |
{ |
---|
378 |
} |
---|
379 |
|
---|
380 |
PlugAddress::PlugAddress( EPlugDirection plugDirection, |
---|
381 |
EPlugAddressMode plugAddressMode, |
---|
382 |
FunctionBlockPlugAddress& functionBlockPlugAddress ) |
---|
383 |
: m_plugDirection( plugDirection ) |
---|
384 |
, m_addressMode( plugAddressMode ) |
---|
385 |
, m_plugAddressData( new FunctionBlockPlugAddress( functionBlockPlugAddress ) ) |
---|
386 |
{ |
---|
387 |
} |
---|
388 |
|
---|
389 |
PlugAddress::PlugAddress() |
---|
390 |
: m_plugDirection( ePD_Undefined ) |
---|
391 |
, m_addressMode( ePAM_Undefined ) |
---|
392 |
, m_plugAddressData( new UndefinedPlugAddress() ) |
---|
393 |
{ |
---|
394 |
} |
---|
395 |
|
---|
396 |
PlugAddress::PlugAddress( const PlugAddress& pa ) |
---|
397 |
: m_plugDirection( pa.m_plugDirection ) |
---|
398 |
, m_addressMode( pa.m_addressMode ) |
---|
399 |
, m_plugAddressData( dynamic_cast<PlugAddressData*>( pa.m_plugAddressData->clone() ) ) |
---|
400 |
{ |
---|
401 |
} |
---|
402 |
|
---|
403 |
PlugAddress::~PlugAddress() |
---|
404 |
{ |
---|
405 |
delete m_plugAddressData; |
---|
406 |
m_plugAddressData = 0; |
---|
407 |
} |
---|
408 |
|
---|
409 |
bool |
---|
410 |
PlugAddress::serialize( Util::Cmd::IOSSerialize& se ) |
---|
411 |
{ |
---|
412 |
se.write( m_plugDirection, "PlugAddress plugDirection" ); |
---|
413 |
se.write( m_addressMode, "PlugAddress addressMode" ); |
---|
414 |
return m_plugAddressData->serialize( se ); |
---|
415 |
} |
---|
416 |
|
---|
417 |
bool |
---|
418 |
PlugAddress::deserialize( Util::Cmd::IISDeserialize& de ) |
---|
419 |
{ |
---|
420 |
de.read( &m_plugDirection ); |
---|
421 |
de.read( &m_addressMode ); |
---|
422 |
return m_plugAddressData->deserialize( de ); |
---|
423 |
} |
---|
424 |
|
---|
425 |
PlugAddress* |
---|
426 |
PlugAddress::clone() const |
---|
427 |
{ |
---|
428 |
return new PlugAddress( *this ); |
---|
429 |
} |
---|
430 |
|
---|
431 |
const char* plugAddressDirectionStrings[] = |
---|
432 |
{ |
---|
433 |
"Input", |
---|
434 |
"Output", |
---|
435 |
"Undefined", |
---|
436 |
}; |
---|
437 |
|
---|
438 |
const char* plugAddressAddressModeStrings[] = |
---|
439 |
{ |
---|
440 |
"Unit", |
---|
441 |
"Subunit", |
---|
442 |
"FunctionBlock", |
---|
443 |
"Undefined", |
---|
444 |
}; |
---|
445 |
|
---|
446 |
const char* |
---|
447 |
plugAddressPlugDirectionToString( PlugAddress::EPlugDirection direction ) |
---|
448 |
{ |
---|
449 |
if ( direction > PlugAddress::ePD_Output ) { |
---|
450 |
direction = PlugAddress::ePD_Undefined; |
---|
451 |
} |
---|
452 |
return plugAddressDirectionStrings[direction]; |
---|
453 |
} |
---|
454 |
|
---|
455 |
const char* |
---|
456 |
plugAddressAddressModeToString( PlugAddress::EPlugAddressMode mode ) |
---|
457 |
{ |
---|
458 |
if ( mode > PlugAddress::ePAM_FunctionBlock ) { |
---|
459 |
mode = PlugAddress::ePAM_FunctionBlock; |
---|
460 |
} |
---|
461 |
return plugAddressAddressModeStrings[mode]; |
---|
462 |
} |
---|
463 |
|
---|
464 |
|
---|
465 |
//////////////////////////////////////////////////////////// |
---|
466 |
|
---|
467 |
PlugAddressSpecificData::PlugAddressSpecificData( EPlugDirection plugDirection, |
---|
468 |
EPlugAddressMode plugAddressMode, |
---|
469 |
UnitPlugSpecificDataPlugAddress& unitPlugAddress ) |
---|
470 |
: m_plugDirection( plugDirection ) |
---|
471 |
, m_addressMode( plugAddressMode ) |
---|
472 |
, m_plugAddressData( new UnitPlugSpecificDataPlugAddress( unitPlugAddress ) ) |
---|
473 |
{ |
---|
474 |
} |
---|
475 |
|
---|
476 |
PlugAddressSpecificData::PlugAddressSpecificData( EPlugDirection plugDirection, |
---|
477 |
EPlugAddressMode plugAddressMode, |
---|
478 |
SubunitPlugSpecificDataPlugAddress& subUnitPlugAddress ) |
---|
479 |
: m_plugDirection( plugDirection ) |
---|
480 |
, m_addressMode( plugAddressMode ) |
---|
481 |
, m_plugAddressData( new SubunitPlugSpecificDataPlugAddress( subUnitPlugAddress ) ) |
---|
482 |
{ |
---|
483 |
} |
---|
484 |
|
---|
485 |
PlugAddressSpecificData::PlugAddressSpecificData( EPlugDirection plugDirection, |
---|
486 |
EPlugAddressMode plugAddressMode, |
---|
487 |
FunctionBlockPlugSpecificDataPlugAddress& functionBlockPlugAddress ) |
---|
488 |
: m_plugDirection( plugDirection ) |
---|
489 |
, m_addressMode( plugAddressMode ) |
---|
490 |
, m_plugAddressData( new FunctionBlockPlugSpecificDataPlugAddress( functionBlockPlugAddress ) ) |
---|
491 |
{ |
---|
492 |
} |
---|
493 |
|
---|
494 |
PlugAddressSpecificData::PlugAddressSpecificData( const PlugAddressSpecificData& pa ) |
---|
495 |
: m_plugDirection( pa.m_plugDirection ) |
---|
496 |
, m_addressMode( pa.m_addressMode ) |
---|
497 |
, m_plugAddressData( dynamic_cast<PlugAddressData*>( pa.m_plugAddressData->clone() ) ) |
---|
498 |
{ |
---|
499 |
} |
---|
500 |
|
---|
501 |
PlugAddressSpecificData::~PlugAddressSpecificData() |
---|
502 |
{ |
---|
503 |
delete m_plugAddressData; |
---|
504 |
m_plugAddressData = 0; |
---|
505 |
} |
---|
506 |
|
---|
507 |
bool |
---|
508 |
PlugAddressSpecificData::serialize( Util::Cmd::IOSSerialize& se ) |
---|
509 |
{ |
---|
510 |
se.write( m_plugDirection, "PlugAddressSpecificData plugDirection" ); |
---|
511 |
se.write( m_addressMode, "PlugAddressSpecificData addressMode" ); |
---|
512 |
return m_plugAddressData->serialize( se ); |
---|
513 |
} |
---|
514 |
|
---|
515 |
bool |
---|
516 |
PlugAddressSpecificData::deserialize( Util::Cmd::IISDeserialize& de ) |
---|
517 |
{ |
---|
518 |
de.read( &m_plugDirection ); |
---|
519 |
de.read( &m_addressMode ); |
---|
520 |
if ( m_plugAddressData ) { |
---|
521 |
delete m_plugAddressData; |
---|
522 |
m_plugAddressData = 0; |
---|
523 |
} |
---|
524 |
switch ( m_addressMode ) { |
---|
525 |
case ePAM_Unit: |
---|
526 |
m_plugAddressData = |
---|
527 |
new UnitPlugSpecificDataPlugAddress( |
---|
528 |
UnitPlugSpecificDataPlugAddress::ePT_PCR, |
---|
529 |
0xff ); |
---|
530 |
break; |
---|
531 |
case ePAM_Subunit: |
---|
532 |
m_plugAddressData = |
---|
533 |
new SubunitPlugSpecificDataPlugAddress( |
---|
534 |
eST_Reserved, |
---|
535 |
0xff, |
---|
536 |
0xff ); |
---|
537 |
break; |
---|
538 |
case ePAM_FunctionBlock: |
---|
539 |
m_plugAddressData = |
---|
540 |
new FunctionBlockPlugSpecificDataPlugAddress( |
---|
541 |
eST_Reserved, |
---|
542 |
0xff, |
---|
543 |
0xff, |
---|
544 |
0xff, |
---|
545 |
0xff); |
---|
546 |
break; |
---|
547 |
default: |
---|
548 |
m_plugAddressData = |
---|
549 |
new UndefinedPlugSpecificDataPlugAddress(); |
---|
550 |
} |
---|
551 |
|
---|
552 |
return m_plugAddressData->deserialize( de ); |
---|
553 |
} |
---|
554 |
|
---|
555 |
PlugAddressSpecificData* |
---|
556 |
PlugAddressSpecificData::clone() const |
---|
557 |
{ |
---|
558 |
return new PlugAddressSpecificData( *this ); |
---|
559 |
} |
---|
560 |
|
---|
561 |
} |
---|