Difference between revisions of "Install phoneDistance"
(→Launch the xPL distance calculator at startup) |
(→Test the phone distance calculator) |
||
(7 intermediate revisions by one user not shown) | |||
Line 4: | Line 4: | ||
Before all, make sure you have installed an [[install xpl hub|xPL hub]]. | Before all, make sure you have installed an [[install xpl hub|xPL hub]]. | ||
− | = Install | + | = Install the phone distance calculator = |
− | On your mobile phone, install | + | == Mobile phone == |
+ | |||
+ | On your mobile phone, install a GPS location streamer such as [http://www.capsicumdreams.com GPS2IP]. | ||
Set-up the application to send <code>GPGGA</code> messages to a selected UDP port (default is 11123). | Set-up the application to send <code>GPGGA</code> messages to a selected UDP port (default is 11123). | ||
− | + | My [http://www.capsicumdreams.com GPS2IP] settings are: | |
− | + | * Time between sending: ''60 seconds'' | |
− | + | * GPS accuracy: ''moderate'' | |
+ | * NMEA message to send: ''GGA'' | ||
+ | * Generate in background mode: ''on'' | ||
+ | * Connection method: ''UDP push'' | ||
+ | * Phone IP selection: ''cellular IP'' | ||
+ | |||
+ | == Linux machine == | ||
Download the [http://www.dspc.ch/xPL/Downloads/xpl-phoneDistance.pl xPL phone distance calculator] script. | Download the [http://www.dspc.ch/xPL/Downloads/xpl-phoneDistance.pl xPL phone distance calculator] script. | ||
Line 27: | Line 35: | ||
SCRIPTS_BASE_DIR=/home/control/Documents/Controls | SCRIPTS_BASE_DIR=/home/control/Documents/Controls | ||
$SCRIPTS_BASE_DIR/xpl-phoneDistance.pl -h | $SCRIPTS_BASE_DIR/xpl-phoneDistance.pl -h | ||
− | $SCRIPTS_BASE_DIR/xpl-phoneDistance.pl -vn | + | $SCRIPTS_BASE_DIR/xpl-phoneDistance.pl -vn home |
− | Open a 2nd terminal window (on any machine with xPL installed) and monitor the xPL protocol: | + | Start the mobile phone application ([http://www.capsicumdreams.com GPS2IP]). |
+ | The location information should appear in the terminal window at the receival of each new GPS location. | ||
+ | |||
+ | Open a 2nd terminal window and look at the loged positions: | ||
+ | cat /tmp/phoneDistance.log | ||
+ | |||
+ | Open a 3rd terminal window (on any machine with xPL installed) and monitor the xPL protocol: | ||
SCRIPTS_BASE_DIR=/home/control/Documents/Controls | SCRIPTS_BASE_DIR=/home/control/Documents/Controls | ||
$SCRIPTS_BASE_DIR/xpl-monitor.pl -vf | $SCRIPTS_BASE_DIR/xpl-monitor.pl -vf | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
= Launch the xPL distance calculator at startup = | = Launch the xPL distance calculator at startup = | ||
Line 50: | Line 57: | ||
On Ubuntu, the xPL distance calculator starts-up once <code>xpl-hub_started</code> has been emitted. | On Ubuntu, the xPL distance calculator starts-up once <code>xpl-hub_started</code> has been emitted. | ||
− | Edit <code>/etc/init/xpl-phoneDistance.conf </code>: | + | Edit <code>/etc/init/xpl-phoneDistance.conf</code>: |
################################################################################ | ################################################################################ | ||
− | # xPL | + | # xPL phone distance calculator |
# | # | ||
− | description "xPL | + | description "xPL phone distance" |
version "1.0" | version "1.0" | ||
author "Francois Corthay" | author "Francois Corthay" | ||
Line 63: | Line 70: | ||
env SCRIPTS_DIR='/home/control/Documents/Controls' | env SCRIPTS_DIR='/home/control/Documents/Controls' | ||
env SCRIPT_NAME='xpl-phoneDistance.pl' | env SCRIPT_NAME='xpl-phoneDistance.pl' | ||
− | env PARAMETERS='-n | + | env PARAMETERS='-n iPhone' |
#------------------------------------------------------------------------------- | #------------------------------------------------------------------------------- | ||
Line 72: | Line 79: | ||
respawn | respawn | ||
setuid control | setuid control | ||
− | setgid | + | setgid users |
#------------------------------------------------------------------------------- | #------------------------------------------------------------------------------- | ||
Line 84: | Line 91: | ||
service xpl-phoneDistance status | service xpl-phoneDistance status | ||
initctl list | grep xpl | initctl list | grep xpl | ||
− | ps aux | grep -i xpl | grep -v grep | sed 's/.*\/Controls\///' | + | ps aux | grep -i xpl | grep -v grep | sed 's/.*\/Controls\///' | sort |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
[[Category: all]] [[Category: install]] [[Category: xPL]] | [[Category: all]] [[Category: install]] [[Category: xPL]] |
Latest revision as of 16:50, 4 June 2015
The distance calculator receives NMEA position messages on an UDP port. From this, it calculates the distance to several locations such as home or work and sends them as an xPL message.
Before all, make sure you have installed an xPL hub.
Contents
[hide]Install the phone distance calculator
Mobile phone
On your mobile phone, install a GPS location streamer such as GPS2IP.
Set-up the application to send GPGGA
messages to a selected UDP port (default is 11123).
My GPS2IP settings are:
- Time between sending: 60 seconds
- GPS accuracy: moderate
- NMEA message to send: GGA
- Generate in background mode: on
- Connection method: UDP push
- Phone IP selection: cellular IP
Linux machine
Download the xPL phone distance calculator script.
Move the script to xPL scripts directory:
SCRIPTS_BASE_DIR=/home/control/Documents/Controls mv xpl-phoneDistance.pl $SCRIPTS_BASE_DIR chown control:users $SCRIPTS_BASE_DIR/*.pl chmod 775 $SCRIPTS_BASE_DIR/*.pl
Test the phone distance calculator
Test it:
su control SCRIPTS_BASE_DIR=/home/control/Documents/Controls $SCRIPTS_BASE_DIR/xpl-phoneDistance.pl -h $SCRIPTS_BASE_DIR/xpl-phoneDistance.pl -vn home
Start the mobile phone application (GPS2IP). The location information should appear in the terminal window at the receival of each new GPS location.
Open a 2nd terminal window and look at the loged positions:
cat /tmp/phoneDistance.log
Open a 3rd terminal window (on any machine with xPL installed) and monitor the xPL protocol:
SCRIPTS_BASE_DIR=/home/control/Documents/Controls $SCRIPTS_BASE_DIR/xpl-monitor.pl -vf
Launch the xPL distance calculator at startup
Multiple instances of the distance calculator can be launched at startup, each with a different GPS UDP port, allowing to follow different phones.
The xPL distance calculator is to be launched after the xPL hub.
Ubuntu
On Ubuntu, the xPL distance calculator starts-up once xpl-hub_started
has been emitted.
Edit /etc/init/xpl-phoneDistance.conf
:
################################################################################ # xPL phone distance calculator # description "xPL phone distance" version "1.0" author "Francois Corthay" #------------------------------------------------------------------------------- # Configuration variables # env SCRIPTS_DIR='/home/control/Documents/Controls' env SCRIPT_NAME='xpl-phoneDistance.pl' env PARAMETERS='-n iPhone' #------------------------------------------------------------------------------- # Start and stop conditions # start on xpl-hub_started stop on shutdown respawn setuid control setgid users #------------------------------------------------------------------------------- # Start daemon # exec $SCRIPTS_DIR/$SCRIPT_NAME $PARAMETERS
Start the device and test it:
su root service xpl-phoneDistance start service xpl-phoneDistance status initctl list | grep xpl ps aux | grep -i xpl | grep -v grep | sed 's/.*\/Controls\///' | sort