<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Jason's Computer Science Blog &#187; Blackberry</title>
	<atom:link href="http://www.jasonernst.com/tag/blackberry/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jasonernst.com</link>
	<description>By Jason Ernst</description>
	<lastBuildDate>Wed, 25 Jan 2012 14:04:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>OpenGL Console Library for Blackberry Native SDK (Playbook)</title>
		<link>http://www.jasonernst.com/2012/01/24/opengl-console-library-for-blackberry-native-sdk-playbook/</link>
		<comments>http://www.jasonernst.com/2012/01/24/opengl-console-library-for-blackberry-native-sdk-playbook/#comments</comments>
		<pubDate>Tue, 24 Jan 2012 20:41:29 +0000</pubDate>
		<dc:creator>Jason Ernst</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Blackberry]]></category>
		<category><![CDATA[Console]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Guide]]></category>
		<category><![CDATA[Native]]></category>
		<category><![CDATA[OpenGL]]></category>
		<category><![CDATA[Playbook]]></category>
		<category><![CDATA[SDK]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.jasonernst.com/?p=1897</guid>
		<description><![CDATA[Over the break, I decided to try my hand at some Blackberry native SDK programming since I recently got a playbook. I looked around the App World and noticed there weren&#8217;t any telnet/ssh tools available for free (that worked the way I wanted) so I thought this would be a good starter project. However, for [...]]]></description>
			<content:encoded><![CDATA[<p>Over the break, I decided to try my hand at some Blackberry native SDK programming since I recently got a playbook. I looked around the App World and noticed there weren&#8217;t any telnet/ssh tools available for free (that worked the way I wanted) so I thought this would be a good starter project.</p>
<p>However, for the look I wanted, I wanted to maximize the screen space for the console application to show as much text as possible and worked off the hello world example on the SDK webpage. Essentially, the simple &#8220;library&#8221; (note: library is used very loosely here) initializes the display, shows the keyboard and supports some simple output using putch and puts functions that I implemented. It can also show a blinking cursor and user input at a prompt. In case someone else can use the code I have made it available. Check back soon to see the source for the telnet portion of the app I made as well or look for it on the App World.</p>
<p><center>
<div class="image"><a href="http://www.jasonernst.com/wp-content/uploads/2012/01/simple_telnet.png"><img src="http://www.jasonernst.com/wp-content/uploads/2012/01/simple_telnet-300x185.png" alt="Simple Telnet - Example Application" title="Simple Telnet - Example Application" width="300" height="185" class="aligncenter size-medium wp-image-1902" /></a><br/>Simple Telnet &#8211; Example Application using the conosole library</div>
<p></center></p>
<p>In order to use the library, you need to make use of the bbutil.c and bbutil.h files that are included in many of the examples provided by RIM. I have provided them here alongside my own code so that it is easier to follow along. I also provide two more files: glconsole.c and glconsole.h. You just need to #include &#8220;glconsole.h&#8221; in your source in order to use the library. All of the functions available to you are listed in the &#8220;glconsole.h&#8221; file as well. I will go over the important ones in this article.</p>
<p>First is gl_init(). This function initializes the library, the screen, font etc. This function should be called before using anything else in the library. Similarly, gl_cleanup() is used to free memory and should be called before your app is terminated.</p>
<p>After initialization, you may now use the puts and putch functions to display characters to the screen. gl_putch(char c) takes a single character and displays it onto the screen. It can handle newlines which are represented as &#8216;\n&#8217; and tabs which are represented as &#8216;\t&#8217;. Backspaces by user input is handled as a &#8216;\b&#8217; character. This is similar to how people on <a href="http://forum.osdev.org/">The osdev.rg website</a> often handle character output in their custom operating systems. I&#8217;m not sure how it relates with normal c standards, but I imagine it is similar. Eventually I hope to implement a printf() type of function, but at the moment the putch() and puts() functions serve what I am doing well enough. Note: puts() is the same as putch() but instead takes a (char *) ie) a string. The string should also be null-terminated, or it will just continue until it hits a null character. The characters are automatically scrolled when the bottom of the screen is reached. </p>
<p>The only other really important function is gl_render(). This function is what should be called everytime the screen needs to be refreshed. This is usually in a for loop within your main() function in your app.</p>
<p>It is also possible to resize the screen using the gl_resize() function. By default the screen starts at 80X29 which is the maximum size with no virtualkeyboard showing, at the font size I selected. When the keyboard shows up, it fits 80&#215;14. In some sample code I&#8217;ll also show how keyboard input can be handled, how to blink the cursor and how to detect when the keyboard is shown or hidden.</p>
<p>For the rest of this guide, I&#8217;ll assume you are using the QNX Momentix IDE available from RIM&#8217;s developer website. To start, create a new project by going to File->New Blackberry Tablet OS C/C++ Project. Name it whatever you like, click next. Then choose the C language, and empty Application Project. You can now drag the gl_console.c, glconsole.h, bbutil.c and bbutil.h files into the src folder within the IDE to include them. You will probably want to copy the files and not link them when it asks. Before compiling, there are several libaries which must be linked to the project. You can do this by right clicking your project, going to properties. Then go to C/C++ General->Paths and Symbols->Libraries. Here you can add libraries. Each time you add one, be sure to check &#8220;add to all Configurations&#8221; so that you don&#8217;t need to do this again if you change from a device-debug to device-release build. The following libraries should be included:</p>
<ul style="margin-left:30px; margin-bottom: 10px;">
<li>bps</li>
<li>EGL</li>
<li>GLESv1_CM</li>
<li>freetype</li>
<li>png</li>
</ul>
<p>Now that all this is setup, it is possible to start you main() function and use the library. If you like you can right click on your src folder and click &#8220;new file&#8221; and create a main.c file or whatever you like to name it. While this isn&#8217;t the typical way you would include a library into a project, this way lets you edit the library source to your liking in case you want to further extend it. </p>
<p>The following example shows a skeleton of what is required to get the code to display some text:</p>
<div class="snippet"><pre><code>#include &lt;stdlib.h&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* EXIT_FAILURE */
#include &lt;stddef.h&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* NULL */
#include &lt;bps/bps.h&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* BPS_SUCCESS */
#include &lt;bps/screen.h&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* screen_event_get_event() */
#include &lt;bps/navigator.h&gt;&nbsp;&nbsp;/* NAVIGATOR_EXIT */
#include &quot;glconsole.h&quot;

void handleScreenEvent(bps_event_t *event);

int main(int argc, char * argv[])
{
&nbsp;&nbsp;int exit_application = 0;

&nbsp;&nbsp;if(EXIT_SUCCESS != gl_init())
&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;fprintf(stderr, &quot;error init\n&quot;);
&nbsp;&nbsp;&nbsp;&nbsp;return 0;
&nbsp;&nbsp;}

&nbsp;&nbsp;gl_puts(&quot;Hello gl console world!\n&quot;);

&nbsp;&nbsp;for(;;)
&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;bps_event_t *event = NULL;
&nbsp;&nbsp;&nbsp;&nbsp;if (bps_get_event(&amp;event, 0) != BPS_SUCCESS)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return EXIT_FAILURE;

&nbsp;&nbsp;&nbsp;&nbsp;if (event)
&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int domain = bps_event_get_domain(event);

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (domain == screen_get_domain())
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;handleScreenEvent(event);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else if ((domain == navigator_get_domain()) &amp;&amp; (NAVIGATOR_EXIT == bps_event_get_code(event)))
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exit_application = 1;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (exit_application)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;gl_render();
&nbsp;&nbsp;}

&nbsp;&nbsp;gl_cleanup();
&nbsp;&nbsp;return 0;
}

void handleScreenEvent(bps_event_t *event)
{
&nbsp;&nbsp;/* do normal event handling here, see other bb examples */
}</code></pre></div>
<p>The key parts are calling gl_init() which initializes the library. Then within the main loop, the gl_render() function should be called which will actually render the text. Finally gl_cleanup() should be called before termination to properly free memory.</p>
<p>In the near future I plan to add some support to handle ansi encoded text (specifically for my telnet application) so that it can display colours and move the cursor around the screen using this standard.</p>
<p>Here are the files:<br />
<a href='http://www.jasonernst.com/wp-content/uploads/2012/01/glconsole.h'>glconsole.h</a><br />
<a href='http://www.jasonernst.com/wp-content/uploads/2012/01/glconsole.c'>glconsole.c</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jasonernst.com/2012/01/24/opengl-console-library-for-blackberry-native-sdk-playbook/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu 10.04, BB Storm 9530 Tethering</title>
		<link>http://www.jasonernst.com/2010/12/24/ubuntu-10-04-bb-storm-9530-tethering/</link>
		<comments>http://www.jasonernst.com/2010/12/24/ubuntu-10-04-bb-storm-9530-tethering/#comments</comments>
		<pubDate>Fri, 24 Dec 2010 20:43:29 +0000</pubDate>
		<dc:creator>Jason Ernst</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Wireless Networks]]></category>
		<category><![CDATA[2010]]></category>
		<category><![CDATA[9530]]></category>
		<category><![CDATA[Blackberry]]></category>
		<category><![CDATA[Storm]]></category>
		<category><![CDATA[Tether]]></category>
		<category><![CDATA[Ubuntu 10.04]]></category>

		<guid isPermaLink="false">http://www.jasonernst.com/?p=1196</guid>
		<description><![CDATA[Some quick instructions on how to tether the Blackberry Storm 9530 in Ubuntu 10.04. (Tethering is for connecting to the Internet using your blackberry for the connection) sudo apt-get install python libusb-dev ppp python-usb python-wxgtk2.8 wget https://bitbucket.org/tcolar/berry4all/downloads/bbtether-0.3m.tgz tar xvf bbthether-0.3m.tgz sudo ./berry4all.sh Then in GUI select Modem->Connect Then select &#8220;Bell Mobility&#8221; when prompted.]]></description>
			<content:encoded><![CDATA[<p>Some quick instructions on how to tether the Blackberry Storm 9530 in Ubuntu 10.04. (Tethering is for connecting to the Internet using your blackberry for the connection)</p>
<div class="snippet">
<div class="snippet-shell">
<code>sudo apt-get install python libusb-dev ppp python-usb python-wxgtk2.8</code></div>
</div>
<div class="snippet">
<div class="snippet-shell">
<code>wget https://bitbucket.org/tcolar/berry4all/downloads/bbtether-0.3m.tgz</code></div>
</div>
<div class="snippet">
<div class="snippet-shell">
<code>tar xvf bbthether-0.3m.tgz</code></div>
</div>
<div class="snippet">
<div class="snippet-shell">
<code>sudo ./berry4all.sh</code></div>
</div>
<p><center><a href="http://www.jasonernst.com/wp-content/uploads/2010/12/Berry4All_005.png"><img src="http://www.jasonernst.com/wp-content/uploads/2010/12/Berry4All_005.png" alt="" title="Berry4All_005" width="727" height="507" class="aligncenter size-full wp-image-1197" /></a></center></p>
<p>Then in GUI select Modem->Connect<br />
Then select &#8220;Bell Mobility&#8221; when prompted.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jasonernst.com/2010/12/24/ubuntu-10-04-bb-storm-9530-tethering/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Back after a long hiatus!</title>
		<link>http://www.jasonernst.com/2009/08/21/back-after-a-long-hiatus/</link>
		<comments>http://www.jasonernst.com/2009/08/21/back-after-a-long-hiatus/#comments</comments>
		<pubDate>Fri, 21 Aug 2009 20:31:03 +0000</pubDate>
		<dc:creator>Jason Ernst</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[Blackberry]]></category>
		<category><![CDATA[Cross Canada]]></category>
		<category><![CDATA[GPS Tracking]]></category>

		<guid isPermaLink="false">http://www.jasonernst.com/?p=699</guid>
		<description><![CDATA[Well after a long break from writing in my blog I am finally back! (Thanks Eddie for the encouragement to post again! haha) If you have been paying attention to my projects page you will have seen a blackberry GPS tracking tool (http://www.jasonernst.com/projects/blackberry-gps-tracker/) that I created. This summer I got a chance to test it [...]]]></description>
			<content:encoded><![CDATA[<p>Well after a long break from writing in my blog I am finally back! (Thanks <a href="http://tin.blogdns.com/">Eddie</a> for the encouragement to post again! haha) If you have been paying attention to my projects page you will have seen a blackberry GPS tracking tool (<a href="http://www.jasonernst.com/projects/blackberry-gps-tracker/">http://www.jasonernst.com/projects/blackberry-gps-tracker/</a>) that I created. This summer I got a chance to test it out across the country as I went on a 42-day cross Canada road trip.</p>
<p><span id="more-699"></span></p>
<div class="image"><a href="http://www.jasonernst.com/wp-content/uploads/2009/08/gps2.jpg"><img src="http://www.jasonernst.com/wp-content/uploads/2009/08/gps2-300x176.jpg" alt="" title="gps2" width="300" height="176" class="alignnone size-medium wp-image-885" /></a></div>
<div class="image"><a href="http://www.jasonernst.com/wp-content/uploads/2009/08/gps1.jpg"><img src="http://www.jasonernst.com/wp-content/uploads/2009/08/gps1-300x166.jpg" alt="" title="gps1" width="300" height="166" class="alignnone size-medium wp-image-884" /></a></div>
<p>I used the tracking tool to record my locations along my trip. I was surprised to find that Telus did not charge me roaming charges for using data all over the place which was great! Anyway after my long rest, I am back and will be hopefully posting some more technical computer related topics again soon. I arrived home to find myself working on a website contract for my consulting company (<a href="http://www.ernstconsulting.ca">http://www.ernstconsulting.ca</a>), a book chapter with some colleagues and some other small websites for some friends. So as soon as I finish all of that expect more on my blog (oh and classes start in Sept. for my PhD! so I will likely post content related to those)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jasonernst.com/2009/08/21/back-after-a-long-hiatus/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

