Package com.aelitis.net.upnp

Examples of com.aelitis.net.upnp.UPnPException


  {
    UPnPAction act = service.getAction( "GetFreeSpace" );
   
    if ( act == null ){
           
      throw( new UPnPException( "GetFreeSpace not supported" ));
     
    }else{
         
      UPnPActionInvocation inv = act.getInvocation();
       
      inv.addArgument( "NewClientID", client_id );
     
      UPnPActionArgument[]  args = inv.invoke();
           
      for (int i=0;i<args.length;i++){
       
        UPnPActionArgument  arg = args[i];
     
        String  name = arg.getName();
       
        if ( name.equalsIgnoreCase("NewFreeSpace")){
         
          return( Long.parseLong( arg.getValue()));
         
        }
      }
     
      throw( new UPnPException( "result not found" ));
    }
  }
View Full Code Here


  {
    UPnPAction act = service.getAction( "Activate" );
   
    if ( act == null ){
           
      throw( new UPnPException( "Activate not supported" ));
     
    }else{
         
      UPnPActionInvocation inv = act.getInvocation();
       
      inv.addArgument( "NewClientID", client_id );
     
      UPnPActionArgument[]  args = inv.invoke();
           
      for (int i=0;i<args.length;i++){
       
        UPnPActionArgument  arg = args[i];
     
        String  name = arg.getName();
       
        if ( name.equalsIgnoreCase("NewStatus")){
         
          return;
         
        }
      }
     
      throw( new UPnPException( "status not found" ));
    }
  }
View Full Code Here

  {
    UPnPAction act = service.getAction( "SetDownloads" );
   
    if ( act == null ){
           
      throw( new UPnPException( "SetDownloads not supported" ));
     
    }else{
         
      UPnPActionInvocation inv = act.getInvocation();
           
      inv.addArgument( "NewClientID", client_id );
      inv.addArgument( "NewTorrentHashList", hash_list );
     
      UPnPActionArgument[]  args = inv.invoke();
     
      String  result  = null;
      String  status   = null;
     
      for (int i=0;i<args.length;i++){
       
        UPnPActionArgument  arg = args[i];
     
        String  name = arg.getName();
       
        if ( name.equalsIgnoreCase("NewSetDownloadsResultList")){
         
          result = arg.getValue();
         
        }else if ( name.equalsIgnoreCase("NewStatus")){
         
          status = arg.getValue();
        }
      }
     
      if ( result != null && status != null ){
       
        return( new String[]{ result, status });
      }
     
      throw( new UPnPException( "result or status not found" ));
    }
  }
View Full Code Here

  {
    UPnPAction act = service.getAction( "AddDownload" );
   
    if ( act == null ){
           
      throw( new UPnPException( "AddDownload not supported" ));
     
    }else{
         
      UPnPActionInvocation inv = act.getInvocation();
           
      inv.addArgument( "NewClientID", client_id );
      inv.addArgument( "NewTorrentHash", hash );
      inv.addArgument( "NewTorrentData", torrent );
     
      UPnPActionArgument[]  args = inv.invoke();
           
      for (int i=0;i<args.length;i++){
       
        UPnPActionArgument  arg = args[i];
     
        String  name = arg.getName();
       
        if ( name.equalsIgnoreCase("NewStatus")){
         
          return( arg.getValue());
        }
      }
     
      throw( new UPnPException( "result not found" ));
    }
  }
View Full Code Here

  {
    UPnPAction act = service.getAction( "AddDownloadChunked" );
   
    if ( act == null ){
           
      throw( new UPnPException( "AddDownloadChunked not supported" ));
     
    }else{
         
      UPnPActionInvocation inv = act.getInvocation();
           
      inv.addArgument( "NewClientID", client_id );
      inv.addArgument( "NewTorrentHash", hash );
      inv.addArgument( "NewTorrentData", chunk );
      inv.addArgument( "NewChunkOffset", String.valueOf( offset ));
      inv.addArgument( "NewTotalLength", String.valueOf( total_size ));
     
      UPnPActionArgument[]  args = inv.invoke();
           
      for (int i=0;i<args.length;i++){
       
        UPnPActionArgument  arg = args[i];
     
        String  name = arg.getName();
       
        if ( name.equalsIgnoreCase("NewStatus")){
         
          return( arg.getValue());
        }
      }
     
      throw( new UPnPException( "result not found" ));
    }
  }
View Full Code Here

    {
      UPnPAction act = service.getAction( "UpdateDownload" );
     
      if ( act == null ){
             
        throw( new UPnPException( "UpdateDownload not supported" ));
       
      }else{
           
        UPnPActionInvocation inv = act.getInvocation();
             
        inv.addArgument( "NewClientID", client_id );
       inv.addArgument( "NewTorrentHash", hash );
       inv.addArgument( "NewPieceRequiredMap", required_map );
       
        UPnPActionArgument[]  args = inv.invoke();
       
        String  have  = null;
        String  status   = null;
       
        for (int i=0;i<args.length;i++){
         
          UPnPActionArgument  arg = args[i];
       
          String  name = arg.getName();
         
          if ( name.equalsIgnoreCase("NewPieceHaveMap")){
           
            have = arg.getValue();
           
          }else if ( name.equalsIgnoreCase("NewStatus")){
           
            status = arg.getValue();
          }
        }
       
        if ( have != null && status != null ){
         
          return( new String[]{ have, status });
        }
       
        throw( new UPnPException( "have or status not found" ));
      }
    }
View Full Code Here

  {
    UPnPAction act = service.getAction( "RemoveDownload" );
   
    if ( act == null ){
           
      throw( new UPnPException( "RemoveDownload not supported" ));
     
    }else{
         
      UPnPActionInvocation inv = act.getInvocation();
           
      inv.addArgument( "NewClientID", client_id );
      inv.addArgument( "NewTorrentHash", hash );
   
      UPnPActionArgument[]  args = inv.invoke();
     
      String  status   = null;
     
      for (int i=0;i<args.length;i++){
       
        UPnPActionArgument  arg = args[i];
     
        String  name = arg.getName();
       
        if ( name.equalsIgnoreCase("NewStatus")){
         
          status = arg.getValue();
        }
      }
     
      if ( status != null ){
       
        return( status );
      }
     
      throw( new UPnPException( "status not found" ));
    }
  }
View Full Code Here

  {
    UPnPAction act = service.getAction( "StartDownload" );
   
    if ( act == null ){
           
      throw( new UPnPException( "StartDownload not supported" ));
     
    }else{
         
      UPnPActionInvocation inv = act.getInvocation();
           
      inv.addArgument( "NewClientID", client_id );
      inv.addArgument( "NewTorrentHash", hash );
   
      UPnPActionArgument[]  args = inv.invoke();
     
      String  status     = null;
      String  data_port  = null;
     
      for (int i=0;i<args.length;i++){
       
        UPnPActionArgument  arg = args[i];
     
        String  name = arg.getName();
       
        if ( name.equalsIgnoreCase("NewStatus")){
         
          status = arg.getValue();
         
        }else if ( name.equalsIgnoreCase("NewDataPort")){
         
          data_port = arg.getValue();
        }
      }
     
      if ( status != null && data_port != null ){
       
        return( new String[]{ data_port, status });
      }
     
      throw( new UPnPException( "status or data port not found" ));
    }
  }
View Full Code Here

   
    if ( act == null ){
     
      service.getDevice().getRootDevice().getUPnP().log( "Action 'GetCommonLinkProperties' not supported, binding not established" );
     
      throw( new UPnPException( "GetCommonLinkProperties not supported" ));
     
    }else{
         
      UPnPActionInvocation inv = act.getInvocation();
           
View Full Code Here

   
    public NatPMPImpl(NatPMPDevice device ) throws UPnPException {
        try {
            natDevice = device;
        } catch( Exception e) {
            throw( new UPnPException( "Error in getting NatPMP Service!" ));
        }
    }
View Full Code Here

TOP

Related Classes of com.aelitis.net.upnp.UPnPException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.