예제 #1
0
BOOL upnp_clock_actionreceived(mUpnpAction *action)
{
	mUpnpTime currTime;
	const char *actionName;
	mUpnpArgument *currTimeArg;
	char sysTimeStr[SYSTEM_TIME_BUF_LEN];
	mUpnpArgument *newTimeArg, *resultArg;

	currTime = mupnp_getcurrentsystemtime();
	
	actionName = mupnp_action_getname(action);
	if (strcmp("GetTime", actionName) == 0) {
		GetSystemTimeString(currTime, sysTimeStr);
		currTimeArg = mupnp_action_getargumentbyname(action, "CurrentTime");
		mupnp_argument_setvalue(currTimeArg, sysTimeStr);
		return TRUE;
	}
	if (strcmp(actionName, "SetTime") == 0) {
		newTimeArg = mupnp_action_getargumentbyname(action, "NewTime");
		resultArg = mupnp_action_getargumentbyname(action, "Result");
		mupnp_argument_setvalue(resultArg, "Not implemented");
		return TRUE;
	}

	return FALSE;
}
예제 #2
0
bool mupnp_control_action_response_getresult(mUpnpActionResponse *actionRes, mUpnpAction *action)
{
	mUpnpXmlNode *resNode;
	mUpnpXmlNode *argNode;
	char *argName;
	mUpnpArgument *arg;
	
	mupnp_log_debug_l4("Entering...\n");

	resNode = mupnp_control_action_response_getactionresponsenode(actionRes);
	if (resNode == NULL)
		return false;
		
	for (argNode = mupnp_xml_node_getchildnodes(resNode); argNode != NULL; argNode = mupnp_xml_node_next(argNode)) {
		argName = mupnp_xml_node_getname(argNode);
		arg = mupnp_action_getargumentbyname(action, argName);
		if (arg == NULL)
			continue;
		mupnp_argument_setvalue(arg, mupnp_xml_node_getvalue(argNode));
	}

	return true;

	mupnp_log_debug_l4("Leaving...\n");
}
예제 #3
0
파일: action.c 프로젝트: WilliamRen/mupnpc
char *mupnp_action_getargumentvaluebyname(mUpnpAction *action, const char *name)
{
	mUpnpArgument *arg;

	arg = mupnp_action_getargumentbyname(action, name);
	if (!arg)
		return NULL;
	return mupnp_argument_getvalue(arg);
}
예제 #4
0
파일: action.c 프로젝트: WilliamRen/mupnpc
bool mupnp_action_setargumentvaluebyname(mUpnpAction *action, const char *name, const char *value)
{
	mUpnpArgument *arg;

	arg = mupnp_action_getargumentbyname(action, name);
	if (!arg)
		return false;
	mupnp_argument_setvalue(arg, value);
	return true;
}
예제 #5
0
// Used for xbox360 support, see README.360
bool mupnp_upnpav_dms_medrec_actionreceived(mUpnpAction *action)
{
    char *actionName;
    mUpnpArgument *arg;

    actionName = (char*)mupnp_action_getname(action);

    if (mupnp_strlen(actionName) <= 0)
        return false;


    if (mupnp_streq(actionName, CG_UPNPAV_DMS_MEDIARECEIVER_IS_AUTHORIZED )) {
        arg = mupnp_action_getargumentbyname(action,
                                               CG_UPNPAV_DMS_MEDIARECEIVER_RESULT);
        if (!arg)
            return false;
        mupnp_argument_setvalue(arg, "1");
        return true;
    }

    if (mupnp_streq(actionName, CG_UPNPAV_DMS_MEDIARECEIVER_IS_VALIDATED)) {
        arg = mupnp_action_getargumentbyname(action,
                                               CG_UPNPAV_DMS_MEDIARECEIVER_RESULT);
        if (!arg)
            return false;
        mupnp_argument_setvalue(arg, "1");
        return true;
    }

    if (mupnp_streq(actionName, CG_UPNPAV_DMS_MEDIARECEIVER_REGISTER_DEVICE)) {
        arg = mupnp_action_getargumentbyname(action,
                                               CG_UPNPAV_DMS_MEDIARECEIVER_REGISTRATION_RESP_MSG);
        if (!arg)
            return false;
        // Specifications say to return base64 message.
        mupnp_argument_setvalue(arg, "1");
        return true;
    }


    return true;
}
예제 #6
0
bool mupnp_upnpav_dms_condir_actionreceived(mUpnpAction *action)
{
	mUpnpAvServer *dms;
	mUpnpDevice *dev;
	char *actionName;
	mUpnpArgument *arg;
	char *argValue;
	char intBuf[MUPNP_STRING_INTEGER_BUFLEN];

	actionName = (char*)mupnp_action_getname(action);
	if (mupnp_strlen(actionName) <= 0)
		return false;

	dev = (mUpnpDevice *)mupnp_service_getdevice(mupnp_action_getservice(action));
	if (!dev)
		return false;

	dms = (mUpnpAvServer *)mupnp_device_getuserdata(dev);
	if (!dms)
		return false;

	/* Browse */
	if (mupnp_streq(actionName, CG_UPNPAV_DMS_CONTENTDIRECTORY_BROWSE))
	{
		arg = mupnp_action_getargumentbyname(action, CG_UPNPAV_DMS_CONTENTDIRECTORY_BROWSE_BROWSE_FLAG);
		if (!arg)
			return false;
		argValue = mupnp_argument_getvalue(arg);
		if (mupnp_streq(argValue, CG_UPNPAV_DMS_CONTENTDIRECTORY_BROWSE_BROWSE_METADATA))
			return mupnp_upnpav_dms_condir_browsemetadata(dms, action);
		if (mupnp_streq(argValue, CG_UPNPAV_DMS_CONTENTDIRECTORY_BROWSE_BROWSE_DIRECT_CHILDREN))
			return mupnp_upnpav_dms_condir_browsedirectchildren(dms, action);
		return false;
	}

	/* Search */
	if (mupnp_streq(actionName, CG_UPNPAV_DMS_CONTENTDIRECTORY_SEARCH)) {
		/* Not Implemented */
		return false;
	}

	/* Sort Capabilities */
	if (mupnp_streq(actionName, CG_UPNPAV_DMS_CONTENTDIRECTORY_GET_SORT_CAPABILITIES)) {
		arg = mupnp_action_getargumentbyname(action, CG_UPNPAV_DMS_CONTENTDIRECTORY_SORT_CAPS);
		if (!arg)
			return false;
		mupnp_argument_setvalue(arg, "");
		return true;
	}

	/* Search Capabilities */
	if (mupnp_streq(actionName, CG_UPNPAV_DMS_CONTENTDIRECTORY_GET_SEARCH_CAPABILITIES)) {
		arg = mupnp_action_getargumentbyname(action, CG_UPNPAV_DMS_CONTENTDIRECTORY_SEARCH_CAPS);
		if (!arg)
			return false;
		mupnp_argument_setvalue(arg, "");
		return true;
	}

	/* System Update ID */
	if (mupnp_streq(actionName, CG_UPNPAV_DMS_CONTENTDIRECTORY_GET_SYSTEM_UPDATE_ID)) {
		arg = mupnp_action_getargumentbyname(action, CG_UPNPAV_DMS_CONTENTDIRECTORY_ID);
		if (!arg)
			return false;
		mupnp_argument_setvalue(arg, mupnp_int2str(mupnp_upnpav_dms_condir_getsystemupdateid(dms), intBuf, MUPNP_STRING_INTEGER_BUFLEN));
		return true;
	}

	return false;
}