Changeset 365

Show
Ignore:
Timestamp:
01/03/07 14:37:50 (17 years ago)
Author:
wagi
Message:

src/libfreebobavc/serialize* moved to src/libfreebob/avc_serialize*, all includes adapted
src/bebob/bebob_serialize* moved to src/libutil/serialize*
src/libutil/serialize: use Glib::ustring instead of std::string.
src/configrom: serialize and deserialize added (not finished)
src/devicemanager: load and save cached functionality added (not finished)

various small whitespace updates (emacs lässt grüssen :))

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libfreebob/config.h.in

    r360 r365  
    8484#undef const 
    8585 
    86 /* Define to `unsigned' if <sys/types.h> does not define. */ 
     86/* Define to `unsigned int' if <sys/types.h> does not define. */ 
    8787#undef size_t 
    8888 
  • trunk/libfreebob/src/bebob/bebob_avdevice.cpp

    r363 r365  
    2727#include "libfreebobavc/avc_subunit_info.h" 
    2828#include "libfreebobavc/avc_extended_stream_format.h" 
    29 #include "libfreebobavc/serialize.h" 
     29#include "libfreebobavc/avc_serialize.h" 
    3030#include "libfreebobavc/ieee1394service.h" 
    3131#include "libfreebobavc/avc_definitions.h" 
     
    4444                    int nodeId, 
    4545                    int verboseLevel ) 
    46     : m_configRom( configRom ) 
     46    : m_pConfigRom( configRom ) 
    4747    , m_1394Service( &ieee1394service ) 
    4848    , m_nodeId( nodeId ) 
     
    9292AvDevice::getConfigRom() const 
    9393{ 
    94     return *m_configRom; 
     94    return *m_pConfigRom; 
    9595} 
    9696 
     
    544544                return false; 
    545545            } 
    546              
     546 
    547547            m_subunits.push_back( subunit ); 
    548548            audioSubunitFound=true; 
    549              
     549 
    550550            break; 
    551551        case AVCCommand::eST_Music: 
     
    556556                return false; 
    557557            } 
    558              
     558 
    559559            m_subunits.push_back( subunit ); 
    560560            musicSubunitFound=true; 
    561              
     561 
    562562            break; 
    563563        default: 
     
    938938    } 
    939939 
    940     if (!addPlugToProcessor(*outputPlug,m_receiveProcessor,  
     940    if (!addPlugToProcessor(*outputPlug,m_receiveProcessor, 
    941941        FreebobStreaming::AmdtpAudioPort::E_Capture)) { 
    942942        debugFatal("Could not add plug to processor!\n"); 
     
    953953//                                   samplerate, 
    954954//                                   inputPlug->getNrOfChannels()); 
    955 //          
     955// 
    956956//         if(!m_receiveProcessor2->init()) { 
    957957//             debugFatal("Could not initialize snooping receive processor!\n"); 
    958958//             return false; 
    959959//         } 
    960 //         if (!addPlugToProcessor(*inputPlug,m_receiveProcessor2,  
     960//         if (!addPlugToProcessor(*inputPlug,m_receiveProcessor2, 
    961961//             FreebobStreaming::AmdtpAudioPort::E_Capture)) { 
    962962//             debugFatal("Could not add plug to processor!\n"); 
     
    970970                                samplerate, 
    971971                                inputPlug->getNrOfChannels()); 
    972                                  
     972 
    973973        if(!m_transmitProcessor->init()) { 
    974974            debugFatal("Could not initialize transmit processor!\n"); 
    975975            return false; 
    976          
    977         } 
    978          
     976 
     977        } 
     978 
    979979        // FIXME: do this the proper way! 
    980980        m_transmitProcessor->syncmaster=m_receiveProcessor; 
    981      
    982         if (!addPlugToProcessor(*inputPlug,m_transmitProcessor,  
     981 
     982        if (!addPlugToProcessor(*inputPlug,m_transmitProcessor, 
    983983            FreebobStreaming::AmdtpAudioPort::E_Playback)) { 
    984984            debugFatal("Could not add plug to processor!\n"); 
     
    992992bool 
    993993AvDevice::addPlugToProcessor( 
    994     AvPlug& plug,  
    995     FreebobStreaming::StreamProcessor *processor,  
     994    AvPlug& plug, 
     995    FreebobStreaming::StreamProcessor *processor, 
    996996    FreebobStreaming::AmdtpAudioPort::E_Direction direction) { 
    997997 
     
    10101010            const AvPlug::ChannelInfo* channelInfo = &( *it ); 
    10111011            std::ostringstream portname; 
    1012              
     1012 
    10131013            portname << "dev" << m_id << "_" << channelInfo->m_name; 
    1014              
     1014 
    10151015            FreebobStreaming::Port *p=NULL; 
    10161016            switch(clusterInfo->m_portType) { 
     
    10221022                p=new FreebobStreaming::AmdtpAudioPort( 
    10231023                        portname.str(), 
    1024                         direction,  
     1024                        direction, 
    10251025                        // \todo: streaming backend expects indexing starting from 0 
    10261026                        // but bebob reports it starting from 1. Decide where 
    10271027                        // 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, 
    10311031                        clusterInfo->m_portType 
    10321032                ); 
     
    10361036                p=new FreebobStreaming::AmdtpMidiPort( 
    10371037                        portname.str(), 
    1038                         direction,  
     1038                        direction, 
    10391039                        // \todo: streaming backend expects indexing starting from 0 
    10401040                        // but bebob reports it starting from 1. Decide where 
    10411041                        // 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, 
    10451045                        clusterInfo->m_portType 
    10461046                ); 
     
    10611061                debugOutput(DEBUG_LEVEL_VERBOSE, "Skipped port %s\n",channelInfo->m_name.c_str()); 
    10621062            } else { 
    1063          
     1063 
    10641064                if (!processor->addPort(p)) { 
    10651065                    debugWarning("Could not register port with stream processor\n"); 
     
    10721072} 
    10731073 
    1074 int  
     1074int 
    10751075AvDevice::getStreamCount() { 
    10761076    return 2; // one receive, one transmit 
     
    10991099    int plug=0; 
    11001100    int hostplug=-1; 
    1101      
     1101 
    11021102//     if (m_snoopMode) { 
    1103 //      
     1103// 
    11041104//         switch (i) { 
    11051105//         case 0: 
    11061106//             // snooping doesn't use CMP, but obtains the info of the channel 
    11071107//             // from the target plug 
    1108 //              
     1108// 
    11091109//             // TODO: get isochannel from plug 
    1110 //              
     1110// 
    11111111//             // set the channel obtained by the connection management 
    11121112//             m_receiveProcessor->setChannel(iso_channel); 
     
    11151115//             // snooping doesn't use CMP, but obtains the info of the channel 
    11161116//             // from the target plug 
    1117 //              
     1117// 
    11181118//             // TODO: get isochannel from plug 
    1119 //              
     1119// 
    11201120//             // set the channel obtained by the connection management 
    11211121//             m_receiveProcessor2->setChannel(iso_channel); 
    1122 //  
     1122// 
    11231123//             break; 
    11241124//         default: 
     
    11261126//         } 
    11271127//     } else { 
    1128      
     1128 
    11291129        switch (i) { 
    11301130        case 0: 
    11311131            // do connection management: make connection 
    11321132            iso_channel = iec61883_cmp_connect( 
    1133                 m_1394Service->getHandle(),  
    1134                 m_nodeId | 0xffc0,  
     1133                m_1394Service->getHandle(), 
     1134                m_nodeId | 0xffc0, 
    11351135                &plug, 
    1136                 raw1394_get_local_id (m_1394Service->getHandle()),  
    1137                 &hostplug,  
     1136                raw1394_get_local_id (m_1394Service->getHandle()), 
     1137                &hostplug, 
    11381138                &m_receiveProcessorBandwidth); 
    1139              
     1139 
    11401140            // set the channel obtained by the connection management 
    11411141            m_receiveProcessor->setChannel(iso_channel); 
     
    11441144            // do connection management: make connection 
    11451145            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, 
    11501150                &plug, 
    11511151                &m_transmitProcessorBandwidth); 
    1152              
     1152 
    11531153            // set the channel obtained by the connection management 
    11541154            m_transmitProcessor->setChannel(iso_channel); 
     
    11581158        } 
    11591159//     } 
    1160      
     1160 
    11611161    return 0; 
    11621162 
     
    11731173//         case 0: 
    11741174//             // do connection management: break connection 
    1175 //      
     1175// 
    11761176//             break; 
    11771177//         case 1: 
    11781178//             // do connection management: break connection 
    1179 //  
     1179// 
    11801180//             break; 
    11811181//         default: 
     
    11871187            // do connection management: break connection 
    11881188            iec61883_cmp_disconnect( 
    1189                 m_1394Service->getHandle(),  
    1190                 m_nodeId | 0xffc0,  
     1189                m_1394Service->getHandle(), 
     1190                m_nodeId | 0xffc0, 
    11911191                plug, 
    1192                 raw1394_get_local_id (m_1394Service->getHandle()),  
    1193                 hostplug,  
     1192                raw1394_get_local_id (m_1394Service->getHandle()), 
     1193                hostplug, 
    11941194                m_receiveProcessor->getChannel(), 
    11951195                m_receiveProcessorBandwidth); 
    1196      
     1196 
    11971197            break; 
    11981198        case 1: 
    11991199            // do connection management: break connection 
    12001200            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, 
    12051205                plug, 
    12061206                m_transmitProcessor->getChannel(), 
     
    12121212        } 
    12131213//     } 
    1214      
     1214 
    12151215    return 0; 
    12161216} 
    12171217 
     1218bool 
     1219AvDevice::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 
     1240AvDevice* 
     1241AvDevice::deserialize( Glib::ustring basePath, 
     1242                       Ieee1394Service& ieee1394Service, 
     1243                       Util::IODeserialize& deser ) 
     1244{ 
     1245 
     1246    return 0; 
     1247} 
    12181248 
    12191249} // end of namespace 
  • trunk/libfreebob/src/bebob/bebob_avdevice.h

    r336 r365  
    3636#include "libstreaming/AmdtpPortInfo.h" 
    3737 
     38#include "libutil/serialize.h" 
     39 
    3840#include "iavdevice.h" 
    3941 
     
    4749public: 
    4850    AvDevice( std::auto_ptr<ConfigRom>( configRom ), 
    49           Ieee1394Service& ieee1394Service, 
     51              Ieee1394Service& ieee1394Service, 
    5052              int nodeId, 
    51           int verboseLevel ); 
     53              int verboseLevel ); 
    5254    virtual ~AvDevice(); 
    5355 
     
    7274 
    7375    Ieee1394Service* get1394Service() 
    74     { return m_1394Service; } 
     76        { return m_1394Service; } 
    7577 
    7678    AvPlugManager& getPlugManager() 
    77     { return m_plugManager; } 
     79        { return m_plugManager; } 
    7880 
    7981    struct SyncInfo { 
     
    8587            , m_description( description ) 
    8688            {} 
    87     AvPlug*     m_source; 
    88     AvPlug*     m_destination; 
     89        AvPlug*     m_source; 
     90        AvPlug*     m_destination; 
    8991        std::string m_description; 
    9092    }; 
     
    9698        { return m_activeSyncInfo; } 
    9799    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 ); 
    98105 
    99106protected: 
     
    124131                 AvPlug::EAvPlugType type); 
    125132 
    126     bool addPlugToProcessor( AvPlug& plug, FreebobStreaming::StreamProcessor *processor,  
     133    bool addPlugToProcessor( AvPlug& plug, FreebobStreaming::StreamProcessor *processor, 
    127134                             FreebobStreaming::AmdtpAudioPort::E_Direction direction); 
    128135 
     
    137144                                           std::string syncDescription ); 
    138145protected: 
    139     std::auto_ptr<ConfigRom>( m_configRom ); 
     146    std::auto_ptr<ConfigRom>( m_pConfigRom ); 
    140147    Ieee1394Service* m_1394Service; 
    141148    int              m_nodeId; 
  • trunk/libfreebob/src/bebob/bebob_avdevice_subunit.cpp

    r341 r365  
    2727#include "libfreebobavc/avc_plug_info.h" 
    2828#include "libfreebobavc/avc_extended_stream_format.h" 
    29 #include "libfreebobavc/serialize.h" 
     29#include "libfreebobavc/avc_serialize.h" 
    3030 
    3131namespace BeBoB { 
  • trunk/libfreebob/src/bebob/bebob_avplug.cpp

    r341 r365  
    2222 
    2323#include "libfreebobavc/ieee1394service.h" 
    24 #include "libfreebobavc/serialize.h" 
     24#include "libfreebobavc/avc_serialize.h" 
    2525 
    2626namespace BeBoB { 
  • trunk/libfreebob/src/bebob/bebob_dl_codes.h

    r336 r365  
    2424#include "fbtypes.h" 
    2525 
    26 #include "libfreebobavc/serialize.h" 
     26#include "libfreebobavc/avc_serialize.h" 
    2727 
    2828namespace BeBoB { 
  • trunk/libfreebob/src/bebob/bebob_dl_mgr.cpp

    r336 r365  
    2525#include "configrom.h" 
    2626#include "libfreebobavc/ieee1394service.h" 
    27 #include "libfreebobavc/serialize.h" 
     27#include "libfreebobavc/avc_serialize.h" 
    2828 
    2929#include <netinet/in.h> 
  • trunk/libfreebob/src/bounce/bounce_avdevice.cpp

    r336 r365  
    2727#include "libfreebobavc/avc_subunit_info.h" 
    2828#include "libfreebobavc/avc_extended_stream_format.h" 
    29 #include "libfreebobavc/serialize.h" 
     29#include "libfreebobavc/avc_serialize.h" 
    3030#include "libfreebobavc/ieee1394service.h" 
    3131#include "libfreebobavc/avc_definitions.h" 
     
    3333#include "debugmodule/debugmodule.h" 
    3434 
    35 #include <iostream>     
     35#include <iostream> 
    3636#include <sstream> 
    3737#include <stdint.h> 
     
    6161{ 
    6262    setDebugLevel( verboseLevel ); 
    63      
     63 
    6464    debugOutput( DEBUG_LEVEL_VERBOSE, "Created Bounce::BounceDevice (NodeID %d)\n", 
    6565                 nodeId ); 
     
    8484static VendorModelEntry supportedDeviceList[] = 
    8585{ 
    86 //     {0x0000, 0x000000},   
     86//     {0x0000, 0x000000}, 
    8787}; 
    8888 
     
    9898    { 
    9999        if ( ( supportedDeviceList[i].vendor_id == vendorId ) 
    100              && ( supportedDeviceList[i].model_id == modelId )  
     100             && ( supportedDeviceList[i].model_id == modelId ) 
    101101           ) 
    102102        { 
     
    114114        quadlet_t request[6]; 
    115115        quadlet_t *resp; 
    116          
     116 
    117117    debugOutput( DEBUG_LEVEL_VERBOSE, "Discovering...\n" ); 
    118118 
    119119        std::string vendor=std::string(FREEBOB_BOUNCE_SERVER_VENDORNAME); 
    120120        std::string model=std::string(FREEBOB_BOUNCE_SERVER_MODELNAME); 
    121          
     121 
    122122        if (!(m_configRom->getVendorName().compare(0,vendor.length(),vendor,0,vendor.length())==0) 
    123123            || !(m_configRom->getModelName().compare(0,model.length(),model,0,model.length())==0)) { 
     
    178178BounceDevice::addXmlDescription( xmlNodePtr deviceNode ) 
    179179{ 
    180      
     180 
    181181    return false; 
    182182 
     
    187187bool 
    188188BounceDevice::addPortsToProcessor( 
    189         FreebobStreaming::StreamProcessor *processor,  
     189        FreebobStreaming::StreamProcessor *processor, 
    190190        FreebobStreaming::AmdtpAudioPort::E_Direction direction) { 
    191          
     191 
    192192    debugOutput(DEBUG_LEVEL_VERBOSE,"Adding ports to processor\n"); 
    193          
     193 
    194194    int i=0; 
    195195    for (i=0;i<BOUNCE_NR_OF_CHANNELS;i++) { 
    196196        char *buff; 
    197197        asprintf(&buff,"dev%d%s_Port%d",m_id,direction==FreebobStreaming::AmdtpAudioPort::E_Playback?"p":"c",i); 
    198          
     198 
    199199        FreebobStreaming::Port *p=NULL; 
    200200        p=new FreebobStreaming::AmdtpAudioPort( 
    201201                buff, 
    202                 direction,  
     202                direction, 
    203203                // \todo: streaming backend expects indexing starting from 0 
    204204                // but bebob reports it starting from 1. Decide where 
    205205                // 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, 
    209209                0 
    210210        ); 
    211      
     211 
    212212        if (!p) { 
    213213            debugOutput(DEBUG_LEVEL_VERBOSE, "Skipped port %s\n",buff); 
    214214        } else { 
    215      
     215 
    216216            if (!processor->addPort(p)) { 
    217217                debugWarning("Could not register port with stream processor\n"); 
     
    220220            } else { 
    221221                debugOutput(DEBUG_LEVEL_VERBOSE, "Added port %s\n",buff); 
    222              
     222 
    223223            } 
    224224        } 
    225          
     225 
    226226        free(buff); 
    227          
     227 
    228228     } 
    229229 
     
    240240                                 m_samplerate, 
    241241                                 BOUNCE_NR_OF_CHANNELS); 
    242                                   
     242 
    243243        if(!m_receiveProcessor->init()) { 
    244244                debugFatal("Could not initialize receive processor!\n"); 
    245245                return false; 
    246          
    247         } 
    248  
    249         if (!addPortsToProcessor(m_receiveProcessor,  
     246 
     247        } 
     248 
     249        if (!addPortsToProcessor(m_receiveProcessor, 
    250250                FreebobStreaming::AmdtpAudioPort::E_Capture)) { 
    251251                debugFatal("Could not add ports to processor!\n"); 
     
    258258                                 m_samplerate, 
    259259                                 BOUNCE_NR_OF_CHANNELS); 
    260                                   
     260 
    261261        m_transmitProcessor->setVerboseLevel(getDebugLevel()); 
    262          
     262 
    263263        if(!m_transmitProcessor->init()) { 
    264264                debugFatal("Could not initialize transmit processor!\n"); 
    265265                return false; 
    266          
    267         } 
    268  
    269         if (!addPortsToProcessor(m_transmitProcessor,  
     266 
     267        } 
     268 
     269        if (!addPortsToProcessor(m_transmitProcessor, 
    270270                FreebobStreaming::AmdtpAudioPort::E_Playback)) { 
    271271                debugFatal("Could not add ports to processor!\n"); 
    272272                return false; 
    273273        } 
    274          
     274 
    275275        return true; 
    276276} 
    277277 
    278 int  
     278int 
    279279BounceDevice::getStreamCount() { 
    280280        return 2; // one receive, one transmit 
     
    299299//      int plug=0; 
    300300//      int hostplug=-1; 
    301 //      
     301// 
    302302        switch (i) { 
    303303        case 0: 
    304304//              // do connection management: make connection 
    305305//              iso_channel = iec61883_cmp_connect( 
    306 //                      m_1394Service->getHandle(),  
    307 //                      m_nodeId | 0xffc0,  
     306//                      m_1394Service->getHandle(), 
     307//                      m_nodeId | 0xffc0, 
    308308//                      &plug, 
    309 //                      raw1394_get_local_id (m_1394Service->getHandle()),  
    310 //                      &hostplug,  
     309//                      raw1394_get_local_id (m_1394Service->getHandle()), 
     310//                      &hostplug, 
    311311//                      &m_receiveProcessorBandwidth); 
    312 //              
     312// 
    313313//              // set the channel obtained by the connection management 
    314314                m_receiveProcessor->setChannel(1); 
     
    317317//              // do connection management: make connection 
    318318//              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, 
    323323//                      &plug, 
    324324//                      &m_transmitProcessorBandwidth); 
    325 //              
     325// 
    326326//              // set the channel obtained by the connection management 
    327327// //           m_receiveProcessor2->setChannel(iso_channel); 
     
    342342//      int plug=0; 
    343343//      int hostplug=-1; 
    344 //  
     344// 
    345345//      switch (i) { 
    346346//      case 0: 
    347347//              // do connection management: break connection 
    348348//              iec61883_cmp_disconnect( 
    349 //                      m_1394Service->getHandle(),  
    350 //                      m_nodeId | 0xffc0,  
     349//                      m_1394Service->getHandle(), 
     350//                      m_nodeId | 0xffc0, 
    351351//                      plug, 
    352 //                      raw1394_get_local_id (m_1394Service->getHandle()),  
    353 //                      hostplug,  
     352//                      raw1394_get_local_id (m_1394Service->getHandle()), 
     353//                      hostplug, 
    354354//                      m_receiveProcessor->getChannel(), 
    355355//                      m_receiveProcessorBandwidth); 
    356 //  
     356// 
    357357//              break; 
    358358//      case 1: 
    359359//              // do connection management: break connection 
    360360//              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, 
    365365//                      plug, 
    366366//                      m_transmitProcessor->getChannel(), 
    367367//                      m_transmitProcessorBandwidth); 
    368 //  
     368// 
    369369//              // set the channel obtained by the connection management 
    370370// //           m_receiveProcessor2->setChannel(iso_channel); 
  • trunk/libfreebob/src/configrom.cpp

    r336 r365  
    8181} 
    8282 
     83ConfigRom::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 
    83109ConfigRom::~ConfigRom() 
    84110{ 
     111} 
     112 
     113bool 
     114ConfigRom::operator == ( const ConfigRom& rhs ) 
     115{ 
     116    return m_guid == rhs.m_guid; 
    85117} 
    86118 
     
    347379} 
    348380 
    349 const std::string 
     381const Glib::ustring 
    350382ConfigRom::getModelName() const 
    351383{ 
     
    353385} 
    354386 
    355 const std::string 
     387const Glib::ustring 
    356388ConfigRom::getVendorName() const 
    357389{ 
     
    468500    return 1 << ( m_maxRec + 1 ); 
    469501} 
     502 
     503bool 
     504ConfigRom::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 
     528ConfigRom* 
     529ConfigRom::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 
     559bool 
     560ConfigRom::setNodeId( fb_nodeid_t nodeId ) 
     561{ 
     562    m_nodeId = nodeId; 
     563    return true; 
     564} 
  • trunk/libfreebob/src/configrom.h

    r336 r365  
    2525#include "csr1212.h" 
    2626 
     27#include "libutil/serialize.h" 
    2728#include "debugmodule/debugmodule.h" 
    2829 
     
    3839    bool initialize(); 
    3940 
     41    bool operator == ( const ConfigRom& rhs ); 
     42 
    4043    const fb_nodeid_t getNodeId() const; 
    4144    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 
    4548    const unsigned int getModelId() const; 
    4649    const unsigned int getVendorId() const; 
     
    6669 
    6770    bool updatedNodeId(); 
     71    bool setNodeId( fb_nodeid_t nodeId ); 
    6872 
    6973    void printConfigRom() const; 
     74 
     75    bool serialize( Glib::ustring path, Util::IOSerialize& ser ); 
     76    static ConfigRom* deserialize( Glib::ustring path, Util::IODeserialize& deser ); 
    7077 
    7178 protected: 
     
    8087    bool             m_avcDevice; 
    8188    fb_octlet_t      m_guid; 
    82     std::string      m_vendorName; 
    83     std::string      m_modelName; 
     89    Glib::ustring    m_vendorName; 
     90    Glib::ustring    m_modelName; 
    8491    unsigned int     m_vendorId; 
    8592    unsigned int     m_modelId; 
     
    102109 
    103110private: 
    104     ConfigRom( const ConfigRom& ); 
     111    ConfigRom( const ConfigRom& ); // do not allow copy ctor 
     112    ConfigRom();                   // ctor for deserialition 
    105113 
    106114    DECLARE_DEBUG_MODULE; 
  • trunk/libfreebob/src/devicemanager.cpp

    r341 r365  
    107107    { 
    108108        debugOutput( DEBUG_LEVEL_VERBOSE, "Probing node %d...\n", nodeId ); 
    109          
     109 
    110110        std::auto_ptr<ConfigRom> configRom = 
    111111            std::auto_ptr<ConfigRom>( new ConfigRom( *m_1394Service, 
     
    241241} 
    242242 
    243 unsigned int  
     243unsigned int 
    244244DeviceManager::getAvDeviceCount( ) 
    245245{ 
     
    341341            xmlFreeDoc( doc ); 
    342342            xmlCleanupParser(); 
    343              
     343 
    344344            free(result); 
    345345            return 0; 
     
    355355            return 0; 
    356356        } 
    357          
     357 
    358358        free(result); 
    359359    } 
     
    368368} 
    369369 
     370bool 
     371DeviceManager::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 
     393bool 
     394DeviceManager::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  
    2626#include "libfreebob/xmlparser.h" 
    2727 
     28#include <glibmm/ustring.h> 
     29 
    2830#include <vector> 
    2931 
     
    5254 
    5355    IAvDevice* getAvDevice( int nodeId ); 
    54        IAvDevice* getAvDeviceByIndex( int idx ); 
    55        unsigned int getAvDeviceCount(); 
     56    IAvDevice* getAvDeviceByIndex( int idx ); 
     57    unsigned int getAvDeviceCount(); 
    5658 
    5759    xmlDocPtr getXmlDescription(); 
     60 
     61    bool saveCache( Glib::ustring fileName ); 
     62    bool loadCache( Glib::ustring fileName ); 
    5863 
    5964protected: 
  • trunk/libfreebob/src/libfreebobavc/avc_connect.cpp

    r336 r365  
    2020 
    2121#include "avc_connect.h" 
    22 #include "serialize.h" 
     22#include "avc_serialize.h" 
    2323#include "ieee1394service.h" 
    2424 
  • trunk/libfreebob/src/libfreebobavc/avc_extended_cmd_generic.cpp

    r336 r365  
    2020 
    2121#include "avc_extended_cmd_generic.h" 
    22 #include "serialize.h" 
     22#include "avc_serialize.h" 
    2323#include "ieee1394service.h" 
    2424 
  • trunk/libfreebob/src/libfreebobavc/avc_extended_plug_info.cpp

    r336 r365  
    2020 
    2121#include "avc_extended_plug_info.h" 
    22 #include "serialize.h" 
     22#include "avc_serialize.h" 
    2323#include "ieee1394service.h" 
    2424 
     
    627627 
    628628    free(buf); 
    629      
     629 
    630630    switch ( m_infoType ) { 
    631631    case eIT_PlugType: 
  • trunk/libfreebob/src/libfreebobavc/avc_extended_stream_format.cpp

    r336 r365  
    2020 
    2121#include "avc_extended_stream_format.h" 
    22 #include "serialize.h" 
     22#include "avc_serialize.h" 
    2323#include "ieee1394service.h" 
    2424 
  • trunk/libfreebob/src/libfreebobavc/avc_extended_subunit_info.cpp

    r336 r365  
    2020 
    2121#include "avc_extended_subunit_info.h" 
    22 #include "serialize.h" 
     22#include "avc_serialize.h" 
    2323#include "ieee1394service.h" 
    2424 
  • trunk/libfreebob/src/libfreebobavc/avc_function_block.cpp

    r336 r365  
    2020 
    2121#include "avc_function_block.h" 
    22 #include "serialize.h" 
     22#include "avc_serialize.h" 
    2323#include "ieee1394service.h" 
    2424 
  • trunk/libfreebob/src/libfreebobavc/avc_generic.cpp

    r336 r365  
    2020 
    2121#include "avc_generic.h" 
    22 #include "serialize.h" 
     22#include "avc_serialize.h" 
    2323#include "ieee1394service.h" 
    2424 
     
    177177        debugOutput( DEBUG_LEVEL_VERY_VERBOSE,  "  Request:"); 
    178178        showFcpFrame( m_fcpFrame, fcpFrameSize ); 
    179      
     179 
    180180        StringSerializer se_dbg; 
    181181        serialize( se_dbg ); 
    182      
    183         debugOutputShort(DEBUG_LEVEL_VERY_VERBOSE, "%s",  
     182 
     183        debugOutputShort(DEBUG_LEVEL_VERY_VERBOSE, "%s", 
    184184                         se_dbg.getString().c_str()); 
    185185    } 
     
    211211            StringSerializer se_dbg; 
    212212            serialize( se_dbg ); 
    213              
    214             debugOutputShort(DEBUG_LEVEL_VERY_VERBOSE, "%s",  
     213 
     214            debugOutputShort(DEBUG_LEVEL_VERY_VERBOSE, "%s", 
    215215                             se_dbg.getString().c_str()); 
    216216        } 
     
    219219            debugWarning( "unexpected response received (0x%x)\n", m_eResponse ); 
    220220            debugOutput( DEBUG_LEVEL_VERY_VERBOSE,"  Response:"); 
    221              
     221 
    222222            BufferDeserialize de( buf, resp_len ); 
    223223            deserialize( de ); 
     
    229229           debugWarning( "no response\n" ); 
    230230    } 
    231      
     231 
    232232    debugOutputShort( DEBUG_LEVEL_VERY_VERBOSE, "\n" ); 
    233233 
  • trunk/libfreebob/src/libfreebobavc/avc_plug_info.cpp

    r336 r365  
    2020 
    2121#include "avc_plug_info.h" 
    22 #include "serialize.h" 
     22#include "avc_serialize.h" 
    2323#include "ieee1394service.h" 
    2424 
  • trunk/libfreebob/src/libfreebobavc/avc_serialize.cpp

    r336 r365  
    1 /* serialize.cpp 
    2  * Copyright (C) 2005 by Daniel Wagner 
     1/* avc_serialize.cpp 
     2 * Copyright (C) 2005,07 by Daniel Wagner 
    33 * 
    44 * This file is part of FreeBoB. 
     
    1919 */ 
    2020 
    21 #include "serialize.h" 
     21#include "avc_serialize.h" 
    2222 
    2323#include <iostream> 
     
    5050    char* result; 
    5151    asprintf( &result, "  %3d:\t0x%02x\t%s\n", m_cnt, d, name ); 
    52      
     52 
    5353    m_string += result; 
    5454    free( result ); 
    55      
     55 
    5656    m_cnt += sizeof( byte_t ); 
    5757 
     
    6464    char* result; 
    6565    asprintf( &result, "  %3d:\t0x%08x\t%s\n", m_cnt, d, name ); 
    66      
     66 
    6767    m_string += result; 
    6868    free( result ); 
    69      
     69 
    7070    m_cnt += sizeof( quadlet_t ); 
    7171    return true; 
  • trunk/libfreebob/src/libfreebobavc/avc_serialize.h

    r336 r365  
    1 /* serialize.h 
    2  * Copyright (C) 2005 by Daniel Wagner 
     1/* avc_serialize.h 
     2 * Copyright (C) 2005,07 by Daniel Wagner 
    33 * 
    44 * This file is part of FreeBoB. 
  • trunk/libfreebob/src/libfreebobavc/avc_signal_source.cpp

    r336 r365  
    2020 
    2121#include "avc_signal_source.h" 
    22 #include "serialize.h" 
     22#include "avc_serialize.h" 
    2323#include "ieee1394service.h" 
    2424 
  • trunk/libfreebob/src/libfreebobavc/avc_subunit_info.cpp

    r336 r365  
    2020 
    2121#include "avc_subunit_info.h" 
    22 #include "serialize.h" 
     22#include "avc_serialize.h" 
    2323#include "ieee1394service.h" 
    2424 
  • trunk/libfreebob/src/libfreebobavc/avc_unit_info.cpp

    r336 r365  
    2020 
    2121#include "avc_unit_info.h" 
    22 #include "serialize.h" 
     22#include "avc_serialize.h" 
    2323#include "ieee1394service.h" 
    2424 
  • trunk/libfreebob/src/libutil/serialize.cpp

    r361 r365  
    1 /* bebob_serialize.cpp 
    2  * Copyright (C) 2006 by Daniel Wagner 
     1/* serialize.cpp 
     2 * Copyright (C) 2006,07 by Daniel Wagner 
    33 * 
    44 * This file is part of FreeBoB. 
     
    1919 */ 
    2020 
    21 #include "bebob_serialize.h" 
     21#include "serialize.h" 
    2222 
    2323using namespace std; 
     
    4444///////////////////////////////// 
    4545 
    46 BeBoB::XMLSerialize::XMLSerialize( const char* pFileName ) 
     46Util::XMLSerialize::XMLSerialize( Glib::ustring fileName ) 
    4747    : IOSerialize() 
    48     , m_filepath( pFileName ) 
     48    , m_filepath( fileName ) 
    4949{ 
    5050    try { 
     
    5656 
    5757 
    58 BeBoB::XMLSerialize::~XMLSerialize() 
     58Util::XMLSerialize::~XMLSerialize() 
    5959{ 
    6060    try { 
     
    6767 
    6868bool 
    69 BeBoB::XMLSerialize::write( const char* pMemberName, 
    70                             long long value ) 
     69Util::XMLSerialize::write( std::string strMemberName, 
     70                           long long value ) 
    7171 
    7272{ 
    7373    vector<string> tokens; 
    74     string str( pMemberName ); 
    75     tokenize( str, tokens, "/" ); 
     74    tokenize( strMemberName, tokens, "/" ); 
    7675 
    7776    if ( tokens.size() == 0 ) { 
     
    9392 
    9493bool 
    95 BeBoB::XMLSerialize::write( const char* pMemberName, 
    96                             Glib::ustring str) 
     94Util::XMLSerialize::write( std::string strMemberName, 
     95                           Glib::ustring str) 
    9796{ 
    9897    vector<string> tokens; 
    99     string memberName( pMemberName ); 
    100     tokenize( memberName, tokens, "/" ); 
     98    tokenize( strMemberName, tokens, "/" ); 
    10199 
    102100    if ( tokens.size() == 0 ) { 
     
    115113 
    116114xmlpp::Node* 
    117 BeBoB::XMLSerialize::getNodePath( xmlpp::Node* pRootNode, std::vector<string>& tokens ) 
     115Util::XMLSerialize::getNodePath( xmlpp::Node* pRootNode, 
     116                                 std::vector<string>& tokens ) 
    118117{ 
    119118    // returns the correct node on which the new element has to be added. 
     
    155154/***********************************/ 
    156155 
    157 BeBoB::XMLDeserialize::XMLDeserialize( const char* pFileName ) 
     156Util::XMLDeserialize::XMLDeserialize( Glib::ustring fileName ) 
    158157    : IODeserialize() 
    159     , m_filepath( pFileName ) 
     158    , m_filepath( fileName ) 
    160159{ 
    161160    try { 
     
    170169 
    171170 
    172 BeBoB::XMLDeserialize::~XMLDeserialize() 
    173 { 
    174 } 
    175  
    176 bool 
    177 BeBoB::XMLDeserialize::read( const char* pMemberName, 
    178                             long long& value ) 
     171Util::XMLDeserialize::~XMLDeserialize() 
     172{ 
     173} 
     174 
     175bool 
     176Util::XMLDeserialize::read( std::string strMemberName, 
     177                            long long& value ) 
    179178 
    180179{ 
    181180    xmlpp::Node* pNode = m_parser.get_document()->get_root_node(); 
    182181 
    183     xmlpp::NodeSet nodeSet = pNode->find( pMemberName ); 
     182    xmlpp::NodeSet nodeSet = pNode->find( strMemberName ); 
    184183    for ( xmlpp::NodeSet::iterator it = nodeSet.begin(); 
    185184          it != nodeSet.end(); 
    186185          ++it ) 
    187186    { 
    188         const xmlpp::Element* pElement = dynamic_cast< const xmlpp::Element* >( *it ); 
     187        const xmlpp::Element* pElement = 
     188            dynamic_cast< const xmlpp::Element* >( *it ); 
    189189        if ( pElement && pElement->has_child_text() ) { 
    190190            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 ); 
    192193            return true; 
    193194        } 
     
    199200 
    200201bool 
    201 BeBoB::XMLDeserialize::read( const char* pMemberName, 
    202                             Glib::ustring& str ) 
     202Util::XMLDeserialize::read( std::string strMemberName, 
     203                            Glib::ustring& str ) 
    203204{ 
    204205    xmlpp::Node* pNode = m_parser.get_document()->get_root_node(); 
    205206 
    206     xmlpp::NodeSet nodeSet = pNode->find( pMemberName ); 
     207    xmlpp::NodeSet nodeSet = pNode->find( strMemberName ); 
    207208    for ( xmlpp::NodeSet::iterator it = nodeSet.begin(); 
    208209          it != nodeSet.end(); 
  • trunk/libfreebob/src/libutil/serialize.h

    r361 r365  
    1 /* bebob_serialize.h 
    2  * Copyright (C) 2006 by Daniel Wagner 
     1/* serialize.h 
     2 * Copyright (C) 2007 by Daniel Wagner 
    33 * 
    44 * This file is part of FreeBoB. 
     
    2626#include <iostream> 
    2727 
    28 namespace BeBoB { 
    29     class IOSerialize { 
    30     public: 
    31         IOSerialize() {} 
    32         virtual ~IOSerialize() {} 
     28namespace Util { 
    3329 
    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() {} 
    3834 
    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     }; 
    4142 
    4243    class IODeserialize { 
     
    4546        virtual ~IODeserialize() {} 
    4647 
    47         virtual bool read( const char* pMemberName, 
     48        virtual bool read( std::string strMemberName, 
    4849                           long long& value ) = 0; 
    49         virtual bool read( const char* pMemberName, 
     50        virtual bool read( std::string strMemberName, 
    5051                           Glib::ustring& str ) = 0; 
    5152 
    52         template <typename T> bool read( const char* pMemberName, T& value ); 
     53        template <typename T> bool read( std::string strMemberName, T& value ); 
    5354    }; 
    5455 
    5556    class XMLSerialize: public IOSerialize { 
    5657    public: 
    57         XMLSerialize( const char* pFileName ); 
     58        XMLSerialize( Glib::ustring fileName ); 
    5859        virtual ~XMLSerialize(); 
    5960 
    60         virtual bool write( const char* pMemberName, 
     61        virtual bool write( std::string strMemberName, 
    6162                            long long value ); 
    62         virtual bool write( const char* pMemberName, 
     63        virtual bool write( std::string strMemberName, 
    6364                            Glib::ustring str); 
    6465    private: 
     
    6667        xmlpp::Document  m_doc; 
    6768 
    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 ); 
    6971    }; 
    7072 
    7173    class XMLDeserialize: public IODeserialize { 
    7274    public: 
    73         XMLDeserialize( const char* pFileName ); 
     75        XMLDeserialize( Glib::ustring fileName ); 
    7476        virtual ~XMLDeserialize(); 
    7577 
    76         virtual bool read( const char* pMemberName, 
     78        virtual bool read( std::string strMemberName, 
    7779                           long long& value ); 
    78         virtual bool read( const char* pMemberName, 
     80        virtual bool read( std::string strMemberName, 
    7981                           Glib::ustring& str ); 
    8082    private: 
     
    8486 
    8587 
    86     ////////////////////////////////////////// 
     88////////////////////////////////////////// 
    8789 
    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 ) 
    8992    { 
    90         return write( pMemberName, static_cast<long long>( value ) ); 
     93        return write( strMemberName, static_cast<long long>( value ) ); 
    9194    } 
    9295 
    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 ) 
    9498    { 
    95        long long tmp; 
    96         bool result = read( pMemberName, tmp ); 
     99        long long tmp; 
     100        bool result = read( strMemberName, tmp ); 
    97101        value = static_cast<T>( tmp ); 
    98102        return result; 
  • trunk/libfreebob/src/libutil/unittests.cpp

    r361 r365  
    1 /* bebob_unittests.cpp 
    2  * Copyright (C) 2006 by Daniel Wagner 
     1/* unittests.cpp 
     2 * Copyright (C) 2006,07 by Daniel Wagner 
    33 * 
    44 * This file is part of FreeBoB. 
     
    1919 */ 
    2020 
    21 #include "bebob_serialize.h" 
     21#include "serialize.h" 
    2222#include <libraw1394/raw1394.h> 
    2323 
    2424#include <stdio.h> 
    2525 
    26 using namespace BeBoB
     26using namespace Util
    2727 
    2828/////////////////////////////////////// 
  • trunk/libfreebob/src/Makefile.am

    r360 r365  
    6060        bebob/bebob_dl_bcd.h                            \ 
    6161        bebob/bebob_dl_bcd.cpp                          \ 
    62         bebob/bebob_serialize.h                         \ 
    63         bebob/bebob_serialize.cpp                       \ 
    6462        motu/motu_avdevice.cpp                          \ 
    6563        motu/motu_avdevice.h                            \ 
     
    8482        libfreebobavc/avc_unit_info.cpp                 \ 
    8583        libfreebobavc/ieee1394service.cpp               \ 
    86         libfreebobavc/serialize.cpp                   \ 
     84        libfreebobavc/avc_serialize.cpp                       \ 
    8785        libfreebobavc/avc_connect.h                     \ 
    8886        libfreebobavc/avc_definitions.h                 \ 
     
    9795        libfreebobavc/avc_unit_info.h                   \ 
    9896        libfreebobavc/ieee1394service.h                 \ 
    99         libfreebobavc/serialize.h                     \ 
     97        libfreebobavc/avc_serialize.h                 \ 
    10098        debugmodule/debugmodule.h                       \ 
    10199        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 
    134135 
    135136libfreebob_la_LDFLAGS =                                 \ 
     
    143144        maudio/fwap.xml 
    144145 
    145 bin_PROGRAMS = freebob_downloader freebob_sync 
    146146 
    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############### 
    155148 
    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 
     149bin_PROGRAMS = freebob-downloader freebob-sync 
    164150 
    165 noinst_PROGRAMS = test-dll test-debugmodule bebob_unittests 
     151freebob_downloader_SOURCES = freebob-downloader.cpp 
     152freebob_downloader_LDADD = $(top_builddir)/src/libfreebob.la 
     153 
     154freebob_sync_SOURCES = freebob-sync.cpp 
     155freebob_sync_LDADD = $(top_builddir)/src/libfreebob.la 
     156 
     157############### 
     158 
     159noinst_PROGRAMS = test-dll test-debugmodule test-unittests test-ser 
    166160 
    167161test_dll_SOURCES = libutil/test-dll.cpp 
    168 test_dll_LDADD = libfreebob.la 
     162test_dll_LDADD = $(top_builddir)/src/libfreebob.la 
    169163 
    170164test_debugmodule_SOURCES = debugmodule/test_debugmodule.cpp 
    171 test_debugmodule_LDADD = libfreebob.la 
     165test_debugmodule_LDADD = $(top_builddir)/src/libfreebob.la 
    172166 
    173 bebob_unittests_SOURCES = bebob/bebob_unittests.cpp 
    174 bebob_unittests_LDADD   = $(top_builddir)/src/libfreebob.la \ 
    175         $(LIBXMLCPP_LIBS) $(LIBAVC1394_LIBS) $(LIBIEC61883_LIBS) 
     167test_unittests_SOURCES = libutil/unittests.cpp 
     168test_unittests_LDADD = $(top_builddir)/src/libfreebob.la 
    176169 
     170test_ser_SOURCES = ser.cpp 
     171test_ser_LDADD = $(top_builddir)/src/libfreebob.la 
  • trunk/libfreebob/tests/test-extplugcmd.cpp

    r336 r365  
    2121#include "libfreebobavc/avc_extended_plug_info.h" 
    2222#include "libfreebobavc/avc_plug_info.h" 
    23 #include "libfreebobavc/serialize.h" 
     23#include "libfreebobavc/avc_serialize.h" 
    2424#include "libfreebobavc/ieee1394service.h" 
    2525 
  • trunk/libfreebob/tests/test-mixer.cpp

    r336 r365  
    2020 
    2121#include "libfreebobavc/avc_function_block.h" 
    22 #include "libfreebobavc/serialize.h" 
     22#include "libfreebobavc/avc_serialize.h" 
    2323#include "libfreebobavc/ieee1394service.h" 
    2424 
  • trunk/libfreebob/tests/test-volume.cpp

    r336 r365  
    2020 
    2121#include "libfreebobavc/avc_function_block.h" 
    22 #include "libfreebobavc/serialize.h" 
     22#include "libfreebobavc/avc_serialize.h" 
    2323#include "libfreebobavc/ieee1394service.h" 
    2424