Changeset 119
- Timestamp:
- 06/20/05 15:18:09 (19 years ago)
- Files:
-
- trunk/freebob/tests/avc_extended_stream_format.cpp (modified) (1 diff)
- trunk/freebob/tests/avc_generic.cpp (modified) (2 diffs)
- trunk/freebob/tests/avc_generic.h (modified) (1 diff)
- trunk/freebob/tests/avc_plug_info.cpp (modified) (2 diffs)
- trunk/freebob/tests/avc_signal_source.cpp (modified) (6 diffs)
- trunk/freebob/tests/serialize.cpp (modified) (1 diff)
- trunk/freebob/tests/sync_mode.cpp (modified) (17 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/freebob/tests/avc_extended_stream_format.cpp
r111 r119 476 476 bool result = false; 477 477 478 #define STREAM_FORMAT_REQUEST_SIZE 10// XXX random length478 #define STREAM_FORMAT_REQUEST_SIZE 6 // XXX random length 479 479 union UPacket { 480 480 quadlet_t quadlet[STREAM_FORMAT_REQUEST_SIZE]; trunk/freebob/tests/avc_generic.cpp
r109 r119 53 53 { 54 54 m_ctype = commandType; 55 m_commandType = commandType; 55 56 return true; 57 } 58 59 AVCCommand::ECommandType 60 AVCCommand::getCommandType() 61 { 62 return m_commandType; 56 63 } 57 64 … … 109 116 return m_verbose; 110 117 } 111 112 AVCCommand::ECommandType113 AVCCommand::getCommandType()114 {115 return static_cast<ECommandType>( m_ctype );116 }trunk/freebob/tests/avc_generic.h
r109 r119 106 106 107 107 private: 108 ctype_t m_ctype; 109 subunit_t m_subunit; 110 opcode_t m_opcode; 111 EResponse m_eResponse; 112 bool m_verbose; 108 ctype_t m_ctype; 109 subunit_t m_subunit; 110 opcode_t m_opcode; 111 EResponse m_eResponse; 112 bool m_verbose; 113 ECommandType m_commandType; 113 114 }; 114 115 trunk/freebob/tests/avc_plug_info.cpp
r112 r119 104 104 break; 105 105 default: 106 cerr << "Could not deserialize with subfu cntion " << m_subFunction << endl;106 cerr << "Could not deserialize with subfunction " << m_subFunction << endl; 107 107 return false; 108 108 } … … 123 123 bool result = false; 124 124 125 #define STREAM_FORMAT_REQUEST_SIZE 10// XXX random length125 #define STREAM_FORMAT_REQUEST_SIZE 5 // XXX random length 126 126 union UPacket { 127 127 quadlet_t quadlet[STREAM_FORMAT_REQUEST_SIZE]; trunk/freebob/tests/avc_signal_source.cpp
r116 r119 119 119 { 120 120 AVCCommand::serialize( se ); 121 122 byte_t operand; 123 switch ( getCommandType() ) { 124 case eCT_Status: 125 operand = ( m_outputStatus << 5 ) 126 | ( ( m_conv & 0x1 ) << 4 ) 127 | ( m_signalStatus & 0xf ); 128 se.write( operand, "SignalSourceCmd outputStatus & conv & signalStatus" ); 129 break; 130 case eCT_Control: 131 case eCT_SpecificInquiry: 132 operand = m_resultStatus & 0xf; 133 se.write( operand, "SignalSourceCmd resultStatus" ); 134 break; 135 default: 136 cerr << "Can't handle command type " << getCommandType() << endl; 137 return false; 138 } 139 121 140 switch( getSubunitType() ) { 122 141 case eST_Unit: 142 case eST_Audio: 143 case eST_Music: 123 144 { 124 byte_t operand = m_resultStatus & 0xf;125 se.write( operand, "SignalSourceCmd resultStatus" );126 127 145 if ( m_signalSource ) { 128 146 m_signalSource->serialize( se ); … … 142 160 } 143 161 break; 144 case eST_Audio:145 case eST_Music:146 {147 byte_t operand = ( m_outputStatus << 5 ) | ( ( m_conv & 0x1 ) << 4 ) | ( m_signalStatus & 0x7 );148 se.write( operand, "SignalSourceCmd outputStatus & conv & signalStatus" );149 150 if ( m_signalSource ) {151 m_signalSource->serialize( se );152 } else {153 byte_t reserved = 0xff;154 se.write( reserved, "SignalSourceCmd" );155 se.write( reserved, "SignalSourceCmd" );156 }157 158 if ( m_signalDestination ) {159 m_signalDestination->serialize( se );160 } else {161 byte_t reserved = 0xff;162 se.write( reserved, "SignalSourceCmd" );163 se.write( reserved, "SignalSourceCmd" );164 }165 }166 break;167 162 default: 168 163 cerr << "Can't handle subunit type " << getSubunitType() << endl; … … 182 177 183 178 AVCCommand::deserialize( de ); 179 180 byte_t operand; 181 switch ( getCommandType() ) { 182 case eCT_Status: 183 de.read( &operand ); 184 m_outputStatus = operand >> 5; 185 m_conv = ( operand & 0x10 ) >> 4; 186 m_signalStatus = operand & 0xf; 187 break; 188 case eCT_Control: 189 case eCT_SpecificInquiry: 190 de.read( &operand ); 191 m_resultStatus = operand & 0xf; 192 break; 193 default: 194 cerr << "Can't handle command type " << getCommandType() << endl; 195 return false; 196 } 197 184 198 switch( getSubunitType() ) { 185 199 case eST_Unit: 200 case eST_Audio: 201 case eST_Music: 186 202 { 187 203 byte_t operand; 188 189 de.read( &operand );190 m_resultStatus = operand & 0xf;191 192 204 de.peek( &operand ); 193 205 if ( operand == 0xff ) { … … 196 208 m_signalSource = new SignalSubunitAddress; 197 209 } 210 198 211 m_signalSource->deserialize( de ); 199 212 … … 207 220 } 208 221 break; 209 case eST_Audio:210 case eST_Music:211 {212 byte_t operand;213 214 de.read( &operand );215 m_outputStatus = operand >> 5;216 m_conv = ( operand & 0x10 ) >> 4;217 m_signalStatus = operand & 0xf;218 219 de.peek( &operand );220 if ( operand == 0xff ) {221 m_signalSource = new SignalUnitAddress;222 } else {223 m_signalSource = new SignalSubunitAddress;224 }225 226 m_signalSource->deserialize( de );227 228 de.peek( &operand );229 if ( operand == 0xff ) {230 m_signalDestination = new SignalUnitAddress;231 } else {232 m_signalDestination = new SignalSubunitAddress;233 }234 m_signalDestination->deserialize( de );235 }236 break;237 222 default: 238 223 cerr << "Can't handle subunit type " << getSubunitType() << endl; … … 249 234 bool result = false; 250 235 251 #define STREAM_FORMAT_REQUEST_SIZE 10// XXX random length236 #define STREAM_FORMAT_REQUEST_SIZE 5 // XXX random length 252 237 union UPacket { 253 238 quadlet_t quadlet[STREAM_FORMAT_REQUEST_SIZE]; trunk/freebob/tests/serialize.cpp
r108 r119 106 106 bool result = false; 107 107 if ( isCurPosValid() ) { 108 *value = * ( m_curPos + sizeof( byte_t ) );108 *value = *m_curPos; 109 109 result = true; 110 110 } trunk/freebob/tests/sync_mode.cpp
r116 r119 233 233 { 234 234 SignalSourceCmd signalSourceCmd; 235 signalSourceCmd.setSubunitType( destPlug.m_subunitType ); 236 signalSourceCmd.setSubunitId( destPlug.m_subunitId ); 235 signalSourceCmd.setSubunitType( AVCCommand::eST_Unit ); 237 236 signalSourceCmd.setCommandType( AVCCommand::eCT_SpecificInquiry ); 238 237 signalSourceCmd.setVerbose( arguments.verbose ); … … 251 250 252 251 if ( signalSourceCmd.fire( handle, node_id ) ) { 253 usleep( 10000 );254 252 if ( signalSourceCmd.getResponse() == AVCCommand::eR_Implemented ) { 255 253 syncConnectionInfos.push_back( SyncConnectionInfo( connectionName, syncConnectionInfos.size(), sourcePlug, destPlug ) ); … … 285 283 // First we have to find the music subunit sync input plug (address) 286 284 PlugInfoCmd plugInfoCmd; 287 plugInfoCmd.setVerbose( arguments.verbose );288 285 plugInfoCmd.setCommandType( AVCCommand::eCT_Status ); 289 286 plugInfoCmd.setSubunitType( AVCCommand::eST_Music ); … … 292 289 // find input sync plug 293 290 if ( plugInfoCmd.fire( handle, node_id ) ) { 294 usleep( 10000 );295 291 for ( int plugIdx = 0; 296 292 plugIdx < plugInfoCmd.m_destinationPlugs; … … 306 302 extendedStreamFormatCmd.setSubunitId( 0x00 ); 307 303 extendedStreamFormatCmd.setCommandType( AVCCommand::eCT_Status ); 308 extendedStreamFormatCmd.setVerbose( arguments.verbose );309 304 310 305 if ( extendedStreamFormatCmd.fire( handle, node_id ) ) { 311 usleep( 10000 );312 306 FormatInformation* formatInformation = extendedStreamFormatCmd.getFormatInformation(); 313 307 if ( formatInformation … … 338 332 extendedStreamFormatCmd.setSubunitId( 0x00 ); 339 333 extendedStreamFormatCmd.setCommandType( AVCCommand::eCT_Status ); 340 extendedStreamFormatCmd.setVerbose( arguments.verbose );341 334 342 335 if ( extendedStreamFormatCmd.fire( handle, node_id ) ) { 343 usleep( 10000 );344 336 FormatInformation* formatInformation = extendedStreamFormatCmd.getFormatInformation(); 345 337 if ( formatInformation … … 373 365 { 374 366 // - Music subunit sync output plug = internal sync (CSP) 375 inquireConnection( handle, 376 node_id, 377 syncConnectionInfos, 378 syncOutputPlug, 379 syncInputPlug, 380 "internal (CSP)" ); 367 if ( !inquireConnection( handle, 368 node_id, 369 syncConnectionInfos, 370 syncOutputPlug, 371 syncInputPlug, 372 "internal (CSP)" ) ) 373 { 374 return false; 375 } 381 376 382 377 // - Unit input plug 0 = SYT match 383 378 PlugInfo iPCR0( "iPCR[0]", AVCCommand::eST_Unit, 0xff, 0x00 ); 384 inquireConnection( handle, 385 node_id, 386 syncConnectionInfos, 387 iPCR0, 388 syncInputPlug, 389 "SYT match" ); 379 if ( !inquireConnection( handle, 380 node_id, 381 syncConnectionInfos, 382 iPCR0, 383 syncInputPlug, 384 "SYT match" ) ) 385 { 386 return false; 387 } 390 388 391 389 // - Unit input plut 1 = sync stream 392 390 PlugInfo iPCR1( "iPCR[1]", AVCCommand::eST_Unit, 0xff, 0x01 ); 393 inquireConnection( handle, 394 node_id, 395 syncConnectionInfos, 396 iPCR1, 397 syncInputPlug, 398 "sync stream" ); 391 if ( !inquireConnection( handle, 392 node_id, 393 syncConnectionInfos, 394 iPCR1, 395 syncInputPlug, 396 "sync stream" ) ) 397 { 398 return false; 399 } 399 400 400 401 // Find out how many external input plugs exits. … … 402 403 { 403 404 PlugInfoCmd plugInfoCmd; 404 plugInfoCmd.setVerbose( arguments.verbose );405 405 plugInfoCmd.setCommandType( AVCCommand::eCT_Status ); 406 406 407 407 if ( plugInfoCmd.fire( handle, node_id ) ) { 408 usleep( 10000 ); // Don't overload device with requests409 408 for ( int plugIdx = 0; 410 409 plugIdx < plugInfoCmd.m_externalInputPlugs; … … 419 418 0xff, 420 419 0x80 + plugIdx ); 421 inquireConnection( handle, 422 node_id, 423 syncConnectionInfos, 424 externalPlug, 425 syncInputPlug, 426 plugName); 420 if ( !inquireConnection( handle, 421 node_id, 422 syncConnectionInfos, 423 externalPlug, 424 syncInputPlug, 425 plugName) ) 426 { 427 return false; 428 } 427 429 } 430 } else { 431 return false; 428 432 } 429 433 } … … 454 458 if ( info ) { 455 459 SignalSourceCmd signalSourceCmd; 456 signalSourceCmd.setSubunitType( syncInputPlug.m_subunitType ); 457 signalSourceCmd.setSubunitId( syncInputPlug.m_subunitId ); 460 signalSourceCmd.setSubunitType( AVCCommand::eST_Unit ); 458 461 signalSourceCmd.setCommandType( AVCCommand::eCT_Control ); 459 462 signalSourceCmd.setVerbose( arguments.verbose ); … … 478 481 479 482 if ( signalSourceCmd.fire( handle, node_id ) ) { 480 usleep( 10000 );481 483 switch ( signalSourceCmd.getResponse() ) 482 484 { … … 527 529 { 528 530 SignalSourceCmd signalSourceCmd; 529 signalSourceCmd.setSubunitType( syncInputPlug.m_subunitType ); 530 signalSourceCmd.setSubunitId( syncInputPlug.m_subunitId ); 531 signalSourceCmd.setSubunitType( AVCCommand::eST_Unit ); 531 532 signalSourceCmd.setCommandType( AVCCommand::eCT_Status ); 532 533 signalSourceCmd.setVerbose( arguments.verbose ); … … 545 546 546 547 if ( signalSourceCmd.fire( handle, node_id ) ) { 547 usleep( 10000 );548 548 if ( signalSourceCmd.getResponse() == AVCCommand::eR_Implemented ) { 549 549 cout << endl << "Currently activated mode:" << endl; … … 554 554 } catch ( bad_cast ) { } 555 555 556 SignalSubunitAddress* signalSub nitAddress = 0;556 SignalSubunitAddress* signalSubunitAddress = 0; 557 557 try { 558 signalSub nitAddress = dynamic_cast<SignalSubunitAddress*>( signalSourceCmd.getSignalSource() );558 signalSubunitAddress = dynamic_cast<SignalSubunitAddress*>( signalSourceCmd.getSignalSource() ); 559 559 } catch ( bad_cast ) { } 560 560 … … 562 562 if ( signalUnitAddress ) { 563 563 sourcePlug.m_subunitType = AVCCommand::eST_Unit; 564 sourcePlug.m_subunitId = 0x 00;564 sourcePlug.m_subunitId = 0xff; 565 565 sourcePlug.m_plugId = signalUnitAddress->m_plugId; 566 } else if ( signalSub nitAddress ) {567 sourcePlug.m_subunitType = static_cast<AVCCommand::ESubunitType>( signalSub nitAddress->m_subunitType );568 sourcePlug.m_subunitId = signalSub nitAddress->m_subunitId;569 sourcePlug.m_plugId = signalSub nitAddress->m_plugId;566 } else if ( signalSubunitAddress ) { 567 sourcePlug.m_subunitType = static_cast<AVCCommand::ESubunitType>( signalSubunitAddress->m_subunitType ); 568 sourcePlug.m_subunitId = signalSubunitAddress->m_subunitId; 569 sourcePlug.m_plugId = signalSubunitAddress->m_plugId; 570 570 } 571 571 … … 575 575 } 576 576 } 577 } else { 578 return false; 577 579 } 578 580 … … 596 598 SyncConnectionInfos syncConnectionInfos; 597 599 598 findSyncPlugs( handle, node_id, syncInputPlug, syncOutputPlug ); 599 findSupportedConnections( handle, node_id, syncInputPlug, syncOutputPlug, syncConnectionInfos ); 600 600 if ( !findSyncPlugs( handle, node_id, syncInputPlug, syncOutputPlug ) ) { 601 cerr << "Could not discover sync plugs" << endl; 602 return false; 603 } 604 605 if ( !findSupportedConnections( handle, node_id, syncInputPlug, syncOutputPlug, syncConnectionInfos ) ) { 606 cerr << "Could not find supported connections" << endl; 607 return false; 608 } 609 610 bool result = false; 601 611 printSupportedModes( handle, node_id, syncConnectionInfos ); 602 612 if ( sync_mode_id != -1 ) { 603 setCurrentActive( handle, node_id, syncInputPlug, syncConnectionInfos, sync_mode_id ); 613 if ( !setCurrentActive( handle, node_id, syncInputPlug, syncConnectionInfos, sync_mode_id ) ) { 614 cerr << "Could not set new sync mode" << endl; 615 } else { 616 result = true; 617 } 604 618 } 605 619 printCurrentActive( handle, node_id, syncConnectionInfos, syncInputPlug ); 606 620 607 return true;621 return result; 608 622 } 609 623