Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Developer
Posts: 138
Registered: ‎01-09-2011
My Device: Blackberry Tablet OS
Accepted Solution

Connect to simulator 0.9.2?

Hello I am running v0.9.2 of the blackberry tablet simulator. How do I connect to it to view its file contents? FTP/SSH/SCP? I have tried connecting to FTP and SCP using root as the username and my developer password as the password.

 

I get a connection timed out, a connection refused or a 'Waiting for Welcome Message' which leads to a connection timed out.

 

The main reason I want to connect to the tablet is to view the contents of the user directory to see if my application is successfully saving images to it.

 

How do I connect to it?

 

Thanks,

Noah NU

From,
Noah NU
Developer
Posts: 117
Registered: ‎12-03-2010
My Device: Not Specified

Re: Connect to simulator 0.9.2?

Pete's blog had some articles about that.

It seems after version 0.9.2's security raison, there is no easy way to ftp / ssh ... ( maybe wait till new version with python on it ).

 

Anyway, have a look at these:

http://peterhansen.ca/blog/playbook-simulator-ftp-transfer-fails.html

 

http://peterhansen.ca/blog/playbook-simulator-file-access.html

 

---------------------
a) If you like my response/post, please provide a Kudo (white star to the left).
b) If my post solved your problem please click on the Accept as Solution button.

Developer
Posts: 138
Registered: ‎01-09-2011
My Device: Blackberry Tablet OS

Re: Connect to simulator 0.9.2?

[ Edited ]

I am still having connection issues, I guess I'll just wait until the next simulator release.

 

The main reason I want to view the files is because I want to know if the following code works.

 

this = Image Class

 

 

public function SaveImage():void{
			var snap:BitmapData = new BitmapData(this.width,this.height);
			var mat:Matrix = new Matrix();
			snap.draw(this, mat);
			
			// Save to /root/snapshot.png on simulator.  Retrieve using ftp
			var directory:File = File.userDirectory;
			var directoryListing:Array = directory.getDirectoryListing();
			var count:int=0;
			var i:int;
			for(i=0; i < directoryListing.length; i++){
				var imageFile:File = directoryListing[i];
				if(imageFile.name.match("^Doodle_")==null){continue;}
				count++;
			}
			count++;
			var name:File = File.userDirectory.resolvePath('Doodle_'+count.toString()+'.png');
			while(name.exists){
				count++;
				name = File.userDirectory.resolvePath('Doodle_'+count.toString()+'.png');
			}
			var data:ByteArray = PNGEncoder.encode(snap);
			var file:FileStream = new FileStream();
			file.open(name, FileMode.WRITE);
			file.writeBytes(data);
			file.close();
		}

 

I guess we are are working hypothetically here. I am going to add a load feature so I guess that will be the final test. In the mean time though will this work? It is supposed to save an image.

 

From,
Noah NU
Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Connect to simulator 0.9.2?

Can you test it as an AIR application?

Developer
Posts: 138
Registered: ‎01-09-2011
My Device: Blackberry Tablet OS

Re: Connect to simulator 0.9.2?

It works perfectly as a Desktop (AIR) application. It saves the image to the user directory on my windows computer. i.e. C:\Users\Noah

 

What I want to know is how the user directory is going to work on the actual blackberry tablet. Will the user be able to view the contents of this user directory? Is there even a user directory and will my program have read/write access to it?

From,
Noah NU
Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Connect to simulator 0.9.2?

BB annouced the likely folder layout on the PB here.  You probably want to place the image in one of the shared folders.

 

http://supportforums.blackberry.com/t5/Tablet-OS-SDK-for-Adobe-AIR/Application-sandbox-file-system-l...

 

Developer
Posts: 138
Registered: ‎01-09-2011
My Device: Blackberry Tablet OS

Re: Connect to simulator 0.9.2?

Thanks

From,
Noah NU
Highlighted
Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Connect to simulator 0.9.2?

 

And make sure you read down to where I show the mapping from File.xxxxDirectory aliases to the filesystem.  Also note that Elena left out one folder in her list.  I'll let you read the full thread to find what it was...


Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!