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


你可能感兴趣的:(20120531 dms命令行 又添log)