Data transfer API for Rolling Spider


#1

Hi, I’m having trouble with ARDATATRANSFER_MediasDownloader_GetAvailableMediasSync

ARDATATRANSFER_MediasDownloader_New returned ARDATATRANSFER_OK but the next step ARDATATRANSFER_MediasDownloader_GetAvailableMediasSync(_manager,0,&result); returned mediaListCount=0 and that is not true because there are photos in the internal memory, I tried different combinations of remoteDirectory “internal_000”, “/internal_000/Rolling_Spider/media”, and also looking at the sources in TestBLEFtp project I found different port numbers 21 and 51, why ?
any help is appreciated, best regards


#2

hi, any news about this problem?


#3

Hi astrodomi. Have you resolved it? I have the same problem. :pensive:
I post you my code.

try
    {
    	
    	ARDataTransferManager manager=null;
    	try{
    	
    		
    		manager = new ARDataTransferManager();
    	}
    	catch(Exception e){
    		Log.d("DBG", APP_TAG + e.toString());
    		
    	}
    	
    	if(mgatt==null)
    	mgatt= connectToBleDevice(service);
    	
    	Log.d("GATT", mgatt.toString());
    	
    	ARUtilsManager utilsListManager=null;
    	ARUtilsManager utilsQueueManager=null;
    	
    	try{
    	utilsListManager = new ARUtilsManager();
    	utilsQueueManager = new ARUtilsManager();
    	
    	}
    	catch(Exception e){
    		Log.d("DBG", APP_TAG + e.toString());
    		
    		
    	}
    	
    	
    	
    	try{
    	utilsListManager.initBLEFtp(getApplicationContext(), mgatt , 21);  
    	utilsQueueManager.initBLEFtp(getApplicationContext(), mgatt , 21); 
    	
    	}
    	catch(Exception e){
    		Log.d("DBG", APP_TAG + e.toString());
    		
    	}
    	
    	ARDataTransferMediasDownloader mediasManager=null;
    	try{
    	
    		
    	mediasManager = manager.getARDataTransferMediasDownloader();        	
    	
    	}
    	catch(Exception e)
    	{
    		Log.d("DBG", APP_TAG + e.toString());
    		
    	}
    	String tmp = Environment.getExternalStorageDirectory().toString().concat("/ARSDKMedias/");
    	
    	
    	try{
    	mediasManager.createMediasDownloader(utilsListManager, utilsQueueManager, MEDIA_FOLDER, tmp);
    	
    	}
    	catch(Exception e){
    		Log.d("DBG", APP_TAG + e.toString());
    		
    		
    	}
    	
    	
    	
    	
    	int count=1;
    	try{
    	count = mediasManager.getAvailableMediasSync(false);
    	}
    	catch(Exception e){
    	
    	Log.d("DBG", APP_TAG + e.toString());
    	}
    	
    	for (int i=0; i<count; i++)
    	{
    		ARDataTransferMedia media=null;
    		try{
    		media = mediasManager.getAvailableMediaAtIndex(i);
    		
    		
    		}
        	catch(Exception e){
        		
        		Log.d("DBG", APP_TAG + e.toString());
        	}
    		if(media!=null){
    		
    		    try{
        		
    		      mediasManager.addMediaToQueue(media, TransferActivityDue.this, null, TransferActivityDue.this, null);
    		       }
    		      catch(Exception e){
    			  
        		   Log.d("DBG", APP_TAG + e.toString());
    		           }
    		}
    	}
    		
    	
    	
    	Runnable mediasDownloader = mediasManager.getDownloaderQueueRunnable();
    	Thread mediasThread = new Thread(mediasDownloader);
    	mediasThread.start();
    	
    	
    	
    	
    	
    	
    	
    	mediasManager.cancelQueueThread();
    	
    	try { 
    		mediasThread.join(); 
    		
    	} 
    	catch (InterruptedException e) { 
    		Log.d("DBG", "join " + e.toString());  
    		}
    	
    	mediasManager.dispose();
    	manager.dispose();
    	utilsListManager.closeBLEFtp(getApplicationContext());
    	utilsQueueManager.closeBLEFtp(getApplicationContext());
    	utilsListManager.dispose();
    	utilsQueueManager.dispose();
    	
    	
    }
    catch (Exception e)
    {
    	Log.d("DBG", APP_TAG + e.toString());
    }
    catch (Throwable e)
    {
    	Log.d("DBG", APP_TAG + e.toString());
    }
}

#4

In this code you use a variable mgatt that you never declare. What is this variable?


#5

I have declared it when I have initialized BLE connection. Do you think that it’s possible download image when drone hover?


#6

Hi,

For information, there is an example about the data transfer API in the samples.

Downloading while flying is not forbidden by the drone itself, but we are discouraging you doing so.
Anyway, you can do it, but keep in mind that it might interfere with piloting commands so you may create a laggy piloting experience for your user.

Best regards,
Djavan