20120531 dms命令行 又添log

又添加了一些log。這些添加的log說明,upnp.start之後,就可以任意寫代碼了。

    /*---------------------------------------------------------------------- 
    |   includes 
    +---------------------------------------------------------------------*/  
    #include "PltUPnP.h"  
    #include "PltFileMediaServer.h"  
      
    #include <stdlib.h>  
      
    NPT_SET_LOCAL_LOGGER("platinum.media.server.file.test")  
      
    //爲了測試別的程序,下面兩個變量在這裏聲明。  
    PLT_UPnP upnp;  
    PLT_DeviceHostReference device;  
    /*---------------------------------------------------------------------- 
    |   main 
    +---------------------------------------------------------------------*/  
    int  
    main(int /* argc */, char** argv)  
    {  
        // setup Neptune logging  
        NPT_LogManager::GetDefault().Configure("plist:.level=INFO;.handlers=ConsoleHandler;.ConsoleHandler.colors=off;.ConsoleHandler.filter=42");  
      
        /* for DLNA faster testing */  
        PLT_Constants::GetInstance().SetDefaultDeviceLease(30.);  
       
        /* 
        PLT_DeviceHostReference device( 
            new PLT_FileMediaServer("/data/local",  
                                    "11111111111UPnP Media Server", 
                                    false, 
                                    "11111111111"));     
        */  
        //上面的實例化是可行的。爲了其他程序的測試,採用下面的形式。  
        //後面兩個參數可以採用默認值。爲了測試方便,採用下面的形式。  
        device = new PLT_FileMediaServer("/data/local",   
                                    "4444444444444UPnP Media Server",  
                                    false,  
                                    "4444444444444");  
        NPT_List<NPT_IpAddress> list;  
        NPT_CHECK_SEVERE(PLT_UPnPMessageHelper::GetIPAddresses(list));  
        NPT_String ip = list.GetFirstItem()->ToString();  
      
        device->m_ModelDescription = "Platinum File Media Server";  
        device->m_ModelURL = "http://www.plutinosoft.com/";  
        device->m_ModelNumber = "1.0";  
        device->m_ModelName = "Platinum File Media Server";  
        device->m_Manufacturer = "Plutinosoft";  
        device->m_ManufacturerURL = "http://www.plutinosoft.com/";  
        /*  NPT_LOG_INFO_2("baojinyu,debug info:ip-->%s,ip--->%s",  
                        ip,  
                        ip);*/    
        //上述log不能加。  
        NPT_LOG_INFO("AddDevice前面");  
        upnp.AddDevice(device);  
        NPT_LOG_INFO("AddDevice後面,upnp.Start前面");  
        NPT_String uuid = device->GetUUID();  
          
        NPT_CHECK_SEVERE(upnp.Start());  
        NPT_LOG_INFO("upnp.Start後面");  
        NPT_LOG_INFO("Press 'q' to quit.");  
        NPT_LOG_INFO_2("baojinyu,debug info:ip-->%s,uuid--->%s", 
					(const char*)ip, 
					(const char*)uuid);
	while(1)
	{
	}  
        char buf[256];  
        while (gets(buf)) {  
            if (*buf == 'q')  
                break;  
        }  
      
        upnp.Stop();  
      
        return 0;  
    }  

運行結果:

Source/Apps/dmsThread/main.cpp(101): [main] INFO: AddDevice��前��面
Source/Apps/dmsThread/main.cpp(103): [main] INFO: AddDevice��後��面��,upnp.Start��前��面
Source/Core/PltUPnP.cpp(150): [Start] INFO: Starting UPnP...
Source/Core/PltHttpServer.cpp(117): [Start] INFO: HttpServer listening on 0.0.0.0:1626
Source/Apps/dmsThread/main.cpp(107): [main] INFO: upnp.Start��後��面
Source/Apps/dmsThread/main.cpp(108): [main] INFO: Press 'q' to quit.
Source/Apps/dmsThread/main.cpp(111): [main] INFO: baojinyu,debug info:ip-->10.20.112.54,uuid--->555555555555555
Source/Core/PltDeviceHost.cpp(759): [SendSsdpSearchResponse] INFO: Responding to a M-SEARCH request for upnp:rootdevice


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章