Example #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");
}
Example #2
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);
}
Example #3
0
void upnp_clock_device_update(mUpnpDevice *clockDev)
{
	mUpnpTime currTime;
	mUpnpService *timeService;
	mUpnpStateVariable *timeState;
	char sysTimeStr[SYSTEM_TIME_BUF_LEN];
	
	timeService = mupnp_device_getservicebyexacttype(clockDev, "urn:schemas-upnp-org:service:timer:1");
	if (timeService == NULL)
		return;

	timeState = mupnp_service_getstatevariablebyname(timeService, "Time");
	if (timeState == NULL)
		return;
	
	currTime = mupnp_getcurrentsystemtime();
	GetSystemTimeString(currTime, sysTimeStr);
	mupnp_statevariable_setvalue(timeState, sysTimeStr);
	
	printf("%s\n", sysTimeStr);
}
Example #4
0
/**
 * When an event is received, update also the associated service's
 * state table to include the evented state variable.
 *
 * @param service The service, whose state table to update
 * @param prop The evented property from which to update
 */
void mupnp_controlpoint_updatestatetablefromproperty(mUpnpService* service,
    mUpnpProperty* prop)
{
  mUpnpStateVariable* var = NULL;

  mupnp_log_debug_l4("Entering...\n");

  if (service == NULL || prop == NULL) {
    return;
  }

  var = mupnp_service_getstatevariablebyname(service,
      mupnp_property_getname(prop));

  if (var) {
    mupnp_statevariable_setvalue(var,
        mupnp_property_getvalue(prop));
  }

  mupnp_log_debug_l4("Leaving...\n");
}
Example #5
0
void mupnp_upnpav_dmr_addprotocolinfo(mUpnpAvRenderer *dmr, mUpnpAvProtocolInfo *info)
{
	mUpnpString *protocolInfos;
	mUpnpAvProtocolInfo *protocolInfo;
	mUpnpService *service;
	mUpnpStateVariable *stateVar;

	mupnp_upnpav_protocolinfolist_add(dmr->protocolInfoList, info);

	protocolInfos = mupnp_string_new();
	for (protocolInfo = mupnp_upnpav_dmr_getprotocolinfos(dmr); protocolInfo; protocolInfo = mupnp_upnpav_protocolinfo_next(protocolInfo)) {
		if (0 < mupnp_string_length(protocolInfos))
			mupnp_string_addvalue(protocolInfos, ",");
		mupnp_string_addvalue(protocolInfos, mupnp_upnpav_protocolinfo_getstring(protocolInfo));
	}

	service = mupnp_device_getservicebyexacttype(dmr->dev, CG_UPNPAV_DMR_CONNECTIONMANAGER_SERVICE_TYPE);
	stateVar = mupnp_service_getstatevariablebyname(service, CG_UPNPAV_DMR_CONNECTIONMANAGER_SINKPROTOCOLINFO);
	mupnp_statevariable_setvalue(stateVar, mupnp_string_getvalue(protocolInfos));

	mupnp_string_delete(protocolInfos);
}