Пример #1
0
mUpnpStateVariable *SelectStateVariable(mUpnpService *service)
{
	mUpnpStateVariable *stateVar;
	int n;
	char key;
	int serviceNum;

	n = 0;
	for (stateVar = mupnp_service_getstatevariables(service); stateVar != NULL; stateVar = mupnp_statevariable_next(stateVar)) {
		key = 'a' + n;
		if ('z' < key)
			break;
		printf(" [%c] = %s\n", key, mupnp_statevariable_getname(stateVar));
		n++;
	}
	printf("Select StateVariable : ");
	key = kbgetkey();
	key = tolower(key);
	printf("%c\n", key);
	
	if (!isalpha(key))
		return NULL;
	
	serviceNum = key - 'a';
	stateVar = mupnp_service_getstatevariables(service);
	for (n=1; n<serviceNum; n++)
		stateVar = mupnp_statevariable_next(stateVar);

	return stateVar;
}
Пример #2
0
bool mupnp_service_notifyall(mUpnpService* service, bool doBracket)
{
  mUpnpStateVariable* statVar;

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

  if (doBracket) {
    mupnp_service_notifyallbracket(service);
  }
  else {
    for (statVar = mupnp_service_getstatevariables(service); statVar != NULL; statVar = mupnp_statevariable_next(statVar)) {
      if (mupnp_statevariable_issendevents(statVar) == true)
        mupnp_service_notify(service, statVar);
    }
  }

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

  return true;
}
Пример #3
0
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));
		}
	}
}