Vallgrind and Android working together

Introduction

Valgrind has severall tools that can be used to identify and profile native applications, such as memcheck, callgrind, etc… This document will cover the settings for memcheck only.

This document is intended to be used with native Android applications.

Installation

Get sources from web from http://valgrind.org

Get Android ndk

configure environment as bellow

inside /etc/profile


 

JDK_HOME=/opt/java/jdk1.7.0_45/

RESOURCES_FOLDER=~/RESOURCES/

ANDROID_HOME=$RESOURCES_FOLDER/android-sdk/

GRADLE_HOME=$RESOURCES_FOLDER//gradle-2.0/

NDKROOT=$RESOURCES_FOLDER//android-ndk-r10

NDK_HOME=$NDKROOT

HWKIND=generic

TOOLCHAIN=$NDK_HOME/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi

AR=$TOOLCHAIN-ar

LD=$TOOLCHAIN-ld

CC=$TOOLCHAIN-gcc

PATH=$PATH:$ANDROID_HOME/platform-tools

PATH=$PATH:$ANDROID_HOME/tools

PATH=$PATH:$GRADLE_HOME/bin:$JDK_HOME/bin:$NDK_HOME


 

Make and make install ;

 

On rooted device

create folder tree

/data/local/Inst

/data/local/Inst/tmp

 

copy valgrind binaries to device

adb push valgrind/Inst/data/local/Inst /data/local/Inst

chmod -R 777 data/local/Inst

 

Note: make sure the device has a good processor (to be faster) and have enough memory space, because valgrind binaries will occupy around 250 Mb of storage. Also have in mind that this only works on rooted or debug versions of android systems.

 

Deploy valgrind into android

Because one will deploy the android application on a remote target then two scripts will be required to bootstrap and run the app.

 

A bootstrap file bootstrap_valgrind.sh that must be on the host machine.


 

#!/usr/bin/env bash

PACKAGE=”COM.MY.PACKAGENAME

adb push suppresions.supp /data/local/Inst/suppresions.supp

adb push start_valgrind.sh /data/local/Inst/

adb shell chmod 777 /data/local/Inst/start_valgrind.sh

adb root

adb shell setprop wrap.$PACKAGE “logwrapper /data/local/Inst/start_valgrind.sh”

echo “wrap.$PACKAGE: $(adb shell getprop wrap.$PACKAGE)”

#The .StartActivity is the start activity of the Application

adb shell am force-stop $PACKAGE

adb shell am start -a android.intent.action.MAIN -n $PACKAGE/.StartActivity

# celar logcat

adb logcat -c

# start logcat

adb logcat

exit 0


 

The start file start_valgrind.sh that must be on the remote device, on the /data/local/Inst folder


 

#!/system/bin/sh

PACKAGE=”COM.MY.PACKAGENAME

# Callgrind tool

#VGPARAMS=’-v –error-limit=no –trace-children=yes –log-file=/sdcard/valgrind.log.%p –tool=callgrind –callgrind-out-file=/sdcard/callgrind.out.%p –vgdb=yes’

#VGPARAMS=’-v –log-file=/sdcard/valgrind.log.%p –tool=massif –massif-out-file=/sdcard/massif.out.%p ‘

#VGPARAMS=’-v –instr-atstart=no –error-limit=no –trace-children=yes –log-file=/sdcard/valgrind.log.%p –tool=callgrind –callgrind-out-file=/sdcard/callgrind.out.%p ‘

#export USER=root

#export HOSTNAME=t0lte

# Memcheck tool

VGPARAMS=’-v –log-file=/sdcard/valgrind.log.%p –leak-check=yes –leak-resolution=high –show-reachable=yes –error-limit=no –undef-value-errors=no –read-var-info=yes’

export TMPDIR=/data/local/Inst/tmp

echo “============Starting Valgrind ==============”

echo “Executing through valgrind: $VGPARAMS $*”

exec /data/local/Inst/bin/valgrind $VGPARAMS $*

#PORT=1234

#echo “running Valgrind debuger on port $PORT”

#exec /data/local/Inst/vgdb –port=$PORT


 

Notes: Package must not be bigger than 26 characters, because the setprop can have only 32 chars.

 

Compile Android project

On Android project, make sure to compile with debug flag without optimizations (thus it might work with optimizations also) and make sure the deployed APK has the debug symbols. Normally the libs folder have the .so files stripped that information, thus just copy them from the obj/local/armeabi to the folder libs/armeabi, and then deploy the APK to the device.

To verify if the .so files contains debug symbols :

arm-linux-androideabi-gcc-nm -a libs/armeabi/libsynclib.so

 

Start memory profiling

Now that we already have our project deployed into the android system, and the valgrind scripts are ready, just run the bootstrap_valgrind.sh script to start the profiling.

./bootstrap_valgrind.sh

 

Note that when using this profiling the app will become very slow (10 – 100 times slower), so just be patient

 

Retrieving results

After running the application on profile mode, make sure that one does actions that use the libs that should be analyzed and then retrieve the results that should be on the /sdcard/valgrind.log.%p, being that the last number is the PID of the process.

Just retrieve the files with

adb pull /scard/valgrind.log.%p

 

and then analyze them.

 

Analyzing memcheck output files

==PID== Invalid read of size 1

==PID== at 0x4832F54: strlen (vg_replace_strmem.c:415)

==PID== by 0x2EE6681F: Sender::BuildReplaceCommand(…) (Sender.cpp:624)

==PID== by 0x2EFC7DCB: Java_com_my_packagename_Classname_sync (jnibridge.c:130)

==PID== by 0x4F54B73: dvmPlatformInvoke (in /system/lib/libdvm.so)

==PID== Address 0x2d8bd1c1 is 0 bytes after a block of size 7,825 alloc’d

==PID== at 0x48315B8: calloc (vg_replace_malloc.c:626)

==PID== by 0x2EE667F7: Sender::BuildReplaceCommand(…) (Sender.cpp:621)

==PID== by 0x2EFC7DCB: Java_com_my_packagename_Classname_sync (jnibridge.c:130)

==PID== by 0x4F54B73: dvmPlatformInvoke (in /system/lib/libdvm.so)

 

For instance on the example above there’s a read of one byte (char) on a place that it shouldn’t with unexpected data.

 

Another examples … ask Google 🙂

 

Project: AirNavView

The last project i have a keen interest in, and which i’ve been thought of in a long time is a navigation software for aircraft, using the Android system. Its intended to be (in a long haul) something similar with JeppView Mobile, or Lido. That is you would plan your navigation, setting the origin and destination airports, the SID and STARs in use, the waypoints, and the AirNavView will automatically autozoom on the active area displaying the airplane position and its past path (as an option).

The requirements that must be met are the following:

– It must be based on GPL license, free for all.

– It must be updated freely, therefore using the eAIP as datasource.

– it must be easy to update, i.e. update only outdated charts, waypoints, and so on.

– Must run on Android System (tablet or handset), therefore some power saving methods should be used.

This ongoing project went through some changes along the way, because at first it was intended to use the new AIXM format which contains the tags for the approach segments, but this format is not readily available for free, therefore i decided for the eAIP data for free to every pilot out there.

Project overciew
using VisualParadigm comunity version

As a project like this will take long time, the first phase is to create a application for terminal chart usability, that is with an approach chart (ILS, VOR, NDB, …) overlaying the aircraft position, both on the horizontal plane as on the vertical.

A screenshot of what Phase 1 should be.
There’s an mark both on horizontal and vertical plane.

To achieve these its needed to calibrate the screen and correspond with the real coordinates present on the chart. That would be the only hack i thought to overcome this problem.

The Phase 2:

Do the same with the STAR’s and automatically transition to the best approach chart available to the airport.

Also make it must be easy to change the approach chart, to another VOR, NDB, whatever.

The phase 3:

Mapping over the SID’s, waypoints enRoute, and change over to the STARs and approach when close to airport.

The Phase 4:

Using the terminal ground charts, to know where to go and park the airplane.

The Phase 5:

Develop a desktop manager, to plan all the trip and export the data to the android tablet or handset.
This could also be implemented in the WEB, creating instead a webservice or webapp that will automatically send the trip plan to the device.

NOTE: if there’s any software developer and/or pilot that would like to contribute, just let me know.
Also if you have any usecase, or particular detail that a software like this should have, please give me your input, it will very welcome.

SQL (Structured Query Language): introduction

What’s the big deal with SQL?? I like to simplify everything, because its very difficult to think straight when you know the problem at hand has thousands of modules, several ways to go wrong. So the first thing to do is create a big picture schematic of the problem. So what’s present here is a simple schema of the SQL structure, which is a simple language used on Relational Database Systems. The RDBM systems can be Microsoft, PlSQL, MySqL or Oracle, and there are differences between the syntax implementation between vendors (one could ask why!?) but the principles are similar to all. As are the syntaxes more often used.

An overview of the lexical structure of the SQL.  created using: http://yuml.me

Example 1:

SELECT name, phone FROM Authors WHERE phone=123456789;

Token Special Character: SELECT

Keywords: FROM, WHERE

Operator: = (equal sign)

Objects: name (which is of Datatype String), phone (datatype: int)

Objects Table: Authors

Translation of the statement: Show the name of the author that has the phone number 123456789. The data displayed will show the name and phone number. Attention that this will show more than one registry (row) of for some reason two authors have the same phone number. This could be avoided, by setting the phonenumber as unique, which will enforce a unique relation between phone number and name.

So all the SELECT statements will be similar with this one. Sure it can be way more tricky when adding relations (1-many, many-many) between tables, in that case there will be other keywords to connect (JOIN) the tables, and even nested statements.

Example 2:

Assuming one has 2 tables Authors, Books which are connected by the authorname (OK its not a strong key, but its just for example), anyway,

SELECT name, phone FROM authors INNER JOIN books ON books.authorname = authors.name WHERE authors.phone = 123456789;

Translation: Show the author name, author phonenumber and book title published by the author, which as the phone number 123456789. There are also several other ways (simpler even) to do this but i wanted to point out the use of the keyword INNER JOIN.

References worth checking out :

http://www.thethirdmanifesto.com/

Jasper Reports: create report dynamically

So here’s another post about Jasper Reports.

In this one the template is created dynamically, there’s no need to create the JRXML file beforehand.

The datasource continues to be an ArrayList with a class People.

NOTE: These posts are before anything, for my recall whenever its needed. But its also here for anyone that requires it. I’ll try always to post a complete project, with all necessary classes and without censuring any part, thus making it compilable and runnable. Many other sites out there only posts the business core, but sometimes a few lines of code that’s not there makes the difference.

/***
* Demonstration 2
* This demo creates the template dynamically
* compiles the reportBin.jasper file and fill it with the
* arraylist of Person.
*
* @author slima
*/
import java.awt.Color;
import java.util.ArrayList;
import java.util.List;

import net.sf.jasperreports.engine.JRBand;
import net.sf.jasperreports.engine.JRElement;
import net.sf.jasperreports.engine.JRPrintText;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.base.JRBasePrintText;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
import net.sf.jasperreports.engine.design.JRDesignBand;
import net.sf.jasperreports.engine.design.JRDesignExpression;
import net.sf.jasperreports.engine.design.JRDesignField;
import net.sf.jasperreports.engine.design.JRDesignSection;
import net.sf.jasperreports.engine.design.JRDesignStaticText;
import net.sf.jasperreports.engine.design.JRDesignStyle;
import net.sf.jasperreports.engine.design.JRDesignTextField;
import net.sf.jasperreports.engine.design.JasperDesign;
import net.sf.jasperreports.engine.type.HorizontalAlignEnum;
import net.sf.jasperreports.engine.type.ModeEnum;
import net.sf.jasperreports.engine.type.SplitTypeEnum;
import net.sf.jasperreports.engine.xml.JRBandFactory;
import net.sf.jasperreports.engine.xml.JRStaticTextFactory;
import net.sf.jasperreports.engine.xml.JRXmlLoader;
import net.sf.jasperreports.view.JasperViewer;

public class Demo1  {

/** ArrayList as datasource */
private List<Person> myList;

public void execute() throws Exception {

// INput data into datasource
Person p1 = new Person(new Long(1), "Joaquim_not_so_long_name", "Caparrosa");
Person p2 = new Person(new Long(2), "Manel", "Picpapau");
Person p3 = new Person(new Long(3), "Teresa", "Pirimpim");
Person p4 = new Person(new Long(4), "Miguel", "Manalanao");

myList = new ArrayList<Person>();
myList.add( p1);
myList.add( p2);
myList.add( p3);
myList.add( p4);

// Start by designing the report dynamically, then compile it to the Jasper file
// then fill it with the data and afterwords view it with jasperviewer
try {
//create the design
JasperDesign design = new JasperDesign();
design.setName("Report Name");
design.setPageWidth(595);
design.setPageHeight(842);
design.setColumnWidth(515);
design.setColumnSpacing(0);
design.setLeftMargin(40);
design.setRightMargin(40);
design.setTopMargin(50);
design.setBottomMargin(50);

//Set Title
JRDesignBand titleBand = new JRDesignBand();
titleBand.setHeight(50);

JRDesignStaticText  titleText = new JRDesignStaticText();
titleText.setText("List of People");
titleText.setX(0);
titleText.setY(0);
titleText.setWidth(500);
titleText.setHeight(50);
titleText.setBold(true);
titleText.setFontSize(20);
titleText.setMode(ModeEnum.OPAQUE);
titleText.setHorizontalAlignment(HorizontalAlignEnum.CENTER);

//adding elements
titleBand.addElement(titleText);
design.setTitle(titleBand);

JRDesignField fieldId = new JRDesignField();
fieldId.setName("id");
fieldId.setValueClass(java.lang.Long.class);
design.addField(fieldId);
JRDesignField fieldName = new JRDesignField();
fieldName.setName("name");
fieldName.setValueClass(java.lang.String.class);
design.addField(fieldName);
JRDesignField fieldLastName = new JRDesignField();
fieldLastName.setName("lastName");
fieldLastName.setValueClass(java.lang.String.class);
design.addField(fieldLastName);

JRDesignBand band = new JRDesignBand();
band.setHeight(40);

JRDesignStaticText statictext = new JRDesignStaticText();
statictext.setX(0);
statictext.setY(0);
statictext.setWidth(60);
statictext.setHeight(20);
statictext.setMode(ModeEnum.OPAQUE);
statictext.setHorizontalAlignment(HorizontalAlignEnum.LEFT);
statictext.setText("ID: ");
band.addElement(statictext);

JRDesignTextField textfield = new JRDesignTextField();
textfield.setX(60);
textfield.setY(0);
textfield.setWidth(200);
textfield.setHeight(20);
textfield.setHorizontalAlignment(HorizontalAlignEnum.LEFT);

JRDesignExpression expression = new JRDesignExpression();
//expression.setText("$F{id}");
expression.addFieldChunk("id");
textfield.setExpression(expression);
band.addElement(textfield);

JRDesignTextField textfieldName  = new JRDesignTextField();
textfieldName.setX(100);
textfieldName.setY(0);
textfieldName.setWidth(500);
textfieldName.setHeight(20);
textfieldName.setHorizontalAlignment(HorizontalAlignEnum.LEFT);

JRDesignExpression expressionName = new JRDesignExpression();
//expression.setText("$F{id}");
//expressionName.setText("\"NOME: \" + $F{name}");
expressionName.addTextChunk("\"NAME: \" + ");
expressionName.addFieldChunk("lastName");
expressionName.addTextChunk(" + \", \" + ");
expressionName.addFieldChunk("name");
textfieldName.setExpression(expressionName);

band.addElement(textfieldName);

//Adding the prepared detail section to design
JRDesignSection section  =  (JRDesignSection) design.getDetailSection();
section.addBand(band);

//Compiling the report to the temporary jasper file
JasperCompileManager.compileReportToFile(design, "reportBin_dynamic.jasper");
//Fillin the report with the data from the arrayList
JasperPrint jp = JasperFillManager.fillReport("reportBin_dynamic.jasper",
null,
new JRBeanCollectionDataSource(getMyList()));
JasperViewer.viewReport(jp);

} catch (Exception e) {
e.printStackTrace();
}
}

public List<Person> getMyList() {
return myList;
}

/**
* Executing the Demonstration
*/
public static void main(String[] args) {
Demo1 m = new Demo1();
try {
m.execute();
} catch (Exception e) {
e.printStackTrace();
}
}
}

JR Creating the template programaticaly

Jasper Reports: cont.

So what if i want to use Jasper Reports to print out Certificates or Declarations or other text based document with JR using data from the DB to fill out the blanks. An example of this is an academic certificate, one already have the template prepared and just need to fill out the name and the grades.

I’m a newbie with this reporting tool, but what i first noted is that it works awesome to display tables with rows of data and even charts and plots. But to perform this kind of print outs, i didn’t find that much of info out on the internet, but with effort i found that’s easier than i thought. One just needs to prepare the JRXML the fieldtext tabs with the required text, and putting on the field values wherever needed.

My little Demo, has the report.jrxml file, and a class Person which contains the First and Last name of a person.

I used an arrayList of Person as datasource to the report, and i tried to print several certificates with the following result

Using a very long name as input to the record

Using a regular size name for input to the record

Anyone can see on both result reports that the text was wrapped and justified as needed to accommodate the difference in the names. I tried with a small name and with a very long name and the results were what i was expecting before starting this project.

Mission Accomplished.

 

Thanks to: http://yuml.me/

Jasper Reports: 101

Jasper Reports is a reporting tool, for JAVA with enormous potential. I will try to put here the fundamentals of it. Starting with a brief intro, and the following posts with more information regarding each subject of it, with code snipets whenever possible. It doesn’t intend to replace a book, but just important bits that might be useful in future developments, for me or anyone else.

Jasper Reports Workflow

Create JRXML: the first step is to create a Jasper Reports XML (JRXML) based file, with the specifications of the report to be created. There’s a iReport tool from JasperReports website, to create such files.

Compile JRXML to Template: The JRXML needs to be compiled to the JasperReports binary template, using the .compileReportToFile() method. This will create a .jasper file, which is called the jasper file.

Fill the Jasper File: The jasper file is then used to fill with the data that its to be reported and the result .jrprint file it’s in a native format which can only be read with a JasperReport Viewer. However this file can be exported into other media.

Export Report: The process of exporting the jasper file is to make it readable in known formats, such as PDF, Word, etc…






My first project:

Person.java


/***
 * Person is the data object
 * @author slima
 */
public class Person {
private Long id;
private String name;
private String lastName;
public Person() {
 }

public Person(String name, String lastName) {
 this.name = name;
 this.lastName = lastName;
 }

public Person(Long id, String name, String lastName) {
 this.id = id;
 this.name = name;
 this.lastName = lastName;
 }

 public Long getId() {
 return id;
 }

public void setId(Long id) {
 this.id = id;
 }

public String getLastName() {
 return lastName;
 }

public void setLastName(String lastName) {
 this.lastName = lastName;
 }

public String getName() {
 return name;
 }

public void setName(String name) {
 this.name = name;
 }
}

report.jrxml

<?xml version="1.0"?>
<!DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD Report Design//EN" 
"http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
<jasperReport name="jasper_test">

  <!-- Our fields from the Person class. -->
  <field name="name" class="java.lang.String"/>
  <field name="lastName" class="java.lang.String"/>
  <field name="id" class="java.lang.Long"/>
  
  <title>
    <band height="50">
      <staticText>
        <reportElement x="0" y="0" width="180" height="15"/>
        <textElement/>
        <text><![CDATA[My First Report using ARRAY LIST as datasource]]></text>
      </staticText>
    </band>
  </title>
  <pageHeader>
    <band/>
  </pageHeader>
  <columnHeader>
    <band height="20">
      <staticText>
        <reportElement x="0" y="0" width="180" height="20"/>
        <textElement>
          <font isBold="true"/>
        </textElement>
        <text><![CDATA[ID]]></text>
      </staticText>
      <staticText>
        <reportElement x="180" y="0" width="180" height="20"/>
        <textElement>
          <font isUnderline="true"/>
        </textElement>
        <text><![CDATA[NAME]]></text>
      </staticText>
      <staticText>
        <reportElement x="360" y="0" width="180" height="20"/>
        <textElement>
          <font isUnderline="true"/>
        </textElement>
        <text><![CDATA[LASTNAME]]></text>
      </staticText>
    </band>
  </columnHeader>
  <detail>
    <band height="20">
      <textField>
        <reportElement x="0" y="0" width="180" height="15"/>
        <textElement/>
        <textFieldExpression><![CDATA[$F{id}]]></textFieldExpression>
      </textField>
      <textField>
        <reportElement x="180" y="0" width="180" height="15"/>
        <textElement/>
        <textFieldExpression><![CDATA[$F{name}]]></textFieldExpression>
      </textField>
      <textField>
        <reportElement x="360" y="0" width="180" height="15"/>
        <textElement/>
        <textFieldExpression><![CDATA[$F{lastName}]]></textFieldExpression>
      </textField>
    </band>
  </detail>
  <columnFooter>
    <band/>
  </columnFooter>
  <pageFooter>
    <band height="15">
      <staticText>
        <reportElement x="0" y="0" width="40" height="15"/>
        <textElement/>
        <text><![CDATA[Page:]]></text>
      </staticText>
      <textField>
        <reportElement x="40" y="0" width="100" height="15"/>
        <textElement/>
        <textFieldExpression class="java.lang.Integer"><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
      </textField>
    </band>
  </pageFooter>
  <summary>
    <band/>
  </summary>
</jasperReport>

Demo1.java

/***
* Demonstration 1
* This demo uses the report.jrxml as the template
* creates the reportBin.jasper file and fill it with the
* arraylist of Person.
*
* <span style="color: #0000ff;">@author slima</span>
*/
import java.util.ArrayList;
import java.util.List;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
import net.sf.jasperreports.view.JasperViewer;

public class Demo1  {

/** ArrayList as datasource */
private List myList;

public void execute() throws Exception {
// INput data into datasource
Person p1 = new Person(new Long(1), "Joaquim", "Caparrosa");
Person p2 = new Person(new Long(2), "Manel", "Picpapau");
Person p3 = new Person(new Long(3), "Teresa", "Pirimpim");
Person p4 = new Person(new Long(4), "Miguel", "Manalanao");

myList = new ArrayList();
myList.add( p1);
myList.add( p2);
myList.add( p3);
myList.add( p4);

//Compile the jrxml to Jasper file
// then fill it with the data into
// afterwords view it with jasperviewer
// Use the . directory as temp
try {
JasperCompileManager.compileReportToFile(
"report.jrxml",
"reportBin.jasper");

JasperPrint jp = JasperFillManager.fillReport("reportBin.jasper",
null,
new JRBeanCollectionDataSource(getMyList()));
JasperViewer.viewReport(jp);
} catch (Exception e) {
e.printStackTrace();
}
}

public List getMyList() {
return myList;
}

	/**
	 * Executing the Demonstration
	 */
	public static void main(String[] args) {
		Demo1 m = new Demo1();
		try {
			m.execute();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}

This project was compiled using the latest Eclipse IDE and JasperReports 4.7.1

TODO for Tomorrow…
– generate the reports even without the JRXML file (create it on the fly)
– generate the report using a jrxml file as a minimal template and add all the required fields on the fly.

Android Development: Sensors test

Using Eclipse IDE, Android Emulator, and SensorSimulator is possible to create android applications and simulating it without the need to install it on the physical device. This SensorSimulator is very useful because you can simulate a movement of the device and all the sensor data will be available to your application.

A few hiccups i encountered:
1º allow the Internet permission on the manifest file
2º remove the SDK target version requirement

</pre>
<code></code>

The installation and configuration of the sensorSimulator here!


private SensorManagerSimulator mSensorManager ;
public void onCreate()
{
...
mSensorManager = SensorManagerSimulator.getSystemService(this, SENSOR_SERVICE);
mSensorManager.connectSimulator();
}
@Override
protected void onResume() {
super.onResume();
mSensorManager.registerListener(listener, mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), SensorManager.SENSOR_DELAY_FASTEST);
}
@Override
protected void onStop() {
mSensorManager.unregisterListener(listener);
super.onStop();
}

private SensorEventListener listener = new SensorEventListener()
{
  public void onSensorChanged(SensorEvent event) {
    //Do Stuff Here
 }
};
}

Wireless ElectroCardioGram

As a university project, i also designed a ECG (Electrocardiogram) that allow the recording of the ECG data into a custom made software, for later use and exporting to SIGIF format.

The wireless Receiver

The wireless Receiver

ECG software receiver software.

The signal on the Oscilloscope

Schematic: amplifier and emitter

Schematic: receiver

DICOM part18 implementation

The project aimed at allowing authenticated users from outside an institution to access DICOM images of the Radiology RIS, using an HTTP webservice (DICOM part18) as a broker. This allow ease of access and a reduction in bandwith due to JPEG lossless compression, and region selection.

Description of the project implementing the DICOM part 18. Allowing authenticated users from outside to access to RIS servers.

This implementation allowed a transparent and scalable way of accessing DICOM objects from outside of institution. The Webservice implemented using JAVA Servelets, and PIXELMED toolkit communicate with internal RIS servers, and after some encoding and region detection the image is available through the webservice.

Also to test out this system, an applet was also created to be easier to the user accessing the radiology images.

A Viewer to allow the user an easy access to the system.