Tag Archives: Playbook

BB Playbook as Gutenberg Book Reader

I wanted to make a lightweight e-book reader with minimal expense. An old Blackberry Playbook sitting around, plus free Project Gutenberg e-books, turned out to be a zero cost method. I’m going to describe the details here, because they may be useful to someone else also.

The Playbook has a nice app “100 Free Ebooks” which has the top 100-some Gutenberg ebooks downloaded onto the Playbook’s ramdisk, ie there is no need for net access when reading. That is ideal for travel, because there are no expiry dates on the books, and the internet is not used while on the road. However, how to add more of the Gutenberg books? There are almost 50,000 of them, so the top-100 most frequently downloaded is only 0.2 percent of the whole library. I wanted some of the books which are personally interesting, though not in the top 100.

The solution is this:

1) Install Blackberry Desktop (BBD) software on a Windows machine (Win-7 in my situation), and connect the Playbook (PB) via USB cable to the Win7 system. Use BBD or direct disk access via Win7 to create /books/gut directory to receive the additional Gutenburg book files.

2) Download html (or sometimes, pdf) files for the Gutenberg books from their website http://www.gutenberg.org. The files can be saved directly into the Device/books/gut directory on the PB.

3) On the PB, use browser to go to file://accounts/1000/shared/books/gut/ which is the pathname where the books were stored, in terms of the browser’s view of the file system. Put a bookmark on the home screen, and call it something like “Gut Books”.

Here’s a picture of the resulting screen. One just picks the desired book from the list, and reads it as an html or pdf file, using either the browser or Adobe reader respectively.

bb-files-1-png2

It would also be possible, presumably, to prepare an index.html file which would give a nice-looking front end to one’s personal ebook collection. That’s basically what the top-100 application does.

Best wishes,

Ken Roberts

11-Aug-2015

Blackberry Playbook Programming

The Blackberry Playbook tablet can be programmed, if you know the C language.  I was quite surprised to discover how open it is.  In case others are interested, here is the technique used:

– Download the Playbook software development kit (SDK) to your Windows PC.  Obtain a code-signing key.  That key can be used to publish apps to the app store.  However, it is not necessary to publish an app in order to be able to use it on your own playbook.

– In the SDK, write your app.  There are a number of sample apps available as code examples.  For instance, I wanted to write a rotating torus application, to learn some graphics programming.  Using the SDK, create a new project: File – New – Blackberry Tablet OS project, with the OpenGL ES 2.0 template.  When built and run, that program creates a 2-D coloured square which rotates.

– Modify the template code.  Strip out the square logic, and substitute code which defines the surface of a torus.  The torus is formed from an N1-sided polygon, approximating a circle of radius R1, which is rotated in space, N2 copies, around a larger circle of radius R2.  That forms the vertexes of the torus.  Those vertexes are used to define triangular patches of surface, which in GLES2 are referred to as elements.

– Also include code which rotates the torus around the x, y, or z axes, modifying the rotating square code.  Compile, debug, and run on the playbook until the code is working to satisfaction.

– BUT, a problem is encountered.  The torus surface is not being drawn correctly.  It turns out that the depth feature of GLES2 has not been enabled, in the screen initialization routine which is part of the bbutil.c library provided by Blackberry.  It is necessary to modify bbutil.c to include a spec “EGL_DEPTH_SIZE, 24″ in the “attrib_list” specs within the bbutil_init_egl routine.  Very fortunately, bbutil.c is provided as source code, and a distinct copy is set up with each newly created project, so it is easy to modify for this special situation.  Now the depth testing works satisfactorily.

The result: an enjoyable coding project, and a nice rotating torus on the screen.

As a further refinement, code was added to detect the position of user touches on the screen and cause the torus to change its rotation, based upon the location of the screen touch.  The test for the touch location is not as well documented as I needed, so here is the detail;  Inside the “handleScreenEvent” routine, after a SCREEN_EVENT_MTOUCH… event has been identified, include a call to get SCREEN_PROPERTY_SOURCE_POSITION into a pair of short integers.  Those will be the x and y coordinates of the screen touch, in pixels from the top left of screen.

Enjoy!

Ken Roberts

27-Nov-2013

Image