BOOL upnp_clock_actionreceived(CgUpnpAction *action) { CgTime currTime; char *actionName; CgUpnpArgument *currTimeArg; char sysTimeStr[SYSTEM_TIME_BUF_LEN]; CgUpnpArgument *newTimeArg, *resultArg; currTime = cg_getcurrentsystemtime(); actionName = cg_upnp_action_getname(action); if (strcmp("GetTime", actionName) == 0) { GetSystemTimeString(currTime, sysTimeStr); currTimeArg = cg_upnp_action_getargumentbyname(action, "CurrentTime"); cg_upnp_argument_setvalue(currTimeArg, sysTimeStr); return TRUE; } if (strcmp(actionName, "SetTime") == 0) { newTimeArg = cg_upnp_action_getargumentbyname(action, "NewTime"); resultArg = cg_upnp_action_getargumentbyname(action, "Result"); cg_upnp_argument_setvalue(resultArg, "Not implemented"); return TRUE; } return FALSE; }
BOOL cg_upnpav_dms_conmgr_actionreceived(CgUpnpAction* action) { CgUpnpAvServer* dms; CgUpnpDevice* dev; char* actionName; CgUpnpArgument* arg; CgString* protocolInfos; CgUpnpAvProtocolInfo* protocolInfo; actionName = (char*)cg_upnp_action_getname(action); if (cg_strlen(actionName) <= 0) return FALSE; dev = (CgUpnpDevice*)cg_upnp_service_getdevice(cg_upnp_action_getservice(action)); if (!dev) return FALSE; dms = (CgUpnpAvServer*)cg_upnp_device_getuserdata(dev); if (!dms) return FALSE; /* GetProtocolInfo*/ if (cg_streq(actionName, CG_UPNPAV_DMS_CONNECTIONMANAGER_GET_PROTOCOL_INFO)) { arg = cg_upnp_action_getargumentbyname(action, CG_UPNPAV_DMS_CONNECTIONMANAGER_SOURCE); if (!arg) return FALSE; protocolInfos = cg_string_new(); for (protocolInfo = cg_upnpav_dms_getprotocolinfos(dms); protocolInfo; protocolInfo = cg_upnpav_protocolinfo_next(protocolInfo)) { if (0 < cg_string_length(protocolInfos)) cg_string_addvalue(protocolInfos, ","); cg_string_addvalue(protocolInfos, cg_upnpav_protocolinfo_getstring(protocolInfo)); } cg_upnp_argument_setvalue(arg, cg_string_getvalue(protocolInfos)); cg_string_delete(protocolInfos); return TRUE; } return FALSE; }