Hello All,
This week started and ended on two different notes. For the last two months I have been working on the Pedometer for the Medical Device Plugin. I started working on this pedometer using Cordova's accelerometer.watchAcceleration. For a while this was ok, until further research showed that JavaScript files cannot be run as a service. For the time I had developed the pedometer I spent time creating a JQuery Mobile Interface that used sliders and range sliders that allowed the user to adjust their stride length and low step intensity and high step intensity. The user could start getting their data and stop as well. Now the challenge is creating the Pedometer using Native Android Java and Services that allow the user to run the Pedometer in the background. Already I have the steps counting. I have the service. But there are other features that I am still querying, as well as the fact that the request to create the Pedometer natively is still new and the full feature set may be fairly wide. I hope to have this finished soon. The WWW is full of papers and labs that talk about accelerometers. Finding out what a step was challenge that involved brainstorming with fellow crew members. I would like to thank them for being so patient. But the challenge remains for the job to be completed. This is just one week. Next week continues. I hope for further progress as I look forward to seeing the final product.
Eddie Blog
Friday 30 August 2013
Monday 8 July 2013
Accelerometer application
For the last three to four weeks at CDOT I have been working with the native Android Accelerometer through Cordova. The goal is to have a pedometer that uses the phone's native Accelerometer that enables the user to walk and simultaneously have their steps counted. This has been very exciting for me. I have needed to do a lot of research that involves finding out "What exactly is a step?" This forced me to become aware of myself and those around me, making me think "How do we walk from point A to B" After a certain age we do this so easily (those who are able to). But rediscovering this in computer language was different. I am currently using the following formula to calculate the force exerted on the phone:
Step force = ((acceleration.x * acceleration.x) + (acceleration.y * acceleration.y) + (acceleration.z * acceleration.z)) / (9.78 * 9.78);
On average a force near to the value of 2 counts as a step.
At the moment the demo only outputs X,Y, and Z acceleration with time-stamp, steps according to the formula above, the force exerted on the phone, distance, intensity and stride length. I have also tested the results with another pedometer. Because intensity varies with each person, I later added a feature to the demo that allows the user to adjust their intensity. The user may also change their stride length. They may adjust their stride length and intensity at any moment in the workout. This gives me the idea that maybe the intensity can self adjust.
In the future maybe I can make this application help the user manage their fitness goals. Currently the prototype is a pull request and only has a certain scope. Later on there will be testing, and other new features. The pedometer will truly be a part of the NexJ Medical Device Plugin, and no more. Project scope is very important.
The latest Cordova Accelerometer Specs can be found here: Cordova Accelerometer
To see the Cordova tests visit: Apache/Cordova-mobile-spec. A personal goal is to later implement the accelerometer test in QUnit for the pedometer integration.
This is slowly coming together. I am pleased with what I have so far, but am ready to make the extra effort.
See my pull request here: Pedometer Skeleton
Step force = ((acceleration.x * acceleration.x) + (acceleration.y * acceleration.y) + (acceleration.z * acceleration.z)) / (9.78 * 9.78);
On average a force near to the value of 2 counts as a step.
At the moment the demo only outputs X,Y, and Z acceleration with time-stamp, steps according to the formula above, the force exerted on the phone, distance, intensity and stride length. I have also tested the results with another pedometer. Because intensity varies with each person, I later added a feature to the demo that allows the user to adjust their intensity. The user may also change their stride length. They may adjust their stride length and intensity at any moment in the workout. This gives me the idea that maybe the intensity can self adjust.
In the future maybe I can make this application help the user manage their fitness goals. Currently the prototype is a pull request and only has a certain scope. Later on there will be testing, and other new features. The pedometer will truly be a part of the NexJ Medical Device Plugin, and no more. Project scope is very important.
The latest Cordova Accelerometer Specs can be found here: Cordova Accelerometer
To see the Cordova tests visit: Apache/Cordova-mobile-spec. A personal goal is to later implement the accelerometer test in QUnit for the pedometer integration.
This is slowly coming together. I am pleased with what I have so far, but am ready to make the extra effort.
See my pull request here: Pedometer Skeleton
Wednesday 5 June 2013
Recapping the last couple weeks
To make my blog posts clearer I decided that I would follow the format of the morning 'SCRUM' that I am participating at CDOT. For those who do not know what a SCRUM is, I will tell a little more. Every morning at CDOT (The Seneca Centre for Development of Open Technology) we talk about some task that we have done are will do that relates to our job. I found an article on Wikipedia that explains the term http://en.wikipedia.org/wiki/Scrum_(software_development). My latest task is to create tests for the NEXJ Mobile Bluetooth Adapter https://bitbucket.org/nexj/mobile-bluetooth-adapters/. This task will be done using QUnit http://qunitjs.com/.
In the last three to four weeks I have spent a fair amount of time becoming familiar with this Testing Framework. There is still more to learn. At first I could not get the tests working and wondered why? It took me some time to think that I should check the QUnit cookbook hosted on its site. I could not get my tests started. What kind of Tests? Asynchronous Callback Tests... More information can be found here http://qunitjs.com/cookbook/#asynchronous-callbacks. What helped me in the end was to overcome my sense of estrangement by comparing my source code with the examples on the CookBook page. I found out that I had not:
"
setTimeout(function() {
"
After setTimeout everything worked fine.
The next thing I learned was that I could easily set the:
"
expect( 1 );
"
where needed.
Currently these tests are available as a Pull Request: Pull Request with tests. You can easily skim and checkout the commits tab. This is just for now. But I am learning a lot from the QUnit Testing Framework.
In the last three to four weeks I have spent a fair amount of time becoming familiar with this Testing Framework. There is still more to learn. At first I could not get the tests working and wondered why? It took me some time to think that I should check the QUnit cookbook hosted on its site. I could not get my tests started. What kind of Tests? Asynchronous Callback Tests... More information can be found here http://qunitjs.com/cookbook/#asynchronous-callbacks. What helped me in the end was to overcome my sense of estrangement by comparing my source code with the examples on the CookBook page. I found out that I had not:
"
setTimeout(function() {
}, 1000);ok( true, "Passed and ready to resume!" );
start();
"
After setTimeout everything worked fine.
The next thing I learned was that I could easily set the:
"
expect( 1 );
"
where needed.
Currently these tests are available as a Pull Request: Pull Request with tests. You can easily skim and checkout the commits tab. This is just for now. But I am learning a lot from the QUnit Testing Framework.
Thursday 9 May 2013
How to add syntax highlighting to your own blog!
Since I am going to be demonstrating source code this summer... I thought "What about syntax highlighting" in my blog. So I went ahead and searched online. There are a number of ways of going about and doing this. I am choosing to do this with a simple javascript library called 'highlight.js'. First you can visit this page:
http://softwaremaniacs.org/soft/highlight/en/download/
There you will find the latest version of the syntax highlighting library.
Copy the two links. At the time of this post I copied these two links:
You must place these references after the </head> and before the <body>
next...
Go to this link: http://softwaremaniacs.org/soft/highlight/en/description/ You will read that it is necessary to place the code according to these instructions.
"This will highlight all code on the page marked up as
This should work anywhere.
http://softwaremaniacs.org/soft/highlight/en/download/
There you will find the latest version of the syntax highlighting library.
Copy the two links. At the time of this post I copied these two links:
<link href='http://yandex.st/highlightjs/7.3/styles/default.min.css' rel='stylesheet'/>
<script src='http://yandex.st/highlightjs/7.3/highlight.min.js'/>
<script>hljs.initHighlightingOnLoad();</script>
You must place these references after the </head> and before the <body>
next...
Go to this link: http://softwaremaniacs.org/soft/highlight/en/description/ You will read that it is necessary to place the code according to these instructions.
"This will highlight all code on the page marked up as
<pre><code> .. </code></pre>
. If you use different markup or need to apply highlighting dynamically, read "Custom initialization" below."
This should work anywhere.
An undefined application.
My first task for this year is to create a set of tasks for the Mobile Bluetooth Device Connectivity at NEXJ CDOT Seneca. Bellow is a simple test that will be built upon with the necessary functionality to fully test the Bluetooth project:
For example the following Test shows that the window application for the Bluetooth mobile device is undefined. For this test I am using Qunit. So a test has been written for this:<!DOCTYPE html><html><head><meta charset="utf-8"><title>NexJ Medical Bluetooth Adapter JavaScript Test</title><link rel="stylesheet" type="text/css" href="../libs/css/qunit-1.11.0.css" /></head><body><div id="qunit"></div><div id="qunit-fixture"></div><script type="text/javascript" src="../libs/js/qunit-1.11.0.js"></script><script type="text/javascript" src="../libs/js/cordova-2.5.0.js"></script><script type="text/javascript" src="../medicalDevicePlugin.js"></script><script type="text/javascript" src="demo.js"></script><script src="test.js"></script></body></html>
test( "a basic test example", function() { var value = "hello"; equal( value, "hello", "We expect value to be hello" ); if(typeof app == "undefined") { var testAppp = "undefined"; equal( testAppp, "undefined", "undefined" ); }else if(typeof app != "undefined") { var testAppp = "defined"; equal( testAppp, "undefined", "undefined" ); } });
Subscribe to:
Posts (Atom)