1 |
/* avc_function_block.cpp |
---|
2 |
* Copyright (C) 2006 by Daniel Wagner |
---|
3 |
* |
---|
4 |
* This file is part of FreeBoB. |
---|
5 |
* |
---|
6 |
* FreeBoB is free software; you can redistribute it and/or modify |
---|
7 |
* it under the terms of the GNU General Public License as published by |
---|
8 |
* the Free Software Foundation; either version 2 of the License, or |
---|
9 |
* (at your option) any later version. |
---|
10 |
* FreeBoB 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 FreeBoB; if not, write to the Free Software |
---|
17 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
---|
18 |
* MA 02111-1307 USA. |
---|
19 |
*/ |
---|
20 |
|
---|
21 |
#include "avc_function_block.h" |
---|
22 |
#include "avc_serialize.h" |
---|
23 |
#include "libieee1394/ieee1394service.h" |
---|
24 |
|
---|
25 |
///////////////////////////////// |
---|
26 |
|
---|
27 |
FunctionBlockFeatureVolume::FunctionBlockFeatureVolume() |
---|
28 |
: IBusData() |
---|
29 |
, m_controlSelector( FunctionBlockFeature::eCSE_Feature_Volume ) |
---|
30 |
, m_controlDataLength( 2 ) |
---|
31 |
, m_volume( 0 ) |
---|
32 |
{ |
---|
33 |
} |
---|
34 |
|
---|
35 |
FunctionBlockFeatureVolume::FunctionBlockFeatureVolume( const FunctionBlockFeatureVolume& rhs ) |
---|
36 |
: m_controlSelector( rhs.m_controlSelector ) |
---|
37 |
, m_controlDataLength( rhs.m_controlDataLength ) |
---|
38 |
, m_volume( rhs.m_volume ) |
---|
39 |
{ |
---|
40 |
} |
---|
41 |
|
---|
42 |
FunctionBlockFeatureVolume::~FunctionBlockFeatureVolume() |
---|
43 |
{ |
---|
44 |
} |
---|
45 |
|
---|
46 |
bool |
---|
47 |
FunctionBlockFeatureVolume::serialize( IOSSerialize& se ) |
---|
48 |
{ |
---|
49 |
bool bStatus; |
---|
50 |
byte_t val; |
---|
51 |
bStatus = se.write( m_controlSelector, "FunctionBlockFeatureVolume controlSelector" ); |
---|
52 |
bStatus &= se.write( m_controlDataLength, "FunctionBlockFeatureVolume controlDataLength" ); |
---|
53 |
val = (byte_t)(m_volume >> 8); |
---|
54 |
bStatus &= se.write( val, "FunctionBlockFeatureVolume volume high" ); |
---|
55 |
val = m_volume & 0xff; |
---|
56 |
bStatus &= se.write( val, "FunctionBlockFeatureVolume volume low" ); |
---|
57 |
|
---|
58 |
return bStatus; |
---|
59 |
} |
---|
60 |
|
---|
61 |
bool |
---|
62 |
FunctionBlockFeatureVolume::deserialize( IISDeserialize& de ) |
---|
63 |
{ |
---|
64 |
bool bStatus; |
---|
65 |
byte_t val; |
---|
66 |
bStatus = de.read( &m_controlSelector ); |
---|
67 |
bStatus &= de.read( &m_controlDataLength ); |
---|
68 |
bStatus &= de.read( &val ); |
---|
69 |
m_volume = val << 8; |
---|
70 |
bStatus &= de.read( &val ); |
---|
71 |
m_volume |= val; |
---|
72 |
|
---|
73 |
return bStatus; |
---|
74 |
} |
---|
75 |
|
---|
76 |
FunctionBlockFeatureVolume* |
---|
77 |
FunctionBlockFeatureVolume::clone() const |
---|
78 |
{ |
---|
79 |
return new FunctionBlockFeatureVolume( *this ); |
---|
80 |
} |
---|
81 |
|
---|
82 |
///////////////////////////////// |
---|
83 |
|
---|
84 |
FunctionBlockProcessingMixer::FunctionBlockProcessingMixer() |
---|
85 |
: IBusData() |
---|
86 |
, m_controlSelector( FunctionBlockProcessing::eCSE_Processing_Mixer ) |
---|
87 |
{ |
---|
88 |
} |
---|
89 |
|
---|
90 |
FunctionBlockProcessingMixer::FunctionBlockProcessingMixer( const FunctionBlockProcessingMixer& rhs ) |
---|
91 |
: m_controlSelector( rhs.m_controlSelector ) |
---|
92 |
{ |
---|
93 |
} |
---|
94 |
|
---|
95 |
FunctionBlockProcessingMixer::~FunctionBlockProcessingMixer() |
---|
96 |
{ |
---|
97 |
} |
---|
98 |
|
---|
99 |
bool |
---|
100 |
FunctionBlockProcessingMixer::serialize( IOSSerialize& se ) |
---|
101 |
{ |
---|
102 |
bool bStatus; |
---|
103 |
bStatus = se.write( m_controlSelector, "FunctionBlockProcessingMixer controlSelector" ); |
---|
104 |
|
---|
105 |
return bStatus; |
---|
106 |
} |
---|
107 |
|
---|
108 |
bool |
---|
109 |
FunctionBlockProcessingMixer::deserialize( IISDeserialize& de ) |
---|
110 |
{ |
---|
111 |
bool bStatus; |
---|
112 |
bStatus = de.read( &m_controlSelector ); |
---|
113 |
|
---|
114 |
return bStatus; |
---|
115 |
} |
---|
116 |
|
---|
117 |
FunctionBlockProcessingMixer* |
---|
118 |
FunctionBlockProcessingMixer::clone() const |
---|
119 |
{ |
---|
120 |
return new FunctionBlockProcessingMixer( *this ); |
---|
121 |
} |
---|
122 |
|
---|
123 |
///////////////////////////////// |
---|
124 |
|
---|
125 |
FunctionBlockProcessingEnhancedMixer::FunctionBlockProcessingEnhancedMixer() |
---|
126 |
: IBusData() |
---|
127 |
, m_controlSelector( FunctionBlockProcessing::eCSE_Processing_EnhancedMixer ) |
---|
128 |
, m_statusSelector( eSS_ProgramableState ) |
---|
129 |
{ |
---|
130 |
} |
---|
131 |
|
---|
132 |
FunctionBlockProcessingEnhancedMixer::FunctionBlockProcessingEnhancedMixer( |
---|
133 |
const FunctionBlockProcessingEnhancedMixer& rhs ) |
---|
134 |
: m_controlSelector( rhs.m_controlSelector ) |
---|
135 |
, m_statusSelector( rhs.m_statusSelector ) |
---|
136 |
{ |
---|
137 |
} |
---|
138 |
|
---|
139 |
FunctionBlockProcessingEnhancedMixer::~FunctionBlockProcessingEnhancedMixer() |
---|
140 |
{ |
---|
141 |
} |
---|
142 |
|
---|
143 |
bool |
---|
144 |
FunctionBlockProcessingEnhancedMixer::serialize( IOSSerialize& se ) |
---|
145 |
{ |
---|
146 |
bool bStatus; |
---|
147 |
bStatus = se.write( m_controlSelector, "FunctionBlockProcessingEnhancedMixer controlSelector" ); |
---|
148 |
bStatus &= se.write( m_statusSelector, "FunctionBlockProcessingEnhancedMixer statusSelector" ); |
---|
149 |
|
---|
150 |
return bStatus; |
---|
151 |
} |
---|
152 |
|
---|
153 |
bool |
---|
154 |
FunctionBlockProcessingEnhancedMixer::deserialize( IISDeserialize& de ) |
---|
155 |
{ |
---|
156 |
bool bStatus; |
---|
157 |
bStatus = de.read( &m_controlSelector ); |
---|
158 |
bStatus &= de.read( &m_statusSelector ); |
---|
159 |
|
---|
160 |
return bStatus; |
---|
161 |
} |
---|
162 |
|
---|
163 |
FunctionBlockProcessingEnhancedMixer* |
---|
164 |
FunctionBlockProcessingEnhancedMixer::clone() const |
---|
165 |
{ |
---|
166 |
return new FunctionBlockProcessingEnhancedMixer( *this ); |
---|
167 |
} |
---|
168 |
|
---|
169 |
|
---|
170 |
///////////////////////////////// |
---|
171 |
///////////////////////////////// |
---|
172 |
|
---|
173 |
FunctionBlockSelector::FunctionBlockSelector() |
---|
174 |
: IBusData() |
---|
175 |
, m_selectorLength( 0x02 ) |
---|
176 |
, m_inputFbPlugNumber( 0x00 ) |
---|
177 |
, m_controlSelector( eCSE_Selector_Selector ) |
---|
178 |
{ |
---|
179 |
} |
---|
180 |
|
---|
181 |
FunctionBlockSelector::FunctionBlockSelector( const FunctionBlockSelector& rhs ) |
---|
182 |
: IBusData() |
---|
183 |
, m_selectorLength( rhs.m_selectorLength ) |
---|
184 |
, m_inputFbPlugNumber( rhs.m_inputFbPlugNumber ) |
---|
185 |
, m_controlSelector( rhs.m_controlSelector ) |
---|
186 |
{ |
---|
187 |
} |
---|
188 |
|
---|
189 |
FunctionBlockSelector::~FunctionBlockSelector() |
---|
190 |
{ |
---|
191 |
} |
---|
192 |
|
---|
193 |
bool |
---|
194 |
FunctionBlockSelector::serialize( IOSSerialize& se ) |
---|
195 |
{ |
---|
196 |
bool bStatus; |
---|
197 |
bStatus = se.write( m_selectorLength, "FunctionBlockSelector selectorLength" ); |
---|
198 |
bStatus &= se.write( m_inputFbPlugNumber, "FunctionBlockSelector inputFbPlugNumber" ); |
---|
199 |
bStatus &= se.write( m_controlSelector, "FunctionBlockSelector controlSelector" ); |
---|
200 |
|
---|
201 |
return bStatus; |
---|
202 |
} |
---|
203 |
|
---|
204 |
bool |
---|
205 |
FunctionBlockSelector::deserialize( IISDeserialize& de ) |
---|
206 |
{ |
---|
207 |
bool bStatus; |
---|
208 |
bStatus = de.read( &m_selectorLength ); |
---|
209 |
bStatus &= de.read( &m_inputFbPlugNumber ); |
---|
210 |
bStatus &= de.read( &m_controlSelector ); |
---|
211 |
|
---|
212 |
return bStatus; |
---|
213 |
} |
---|
214 |
|
---|
215 |
FunctionBlockSelector* |
---|
216 |
FunctionBlockSelector::clone() const |
---|
217 |
{ |
---|
218 |
return new FunctionBlockSelector( *this ); |
---|
219 |
} |
---|
220 |
|
---|
221 |
///////////////////////////////// |
---|
222 |
|
---|
223 |
FunctionBlockFeature::FunctionBlockFeature() |
---|
224 |
: IBusData() |
---|
225 |
, m_selectorLength( 0x02 ) |
---|
226 |
, m_audioChannelNumber( 0x00 ) |
---|
227 |
, m_pVolume( 0 ) |
---|
228 |
{ |
---|
229 |
} |
---|
230 |
|
---|
231 |
FunctionBlockFeature::FunctionBlockFeature( const FunctionBlockFeature& rhs ) |
---|
232 |
: IBusData() |
---|
233 |
, m_selectorLength( rhs.m_selectorLength ) |
---|
234 |
, m_audioChannelNumber( rhs.m_audioChannelNumber ) |
---|
235 |
{ |
---|
236 |
if ( rhs.m_pVolume ) { |
---|
237 |
m_pVolume = new FunctionBlockFeatureVolume( *rhs.m_pVolume ); |
---|
238 |
} |
---|
239 |
} |
---|
240 |
|
---|
241 |
FunctionBlockFeature::~FunctionBlockFeature() |
---|
242 |
{ |
---|
243 |
delete m_pVolume; |
---|
244 |
m_pVolume = 0; |
---|
245 |
} |
---|
246 |
|
---|
247 |
bool |
---|
248 |
FunctionBlockFeature::serialize( IOSSerialize& se ) |
---|
249 |
{ |
---|
250 |
bool bStatus; |
---|
251 |
bStatus = se.write( m_selectorLength, "FunctionBlockFeature selectorLength" ); |
---|
252 |
bStatus &= se.write( m_audioChannelNumber, "FunctionBlockFeature audioChannelNumber" ); |
---|
253 |
|
---|
254 |
if ( m_pVolume ) { |
---|
255 |
bStatus &= m_pVolume->serialize( se ); |
---|
256 |
} else { |
---|
257 |
bStatus = false; |
---|
258 |
} |
---|
259 |
|
---|
260 |
return bStatus; |
---|
261 |
} |
---|
262 |
|
---|
263 |
bool |
---|
264 |
FunctionBlockFeature::deserialize( IISDeserialize& de ) |
---|
265 |
{ |
---|
266 |
bool bStatus; |
---|
267 |
bStatus = de.read( &m_selectorLength ); |
---|
268 |
bStatus &= de.read( &m_audioChannelNumber ); |
---|
269 |
|
---|
270 |
byte_t controlSelector; |
---|
271 |
bStatus &= de.peek( &controlSelector ); |
---|
272 |
switch( controlSelector ) { |
---|
273 |
case eCSE_Feature_Volume: |
---|
274 |
if ( !m_pVolume ) { |
---|
275 |
m_pVolume = new FunctionBlockFeatureVolume; |
---|
276 |
} |
---|
277 |
bStatus &= m_pVolume->deserialize( de ); |
---|
278 |
break; |
---|
279 |
case eCSE_Feature_Mute: |
---|
280 |
case eCSE_Feature_LRBalance: |
---|
281 |
case eCSE_Feature_FRBalance: |
---|
282 |
case eCSE_Feature_Bass: |
---|
283 |
case eCSE_Feature_Mid: |
---|
284 |
case eCSE_Feature_Treble: |
---|
285 |
case eCSE_Feature_GEQ: |
---|
286 |
case eCSE_Feature_AGC: |
---|
287 |
case eCSE_Feature_Delay: |
---|
288 |
case eCSE_Feature_BassBoost: |
---|
289 |
case eCSE_Feature_Loudness: |
---|
290 |
default: |
---|
291 |
bStatus = false; |
---|
292 |
} |
---|
293 |
|
---|
294 |
return bStatus; |
---|
295 |
} |
---|
296 |
|
---|
297 |
FunctionBlockFeature* |
---|
298 |
FunctionBlockFeature::clone() const |
---|
299 |
{ |
---|
300 |
return new FunctionBlockFeature( *this ); |
---|
301 |
} |
---|
302 |
|
---|
303 |
///////////////////////////////// |
---|
304 |
|
---|
305 |
FunctionBlockProcessing::FunctionBlockProcessing() |
---|
306 |
: IBusData() |
---|
307 |
, m_selectorLength( 0x04 ) |
---|
308 |
, m_fbInputPlugNumber( 0x00 ) |
---|
309 |
, m_inputAudioChannelNumber( 0x00 ) |
---|
310 |
, m_outputAudioChannelNumber( 0x00 ) |
---|
311 |
, m_pMixer( 0 ) |
---|
312 |
, m_pEnhancedMixer( 0 ) |
---|
313 |
{ |
---|
314 |
} |
---|
315 |
|
---|
316 |
FunctionBlockProcessing::FunctionBlockProcessing( const FunctionBlockProcessing& rhs ) |
---|
317 |
: m_selectorLength( rhs.m_selectorLength ) |
---|
318 |
, m_fbInputPlugNumber( rhs.m_fbInputPlugNumber ) |
---|
319 |
, m_inputAudioChannelNumber( rhs.m_inputAudioChannelNumber ) |
---|
320 |
, m_outputAudioChannelNumber( rhs.m_outputAudioChannelNumber ) |
---|
321 |
{ |
---|
322 |
if ( rhs.m_pMixer ) { |
---|
323 |
m_pMixer = new FunctionBlockProcessingMixer( *rhs.m_pMixer ); |
---|
324 |
} else if ( rhs.m_pEnhancedMixer ) { |
---|
325 |
m_pEnhancedMixer = new FunctionBlockProcessingEnhancedMixer( *rhs.m_pEnhancedMixer ); |
---|
326 |
} |
---|
327 |
} |
---|
328 |
|
---|
329 |
FunctionBlockProcessing::~FunctionBlockProcessing() |
---|
330 |
{ |
---|
331 |
delete m_pMixer; |
---|
332 |
m_pMixer = 0; |
---|
333 |
delete m_pEnhancedMixer; |
---|
334 |
m_pEnhancedMixer = 0; |
---|
335 |
} |
---|
336 |
|
---|
337 |
bool |
---|
338 |
FunctionBlockProcessing::serialize( IOSSerialize& se ) |
---|
339 |
{ |
---|
340 |
bool bStatus; |
---|
341 |
bStatus = se.write( m_selectorLength, "FunctionBlockProcessing selectorLength" ); |
---|
342 |
bStatus &= se.write( m_fbInputPlugNumber, "FunctionBlockProcessing fbInputPlugNumber" ); |
---|
343 |
bStatus &= se.write( m_inputAudioChannelNumber, "FunctionBlockProcessing inputAudioChannelNumber" ); |
---|
344 |
bStatus &= se.write( m_outputAudioChannelNumber, "FunctionBlockProcessing outputAudioChannelNumber" ); |
---|
345 |
|
---|
346 |
if ( m_pMixer ) { |
---|
347 |
bStatus &= m_pMixer->serialize( se ); |
---|
348 |
} else if ( m_pEnhancedMixer ) { |
---|
349 |
bStatus &= m_pEnhancedMixer->serialize( se ); |
---|
350 |
} else { |
---|
351 |
bStatus = false; |
---|
352 |
} |
---|
353 |
|
---|
354 |
return bStatus; |
---|
355 |
} |
---|
356 |
|
---|
357 |
bool |
---|
358 |
FunctionBlockProcessing::deserialize( IISDeserialize& de ) |
---|
359 |
{ |
---|
360 |
bool bStatus; |
---|
361 |
bStatus = de.read( &m_selectorLength ); |
---|
362 |
bStatus &= de.read( &m_fbInputPlugNumber ); |
---|
363 |
bStatus &= de.read( &m_inputAudioChannelNumber ); |
---|
364 |
bStatus &= de.read( &m_outputAudioChannelNumber ); |
---|
365 |
|
---|
366 |
byte_t controlSelector; |
---|
367 |
bStatus &= de.peek( &controlSelector ); |
---|
368 |
switch( controlSelector ) { |
---|
369 |
case eCSE_Processing_Mixer: |
---|
370 |
if ( !m_pMixer ) { |
---|
371 |
m_pMixer = new FunctionBlockProcessingMixer; |
---|
372 |
} |
---|
373 |
bStatus &= m_pMixer->deserialize( de ); |
---|
374 |
break; |
---|
375 |
case eCSE_Processing_EnhancedMixer: |
---|
376 |
if ( !m_pEnhancedMixer ) { |
---|
377 |
m_pEnhancedMixer = new FunctionBlockProcessingEnhancedMixer; |
---|
378 |
} |
---|
379 |
bStatus &= m_pEnhancedMixer->deserialize( de ); |
---|
380 |
break; |
---|
381 |
case eCSE_Processing_Enable: |
---|
382 |
case eCSE_Processing_Mode: |
---|
383 |
default: |
---|
384 |
bStatus = false; |
---|
385 |
} |
---|
386 |
|
---|
387 |
return bStatus; |
---|
388 |
} |
---|
389 |
|
---|
390 |
FunctionBlockProcessing* |
---|
391 |
FunctionBlockProcessing::clone() const |
---|
392 |
{ |
---|
393 |
return new FunctionBlockProcessing( *this ); |
---|
394 |
} |
---|
395 |
|
---|
396 |
///////////////////////////////// |
---|
397 |
|
---|
398 |
FunctionBlockCodec::FunctionBlockCodec() |
---|
399 |
: IBusData() |
---|
400 |
{ |
---|
401 |
} |
---|
402 |
|
---|
403 |
FunctionBlockCodec::FunctionBlockCodec( const FunctionBlockCodec& rhs ) |
---|
404 |
: IBusData() |
---|
405 |
{ |
---|
406 |
} |
---|
407 |
|
---|
408 |
FunctionBlockCodec::~FunctionBlockCodec() |
---|
409 |
{ |
---|
410 |
} |
---|
411 |
|
---|
412 |
bool |
---|
413 |
FunctionBlockCodec::serialize( IOSSerialize& se ) |
---|
414 |
{ |
---|
415 |
return false; |
---|
416 |
} |
---|
417 |
|
---|
418 |
bool |
---|
419 |
FunctionBlockCodec::deserialize( IISDeserialize& de ) |
---|
420 |
{ |
---|
421 |
return false; |
---|
422 |
} |
---|
423 |
|
---|
424 |
FunctionBlockCodec* |
---|
425 |
FunctionBlockCodec::clone() const |
---|
426 |
{ |
---|
427 |
return new FunctionBlockCodec( *this ); |
---|
428 |
} |
---|
429 |
|
---|
430 |
///////////////////////////////// |
---|
431 |
///////////////////////////////// |
---|
432 |
|
---|
433 |
FunctionBlockCmd::FunctionBlockCmd( Ieee1394Service& ieee1394service, |
---|
434 |
EFunctionBlockType eType, |
---|
435 |
function_block_id_t id, |
---|
436 |
EControlAttribute eCtrlAttrib ) |
---|
437 |
: AVCCommand( ieee1394service, AVC1394_FUNCTION_BLOCK_CMD ) |
---|
438 |
, m_functionBlockType( eType ) |
---|
439 |
, m_functionBlockId( id ) |
---|
440 |
, m_controlAttribute( eCtrlAttrib ) |
---|
441 |
, m_pFBSelector( 0 ) |
---|
442 |
, m_pFBFeature( 0 ) |
---|
443 |
, m_pFBProcessing( 0 ) |
---|
444 |
, m_pFBCodec( 0 ) |
---|
445 |
{ |
---|
446 |
setSubunitType( eST_Audio ); |
---|
447 |
|
---|
448 |
switch( m_functionBlockType ) { |
---|
449 |
case eFBT_Selector: |
---|
450 |
m_pFBSelector = new FunctionBlockSelector; |
---|
451 |
break; |
---|
452 |
case eFBT_Feature: |
---|
453 |
m_pFBFeature = new FunctionBlockFeature; |
---|
454 |
break; |
---|
455 |
case eFBT_Processing: |
---|
456 |
m_pFBProcessing = new FunctionBlockProcessing; |
---|
457 |
break; |
---|
458 |
case eFBT_Codec: |
---|
459 |
m_pFBCodec = new FunctionBlockCodec; |
---|
460 |
break; |
---|
461 |
} |
---|
462 |
} |
---|
463 |
|
---|
464 |
FunctionBlockCmd::FunctionBlockCmd( const FunctionBlockCmd& rhs ) |
---|
465 |
: AVCCommand( rhs ) |
---|
466 |
, m_functionBlockType( rhs.m_functionBlockType ) |
---|
467 |
, m_functionBlockId( rhs.m_functionBlockId ) |
---|
468 |
, m_controlAttribute( rhs.m_controlAttribute ) |
---|
469 |
, m_pFBSelector( new FunctionBlockSelector( *rhs.m_pFBSelector ) ) |
---|
470 |
, m_pFBFeature( new FunctionBlockFeature( *rhs.m_pFBFeature ) ) |
---|
471 |
, m_pFBProcessing( new FunctionBlockProcessing( *rhs.m_pFBProcessing ) ) |
---|
472 |
, m_pFBCodec( new FunctionBlockCodec( *rhs.m_pFBCodec ) ) |
---|
473 |
{ |
---|
474 |
} |
---|
475 |
|
---|
476 |
FunctionBlockCmd::~FunctionBlockCmd() |
---|
477 |
{ |
---|
478 |
delete m_pFBSelector; |
---|
479 |
m_pFBSelector = 0; |
---|
480 |
delete m_pFBFeature; |
---|
481 |
m_pFBFeature = 0; |
---|
482 |
delete m_pFBProcessing; |
---|
483 |
m_pFBProcessing = 0; |
---|
484 |
delete m_pFBCodec; |
---|
485 |
m_pFBCodec = 0; |
---|
486 |
} |
---|
487 |
|
---|
488 |
bool |
---|
489 |
FunctionBlockCmd::serialize( IOSSerialize& se ) |
---|
490 |
{ |
---|
491 |
bool bStatus; |
---|
492 |
bStatus = AVCCommand::serialize( se ); |
---|
493 |
bStatus &= se.write( m_functionBlockType, "FunctionBlockCmd functionBlockType" ); |
---|
494 |
bStatus &= se.write( m_functionBlockId, "FunctionBlockCmd functionBlockId" ); |
---|
495 |
bStatus &= se.write( m_controlAttribute, "FunctionBlockCmd controlAttribute" ); |
---|
496 |
|
---|
497 |
switch( m_functionBlockType ) { |
---|
498 |
case eFBT_Selector: |
---|
499 |
if ( m_pFBSelector ) { |
---|
500 |
bStatus &= m_pFBSelector->serialize( se ); |
---|
501 |
} else { |
---|
502 |
bStatus = false; |
---|
503 |
} |
---|
504 |
break; |
---|
505 |
case eFBT_Feature: |
---|
506 |
if ( m_pFBFeature ) { |
---|
507 |
bStatus &= m_pFBFeature->serialize( se ); |
---|
508 |
} else { |
---|
509 |
bStatus = false; |
---|
510 |
} |
---|
511 |
break; |
---|
512 |
case eFBT_Processing: |
---|
513 |
if ( m_pFBProcessing ) { |
---|
514 |
bStatus &= m_pFBProcessing->serialize( se ); |
---|
515 |
} else { |
---|
516 |
bStatus = false; |
---|
517 |
} |
---|
518 |
break; |
---|
519 |
case eFBT_Codec: |
---|
520 |
if ( m_pFBCodec ) { |
---|
521 |
bStatus &= m_pFBCodec->serialize( se ); |
---|
522 |
} else { |
---|
523 |
bStatus = false; |
---|
524 |
} |
---|
525 |
break; |
---|
526 |
default: |
---|
527 |
bStatus = false; |
---|
528 |
} |
---|
529 |
|
---|
530 |
return bStatus; |
---|
531 |
} |
---|
532 |
|
---|
533 |
bool |
---|
534 |
FunctionBlockCmd::deserialize( IISDeserialize& de ) |
---|
535 |
{ |
---|
536 |
bool bStatus; |
---|
537 |
bStatus = AVCCommand::deserialize( de ); |
---|
538 |
|
---|
539 |
bStatus &= de.read( &m_functionBlockType ); |
---|
540 |
bStatus &= de.read( &m_functionBlockId ); |
---|
541 |
bStatus &= de.read( &m_controlAttribute ); |
---|
542 |
|
---|
543 |
switch( m_functionBlockType ) { |
---|
544 |
case eFBT_Selector: |
---|
545 |
if ( !m_pFBSelector ) { |
---|
546 |
m_pFBSelector = new FunctionBlockSelector; |
---|
547 |
} |
---|
548 |
bStatus &= m_pFBSelector->deserialize( de ); |
---|
549 |
break; |
---|
550 |
case eFBT_Feature: |
---|
551 |
if ( !m_pFBFeature ) { |
---|
552 |
m_pFBFeature = new FunctionBlockFeature; |
---|
553 |
} |
---|
554 |
bStatus &= m_pFBFeature->deserialize( de ); |
---|
555 |
break; |
---|
556 |
case eFBT_Processing: |
---|
557 |
if ( !m_pFBProcessing ) { |
---|
558 |
m_pFBProcessing = new FunctionBlockProcessing; |
---|
559 |
} |
---|
560 |
bStatus &= m_pFBProcessing->deserialize( de ); |
---|
561 |
break; |
---|
562 |
case eFBT_Codec: |
---|
563 |
if ( !m_pFBCodec ) { |
---|
564 |
m_pFBCodec = new FunctionBlockCodec; |
---|
565 |
} |
---|
566 |
bStatus &= m_pFBCodec->deserialize( de ); |
---|
567 |
break; |
---|
568 |
default: |
---|
569 |
bStatus = false; |
---|
570 |
} |
---|
571 |
|
---|
572 |
return bStatus; |
---|
573 |
} |
---|
574 |
|
---|
575 |
FunctionBlockCmd* |
---|
576 |
FunctionBlockCmd::clone() const |
---|
577 |
{ |
---|
578 |
return new FunctionBlockCmd( *this ); |
---|
579 |
} |
---|