Changeset 22

Show
Ignore:
Timestamp:
11/25/04 11:30:41 (19 years ago)
Author:
pieterpalmers
Message:

- Added the following info block handlers:

Basic read functionallity only.

- Changed Makefile.am to reflect these new files
- Removed a bug from avdescriptor->readBuffer
- Added some basic tests of the new handlers (remark: the new tests could be device specific)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/freebob/src/avdescriptor.cpp

    r21 r22  
    249249                        length=iLength-address; 
    250250                } 
    251                 memcpy((void*)buffer, (void*)aContents, length); 
     251                memcpy((void*)buffer, (void*)(aContents+address), length); 
    252252                return length; 
    253253                 
  • trunk/freebob/src/avinfoblock.h

    r21 r22  
    3333public: 
    3434        AvInfoBlock(AvDescriptor *parent, int address); // read an infoblock from a parent starting from a specific position 
    35         ~AvInfoBlock(); 
     35        virtual ~AvInfoBlock(); 
    3636 
    3737        bool isValid(); 
     
    3939        unsigned int getType(); 
    4040 
    41         unsigned char readByte(unsigned int address); 
    42         unsigned int readWord(unsigned int address); 
    43         unsigned int readBuffer(unsigned int address, unsigned int length, unsigned char *buffer); 
     41        virtual unsigned char readByte(unsigned int address); 
     42        virtual unsigned int readWord(unsigned int address); 
     43        virtual unsigned int readBuffer(unsigned int address, unsigned int length, unsigned char *buffer); 
    4444                 
    4545protected: 
  • trunk/freebob/src/ieee1394service.cpp

    r21 r22  
    3030#include "avmusicstatusdescriptor.h" 
    3131#include "avinfoblock.h" 
     32#include "avgeneralmusicstatusinfoblock.h" 
     33#include "avnameinfoblock.h" 
     34#include "avaudioinfoblock.h" 
     35#include "avmidiinfoblock.h" 
     36#include "avaudiosyncinfoblock.h" 
    3237 
    3338Ieee1394Service* Ieee1394Service::m_pInstance = 0; 
     
    228233                         
    229234                        debugPrint (DEBUG_LEVEL_INFO, "      Length: 0x%04X (%d)  Type: 0x%04X\n",testblock2->getLength(),testblock2->getLength(),testblock2->getType()); 
    230                          
     235                 
     236                        // test the general status info block 
     237                        debugPrint (DEBUG_LEVEL_INFO, "    Trying to create an AvGeneralMusicStatusInfoBlock...\n"); 
     238                        AvGeneralMusicInfoBlock *testblock3=new AvGeneralMusicInfoBlock(testdesc_mid2,0); 
     239                         
     240                        // PP: the next tests could fail because of the difference in hardware. 
     241                        // these classes are intended to be used in the parser. I use hardcoded addresses in the test code, 
     242                        // instead of derived addresses based on the parent descriptors. 
     243                        // this is only intended to debug the base classes before using them in the parser. 
     244                         
     245                         
     246                        // this one should be valid (on my config) 
     247                        debugPrint (DEBUG_LEVEL_INFO, "     isValid? %s\n",(testblock3->isValid()?"yes":"no")); 
     248                        debugPrint (DEBUG_LEVEL_INFO, "      canTransmitBlocking? %s\n",(testblock3->canTransmitBlocking()?"yes":"no")); 
     249                        debugPrint (DEBUG_LEVEL_INFO, "      canTransmitNonblocking? %s\n",(testblock3->canTransmitNonblocking()?"yes":"no")); 
     250                        debugPrint (DEBUG_LEVEL_INFO, "      canReceiveBlocking? %s\n",(testblock3->canReceiveBlocking()?"yes":"no")); 
     251                        debugPrint (DEBUG_LEVEL_INFO, "      canReceiveNonblocking? %s\n",(testblock3->canReceiveNonblocking()?"yes":"no")); 
     252                         
     253                        delete testblock3; 
     254                        // this one shouldn't be valid 
     255                        testblock3=new AvGeneralMusicInfoBlock(testdesc_mid2,2+testblock1->getLength()); 
     256                        debugPrint (DEBUG_LEVEL_INFO, "     isValid? %s\n",(testblock3->isValid()?"yes":"no")); 
     257                        debugPrint (DEBUG_LEVEL_INFO, "      canTransmitBlocking? %s\n",(testblock3->canTransmitBlocking()?"yes":"no")); 
     258                        debugPrint (DEBUG_LEVEL_INFO, "      canTransmitNonblocking? %s\n",(testblock3->canTransmitNonblocking()?"yes":"no")); 
     259                        debugPrint (DEBUG_LEVEL_INFO, "      canReceiveBlocking? %s\n",(testblock3->canReceiveBlocking()?"yes":"no")); 
     260                        debugPrint (DEBUG_LEVEL_INFO, "      canReceiveNonblocking? %s\n",(testblock3->canReceiveNonblocking()?"yes":"no")); 
     261                         
     262                        debugPrint (DEBUG_LEVEL_INFO, "    Trying to create an AvAudioInfoBlock...\n"); 
     263                         
     264                        AvAudioInfoBlock *testblock4=new AvAudioInfoBlock(testdesc_mid2,0x01A); 
     265                        debugPrint (DEBUG_LEVEL_INFO, "     isValid? %s\n",(testblock4->isValid()?"yes":"no")); 
     266                        debugPrint (DEBUG_LEVEL_INFO, "      Length? 0x%04X (%d)\n",testblock4->getLength(),testblock4->getLength()); 
     267                        debugPrint (DEBUG_LEVEL_INFO, "      streams: %d\n",testblock4->getNbStreams()); 
     268                        debugPrint (DEBUG_LEVEL_INFO, "      Name: %s\n",testblock4->getName()); 
     269                         
     270                        debugPrint (DEBUG_LEVEL_INFO, "    Trying to create an AvMidiInfoBlock...\n"); 
     271 
     272                        AvMidiInfoBlock *testblock5=new AvMidiInfoBlock(testdesc_mid2,0x097); 
     273                        debugPrint (DEBUG_LEVEL_INFO, "     isValid? %s\n",(testblock5->isValid()?"yes":"no")); 
     274                        debugPrint (DEBUG_LEVEL_INFO, "      Length? 0x%04X (%d)\n",testblock5->getLength(),testblock5->getLength()); 
     275                        unsigned int nb_midi_streams=testblock5->getNbStreams(); 
     276                        debugPrint (DEBUG_LEVEL_INFO, "      streams: %d\n",nb_midi_streams); 
     277                        for (unsigned int i=0;i<nb_midi_streams;i++) { 
     278                                debugPrint (DEBUG_LEVEL_INFO, "       stream %d name: %s\n",i,testblock5->getName(i)); 
     279                        } 
     280                         
     281                        debugPrint (DEBUG_LEVEL_INFO, "    Trying to create an AvAudioSyncInfoBlock...\n"); 
     282                        AvAudioSyncInfoBlock *testblock6=new AvAudioSyncInfoBlock(testdesc_mid2,0x0260); 
     283                        debugPrint (DEBUG_LEVEL_INFO, "     isValid? %s\n",(testblock6->isValid()?"yes":"no")); 
     284                        debugPrint (DEBUG_LEVEL_INFO, "      canSyncBus? %s\n",(testblock6->canSyncBus()?"yes":"no")); 
     285                        debugPrint (DEBUG_LEVEL_INFO, "      canSyncExternal? %s\n",(testblock6->canSyncExternal()?"yes":"no")); 
     286                         
     287                         
    231288                        debugPrint (DEBUG_LEVEL_INFO, "    Deleting AvInfoBlocks...\n"); 
     289                         
    232290                        delete testblock1; 
    233291                        delete testblock2; 
    234                          
     292                        delete testblock3; 
     293                        delete testblock4; 
     294                        delete testblock5; 
     295                        delete testblock6; 
     296                                                                         
    235297                        debugPrint (DEBUG_LEVEL_INFO, "    Deleting AvMusicStatusDescriptor...\n"); 
    236298                        delete testdesc_mid2;                    
  • trunk/freebob/src/Makefile.am

    r21 r22  
    4343        avinfoblock.h \ 
    4444        avinfoblock.cpp \ 
     45        avgeneralmusicstatusinfoblock.h \ 
     46        avgeneralmusicstatusinfoblock.cpp \ 
     47        avnameinfoblock.h \ 
     48        avnameinfoblock.cpp \ 
     49        avaudioinfoblock.h \ 
     50        avaudioinfoblock.cpp \ 
     51        avmidiinfoblock.h \ 
     52        avmidiinfoblock.cpp \ 
     53        avaudiosyncinfoblock.h \ 
     54        avaudiosyncinfoblock.cpp \ 
    4555        debugmodule.cpp \ 
    4656        main.cpp