Changeset 365
- Timestamp:
- 01/03/07 14:37:50 (17 years ago)
- Files:
-
- trunk/libfreebob/config.h.in (modified) (1 diff)
- trunk/libfreebob/src/bebob/bebob_avdevice.cpp (modified) (22 diffs)
- trunk/libfreebob/src/bebob/bebob_avdevice.h (modified) (7 diffs)
- trunk/libfreebob/src/bebob/bebob_avdevice_subunit.cpp (modified) (1 diff)
- trunk/libfreebob/src/bebob/bebob_avplug.cpp (modified) (1 diff)
- trunk/libfreebob/src/bebob/bebob_dl_codes.h (modified) (1 diff)
- trunk/libfreebob/src/bebob/bebob_dl_mgr.cpp (modified) (1 diff)
- trunk/libfreebob/src/bounce/bounce_avdevice.cpp (modified) (14 diffs)
- trunk/libfreebob/src/configrom.cpp (modified) (4 diffs)
- trunk/libfreebob/src/configrom.h (modified) (5 diffs)
- trunk/libfreebob/src/devicemanager.cpp (modified) (5 diffs)
- trunk/libfreebob/src/devicemanager.h (modified) (2 diffs)
- trunk/libfreebob/src/libfreebobavc/avc_connect.cpp (modified) (1 diff)
- trunk/libfreebob/src/libfreebobavc/avc_extended_cmd_generic.cpp (modified) (1 diff)
- trunk/libfreebob/src/libfreebobavc/avc_extended_plug_info.cpp (modified) (2 diffs)
- trunk/libfreebob/src/libfreebobavc/avc_extended_stream_format.cpp (modified) (1 diff)
- trunk/libfreebob/src/libfreebobavc/avc_extended_subunit_info.cpp (modified) (1 diff)
- trunk/libfreebob/src/libfreebobavc/avc_function_block.cpp (modified) (1 diff)
- trunk/libfreebob/src/libfreebobavc/avc_generic.cpp (modified) (5 diffs)
- trunk/libfreebob/src/libfreebobavc/avc_plug_info.cpp (modified) (1 diff)
- trunk/libfreebob/src/libfreebobavc/avc_serialize.cpp (moved) (moved from trunk/libfreebob/src/libfreebobavc/serialize.cpp) (4 diffs)
- trunk/libfreebob/src/libfreebobavc/avc_serialize.h (moved) (moved from trunk/libfreebob/src/libfreebobavc/serialize.h) (1 diff)
- trunk/libfreebob/src/libfreebobavc/avc_signal_source.cpp (modified) (1 diff)
- trunk/libfreebob/src/libfreebobavc/avc_subunit_info.cpp (modified) (1 diff)
- trunk/libfreebob/src/libfreebobavc/avc_unit_info.cpp (modified) (1 diff)
- trunk/libfreebob/src/libutil/serialize.cpp (moved) (moved from trunk/libfreebob/src/bebob/bebob_serialize.cpp) (10 diffs)
- trunk/libfreebob/src/libutil/serialize.h (moved) (moved from trunk/libfreebob/src/bebob/bebob_serialize.h) (5 diffs)
- trunk/libfreebob/src/libutil/unittests.cpp (moved) (moved from trunk/libfreebob/src/bebob/bebob_unittests.cpp) (2 diffs)
- trunk/libfreebob/src/Makefile.am (modified) (4 diffs)
- trunk/libfreebob/src/ser.cpp (added)
- trunk/libfreebob/tests/test-extplugcmd.cpp (modified) (1 diff)
- trunk/libfreebob/tests/test-mixer.cpp (modified) (1 diff)
- trunk/libfreebob/tests/test-volume.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libfreebob/config.h.in
r360 r365 84 84 #undef const 85 85 86 /* Define to `unsigned ' if <sys/types.h> does not define. */86 /* Define to `unsigned int' if <sys/types.h> does not define. */ 87 87 #undef size_t 88 88 trunk/libfreebob/src/bebob/bebob_avdevice.cpp
r363 r365 27 27 #include "libfreebobavc/avc_subunit_info.h" 28 28 #include "libfreebobavc/avc_extended_stream_format.h" 29 #include "libfreebobavc/ serialize.h"29 #include "libfreebobavc/avc_serialize.h" 30 30 #include "libfreebobavc/ieee1394service.h" 31 31 #include "libfreebobavc/avc_definitions.h" … … 44 44 int nodeId, 45 45 int verboseLevel ) 46 : m_ configRom( configRom )46 : m_pConfigRom( configRom ) 47 47 , m_1394Service( &ieee1394service ) 48 48 , m_nodeId( nodeId ) … … 92 92 AvDevice::getConfigRom() const 93 93 { 94 return *m_ configRom;94 return *m_pConfigRom; 95 95 } 96 96 … … 544 544 return false; 545 545 } 546 546 547 547 m_subunits.push_back( subunit ); 548 548 audioSubunitFound=true; 549 549 550 550 break; 551 551 case AVCCommand::eST_Music: … … 556 556 return false; 557 557 } 558 558 559 559 m_subunits.push_back( subunit ); 560 560 musicSubunitFound=true; 561 561 562 562 break; 563 563 default: … … 938 938 } 939 939 940 if (!addPlugToProcessor(*outputPlug,m_receiveProcessor, 940 if (!addPlugToProcessor(*outputPlug,m_receiveProcessor, 941 941 FreebobStreaming::AmdtpAudioPort::E_Capture)) { 942 942 debugFatal("Could not add plug to processor!\n"); … … 953 953 // samplerate, 954 954 // inputPlug->getNrOfChannels()); 955 // 955 // 956 956 // if(!m_receiveProcessor2->init()) { 957 957 // debugFatal("Could not initialize snooping receive processor!\n"); 958 958 // return false; 959 959 // } 960 // if (!addPlugToProcessor(*inputPlug,m_receiveProcessor2, 960 // if (!addPlugToProcessor(*inputPlug,m_receiveProcessor2, 961 961 // FreebobStreaming::AmdtpAudioPort::E_Capture)) { 962 962 // debugFatal("Could not add plug to processor!\n"); … … 970 970 samplerate, 971 971 inputPlug->getNrOfChannels()); 972 972 973 973 if(!m_transmitProcessor->init()) { 974 974 debugFatal("Could not initialize transmit processor!\n"); 975 975 return false; 976 977 } 978 976 977 } 978 979 979 // FIXME: do this the proper way! 980 980 m_transmitProcessor->syncmaster=m_receiveProcessor; 981 982 if (!addPlugToProcessor(*inputPlug,m_transmitProcessor, 981 982 if (!addPlugToProcessor(*inputPlug,m_transmitProcessor, 983 983 FreebobStreaming::AmdtpAudioPort::E_Playback)) { 984 984 debugFatal("Could not add plug to processor!\n"); … … 992 992 bool 993 993 AvDevice::addPlugToProcessor( 994 AvPlug& plug, 995 FreebobStreaming::StreamProcessor *processor, 994 AvPlug& plug, 995 FreebobStreaming::StreamProcessor *processor, 996 996 FreebobStreaming::AmdtpAudioPort::E_Direction direction) { 997 997 … … 1010 1010 const AvPlug::ChannelInfo* channelInfo = &( *it ); 1011 1011 std::ostringstream portname; 1012 1012 1013 1013 portname << "dev" << m_id << "_" << channelInfo->m_name; 1014 1014 1015 1015 FreebobStreaming::Port *p=NULL; 1016 1016 switch(clusterInfo->m_portType) { … … 1022 1022 p=new FreebobStreaming::AmdtpAudioPort( 1023 1023 portname.str(), 1024 direction, 1024 direction, 1025 1025 // \todo: streaming backend expects indexing starting from 0 1026 1026 // but bebob reports it starting from 1. Decide where 1027 1027 // and how to handle this (pp: here) 1028 channelInfo->m_streamPosition - 1, 1029 channelInfo->m_location, 1030 FreebobStreaming::AmdtpPortInfo::E_MBLA, 1028 channelInfo->m_streamPosition - 1, 1029 channelInfo->m_location, 1030 FreebobStreaming::AmdtpPortInfo::E_MBLA, 1031 1031 clusterInfo->m_portType 1032 1032 ); … … 1036 1036 p=new FreebobStreaming::AmdtpMidiPort( 1037 1037 portname.str(), 1038 direction, 1038 direction, 1039 1039 // \todo: streaming backend expects indexing starting from 0 1040 1040 // but bebob reports it starting from 1. Decide where 1041 1041 // and how to handle this (pp: here) 1042 channelInfo->m_streamPosition - 1, 1043 channelInfo->m_location, 1044 FreebobStreaming::AmdtpPortInfo::E_Midi, 1042 channelInfo->m_streamPosition - 1, 1043 channelInfo->m_location, 1044 FreebobStreaming::AmdtpPortInfo::E_Midi, 1045 1045 clusterInfo->m_portType 1046 1046 ); … … 1061 1061 debugOutput(DEBUG_LEVEL_VERBOSE, "Skipped port %s\n",channelInfo->m_name.c_str()); 1062 1062 } else { 1063 1063 1064 1064 if (!processor->addPort(p)) { 1065 1065 debugWarning("Could not register port with stream processor\n"); … … 1072 1072 } 1073 1073 1074 int 1074 int 1075 1075 AvDevice::getStreamCount() { 1076 1076 return 2; // one receive, one transmit … … 1099 1099 int plug=0; 1100 1100 int hostplug=-1; 1101 1101 1102 1102 // if (m_snoopMode) { 1103 // 1103 // 1104 1104 // switch (i) { 1105 1105 // case 0: 1106 1106 // // snooping doesn't use CMP, but obtains the info of the channel 1107 1107 // // from the target plug 1108 // 1108 // 1109 1109 // // TODO: get isochannel from plug 1110 // 1110 // 1111 1111 // // set the channel obtained by the connection management 1112 1112 // m_receiveProcessor->setChannel(iso_channel); … … 1115 1115 // // snooping doesn't use CMP, but obtains the info of the channel 1116 1116 // // from the target plug 1117 // 1117 // 1118 1118 // // TODO: get isochannel from plug 1119 // 1119 // 1120 1120 // // set the channel obtained by the connection management 1121 1121 // m_receiveProcessor2->setChannel(iso_channel); 1122 // 1122 // 1123 1123 // break; 1124 1124 // default: … … 1126 1126 // } 1127 1127 // } else { 1128 1128 1129 1129 switch (i) { 1130 1130 case 0: 1131 1131 // do connection management: make connection 1132 1132 iso_channel = iec61883_cmp_connect( 1133 m_1394Service->getHandle(), 1134 m_nodeId | 0xffc0, 1133 m_1394Service->getHandle(), 1134 m_nodeId | 0xffc0, 1135 1135 &plug, 1136 raw1394_get_local_id (m_1394Service->getHandle()), 1137 &hostplug, 1136 raw1394_get_local_id (m_1394Service->getHandle()), 1137 &hostplug, 1138 1138 &m_receiveProcessorBandwidth); 1139 1139 1140 1140 // set the channel obtained by the connection management 1141 1141 m_receiveProcessor->setChannel(iso_channel); … … 1144 1144 // do connection management: make connection 1145 1145 iso_channel = iec61883_cmp_connect( 1146 m_1394Service->getHandle(), 1147 raw1394_get_local_id (m_1394Service->getHandle()), 1148 &hostplug, 1149 m_nodeId | 0xffc0, 1146 m_1394Service->getHandle(), 1147 raw1394_get_local_id (m_1394Service->getHandle()), 1148 &hostplug, 1149 m_nodeId | 0xffc0, 1150 1150 &plug, 1151 1151 &m_transmitProcessorBandwidth); 1152 1152 1153 1153 // set the channel obtained by the connection management 1154 1154 m_transmitProcessor->setChannel(iso_channel); … … 1158 1158 } 1159 1159 // } 1160 1160 1161 1161 return 0; 1162 1162 … … 1173 1173 // case 0: 1174 1174 // // do connection management: break connection 1175 // 1175 // 1176 1176 // break; 1177 1177 // case 1: 1178 1178 // // do connection management: break connection 1179 // 1179 // 1180 1180 // break; 1181 1181 // default: … … 1187 1187 // do connection management: break connection 1188 1188 iec61883_cmp_disconnect( 1189 m_1394Service->getHandle(), 1190 m_nodeId | 0xffc0, 1189 m_1394Service->getHandle(), 1190 m_nodeId | 0xffc0, 1191 1191 plug, 1192 raw1394_get_local_id (m_1394Service->getHandle()), 1193 hostplug, 1192 raw1394_get_local_id (m_1394Service->getHandle()), 1193 hostplug, 1194 1194 m_receiveProcessor->getChannel(), 1195 1195 m_receiveProcessorBandwidth); 1196 1196 1197 1197 break; 1198 1198 case 1: 1199 1199 // do connection management: break connection 1200 1200 iec61883_cmp_disconnect( 1201 m_1394Service->getHandle(), 1202 raw1394_get_local_id (m_1394Service->getHandle()), 1203 hostplug, 1204 m_nodeId | 0xffc0, 1201 m_1394Service->getHandle(), 1202 raw1394_get_local_id (m_1394Service->getHandle()), 1203 hostplug, 1204 m_nodeId | 0xffc0, 1205 1205 plug, 1206 1206 m_transmitProcessor->getChannel(), … … 1212 1212 } 1213 1213 // } 1214 1214 1215 1215 return 0; 1216 1216 } 1217 1217 1218 bool 1219 AvDevice::serialize( Glib::ustring basePath, Util::IOSerialize& ser ) 1220 { 1221 // create base path string 1222 /* 1223 char* buf; 1224 asprintf( &buf, "%08x%08x", 1225 ( unsigned int ) ( m_pConfigRom->getGuid() >> 32 ), 1226 ( unsigned int ) ( m_pConfigRom->getGuid() & 0xffffffff ) ); 1227 std::string avDevicePath = basePath 1228 + m_pConfigRom->getVendorName() + "/" 1229 + m_pConfigRom->getModelName() + "/" 1230 + buf; 1231 free( buf ); 1232 */ 1233 1234 bool result; 1235 result = m_pConfigRom->serialize( basePath + "m_pConfigRom/", ser ); 1236 1237 return result; 1238 } 1239 1240 AvDevice* 1241 AvDevice::deserialize( Glib::ustring basePath, 1242 Ieee1394Service& ieee1394Service, 1243 Util::IODeserialize& deser ) 1244 { 1245 1246 return 0; 1247 } 1218 1248 1219 1249 } // end of namespace trunk/libfreebob/src/bebob/bebob_avdevice.h
r336 r365 36 36 #include "libstreaming/AmdtpPortInfo.h" 37 37 38 #include "libutil/serialize.h" 39 38 40 #include "iavdevice.h" 39 41 … … 47 49 public: 48 50 AvDevice( std::auto_ptr<ConfigRom>( configRom ), 49 Ieee1394Service& ieee1394Service,51 Ieee1394Service& ieee1394Service, 50 52 int nodeId, 51 int verboseLevel );53 int verboseLevel ); 52 54 virtual ~AvDevice(); 53 55 … … 72 74 73 75 Ieee1394Service* get1394Service() 74 { return m_1394Service; }76 { return m_1394Service; } 75 77 76 78 AvPlugManager& getPlugManager() 77 { return m_plugManager; }79 { return m_plugManager; } 78 80 79 81 struct SyncInfo { … … 85 87 , m_description( description ) 86 88 {} 87 AvPlug* m_source;88 AvPlug* m_destination;89 AvPlug* m_source; 90 AvPlug* m_destination; 89 91 std::string m_description; 90 92 }; … … 96 98 { return m_activeSyncInfo; } 97 99 bool setActiveSync( const SyncInfo& syncInfo ); 100 101 bool serialize( Glib::ustring basePath, Util::IOSerialize& ser ); 102 static AvDevice* deserialize( Glib::ustring basePath, 103 Ieee1394Service& ieee1394Service, 104 Util::IODeserialize& deser ); 98 105 99 106 protected: … … 124 131 AvPlug::EAvPlugType type); 125 132 126 bool addPlugToProcessor( AvPlug& plug, FreebobStreaming::StreamProcessor *processor, 133 bool addPlugToProcessor( AvPlug& plug, FreebobStreaming::StreamProcessor *processor, 127 134 FreebobStreaming::AmdtpAudioPort::E_Direction direction); 128 135 … … 137 144 std::string syncDescription ); 138 145 protected: 139 std::auto_ptr<ConfigRom>( m_ configRom );146 std::auto_ptr<ConfigRom>( m_pConfigRom ); 140 147 Ieee1394Service* m_1394Service; 141 148 int m_nodeId; trunk/libfreebob/src/bebob/bebob_avdevice_subunit.cpp
r341 r365 27 27 #include "libfreebobavc/avc_plug_info.h" 28 28 #include "libfreebobavc/avc_extended_stream_format.h" 29 #include "libfreebobavc/ serialize.h"29 #include "libfreebobavc/avc_serialize.h" 30 30 31 31 namespace BeBoB { trunk/libfreebob/src/bebob/bebob_avplug.cpp
r341 r365 22 22 23 23 #include "libfreebobavc/ieee1394service.h" 24 #include "libfreebobavc/ serialize.h"24 #include "libfreebobavc/avc_serialize.h" 25 25 26 26 namespace BeBoB { trunk/libfreebob/src/bebob/bebob_dl_codes.h
r336 r365 24 24 #include "fbtypes.h" 25 25 26 #include "libfreebobavc/ serialize.h"26 #include "libfreebobavc/avc_serialize.h" 27 27 28 28 namespace BeBoB { trunk/libfreebob/src/bebob/bebob_dl_mgr.cpp
r336 r365 25 25 #include "configrom.h" 26 26 #include "libfreebobavc/ieee1394service.h" 27 #include "libfreebobavc/ serialize.h"27 #include "libfreebobavc/avc_serialize.h" 28 28 29 29 #include <netinet/in.h> trunk/libfreebob/src/bounce/bounce_avdevice.cpp
r336 r365 27 27 #include "libfreebobavc/avc_subunit_info.h" 28 28 #include "libfreebobavc/avc_extended_stream_format.h" 29 #include "libfreebobavc/ serialize.h"29 #include "libfreebobavc/avc_serialize.h" 30 30 #include "libfreebobavc/ieee1394service.h" 31 31 #include "libfreebobavc/avc_definitions.h" … … 33 33 #include "debugmodule/debugmodule.h" 34 34 35 #include <iostream> 35 #include <iostream> 36 36 #include <sstream> 37 37 #include <stdint.h> … … 61 61 { 62 62 setDebugLevel( verboseLevel ); 63 63 64 64 debugOutput( DEBUG_LEVEL_VERBOSE, "Created Bounce::BounceDevice (NodeID %d)\n", 65 65 nodeId ); … … 84 84 static VendorModelEntry supportedDeviceList[] = 85 85 { 86 // {0x0000, 0x000000}, 86 // {0x0000, 0x000000}, 87 87 }; 88 88 … … 98 98 { 99 99 if ( ( supportedDeviceList[i].vendor_id == vendorId ) 100 && ( supportedDeviceList[i].model_id == modelId ) 100 && ( supportedDeviceList[i].model_id == modelId ) 101 101 ) 102 102 { … … 114 114 quadlet_t request[6]; 115 115 quadlet_t *resp; 116 116 117 117 debugOutput( DEBUG_LEVEL_VERBOSE, "Discovering...\n" ); 118 118 119 119 std::string vendor=std::string(FREEBOB_BOUNCE_SERVER_VENDORNAME); 120 120 std::string model=std::string(FREEBOB_BOUNCE_SERVER_MODELNAME); 121 121 122 122 if (!(m_configRom->getVendorName().compare(0,vendor.length(),vendor,0,vendor.length())==0) 123 123 || !(m_configRom->getModelName().compare(0,model.length(),model,0,model.length())==0)) { … … 178 178 BounceDevice::addXmlDescription( xmlNodePtr deviceNode ) 179 179 { 180 180 181 181 return false; 182 182 … … 187 187 bool 188 188 BounceDevice::addPortsToProcessor( 189 FreebobStreaming::StreamProcessor *processor, 189 FreebobStreaming::StreamProcessor *processor, 190 190 FreebobStreaming::AmdtpAudioPort::E_Direction direction) { 191 191 192 192 debugOutput(DEBUG_LEVEL_VERBOSE,"Adding ports to processor\n"); 193 193 194 194 int i=0; 195 195 for (i=0;i<BOUNCE_NR_OF_CHANNELS;i++) { 196 196 char *buff; 197 197 asprintf(&buff,"dev%d%s_Port%d",m_id,direction==FreebobStreaming::AmdtpAudioPort::E_Playback?"p":"c",i); 198 198 199 199 FreebobStreaming::Port *p=NULL; 200 200 p=new FreebobStreaming::AmdtpAudioPort( 201 201 buff, 202 direction, 202 direction, 203 203 // \todo: streaming backend expects indexing starting from 0 204 204 // but bebob reports it starting from 1. Decide where 205 205 // and how to handle this (pp: here) 206 i, 207 0, 208 FreebobStreaming::AmdtpPortInfo::E_MBLA, 206 i, 207 0, 208 FreebobStreaming::AmdtpPortInfo::E_MBLA, 209 209 0 210 210 ); 211 211 212 212 if (!p) { 213 213 debugOutput(DEBUG_LEVEL_VERBOSE, "Skipped port %s\n",buff); 214 214 } else { 215 215 216 216 if (!processor->addPort(p)) { 217 217 debugWarning("Could not register port with stream processor\n"); … … 220 220 } else { 221 221 debugOutput(DEBUG_LEVEL_VERBOSE, "Added port %s\n",buff); 222 222 223 223 } 224 224 } 225 225 226 226 free(buff); 227 227 228 228 } 229 229 … … 240 240 m_samplerate, 241 241 BOUNCE_NR_OF_CHANNELS); 242 242 243 243 if(!m_receiveProcessor->init()) { 244 244 debugFatal("Could not initialize receive processor!\n"); 245 245 return false; 246 247 } 248 249 if (!addPortsToProcessor(m_receiveProcessor, 246 247 } 248 249 if (!addPortsToProcessor(m_receiveProcessor, 250 250 FreebobStreaming::AmdtpAudioPort::E_Capture)) { 251 251 debugFatal("Could not add ports to processor!\n"); … … 258 258 m_samplerate, 259 259 BOUNCE_NR_OF_CHANNELS); 260 260 261 261 m_transmitProcessor->setVerboseLevel(getDebugLevel()); 262 262 263 263 if(!m_transmitProcessor->init()) { 264 264 debugFatal("Could not initialize transmit processor!\n"); 265 265 return false; 266 267 } 268 269 if (!addPortsToProcessor(m_transmitProcessor, 266 267 } 268 269 if (!addPortsToProcessor(m_transmitProcessor, 270 270 FreebobStreaming::AmdtpAudioPort::E_Playback)) { 271 271 debugFatal("Could not add ports to processor!\n"); 272 272 return false; 273 273 } 274 274 275 275 return true; 276 276 } 277 277 278 int 278 int 279 279 BounceDevice::getStreamCount() { 280 280 return 2; // one receive, one transmit … … 299 299 // int plug=0; 300 300 // int hostplug=-1; 301 // 301 // 302 302 switch (i) { 303 303 case 0: 304 304 // // do connection management: make connection 305 305 // iso_channel = iec61883_cmp_connect( 306 // m_1394Service->getHandle(), 307 // m_nodeId | 0xffc0, 306 // m_1394Service->getHandle(), 307 // m_nodeId | 0xffc0, 308 308 // &plug, 309 // raw1394_get_local_id (m_1394Service->getHandle()), 310 // &hostplug, 309 // raw1394_get_local_id (m_1394Service->getHandle()), 310 // &hostplug, 311 311 // &m_receiveProcessorBandwidth); 312 // 312 // 313 313 // // set the channel obtained by the connection management 314 314 m_receiveProcessor->setChannel(1); … … 317 317 // // do connection management: make connection 318 318 // iso_channel = iec61883_cmp_connect( 319 // m_1394Service->getHandle(), 320 // raw1394_get_local_id (m_1394Service->getHandle()), 321 // &hostplug, 322 // m_nodeId | 0xffc0, 319 // m_1394Service->getHandle(), 320 // raw1394_get_local_id (m_1394Service->getHandle()), 321 // &hostplug, 322 // m_nodeId | 0xffc0, 323 323 // &plug, 324 324 // &m_transmitProcessorBandwidth); 325 // 325 // 326 326 // // set the channel obtained by the connection management 327 327 // // m_receiveProcessor2->setChannel(iso_channel); … … 342 342 // int plug=0; 343 343 // int hostplug=-1; 344 // 344 // 345 345 // switch (i) { 346 346 // case 0: 347 347 // // do connection management: break connection 348 348 // iec61883_cmp_disconnect( 349 // m_1394Service->getHandle(), 350 // m_nodeId | 0xffc0, 349 // m_1394Service->getHandle(), 350 // m_nodeId | 0xffc0, 351 351 // plug, 352 // raw1394_get_local_id (m_1394Service->getHandle()), 353 // hostplug, 352 // raw1394_get_local_id (m_1394Service->getHandle()), 353 // hostplug, 354 354 // m_receiveProcessor->getChannel(), 355 355 // m_receiveProcessorBandwidth); 356 // 356 // 357 357 // break; 358 358 // case 1: 359 359 // // do connection management: break connection 360 360 // iec61883_cmp_disconnect( 361 // m_1394Service->getHandle(), 362 // raw1394_get_local_id (m_1394Service->getHandle()), 363 // hostplug, 364 // m_nodeId | 0xffc0, 361 // m_1394Service->getHandle(), 362 // raw1394_get_local_id (m_1394Service->getHandle()), 363 // hostplug, 364 // m_nodeId | 0xffc0, 365 365 // plug, 366 366 // m_transmitProcessor->getChannel(), 367 367 // m_transmitProcessorBandwidth); 368 // 368 // 369 369 // // set the channel obtained by the connection management 370 370 // // m_receiveProcessor2->setChannel(iso_channel); trunk/libfreebob/src/configrom.cpp
r336 r365 81 81 } 82 82 83 ConfigRom::ConfigRom() 84 : m_1394Service( 0 ) 85 , m_nodeId( -1 ) 86 , m_avcDevice( false ) 87 , m_guid( 0 ) 88 , m_vendorName( "" ) 89 , m_modelName( "" ) 90 , m_vendorId( 0 ) 91 , m_modelId( 0 ) 92 , m_unit_specifier_id( 0 ) 93 , m_unit_version( 0 ) 94 , m_isIsoResourceManager( false ) 95 , m_isCycleMasterCapable( false ) 96 , m_isSupportIsoOperations( false ) 97 , m_isBusManagerCapable( false ) 98 , m_cycleClkAcc( 0 ) 99 , m_maxRec( 0 ) 100 , m_nodeVendorId( 0 ) 101 , m_chipIdHi( 0 ) 102 , m_chipIdLow( 0 ) 103 , m_vendorNameKv( 0 ) 104 , m_modelNameKv( 0 ) 105 , m_csr( 0 ) 106 { 107 } 108 83 109 ConfigRom::~ConfigRom() 84 110 { 111 } 112 113 bool 114 ConfigRom::operator == ( const ConfigRom& rhs ) 115 { 116 return m_guid == rhs.m_guid; 85 117 } 86 118 … … 347 379 } 348 380 349 const std::string381 const Glib::ustring 350 382 ConfigRom::getModelName() const 351 383 { … … 353 385 } 354 386 355 const std::string387 const Glib::ustring 356 388 ConfigRom::getVendorName() const 357 389 { … … 468 500 return 1 << ( m_maxRec + 1 ); 469 501 } 502 503 bool 504 ConfigRom::serialize( Glib::ustring path, Util::IOSerialize& ser ) 505 { 506 bool result; 507 result = ser.write( path + "/m_nodeId", m_nodeId ); 508 result &= ser.write( path + "/m_avcDevice", m_avcDevice ); 509 result &= ser.write( path + "/m_guid", m_guid ); 510 result &= ser.write( path + "/m_vendorName", Glib::ustring( m_vendorName ) ); 511 result &= ser.write( path + "/m_modelName", Glib::ustring( m_modelName ) ); 512 result &= ser.write( path + "/m_vendorId", m_vendorId ); 513 result &= ser.write( path + "/m_modelId", m_modelId ); 514 result &= ser.write( path + "/m_unit_specifier_id", m_unit_specifier_id ); 515 result &= ser.write( path + "/m_unit_version", m_unit_version ); 516 result &= ser.write( path + "/m_isIsoResourceManager", m_isIsoResourceManager ); 517 result &= ser.write( path + "/m_isCycleMasterCapable", m_isCycleMasterCapable ); 518 result &= ser.write( path + "/m_isSupportIsoOperations", m_isSupportIsoOperations ); 519 result &= ser.write( path + "/m_isBusManagerCapable", m_isBusManagerCapable ); 520 result &= ser.write( path + "/m_cycleClkAcc", m_cycleClkAcc ); 521 result &= ser.write( path + "/m_maxRec", m_maxRec ); 522 result &= ser.write( path + "/m_nodeVendorId", m_nodeVendorId ); 523 result &= ser.write( path + "/m_chipIdHi", m_chipIdHi ); 524 result &= ser.write( path + "/m_chipIdLow", m_chipIdLow ); 525 return result; 526 } 527 528 ConfigRom* 529 ConfigRom::deserialize( Glib::ustring path, Util::IODeserialize& deser ) 530 { 531 ConfigRom* pConfigRom = new ConfigRom; 532 if ( !pConfigRom ) { 533 return 0; 534 } 535 536 bool result; 537 result = deser.read( path + "/m_nodeId", pConfigRom->m_nodeId ); 538 result &= deser.read( path + "/m_avcDevice", pConfigRom->m_avcDevice ); 539 result &= deser.read( path + "/m_guid", pConfigRom->m_guid ); 540 result &= deser.read( path + "/m_vendorName", pConfigRom->m_vendorName ); 541 result &= deser.read( path + "/m_modelName", pConfigRom->m_modelName ); 542 result &= deser.read( path + "/m_vendorId", pConfigRom->m_vendorId ); 543 result &= deser.read( path + "/m_modelId", pConfigRom->m_modelId ); 544 result &= deser.read( path + "/m_unit_specifier_id", pConfigRom->m_unit_specifier_id ); 545 result &= deser.read( path + "/m_unit_version", pConfigRom->m_unit_version ); 546 result &= deser.read( path + "/m_isIsoResourceManager", pConfigRom->m_isIsoResourceManager ); 547 result &= deser.read( path + "/m_isCycleMasterCapable", pConfigRom->m_isCycleMasterCapable ); 548 result &= deser.read( path + "/m_isSupportIsoOperations", pConfigRom->m_isSupportIsoOperations ); 549 result &= deser.read( path + "/m_isBusManagerCapable", pConfigRom->m_isBusManagerCapable ); 550 result &= deser.read( path + "/m_cycleClkAcc", pConfigRom->m_cycleClkAcc ); 551 result &= deser.read( path + "/m_maxRec", pConfigRom->m_maxRec ); 552 result &= deser.read( path + "/m_nodeVendorId", pConfigRom->m_nodeVendorId ); 553 result &= deser.read( path + "/m_chipIdHi", pConfigRom->m_chipIdHi ); 554 result &= deser.read( path + "/m_chipIdLow", pConfigRom->m_chipIdLow ); 555 556 return pConfigRom; 557 } 558 559 bool 560 ConfigRom::setNodeId( fb_nodeid_t nodeId ) 561 { 562 m_nodeId = nodeId; 563 return true; 564 } trunk/libfreebob/src/configrom.h
r336 r365 25 25 #include "csr1212.h" 26 26 27 #include "libutil/serialize.h" 27 28 #include "debugmodule/debugmodule.h" 28 29 … … 38 39 bool initialize(); 39 40 41 bool operator == ( const ConfigRom& rhs ); 42 40 43 const fb_nodeid_t getNodeId() const; 41 44 const fb_octlet_t getGuid() const; 42 const std::string getModelName() const;43 const std::string getVendorName() const;44 45 const Glib::ustring getModelName() const; 46 const Glib::ustring getVendorName() const; 47 45 48 const unsigned int getModelId() const; 46 49 const unsigned int getVendorId() const; … … 66 69 67 70 bool updatedNodeId(); 71 bool setNodeId( fb_nodeid_t nodeId ); 68 72 69 73 void printConfigRom() const; 74 75 bool serialize( Glib::ustring path, Util::IOSerialize& ser ); 76 static ConfigRom* deserialize( Glib::ustring path, Util::IODeserialize& deser ); 70 77 71 78 protected: … … 80 87 bool m_avcDevice; 81 88 fb_octlet_t m_guid; 82 std::stringm_vendorName;83 std::stringm_modelName;89 Glib::ustring m_vendorName; 90 Glib::ustring m_modelName; 84 91 unsigned int m_vendorId; 85 92 unsigned int m_modelId; … … 102 109 103 110 private: 104 ConfigRom( const ConfigRom& ); 111 ConfigRom( const ConfigRom& ); // do not allow copy ctor 112 ConfigRom(); // ctor for deserialition 105 113 106 114 DECLARE_DEBUG_MODULE; trunk/libfreebob/src/devicemanager.cpp
r341 r365 107 107 { 108 108 debugOutput( DEBUG_LEVEL_VERBOSE, "Probing node %d...\n", nodeId ); 109 109 110 110 std::auto_ptr<ConfigRom> configRom = 111 111 std::auto_ptr<ConfigRom>( new ConfigRom( *m_1394Service, … … 241 241 } 242 242 243 unsigned int 243 unsigned int 244 244 DeviceManager::getAvDeviceCount( ) 245 245 { … … 341 341 xmlFreeDoc( doc ); 342 342 xmlCleanupParser(); 343 343 344 344 free(result); 345 345 return 0; … … 355 355 return 0; 356 356 } 357 357 358 358 free(result); 359 359 } … … 368 368 } 369 369 370 bool 371 DeviceManager::saveCache( Glib::ustring fileName ) 372 { 373 int i = 0; 374 for ( IAvDeviceVectorIterator it = m_avDevices.begin(); 375 it != m_avDevices.end(); 376 ++it ) 377 { 378 IAvDevice* pAvDevice = *it; 379 BeBoB::AvDevice* pBeBoBDevice = reinterpret_cast< BeBoB::AvDevice* >( pAvDevice ); 380 if ( pBeBoBDevice ) { 381 Util::XMLSerialize ser( fileName ); 382 std::string idx = "id" + i; 383 Glib::ustring basePath = "BeBoB/" + idx + "/"; 384 i++; 385 pBeBoBDevice->serialize( basePath, ser ); 386 std::cout << "a bebob device serialized" << std::endl; 387 return true; 388 } 389 } 390 return true; 391 } 392 393 bool 394 DeviceManager::loadCache( Glib::ustring fileName ) 395 { 396 Util::XMLDeserialize deser( fileName ); 397 BeBoB::AvDevice* pBeBoBDevice = 0; 398 int i = 0; 399 400 typedef std::vector<ConfigRom*> ConfigRomVector; 401 ConfigRomVector configRoms; 402 403 for ( fb_nodeid_t nodeId = 0; 404 nodeId < m_1394Service->getNodeCount(); 405 ++nodeId ) 406 { 407 ConfigRom* pConfigRom = new ConfigRom( *m_1394Service, nodeId ); 408 if ( !pConfigRom->initialize() ) { 409 // \todo If a PHY on the bus is in power safe mode then 410 // the config rom is missing. So this might be just 411 // such this case and we can safely skip it. But it might 412 // be there is a real software problem on our side. 413 // This should be handled more carefuly. 414 debugOutput( DEBUG_LEVEL_NORMAL, 415 "Could not read config rom from device (node id %d). " 416 "Skip device discovering for this node\n", 417 nodeId ); 418 delete pConfigRom; 419 continue; 420 } 421 configRoms.push_back( pConfigRom ); 422 } 423 424 do { 425 std::string idx = "id" + i; 426 pBeBoBDevice = BeBoB::AvDevice::deserialize( 427 "BeBoB/" + idx + "/", 428 *m_1394Service, 429 deser ); 430 ++i; 431 if ( pBeBoBDevice ) { 432 for (ConfigRomVector::iterator it = configRoms.begin(); 433 it != configRoms.end(); 434 ++it ) 435 { 436 ConfigRom* pConfigRom = *it; 437 438 if ( pBeBoBDevice->getConfigRom() == *pConfigRom ) { 439 pBeBoBDevice->getConfigRom().setNodeId( pConfigRom->getNodeId() ); 440 // m_avDevices.push_back( pBeBoBDevice ); 441 } 442 } 443 } 444 } while ( pBeBoBDevice ); 445 446 return true; 447 } trunk/libfreebob/src/devicemanager.h
r336 r365 26 26 #include "libfreebob/xmlparser.h" 27 27 28 #include <glibmm/ustring.h> 29 28 30 #include <vector> 29 31 … … 52 54 53 55 IAvDevice* getAvDevice( int nodeId ); 54 55 56 IAvDevice* getAvDeviceByIndex( int idx ); 57 unsigned int getAvDeviceCount(); 56 58 57 59 xmlDocPtr getXmlDescription(); 60 61 bool saveCache( Glib::ustring fileName ); 62 bool loadCache( Glib::ustring fileName ); 58 63 59 64 protected: trunk/libfreebob/src/libfreebobavc/avc_connect.cpp
r336 r365 20 20 21 21 #include "avc_connect.h" 22 #include " serialize.h"22 #include "avc_serialize.h" 23 23 #include "ieee1394service.h" 24 24 trunk/libfreebob/src/libfreebobavc/avc_extended_cmd_generic.cpp
r336 r365 20 20 21 21 #include "avc_extended_cmd_generic.h" 22 #include " serialize.h"22 #include "avc_serialize.h" 23 23 #include "ieee1394service.h" 24 24 trunk/libfreebob/src/libfreebobavc/avc_extended_plug_info.cpp
r336 r365 20 20 21 21 #include "avc_extended_plug_info.h" 22 #include " serialize.h"22 #include "avc_serialize.h" 23 23 #include "ieee1394service.h" 24 24 … … 627 627 628 628 free(buf); 629 629 630 630 switch ( m_infoType ) { 631 631 case eIT_PlugType: trunk/libfreebob/src/libfreebobavc/avc_extended_stream_format.cpp
r336 r365 20 20 21 21 #include "avc_extended_stream_format.h" 22 #include " serialize.h"22 #include "avc_serialize.h" 23 23 #include "ieee1394service.h" 24 24 trunk/libfreebob/src/libfreebobavc/avc_extended_subunit_info.cpp
r336 r365 20 20 21 21 #include "avc_extended_subunit_info.h" 22 #include " serialize.h"22 #include "avc_serialize.h" 23 23 #include "ieee1394service.h" 24 24 trunk/libfreebob/src/libfreebobavc/avc_function_block.cpp
r336 r365 20 20 21 21 #include "avc_function_block.h" 22 #include " serialize.h"22 #include "avc_serialize.h" 23 23 #include "ieee1394service.h" 24 24 trunk/libfreebob/src/libfreebobavc/avc_generic.cpp
r336 r365 20 20 21 21 #include "avc_generic.h" 22 #include " serialize.h"22 #include "avc_serialize.h" 23 23 #include "ieee1394service.h" 24 24 … … 177 177 debugOutput( DEBUG_LEVEL_VERY_VERBOSE, " Request:"); 178 178 showFcpFrame( m_fcpFrame, fcpFrameSize ); 179 179 180 180 StringSerializer se_dbg; 181 181 serialize( se_dbg ); 182 183 debugOutputShort(DEBUG_LEVEL_VERY_VERBOSE, "%s", 182 183 debugOutputShort(DEBUG_LEVEL_VERY_VERBOSE, "%s", 184 184 se_dbg.getString().c_str()); 185 185 } … … 211 211 StringSerializer se_dbg; 212 212 serialize( se_dbg ); 213 214 debugOutputShort(DEBUG_LEVEL_VERY_VERBOSE, "%s", 213 214 debugOutputShort(DEBUG_LEVEL_VERY_VERBOSE, "%s", 215 215 se_dbg.getString().c_str()); 216 216 } … … 219 219 debugWarning( "unexpected response received (0x%x)\n", m_eResponse ); 220 220 debugOutput( DEBUG_LEVEL_VERY_VERBOSE," Response:"); 221 221 222 222 BufferDeserialize de( buf, resp_len ); 223 223 deserialize( de ); … … 229 229 debugWarning( "no response\n" ); 230 230 } 231 231 232 232 debugOutputShort( DEBUG_LEVEL_VERY_VERBOSE, "\n" ); 233 233 trunk/libfreebob/src/libfreebobavc/avc_plug_info.cpp
r336 r365 20 20 21 21 #include "avc_plug_info.h" 22 #include " serialize.h"22 #include "avc_serialize.h" 23 23 #include "ieee1394service.h" 24 24 trunk/libfreebob/src/libfreebobavc/avc_serialize.cpp
r336 r365 1 /* serialize.cpp2 * Copyright (C) 2005 by Daniel Wagner1 /* avc_serialize.cpp 2 * Copyright (C) 2005,07 by Daniel Wagner 3 3 * 4 4 * This file is part of FreeBoB. … … 19 19 */ 20 20 21 #include " serialize.h"21 #include "avc_serialize.h" 22 22 23 23 #include <iostream> … … 50 50 char* result; 51 51 asprintf( &result, " %3d:\t0x%02x\t%s\n", m_cnt, d, name ); 52 52 53 53 m_string += result; 54 54 free( result ); 55 55 56 56 m_cnt += sizeof( byte_t ); 57 57 … … 64 64 char* result; 65 65 asprintf( &result, " %3d:\t0x%08x\t%s\n", m_cnt, d, name ); 66 66 67 67 m_string += result; 68 68 free( result ); 69 69 70 70 m_cnt += sizeof( quadlet_t ); 71 71 return true; trunk/libfreebob/src/libfreebobavc/avc_serialize.h
r336 r365 1 /* serialize.h2 * Copyright (C) 2005 by Daniel Wagner1 /* avc_serialize.h 2 * Copyright (C) 2005,07 by Daniel Wagner 3 3 * 4 4 * This file is part of FreeBoB. trunk/libfreebob/src/libfreebobavc/avc_signal_source.cpp
r336 r365 20 20 21 21 #include "avc_signal_source.h" 22 #include " serialize.h"22 #include "avc_serialize.h" 23 23 #include "ieee1394service.h" 24 24 trunk/libfreebob/src/libfreebobavc/avc_subunit_info.cpp
r336 r365 20 20 21 21 #include "avc_subunit_info.h" 22 #include " serialize.h"22 #include "avc_serialize.h" 23 23 #include "ieee1394service.h" 24 24 trunk/libfreebob/src/libfreebobavc/avc_unit_info.cpp
r336 r365 20 20 21 21 #include "avc_unit_info.h" 22 #include " serialize.h"22 #include "avc_serialize.h" 23 23 #include "ieee1394service.h" 24 24 trunk/libfreebob/src/libutil/serialize.cpp
r361 r365 1 /* bebob_serialize.cpp2 * Copyright (C) 2006 by Daniel Wagner1 /* serialize.cpp 2 * Copyright (C) 2006,07 by Daniel Wagner 3 3 * 4 4 * This file is part of FreeBoB. … … 19 19 */ 20 20 21 #include " bebob_serialize.h"21 #include "serialize.h" 22 22 23 23 using namespace std; … … 44 44 ///////////////////////////////// 45 45 46 BeBoB::XMLSerialize::XMLSerialize( const char* pFileName )46 Util::XMLSerialize::XMLSerialize( Glib::ustring fileName ) 47 47 : IOSerialize() 48 , m_filepath( pFileName )48 , m_filepath( fileName ) 49 49 { 50 50 try { … … 56 56 57 57 58 BeBoB::XMLSerialize::~XMLSerialize()58 Util::XMLSerialize::~XMLSerialize() 59 59 { 60 60 try { … … 67 67 68 68 bool 69 BeBoB::XMLSerialize::write( const char* pMemberName,70 69 Util::XMLSerialize::write( std::string strMemberName, 70 long long value ) 71 71 72 72 { 73 73 vector<string> tokens; 74 string str( pMemberName ); 75 tokenize( str, tokens, "/" ); 74 tokenize( strMemberName, tokens, "/" ); 76 75 77 76 if ( tokens.size() == 0 ) { … … 93 92 94 93 bool 95 BeBoB::XMLSerialize::write( const char* pMemberName,96 94 Util::XMLSerialize::write( std::string strMemberName, 95 Glib::ustring str) 97 96 { 98 97 vector<string> tokens; 99 string memberName( pMemberName ); 100 tokenize( memberName, tokens, "/" ); 98 tokenize( strMemberName, tokens, "/" ); 101 99 102 100 if ( tokens.size() == 0 ) { … … 115 113 116 114 xmlpp::Node* 117 BeBoB::XMLSerialize::getNodePath( xmlpp::Node* pRootNode, std::vector<string>& tokens ) 115 Util::XMLSerialize::getNodePath( xmlpp::Node* pRootNode, 116 std::vector<string>& tokens ) 118 117 { 119 118 // returns the correct node on which the new element has to be added. … … 155 154 /***********************************/ 156 155 157 BeBoB::XMLDeserialize::XMLDeserialize( const char* pFileName )156 Util::XMLDeserialize::XMLDeserialize( Glib::ustring fileName ) 158 157 : IODeserialize() 159 , m_filepath( pFileName )158 , m_filepath( fileName ) 160 159 { 161 160 try { … … 170 169 171 170 172 BeBoB::XMLDeserialize::~XMLDeserialize()173 { 174 } 175 176 bool 177 BeBoB::XMLDeserialize::read( const char* pMemberName,178 171 Util::XMLDeserialize::~XMLDeserialize() 172 { 173 } 174 175 bool 176 Util::XMLDeserialize::read( std::string strMemberName, 177 long long& value ) 179 178 180 179 { 181 180 xmlpp::Node* pNode = m_parser.get_document()->get_root_node(); 182 181 183 xmlpp::NodeSet nodeSet = pNode->find( pMemberName );182 xmlpp::NodeSet nodeSet = pNode->find( strMemberName ); 184 183 for ( xmlpp::NodeSet::iterator it = nodeSet.begin(); 185 184 it != nodeSet.end(); 186 185 ++it ) 187 186 { 188 const xmlpp::Element* pElement = dynamic_cast< const xmlpp::Element* >( *it ); 187 const xmlpp::Element* pElement = 188 dynamic_cast< const xmlpp::Element* >( *it ); 189 189 if ( pElement && pElement->has_child_text() ) { 190 190 char* tail; 191 value = strtoll( pElement->get_child_text()->get_content().c_str(), &tail, 0 ); 191 value = strtoll( pElement->get_child_text()->get_content().c_str(), 192 &tail, 0 ); 192 193 return true; 193 194 } … … 199 200 200 201 bool 201 BeBoB::XMLDeserialize::read( const char* pMemberName,202 202 Util::XMLDeserialize::read( std::string strMemberName, 203 Glib::ustring& str ) 203 204 { 204 205 xmlpp::Node* pNode = m_parser.get_document()->get_root_node(); 205 206 206 xmlpp::NodeSet nodeSet = pNode->find( pMemberName );207 xmlpp::NodeSet nodeSet = pNode->find( strMemberName ); 207 208 for ( xmlpp::NodeSet::iterator it = nodeSet.begin(); 208 209 it != nodeSet.end(); trunk/libfreebob/src/libutil/serialize.h
r361 r365 1 /* bebob_serialize.h2 * Copyright (C) 200 6by Daniel Wagner1 /* serialize.h 2 * Copyright (C) 2007 by Daniel Wagner 3 3 * 4 4 * This file is part of FreeBoB. … … 26 26 #include <iostream> 27 27 28 namespace BeBoB { 29 class IOSerialize { 30 public: 31 IOSerialize() {} 32 virtual ~IOSerialize() {} 28 namespace Util { 33 29 34 virtual bool write( const char* pMemberName,35 long long value ) = 0;36 virtual bool write( const char* pMemberName,37 Glib::ustring str) = 0;30 class IOSerialize { 31 public: 32 IOSerialize() {} 33 virtual ~IOSerialize() {} 38 34 39 template <typename T> bool write( const char* pMemberName, T value ); 40 }; 35 virtual bool write( std::string strMemberName, 36 long long value ) = 0; 37 virtual bool write( std::string strMemberName, 38 Glib::ustring str) = 0; 39 40 template <typename T> bool write( std::string strMemberName, T value ); 41 }; 41 42 42 43 class IODeserialize { … … 45 46 virtual ~IODeserialize() {} 46 47 47 virtual bool read( const char* pMemberName,48 virtual bool read( std::string strMemberName, 48 49 long long& value ) = 0; 49 virtual bool read( const char* pMemberName,50 virtual bool read( std::string strMemberName, 50 51 Glib::ustring& str ) = 0; 51 52 52 template <typename T> bool read( const char* pMemberName, T& value );53 template <typename T> bool read( std::string strMemberName, T& value ); 53 54 }; 54 55 55 56 class XMLSerialize: public IOSerialize { 56 57 public: 57 XMLSerialize( const char* pFileName );58 XMLSerialize( Glib::ustring fileName ); 58 59 virtual ~XMLSerialize(); 59 60 60 virtual bool write( const char* pMemberName,61 virtual bool write( std::string strMemberName, 61 62 long long value ); 62 virtual bool write( const char* pMemberName,63 virtual bool write( std::string strMemberName, 63 64 Glib::ustring str); 64 65 private: … … 66 67 xmlpp::Document m_doc; 67 68 68 xmlpp::Node* getNodePath( xmlpp::Node* pRootNode, std::vector<std::string>& tokens ); 69 xmlpp::Node* getNodePath( xmlpp::Node* pRootNode, 70 std::vector<std::string>& tokens ); 69 71 }; 70 72 71 73 class XMLDeserialize: public IODeserialize { 72 74 public: 73 XMLDeserialize( const char* pFileName );75 XMLDeserialize( Glib::ustring fileName ); 74 76 virtual ~XMLDeserialize(); 75 77 76 virtual bool read( const char* pMemberName,78 virtual bool read( std::string strMemberName, 77 79 long long& value ); 78 virtual bool read( const char* pMemberName,80 virtual bool read( std::string strMemberName, 79 81 Glib::ustring& str ); 80 82 private: … … 84 86 85 87 86 88 ////////////////////////////////////////// 87 89 88 template <typename T> bool IOSerialize::write( const char* pMemberName, T value ) 90 template <typename T> bool IOSerialize::write( std::string strMemberName, 91 T value ) 89 92 { 90 return write( pMemberName, static_cast<long long>( value ) );93 return write( strMemberName, static_cast<long long>( value ) ); 91 94 } 92 95 93 template <typename T> bool IODeserialize::read( const char* pMemberName, T& value ) 96 template <typename T> bool IODeserialize::read( std::string strMemberName, 97 T& value ) 94 98 { 95 96 bool result = read( pMemberName, tmp );99 long long tmp; 100 bool result = read( strMemberName, tmp ); 97 101 value = static_cast<T>( tmp ); 98 102 return result; trunk/libfreebob/src/libutil/unittests.cpp
r361 r365 1 /* bebob_unittests.cpp2 * Copyright (C) 2006 by Daniel Wagner1 /* unittests.cpp 2 * Copyright (C) 2006,07 by Daniel Wagner 3 3 * 4 4 * This file is part of FreeBoB. … … 19 19 */ 20 20 21 #include " bebob_serialize.h"21 #include "serialize.h" 22 22 #include <libraw1394/raw1394.h> 23 23 24 24 #include <stdio.h> 25 25 26 using namespace BeBoB;26 using namespace Util; 27 27 28 28 /////////////////////////////////////// trunk/libfreebob/src/Makefile.am
r360 r365 60 60 bebob/bebob_dl_bcd.h \ 61 61 bebob/bebob_dl_bcd.cpp \ 62 bebob/bebob_serialize.h \63 bebob/bebob_serialize.cpp \64 62 motu/motu_avdevice.cpp \ 65 63 motu/motu_avdevice.h \ … … 84 82 libfreebobavc/avc_unit_info.cpp \ 85 83 libfreebobavc/ieee1394service.cpp \ 86 libfreebobavc/ serialize.cpp \84 libfreebobavc/avc_serialize.cpp \ 87 85 libfreebobavc/avc_connect.h \ 88 86 libfreebobavc/avc_definitions.h \ … … 97 95 libfreebobavc/avc_unit_info.h \ 98 96 libfreebobavc/ieee1394service.h \ 99 libfreebobavc/ serialize.h \97 libfreebobavc/avc_serialize.h \ 100 98 debugmodule/debugmodule.h \ 101 99 debugmodule/debugmodule.cpp \ 102 libstreaming/cip.c \ 103 libstreaming/cyclecounter.h \ 104 libstreaming/freebob_streaming.cpp \ 105 libstreaming/IsoHandler.cpp \ 106 libstreaming/IsoHandlerManager.cpp \ 107 libstreaming/IsoStream.cpp \ 108 libstreaming/PacketBuffer.cpp \ 109 libstreaming/PortManager.cpp \ 110 libstreaming/Port.cpp \ 111 libstreaming/StreamProcessor.cpp \ 112 libstreaming/StreamProcessorManager.cpp \ 113 libstreaming/AmdtpPortInfo.cpp \ 114 libstreaming/AmdtpPort.cpp \ 115 libstreaming/AmdtpStreamProcessor.cpp \ 116 libstreaming/ringbuffer.c \ 117 libstreaming/streamstatistics.cpp \ 118 libstreaming/MotuStreamProcessor.cpp \ 119 libstreaming/MotuPort.cpp \ 120 libstreaming/MotuPortInfo.cpp \ 121 libutil/DelayLockedLoop.h \ 122 libutil/Atomic.h \ 123 libutil/PosixThread.h \ 124 libutil/Thread.h \ 125 libutil/DelayLockedLoop.cpp \ 126 libutil/PosixThread.cpp \ 127 libutil/Time.c \ 128 libutil/Time.h \ 129 libutil/TimeSource.cpp \ 130 libutil/TimeSource.h \ 131 libutil/SystemTimeSource.cpp \ 132 libutil/SystemTimeSource.h \ 133 libutil/cycles.h 100 libstreaming/cip.c \ 101 libstreaming/cyclecounter.h \ 102 libstreaming/freebob_streaming.cpp \ 103 libstreaming/IsoHandler.cpp \ 104 libstreaming/IsoHandlerManager.cpp \ 105 libstreaming/IsoStream.cpp \ 106 libstreaming/PacketBuffer.cpp \ 107 libstreaming/PortManager.cpp \ 108 libstreaming/Port.cpp \ 109 libstreaming/StreamProcessor.cpp \ 110 libstreaming/StreamProcessorManager.cpp \ 111 libstreaming/AmdtpPortInfo.cpp \ 112 libstreaming/AmdtpPort.cpp \ 113 libstreaming/AmdtpStreamProcessor.cpp \ 114 libstreaming/ringbuffer.c \ 115 libstreaming/streamstatistics.cpp \ 116 libstreaming/MotuStreamProcessor.cpp \ 117 libstreaming/MotuPort.cpp \ 118 libstreaming/MotuPortInfo.cpp \ 119 libutil/DelayLockedLoop.h \ 120 libutil/Atomic.h \ 121 libutil/PosixThread.h \ 122 libutil/Thread.h \ 123 libutil/DelayLockedLoop.cpp \ 124 libutil/PosixThread.cpp \ 125 libutil/Time.c \ 126 libutil/Time.h \ 127 libutil/TimeSource.cpp \ 128 libutil/TimeSource.h \ 129 libutil/SystemTimeSource.cpp \ 130 libutil/SystemTimeSource.h \ 131 libutil/cycles.h \ 132 libutil/serialize.h \ 133 libutil/serialize.cpp 134 134 135 135 136 libfreebob_la_LDFLAGS = \ … … 143 144 maudio/fwap.xml 144 145 145 bin_PROGRAMS = freebob_downloader freebob_sync146 146 147 freebob_downloader_SOURCES = \ 148 freebob-downloader.cpp 149 freebob_downloader_LDADD = \ 150 libfreebob.la \ 151 $(LIBRAW1394_LIBS) \ 152 $(LIBIEC61883_LIBS) \ 153 $(LIBAVC1394_LIBS) \ 154 -lpthread 147 ############### 155 148 156 freebob_sync_SOURCES = \ 157 freebob-sync.cpp 158 freebob_sync_LDADD = \ 159 libfreebob.la \ 160 $(LIBRAW1394_LIBS) \ 161 $(LIBIEC61883_LIBS) \ 162 $(LIBAVC1394_LIBS) \ 163 -lpthread 149 bin_PROGRAMS = freebob-downloader freebob-sync 164 150 165 noinst_PROGRAMS = test-dll test-debugmodule bebob_unittests 151 freebob_downloader_SOURCES = freebob-downloader.cpp 152 freebob_downloader_LDADD = $(top_builddir)/src/libfreebob.la 153 154 freebob_sync_SOURCES = freebob-sync.cpp 155 freebob_sync_LDADD = $(top_builddir)/src/libfreebob.la 156 157 ############### 158 159 noinst_PROGRAMS = test-dll test-debugmodule test-unittests test-ser 166 160 167 161 test_dll_SOURCES = libutil/test-dll.cpp 168 test_dll_LDADD = libfreebob.la162 test_dll_LDADD = $(top_builddir)/src/libfreebob.la 169 163 170 164 test_debugmodule_SOURCES = debugmodule/test_debugmodule.cpp 171 test_debugmodule_LDADD = libfreebob.la165 test_debugmodule_LDADD = $(top_builddir)/src/libfreebob.la 172 166 173 bebob_unittests_SOURCES = bebob/bebob_unittests.cpp 174 bebob_unittests_LDADD = $(top_builddir)/src/libfreebob.la \ 175 $(LIBXMLCPP_LIBS) $(LIBAVC1394_LIBS) $(LIBIEC61883_LIBS) 167 test_unittests_SOURCES = libutil/unittests.cpp 168 test_unittests_LDADD = $(top_builddir)/src/libfreebob.la 176 169 170 test_ser_SOURCES = ser.cpp 171 test_ser_LDADD = $(top_builddir)/src/libfreebob.la trunk/libfreebob/tests/test-extplugcmd.cpp
r336 r365 21 21 #include "libfreebobavc/avc_extended_plug_info.h" 22 22 #include "libfreebobavc/avc_plug_info.h" 23 #include "libfreebobavc/ serialize.h"23 #include "libfreebobavc/avc_serialize.h" 24 24 #include "libfreebobavc/ieee1394service.h" 25 25 trunk/libfreebob/tests/test-mixer.cpp
r336 r365 20 20 21 21 #include "libfreebobavc/avc_function_block.h" 22 #include "libfreebobavc/ serialize.h"22 #include "libfreebobavc/avc_serialize.h" 23 23 #include "libfreebobavc/ieee1394service.h" 24 24 trunk/libfreebob/tests/test-volume.cpp
r336 r365 20 20 21 21 #include "libfreebobavc/avc_function_block.h" 22 #include "libfreebobavc/ serialize.h"22 #include "libfreebobavc/avc_serialize.h" 23 23 #include "libfreebobavc/ieee1394service.h" 24 24