Пример #1
0
int TvDeviceSetServiceTableVar(unsigned int service, int variable, char *value)
{
	/* IXML_Document  *PropSet= NULL; */
	if (service >= TV_SERVICE_SERVCOUNT ||
	    variable >= tv_service_table[service].VariableCount ||
	    strlen(value) >= TV_MAX_VAL_LEN)
		return (0);

	ithread_mutex_lock(&TVDevMutex);

	strcpy(tv_service_table[service].VariableStrVal[variable], value);
#if 0
	/* Using utility api */
	PropSet = UpnpCreatePropertySet(1,
		tv_service_table[service].VariableName[variable],
		tv_service_table[service].VariableStrVal[variable]);
	UpnpNotifyExt(device_handle, tv_service_table[service].UDN,
		tv_service_table[service].ServiceId, PropSet);
	/* Free created property set */
	Document_free(PropSet);
#endif
	UpnpNotify(device_handle,
		tv_service_table[service].UDN,
		tv_service_table[service].ServiceId,
		(const char **)&tv_service_table[service].VariableName[variable],
		(const char **)&tv_service_table[service].VariableStrVal[variable], 1);

	ithread_mutex_unlock(&TVDevMutex);

	return 1;
}
bool cConnectionManager::OnConnectionChange(){
  IXML_Document* PropertySet = NULL;
  UpnpAddToPropertySet(&PropertySet, "CurrentConnectionIDs", GetConnectionIDsCVS().c_str());
  int ret = UpnpNotifyExt(mDeviceHandle, mMediaServer->GetDeviceUUID().c_str(), mServiceDescription.serviceID.c_str(), PropertySet);
  ixmlDocument_free(PropertySet);

  if(ret != UPNP_E_SUCCESS){
      esyslog("UPnP\tState change notification failed (Error code: %d)",ret);
      return false;
  }

  return true;
}