Changeset 82
- Timestamp:
- 03/30/05 11:36:28 (19 years ago)
- Files:
-
- trunk/freebob/src/avdevice.cpp (modified) (2 diffs)
- trunk/freebob/src/avdevice.h (modified) (5 diffs)
- trunk/freebob/src/cmhandler.cpp (modified) (1 diff)
- trunk/freebob/src/configrom.cpp (modified) (6 diffs)
- trunk/freebob/src/configrom.h (modified) (3 diffs)
- trunk/freebob/src/ieee1394service.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/freebob/src/avdevice.cpp
r80 r82 32 32 #define AVC1394_GET_RESPONSE_OPERAND(x, n) (((x) & (0xFF000000 >> (((n)%4)*8))) >> (((3-(n))%4)*8)) 33 33 34 AvDevice::AvDevice(const char* modelName, octlet_t oGuid) 35 : m_iNodeId( -1 ) 34 AvDevice::AvDevice(ConfigRom& configRom) 35 : m_configRom( ConfigRom( configRom ) ) 36 , m_iNodeId( -1 ) 36 37 , m_iPort( -1 ) 37 38 , m_bInitialised( false ) 38 , m_oGuid( oGuid )39 39 , m_iGeneration( 0 ) 40 40 , cSubUnits( 0 ) … … 45 45 , m_iNbExtDestinationPlugs( 0 ) 46 46 , m_iNbExtSourcePlugs( 0 ) 47 , m_modelName( modelName )48 47 { 49 48 setDebugLevel( DEBUG_LEVEL_MODERATE ); trunk/freebob/src/avdevice.h
r80 r82 1 1 2 /* avdevice.h 2 3 * Copyright (C) 2004 by Daniel Wagner, Pieter Palmers … … 24 25 #include "ieee1394service.h" 25 26 #include "debugmodule.h" 27 #include "configrom.h" 26 28 27 29 #include <libxml/tree.h> … … 41 43 }; 42 44 43 AvDevice( const char* modelName, octlet_t oGuid);45 AvDevice( ConfigRom& configRom); 44 46 virtual ~AvDevice(); 45 47 … … 51 53 { m_iPort = iPort; } 52 54 octlet_t getGuid() 53 { return m_oGuid; } 54 const char* getModelName() const 55 { return m_modelName; } 55 { return m_configRom.getGuid(); } 56 const std::string getVendorName() const 57 { return m_configRom.getVendorName(); } 58 const std::string getModelName() const 59 { return m_configRom.getModelName(); } 60 56 61 57 62 void execute( EStates state ); … … 91 96 92 97 protected: 93 98 AvDeviceSubunit *getSubunit(unsigned char type, unsigned char id); 94 99 95 96 100 FBReturnCodes create1394RawHandle(); 101 FBReturnCodes enumerateSubUnits(); 97 102 98 103 private: 104 ConfigRom m_configRom; 99 105 int m_iNodeId; 100 106 int m_iPort; trunk/freebob/src/cmhandler.cpp
r80 r82 129 129 xmlDocSetRootElement( doc, rootNode ); 130 130 131 char* res; 132 if ( asprintf( &res, 133 "Connecton Informaton for %s configuration", 134 pAvDevice->getModelName() ) < 0) 135 { 136 debugError( "Could't format string\n" ); 137 xmlFreeDoc( doc ); 138 xmlCleanupParser(); 139 return 0; 140 } 131 std::string res = "Connection Information for " 132 + pAvDevice->getVendorName() 133 +", " 134 + pAvDevice->getModelName() 135 + " configuration"; 141 136 if ( !xmlNewChild( rootNode, 142 137 0, 143 138 BAD_CAST "Comment", 144 BAD_CAST res ) ) {139 BAD_CAST res.c_str() ) ) { 145 140 debugError( "Couldn't create comment node\n" ); 146 141 xmlFreeDoc( doc ); trunk/freebob/src/configrom.cpp
r80 r82 50 50 , m_iNodeId( iNodeId ) 51 51 , m_bAvcDevice( false ) 52 , m_vendorName( 0)53 , m_modelName( 0)52 , m_vendorName( "" ) 53 , m_modelName( "" ) 54 54 , m_vendorNameKv( 0 ) 55 55 , m_modelNameKv( 0 ) … … 59 59 ConfigRom::~ConfigRom() 60 60 { 61 delete m_vendorName;62 m_vendorName = 0;63 delete m_modelName;64 m_modelName = 0;65 if ( m_vendorNameKv ) {66 csr1212_release_keyval( m_vendorNameKv );67 }68 if ( m_modelNameKv ) {69 csr1212_release_keyval( m_modelNameKv );70 }71 if ( m_csr ) {72 csr1212_destroy_csr(m_csr);73 }74 61 } 75 62 … … 97 84 if ( m_vendorNameKv ) { 98 85 int len = ( m_vendorNameKv->value.leaf.len - 2 ) * sizeof( quadlet_t ); 99 m_vendorName = new char[len];100 memcpy( m_vendorName,86 char* vendorName = new char[len]; 87 memcpy( vendorName, 101 88 ( void* )CSR1212_TEXTUAL_DESCRIPTOR_LEAF_DATA( m_vendorNameKv ), 102 89 len ); 103 m_vendorName[len] = '\0'; 104 printf( "Vendor name: %s\n", m_vendorName ); 90 vendorName[len] = '\0'; 91 printf( "Vendor name: %s\n", vendorName ); 92 m_vendorName = vendorName; 105 93 } 106 94 if ( m_modelNameKv ) { 107 95 int len = ( m_modelNameKv->value.leaf.len - 2 ) * sizeof( quadlet_t ); 108 m_modelName = new char[len];109 memcpy( m _modelName,96 char* modelName = new char[len]; 97 memcpy( modelName, 110 98 ( void* )CSR1212_TEXTUAL_DESCRIPTOR_LEAF_DATA( m_modelNameKv ), 111 99 len ); 112 m_modelName[len] = '\0'; 113 printf( "Model name: %s\n", m_modelName ); 100 modelName[len] = '\0'; 101 printf( "Model name: %s\n", modelName ); 102 m_modelName = modelName; 114 103 } 115 104 … … 117 106 | CSR1212_BE32_TO_CPU(m_csr->bus_info_data[4]); 118 107 108 if ( m_vendorNameKv ) { 109 csr1212_release_keyval( m_vendorNameKv ); 110 m_vendorNameKv = 0; 111 } 112 if ( m_modelNameKv ) { 113 csr1212_release_keyval( m_modelNameKv ); 114 m_modelNameKv = 0; 115 } 116 if ( m_csr ) { 117 csr1212_destroy_csr(m_csr); 118 m_csr = 0; 119 } 119 120 return true; 120 121 } … … 286 287 } 287 288 288 const char*289 const std::string 289 290 ConfigRom::getModelName() const 290 291 { … … 292 293 } 293 294 294 const char*295 const std::string 295 296 ConfigRom::getVendorName() const 296 297 { trunk/freebob/src/configrom.h
r80 r82 21 21 #define CONFIGROM_H 22 22 23 #include <string> 24 23 25 #include <libraw1394/raw1394.h> 24 26 #include "csr1212.h" 27 25 28 26 29 class ConfigRom { … … 33 36 const bool isAvcDevice() const; 34 37 const octlet_t getGuid() const; 35 const char*getModelName() const;36 const char*getVendorName() const;38 const std::string getModelName() const; 39 const std::string getVendorName() const; 37 40 38 41 protected: … … 48 51 bool m_bAvcDevice; 49 52 octlet_t m_guid; 50 char* m_vendorName; 51 char* m_modelName; 53 std::string m_vendorName; 54 std::string m_modelName; 55 56 /* only used during parsing */ 52 57 struct csr1212_keyval* m_vendorNameKv; 53 58 struct csr1212_keyval* m_modelNameKv; trunk/freebob/src/ieee1394service.cpp
r80 r82 145 145 octlet_t oGuid = configRom.getGuid(); 146 146 147 AvDevice* pAvDevice = new AvDevice( configRom .getModelName(), oGuid);147 AvDevice* pAvDevice = new AvDevice( configRom ); 148 148 if ( !pAvDevice ) { 149 149 debugError( "Could not create AvDevice instance for "