コード例 #1
0
ファイル: upnpavdump.c プロジェクト: Coramo/mupnp
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");
}
コード例 #2
0
ファイル: upnpdump.c プロジェクト: WilliamRen/mupnpc
void QueryDevice(mUpnpControlPoint *ctrlPoint)
{
	mUpnpDevice *selDev;
	mUpnpService *selService;
	mUpnpStateVariable *selStateVar;
	bool querySuccess;
	char *stateValue;
	
	printf("Query Device\n");
	
	selDev = SelectDevice(ctrlPoint);
	if (selDev == NULL)
		return;
	selService = SelectService(selDev);
	if (selService == NULL)
		return;
	selStateVar = SelectStateVariable(selService);
	if (selStateVar == NULL)
		return;
	
	querySuccess = mupnp_statevariable_post(selStateVar);
	
	stateValue = mupnp_statevariable_getvalue(selStateVar);

	printf("Query Result(%d) = %s\n",
		(int)querySuccess, 
		(stateValue != NULL) ? stateValue : "");
}
コード例 #3
0
char *mupnp_upnpav_dmr_getcurrentconnectionids(mUpnpAvRenderer *dmr)
{
	mUpnpService *service;
	mUpnpStateVariable *stateVar;

	service = mupnp_device_getservicebyexacttype(dmr->dev, CG_UPNPAV_DMR_CONNECTIONMANAGER_SERVICE_TYPE);
	stateVar = mupnp_service_getstatevariablebyname(service, CG_UPNPAV_DMR_CONNECTIONMANAGER_CURRENTCONNECTIONIDS);
	return mupnp_statevariable_getvalue(stateVar);
}
コード例 #4
0
ファイル: ccontentdir_service.c プロジェクト: jink2005/mupnpc
int mupnp_upnpav_dms_condir_getsystemupdateid(mUpnpAvServer *dms)
{
	mUpnpDevice *dev;
	mUpnpStateVariable *var;

	dev = mupnp_upnpav_dms_getdevice(dms);
	if (!dev)
		return 0;

	var = mupnp_device_getstatevariablebyname(dev, CG_UPNPAV_DMS_CONTENTDIRECTORY_SYSTEM_UPDATE_ID);
	if (!var)
		return 0;

    /* Thanks for Jorgen Lundman(2011-05-09) */
    if (!mupnp_statevariable_getvalue(var))
        return 0;

	return mupnp_str2int(mupnp_statevariable_getvalue(var));
}
コード例 #5
0
ファイル: upnpdump.c プロジェクト: WilliamRen/mupnpc
void PrintDeviceInfo(mUpnpDevice *dev, int indent)
{
	char indentStr[128];
	int n;
	mUpnpService *service;
	int serviceCnt;
	mUpnpAction *action;
	int actionCnt;
	mUpnpArgumentList *arg;
	int argCnt;
	mUpnpStateVariable *stateVar;
	int stateVarCnt;
	
	for (n=0; n<indent && n<(sizeof(indentStr)-1); n++)
		indentStr[n] = ' ';
	indentStr[n] = '\0';
	
	serviceCnt = 0;
	for (service = mupnp_device_getservices(dev); service != NULL; service = mupnp_service_next(service)) {
		printf("%s service[%d] = %s\n", indentStr, ++serviceCnt, mupnp_service_getservicetype(service));
		actionCnt = 0;
		for (action = mupnp_service_getactions(service); action != NULL; action = mupnp_action_next(action)) {
			printf("%s  action[%d] = %s\n", indentStr, ++actionCnt, mupnp_action_getname(action));
			argCnt = 0;
			for (arg = mupnp_action_getarguments(action); arg != NULL; arg = mupnp_argument_next(arg)) {
				printf("%s   arg[%d] = %s\n", indentStr, ++argCnt, mupnp_argument_getname(arg));
			}
		}
		stateVarCnt = 0;
		for (stateVar = mupnp_service_getstatevariables(service); stateVar != NULL; stateVar = mupnp_statevariable_next(stateVar)) {
			printf("%s  stateVar[%d] = %s = %s\n", 
			       indentStr, 
			       ++stateVarCnt, 
			       mupnp_statevariable_getname(stateVar),
			       mupnp_statevariable_getvalue(stateVar));
		}
	}
}