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"); }
mUpnpDevice *SelectDevice(mUpnpControlPoint *ctrlPoint) { mUpnpDevice *dev; int n; char key; int devNum; n = 0; for (dev = mupnp_controlpoint_getdevices(ctrlPoint); dev != NULL; dev = mupnp_device_next(dev)) { key = 'a' + n; if ('z' < key) break; printf(" [%c] = %s\n", key, mupnp_device_getfriendlyname(dev)); n++; } if (n == 0) return NULL; printf("Select Device : "); key = kbgetkey(); key = tolower(key); printf("%c\n", key); if (!isalpha(key)) return NULL; devNum = key - 'a'; dev = mupnp_controlpoint_getdevices(ctrlPoint); for (n=0; n<devNum; n++) dev = mupnp_device_next(dev); return dev; }
void PrintControlPointDevice(mUpnpControlPoint *ctrlPoint) { mUpnpDevice *dev; int devCnt; printf("Device Num = %d\n", mupnp_controlpoint_getndevices(ctrlPoint)); devCnt = 0; for (dev = mupnp_controlpoint_getdevices(ctrlPoint); dev != NULL; dev = mupnp_device_next(dev)) { printf("[%d] = %s\n", ++devCnt, mupnp_device_getfriendlyname(dev)); PrintDevice(dev, 1); } }
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")); } } }