Tuesday, May 7, 2013

Reed-Solomon Forward Error Correction for Android/Java


A few days ago I was scouring the internet looking for a java library that did forward error correction for a project at work, but I couldn't find anything for java that didn't rely on JNI classes.

Finally I came across some classes that are part of the ZXing project that did some Reed-Solomon encoding and decoding, so I wrote a wrapper class around them to do all the dirty work.

I figured I'd contribute it back to the masses, so here it is:

https://code.google.com/p/reed-solomon-android/

Here's an example of how to use it:

https://code.google.com/p/reed-solomon-android/wiki/ExampleUsage

It's only limitation is that it can only encode data in chunks of 256 bytes.

The two second version of Reed-Solomon forward error correction is you give it your data and it generates error correction codes which get appended to the end of your data. You send your data through a lossy connection (RF link in my case) and the decoder can use those error correction codes to fix bit errors in your data on the receiving end (up to a point). The more error correction bytes you use, the more errors in your data (and in the codes themselves) can be tolerated and still successfully recover your data.

Reed-Solomon coding of some form is used in a lot of commercial technologies like CD's, DVD's, deep space communications (Voyager!), etc. Check it out on Wikipedia, it's good stuff.

The library I created allows you to specify how many error correction bytes you'd like to use (the more the better), so long as the size of your data + the number of error correction bytes is less than or equal to 256 bytes.

Saturday, May 4, 2013

Incredibly useful Android libraries


Here are some of the most useful, awesome Android libraries I've stumbled across in my travels through the interwebs.

ActionBarSherlock

"ActionBarSherlock is an extension of the support library designed to facilitate the use of the action bar design pattern across all versions of Android with a single API."

I've re-architected most of my apps to use ActionBarSherlock for all menu functionality. I really love what Google has done with the action bar and the Holo theme in the way of giving Android its own unique feel and excellent use of screen real estate. ActionBarSherlock makes bringing that functionality to your apps that much simpler.


"StandOut is an open source library that anyone can use to create their own floating apps."

Love the concept, harder in practice to find an appropriate use for this feature. Use sparingly.


A really well done back port of the Jelly Bean number picker. I scoured the web looking for a time chooser that 


"SlidingMenu is an Open Source Android library that allows developers to easily create applications with sliding menus like those made popular in the Google+, YouTube, and Facebook apps."


"The ShowcaseView library is designed to highlight and showcase specific parts of apps to the user with a distinctive and attractive overlay. This library is great for pointing out points of interest for users, gestures, or obscure but useful items."


"Context sensitive notifications for Android." 

I've completely replaced almost all uses of Toast notifications in my apps with Croutons. They're basically a little notification bar that pops down from the top of the screen for a few seconds with your message. Comes with 3 built in styles, Info (blue), Confirm (green) and Alert (red).


"PhotoView aims to help produce an easily usable implementation of a zooming Android ImageView."

An excellent library for displaying a single image. Supports out of the box zooming via multi-touch and tap.