Author Topic: DistoX + Android  (Read 3142 times)

Offline foobarbecue

  • Newbie
  • *
  • Posts: 2
DistoX + Android
« on: May 24, 2011, 05:28:43 pm »
I'm very interested in getting my DistoX to work with my Android device. This possibility has been mentioned in two other threads on this forum but I'd like to have a thread where people can discuss how to do this and post their successes.

My device is a Motorola Defy phone -- totally waterproof and surprisingly tough; I have taken it caving and would recommend it for cave use.

I guess the best starting point is to get TopoLinux working on Android. The new [url]Necessitas Suite[/url] provides QT for Android, so it should be possible to get TopoLinux running.

I've also been thinking about porting Tunnel (survey program by Julian Todd) to Android and implementing DistoX data grabbing in that program. Since Tunnel is already written in Java, this seems fairly feasible.

Anyone want to collaborate on this stuff?

Aaron Curtis

Offline mmilner

  • Experienced digging / conservation juggling
  • forum hero
  • *****
  • Posts: 1169
  • Outside Handshake Cave, Manifold Valley.
    • Darfar P.C. web site
Re: DistoX + Android
« Reply #1 on: May 24, 2011, 10:09:48 pm »
Hi Aaron.

I too have a Motorola Defy phone. I love it. I am also thinking of starting to develop apps for it as it's standard Java (J2SE) which I have experience of.

Currently for surveys I use Compass for Windows, (in an emulator, VMWare, on Linux), but I've also got Palm OS software to produce surveys, just haven't got round to doing anything with any of it yet.

I also have a Disto A3, though sadly couldn't afford an X upgrade.

So, in summary, I would be interested in helping with this if I can.

Regards, Mel.
Norbert Casteret (Ten Years Under the Earth) and Pierre Chevalier (Subterranean Climbers) were my inspiration to start caving. (And I'm still doing it.) Secretary, Darfar Potholing Club, the Peak District.

Offline foobarbecue

  • Newbie
  • *
  • Posts: 2
Re: DistoX + Android
« Reply #2 on: May 28, 2011, 07:07:45 pm »
Mel, glad to hear you're interested. In the last couple of days I got a start on this project by writing a script to download legs from the DistoX. The script is written in python and runs on Android using the Scripting Layer for Android (SL4A). It seems to work pretty well.

I've also gone through a bunch of the Android tutorials (java, don't know if this is what you'd call J2SE or J2ME) and am thinking about porting this script into a java application. After learning some Android UI stuff I think it may be better not to bother trying to port any of the topolinux interface, or trying to cross-compile it using the android NDK, but I think it could be re-written in the form of an android app. Either I'd like to get commit access to the topolinux googlecode repository and do it there or else start a new googlecode repository.

Code: [Select]
Created on May 26, 2011

@author: Aaron Curtis

import android
from base64 import b64decode, b64encode


def connectToDstx(distoMacAddr=distoMacAddr):
    Connect to the DistoX at distoMacAddr and return an android object.
    return dr

def getAleg(dr):
    Download one leg from the DistoX connected to android instance dr
    and return it as a string of hex characters. Also sends acknowledge
    byte to DistoX.
    print dstxPacket
    #Send acknowledgement.
    if firstByte==0b00000001:
    elif firstByte==0b10000001:
    return dstxPacket

def getAllLegs(dr):
    Take download all survey legs from the DistoX connected to android
    instance dr, and return them as a list.
    while legs[-1]!='':
        #get a leg
        print legs[-1]
    #Trim off the None that we used to avoid an IndexError
    return legs

def processLeg(leg):
    Given a DistoX leg as a string of hex characters, returns
    a dictionary of the data.
    outp={'distance':distance, 'compass':compass, 'clino':clino}
    return outp

Offline wookey

  • player
  • **
  • Posts: 105
Re: DistoX + Android
« Reply #3 on: June 12, 2011, 12:27:06 pm »
Hi, I've built and used topolinux. At some point I'll get round to packaging it for Debian & Ubuntu. I have so far failed to get it going on my linux phone (openmoko running SHR), but I haven't actually tried very hard. I will have a go in time for expo this year. I was waiting for Marco Corvi to put the distoX calibration routing into the code (which he had agreed not to do until Beat's article waqs published, but that was done early in 2010 so there should be no problem now. I'll poke him again.

I don't have any android devices (poor-man's linux :-), but I suppose I might end up getting one as they are plentiful.

Topolinux interface is a bit too desktop-oriented, as that's how the author has been using it. Pockettopo has a better in-cave interface, but it also has annoying bugs, especially for a UK caver, and it's nonfree so we can't fix it, or build it for linux/android etc. As you say a re-implementation of the good bits of pockettopo and topolinux is the best answer. If we do it right it'll be fairly easy to build it for android or linux.

In principle I'd love to help but a) I have way too many thing to do already and b) I don't know how to write GUI software or java. All sorts of monkeys seem to write Android apps, so I guess it's not actually that hard, but I'm not sure when anything might happen. I am a cross-building guru though so I can probably help out with some stuff.

Offline marco_corvi

  • Newbie
  • *
  • Posts: 3
Re: DistoX + Android
« Reply #4 on: August 30, 2011, 01:25:20 pm »

Making TopoDroid an Android app for the DistoX.
Any help (develop, docs, test, ... ) is appreciated.

source and compiled (debug) apk are on