Пример #1
0
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;
}
Пример #2
0
BOOL cg_upnpav_dmr_actionreceived(CgUpnpAction* action)
{
  CgUpnpDevice* dev;
  CgUpnpService* service;
  CgUpnpAvRenderer* dmr;
  CG_UPNPAV_ACTION_LISTNER userActionListener;

  service = cg_upnp_action_getservice(action);
  if (!service)
    return FALSE;

  dev = (CgUpnpDevice*)cg_upnp_service_getdevice(service);
  if (!dev)
    return FALSE;

  dmr = (CgUpnpAvRenderer*)cg_upnp_device_getuserdata(dev);
  if (!dmr)
    return FALSE;

  userActionListener = cg_upnpav_dmr_getactionlistener(dmr);
  if (userActionListener) {
    if (userActionListener(action))
      return TRUE;
  }

  if (cg_streq(cg_upnp_service_getservicetype(service), CG_UPNPAV_DMR_AVTRANSPORT_SERVICE_TYPE))
    return cg_upnpav_dmr_avtransport_actionreceived(action);

  if (cg_streq(cg_upnp_service_getservicetype(service), CG_UPNPAV_DMR_RENDERINGCONTROL_SERVICE_TYPE))
    return cg_upnpav_dmr_renderingctrl_actionreceived(action);

  if (cg_streq(cg_upnp_service_getservicetype(service), CG_UPNPAV_DMR_CONNECTIONMANAGER_SERVICE_TYPE))
    return cg_upnpav_dmr_conmgr_actionreceived(action);

  return FALSE;
}
BOOL cg_upnpav_dms_actionreceived(CgUpnpAction *action)
{
    CgUpnpDevice *dev;
    CgUpnpService *service;
    CgUpnpAvServer *dms;
    CG_UPNP_ACTION_LISTNER userActionListener;

    service = cg_upnp_action_getservice(action);
    if (!service)
        return FALSE;

    dev = (CgUpnpDevice *)cg_upnp_service_getdevice(service);
    if (!dev)
        return FALSE;

    dms = (CgUpnpAvServer *)cg_upnp_device_getuserdata(dev);
    if (!dms)
        return FALSE;

    userActionListener = cg_upnpav_dms_getactionlistener(dms);
    if (userActionListener) {
        if (userActionListener(action))
            return TRUE;
    }

    if (cg_streq(cg_upnp_service_getservicetype(service), CG_UPNPAV_DMS_CONTENTDIRECTORY_SERVICE_TYPE))
        return cg_upnpav_dms_condir_actionreceived(action);

    if (cg_streq(cg_upnp_service_getservicetype(service), CG_UPNPAV_DMS_MEDIARECEIVER_SERVICE_TYPE))
        return cg_upnpav_dms_medrec_actionreceived(action);

    if (cg_streq(cg_upnp_service_getservicetype(service), CG_UPNPAV_DMS_CONNECTIONMANAGER_SERVICE_TYPE))
        return cg_upnpav_dms_conmgr_actionreceived(action);

    return FALSE;
}