Esempio n. 1
0
void PrintDMSInfo(mUpnpDevice* dev, int dmsNum)
{
  mUpnpService* conDirService;
  mUpnpAction* browseAction;
  mUpnpStateVariable* searchCap;
  mUpnpStateVariable* sorpCap;

  if (!mupnp_device_isdevicetype(dev, UPNPAVDUMP_DMS_DEVICETYPE))
    return;

  printf("[%d] : %s\n", dmsNum, mupnp_device_getfriendlyname(dev));

  conDirService = mupnp_device_getservicebytype(dev, UPNPAVDUMP_DMS_CONTENTDIR_SERVICETYPE);
  if (!conDirService)
    return;

  searchCap = mupnp_service_getstatevariablebyname(conDirService, "SearchCapabilities");
  if (searchCap) {
    if (mupnp_statevariable_post(searchCap))
      printf(" SearchCapabilities = %s\n", mupnp_statevariable_getvalue(searchCap));
  }

  sorpCap = mupnp_service_getstatevariablebyname(conDirService, "SortCapabilities");
  if (sorpCap) {
    if (mupnp_statevariable_post(sorpCap))
      printf(" SortCapabilities = %s\n", mupnp_statevariable_getvalue(sorpCap));
  }

  browseAction = mupnp_service_getactionbyname(conDirService, UPNPAVDUMP_DMS_BROWSE_ACTIONNAME);
  if (!browseAction)
    return;

  PrintContentDirectory(browseAction, 0, "0");
}
Esempio n. 2
0
void PrintIGDInfo(mUpnpDevice *dev, int igdNum)
{
	mUpnpService *ipConService;
	mUpnpAction *extIpAddrAction;
	mUpnpService *wanComIfCfgService;
	mUpnpAction *totalBytesSentAction;
	mUpnpAction *totalBytesRecvAction;

	if (!mupnp_device_isdevicetype(dev, UPNPAVDUMP_IGD_DEVICETYPE))
		return;
	
	printf("[%d] : %s\n", igdNum, mupnp_device_getfriendlyname(dev));

	ipConService = mupnp_device_getservicebytype(dev, UPNPAVDUMP_IGD_WANIPCON_SERVICETYPE);
	if (ipConService) {
		extIpAddrAction = mupnp_service_getactionbyname(ipConService, "GetExternalIPAddress");
		if (extIpAddrAction) {
			if (mupnp_action_post(extIpAddrAction))
				printf("  GetExternalIPAddress = %s\n", mupnp_action_getargumentvaluebyname(extIpAddrAction, "NewExternalIPAddress"));
		}
	}

	wanComIfCfgService = mupnp_device_getservicebytype(dev, UPNPAVDUMP_IGD_WANCOMIFCFG_SERVICETYPE);
	if (wanComIfCfgService) {
		totalBytesSentAction = mupnp_service_getactionbyname(ipConService, "GetTotalBytesSent");
		if (totalBytesSentAction) {
			if (mupnp_action_post(totalBytesSentAction))
				printf("  GetTotalBytesSent = %s\n", mupnp_action_getargumentvaluebyname(totalBytesSentAction, "NewTotalBytesSent"));
		}
		totalBytesRecvAction = mupnp_service_getactionbyname(ipConService, "GetTotalBytesReceived");
		if (totalBytesRecvAction) {
			if (mupnp_action_post(totalBytesRecvAction))
				printf("  GetTotalBytesSent = %s\n", mupnp_action_getargumentvaluebyname(totalBytesRecvAction, "NewTotalBytesReceived"));
		}
	}
}