When the UPnP programs runs on its own, it runs in a console window. Could this be a problem? Can I fix that?
I used _beginthread as a test program for just the .exe of the UPnP code. I see a window flash and dissapear, but the UPnP functionality is not detected by the UPnP device tester from Intel.
It appears that the UPnP thread just runs and then exits.
Looks like the UPnP code creates its own thread:
void main(void)
{
char *protocolInfo;
DWORD ptid=0;
DWORD ptid2=0;
_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
//////////////////////////////////////////////////////////////////
MicroStackChain = ILibCreateChain();
/* TODO: Each device must have a unique device identifier (UDN) */
DMR_microStack = DMR_CreateMicroStack(MicroStackChain,"WadsCo Renderer","87e67194-bd02-4f0b-a619-935ac8fa8522","0000001",1800,0);
DMR_FP_AVTransport_GetCurrentTransportActions=(DMR__ActionHandler_AVTransport_GetCurrentTransportActions)&DMR_AVTransport_GetCurrentTransportActions;
DMR_FP_AVTransport_GetDeviceCapabilities=(DMR__ActionHandler_AVTransport_GetDeviceCapabilities)&DMR_AVTransport_GetDeviceCapabilities;
DMR_FP_AVTransport_GetMediaInfo=(DMR__ActionHandler_AVTransport_GetMediaInfo)&DMR_AVTransport_GetMediaInfo;
DMR_FP_AVTransport_GetPositionInfo=(DMR__ActionHandler_AVTransport_GetPositionInfo)&DMR_AVTransport_GetPositionInfo;
DMR_FP_AVTransport_GetTransportInfo=(DMR__ActionHandler_AVTransport_GetTransportInfo)&DMR_AVTransport_GetTransportInfo;
DMR_FP_AVTransport_GetTransportSettings=(DMR__ActionHandler_AVTransport_GetTransportSettings)&DMR_AVTransport_GetTransportSettings;
DMR_FP_AVTransport_Next=(DMR__ActionHandler_AVTransport_Next)&DMR_AVTransport_Next;
DMR_FP_AVTransport_Pause=(DMR__ActionHandler_AVTransport_Pause)&DMR_AVTransport_Pause;
DMR_FP_AVTransport_Play=(DMR__ActionHandler_AVTransport_Play)&DMR_AVTransport_Play;
DMR_FP_AVTransport_Previous=(DMR__ActionHandler_AVTransport_Previous)&DMR_AVTransport_Previous;
DMR_FP_AVTransport_Seek=(DMR__ActionHandler_AVTransport_Seek)&DMR_AVTransport_Seek;
DMR_FP_AVTransport_SetAVTransportURI=(DMR__ActionHandler_AVTransport_SetAVTransportURI)&DMR_AVTransport_SetAVTransportURI;
DMR_FP_AVTransport_SetPlayMode=(DMR__ActionHandler_AVTransport_SetPlayMode)&DMR_AVTransport_SetPlayMode;
DMR_FP_AVTransport_Stop=(DMR__ActionHandler_AVTransport_Stop)&DMR_AVTransport_Stop;
DMR_FP_ConnectionManager_GetCurrentConnectionIDs=(DMR__ActionHandler_ConnectionManager_GetCurrentConnectionIDs)&DMR_ConnectionManager_GetCurrentConnectionIDs;
DMR_FP_ConnectionManager_GetCurrentConnectionInfo=(DMR__ActionHandler_ConnectionManager_GetCurrentConnectionInfo)&DMR_ConnectionManager_GetCurrentConnectionInfo;
DMR_FP_ConnectionManager_GetProtocolInfo=(DMR__ActionHandler_ConnectionManager_GetProtocolInfo)&DMR_ConnectionManager_GetProtocolInfo;
DMR_FP_RenderingControl_GetLoudness=(DMR__ActionHandler_RenderingControl_GetLoudness)&DMR_RenderingControl_GetLoudness;
DMR_FP_RenderingControl_GetMute=(DMR__ActionHandler_RenderingControl_GetMute)&DMR_RenderingControl_GetMute;
DMR_FP_RenderingControl_GetVolume=(DMR__ActionHandler_RenderingControl_GetVolume)&DMR_RenderingControl_GetVolume;
DMR_FP_RenderingControl_SetLoudness=(DMR__ActionHandler_RenderingControl_SetLoudness)&DMR_RenderingControl_SetLoudness;
DMR_FP_RenderingControl_SetMute=(DMR__ActionHandler_RenderingControl_SetMute)&DMR_RenderingControl_SetMute;
DMR_FP_RenderingControl_SetVolume=(DMR__ActionHandler_RenderingControl_SetVolume)&DMR_RenderingControl_SetVolume;
/* All evented state variables MUST be initialized before DMR_Start is called. */
protocolInfo = BuildProtocolInfo(ProtocolInfoList);
/* DMR_SetState_AVTransport_LastChange(DMR_microStack,"Sample String");
//DMR_SetState_ConnectionManager_SourceProtocolInfo(DMR_microStack,"Sample String");
DMR_SetState_ConnectionManager_SourceProtocolInfo(DMR_microStack,protocolInfo);
//DMR_SetState_ConnectionManager_SinkProtocolInfo(DMR_microStack,"Sample String");
DMR_SetState_ConnectionManager_SinkProtocolInfo(DMR_microStack,protocolInfo);
DMR_SetState_ConnectionManager_CurrentConnectionIDs(DMR_microStack,"Sample String");
DMR_SetState_RenderingControl_LastChange(DMR_microStack,"Sample String");
*/
DMR_SetState_AVTransport_LastChange(DMR_microStack, "<Event xmlns=\"urn:schemas-upnp-org:metadata-1-0/AVT/\"/ >");
DMR_SetState_ConnectionManager_SourceProtocolInfo(DMR_microStack,protocolInfo);
DMR_SetState_ConnectionManager_SinkProtocolInfo(DMR_microStack, protocolInfo);
DMR_SetState_ConnectionManager_CurrentConnectionIDs(DMR_microStack, "0");
DMR_SetState_RenderingControl_LastChange(DMR_microStack, "<Event xmlns=\"urn:schemas-upnp-org:metadata-1-0/RCS/\"/ >");
printf("Intel MicroStack 1.0 - WadsCo Renderer,\r\n\r\n");
CreateThread(NULL,0,&Run,NULL,0,&ptid);
ILib_IPAddressMonitorTerminator = CreateEvent(NULL,TRUE,FALSE,NULL);
ILib_IPAddressMonitorThread = CreateThread(NULL,0,&ILib_IPAddressMonitorLoop,NULL,0,&ptid2);
ILibStartChain(MicroStackChain);
// return 0;
}
Please help.
Darren