[How to use iSeismometer] Part1 - How the server side program works

This article is for people who would like to know more details about the technical aspects of iSeismometer. I implemented the server side program in PHP + MySQL but if you have webserver which can accept HTTP request, you can implement the program any environment. I’m also attaching the sample code at the bottom of this article.

[caption id=“attachment_239” align=“alignnone” width=“200” caption=“data screen”]data screen[/caption]

In “data” section, this is what’s happen behind the scene:

  1. iPhone takes GPS location data

  2. Attach x,y,z motion signal data with your current location data

  3. Send HTTP POST request on the url in the text box.

As the default, we provide our server for free, but please note that we do not guarantee how long we keep the data in our server depend on our storage space (since it’s text data only, we do not have any plan to delete them anyway. We have GIGABYTES HDD whoofoo!).

Here is the specification of posting data:

[GET parameters in the url]

I’m listing values here with description device_id - 40 characters unique id from your iPhone lat - float lon - float alt - float sampling - I’m just taking sampling frequency which is fixed right now. Just put 100. version - iPhone client version. (Just put 1.0.0) might be useful later when the spec has been changed action - specify “add” comment - free text local_datetime - local date time in ISO format

The actual url will be looks like this

http://(your website)/index.php?device_id=xyz&lat=123&lon=123&alt=123&sampling=100&version=1.0.0&action=add&comment=none&local_datetime=000-00-00 00:00:00

[POST parameter]

signal - format is csv.

e.g.

1.026298,-0.640581,-0.766560 1.338053,-0.216916,-0.335511 0.782834,-0.195438,-0.302473 0.701869,-0.176067,0.100588 0.629521,0.219003,0.477647

this goes HTTP POST section. Very simple and lines are separated by new line characters (\n)

When you are retrieving data (when you click “Download” link on the website), it uses parameters below:

signal_id - specify identical database table’s row number

action - specify “download”

As you can see, i’m using same program by distinguishing user action in the parameter. “action” can have “add”, “download”, or anything else will be viewer mode (list posting history).

Here is the entire source code of the server side program. It’s only 100 lines of code, so please check the source code for more details. I also included the table create sql inside.

Source Code Download

By: kiichi on: