Android Digital Readout Source Code

Monday, December 31, 2012
Main screen of the Touch DRO Androd app
Since posting the screenshots of my Android DRO application I've received a lot of feedback and a number of requests for the source code. As I said before, I intend to post the source code for the whole project, but the last few months have been insanely busy, and I didn't want to post broken code. Over the last few weekends I was able to clean the project up and get rid of the "failed experiments" code.

I've created a new [public] repository on BitBucket for the project here: https://bitbucket.org/ycroosh/android-dro.

Fair warning: this is a very early alpha version with only basic functionality tested on a few devices. Newer the less, it is a start, and you are free to use it in whatever way suits you.

If you'd rather just install the app without all the fuss with setting up Eclipse, etc., the app is available via Google Play Store here: https://play.google.com/store/apps/details?id=com.yuriystoys.dro. Alternatively, to side load the application, the .apk file is here: yadro_current.apk.

What's Done [So Far]


  • Bluetooth communication service used for raw communication. It's based on the "Bluetooth Chat Service" sample code, but I stripped the unused [chat server] code and changed the way the received messages are processed. Instead of bubbling-up raw text to the handler my version sends it to the parser.
  • DRO position parser is a basic implementation of the state machine described in the previous post. It takes one character at a time, and either accepts it or resets to the starting state. I.e. when a parse error occurs the whole position message is discarded. When a "terminator" is encountered the parser call the callback methods on the listeners.
  • Main application class is mostly there to keep track of the communication service and start/stop it when nobody is "listening" (when all callbacks are removed, the service stops). At this point there is only one activity listening to the readout but as features are added there will be more.
  • Main activity is the actual DRO user interface. At this point it lets you connect/disconnect to/from the paired position encoder (Arduino) and switch between metric/inch and absolute/relative mode. Unfortunately the preferences screen is still "under construction", so there is no way to change the resolution etc. I intend to add it in the nearest future, though.

What's Coming Soon


  • Preferences - the settings activity that will let the user set the calibration data and the defaults for modes. etc.
  • Points list - a way to "remember" the points. In the most basic version this will be a simple "Add" button, but more likely I will implement some way to automatically add points based on some criteria.
  • Functions - a way to select two or more points and calculate things like "hole center", etc. I don't have anything concrete in mind, so please let me know if there are things you feel would be useful.

As usual, I'd really appreciate your feedback and suggestions. The comments and emails help me better understand what the community needs, so please keep them coming.

Special shout out to the people who commented/critiqued my design. It's been extremely helpful to have a second set of eyes going over the code, so here: thank you, guys.

5 comments :

  1. Thanks for posting the source Yuri as I had been watching out for it. I am keen to use this as a starter project to learn how to put an app together for Android devices and gain a new skill. Without meaning to impose on your time, it would be great to have some tool chain notes and build instructions or a pointer to other sites if this already well described elsewhere. Regards, Andrew.

    ReplyDelete
    Replies
    1. Andrew,
      Glad I could help :)
      I'm using Eclipse on Mac OS X, but the setup is pretty much the same on Windows/Linux as well.
      Please take a look here: http://developer.android.com/sdk/installing/bundle.html. This should be the easiest way to get going. You might need to download additional SDK versions as described here: http://developer.android.com/tools/help/sdk-manager.html.
      Once all that is taken care of, you can import the project into the workspace by going to "File" >> "Import" >> "General" >> "Existing Project Into Workspace" (or something like that. I'm typing from memory...).

      Hope this helps.

      Thank you
      Yuriy

      Delete
    2. OK, have installed the SDK, built the project and ran the APK on an emulated device (so s-l-o-w). My toe is in the water, now it's time to jump right in. It does look deep at first. Thanks again Yuri.

      Delete
  2. Dear Yuriy,

    one of the best and most inspiring projects for me at the moment. Big "thumb up" for you!
    Following https://bitbucket.org/ycroosh/android-dro gives me an "access denied"
    Is your source code still available?

    Best regards
    Josef

    ReplyDelete
  3. Ditto on the "access denied". Getting same error. Is source still available and/or moved?

    ReplyDelete