Compare commits

...

103 Commits

Author SHA1 Message Date
Stefan Kögl e9e94f87dd removed print 2014-12-08 20:11:50 +01:00
Stefan Kögl e4162538ea last changes before test run 2014-12-04 16:38:55 +01:00
Stefan Kögl e091a32017 better layout for dump grabber 2014-12-04 13:46:20 +01:00
Lucas Pleß 6486a586e0 foo and bar and tried to change dump window size 2014-12-03 19:50:56 +01:00
Lucas Pleß 39ae53f598 added ekg and dump grabber to positioning 2014-12-03 19:43:00 +01:00
Lucas Pleß 5b87ca1bc5 changed window title from ekgplotter 2014-12-03 17:48:31 +01:00
Lucas Pleß e0f49c1232 changed window title 2014-12-03 17:45:49 +01:00
Stefan Kögl 83e63c20ea dump_grabber with window 2014-12-03 16:49:43 +01:00
Stefan Kögl 5da5f207b4 Merge branch 'master' of repos.ctdo.de:psychose 2014-12-03 16:33:07 +01:00
Stefan Kögl 996ae549a4 ekg windowed without streaming 2014-12-03 16:32:45 +01:00
Lucas Pleß ac890076b4 cleaned up the code
changed GUI layout to respect current desktop layout for SDI capture
added temperature offset controls
2014-11-21 03:50:27 +01:00
Lucas Pleß 9c0c7a0fdc added fensterkram teil 1 2014-11-20 15:35:46 +01:00
Lucas Pleß 27914e6a19 and fixed the temperature typo everywhere else (hopefully) 2014-11-19 03:21:14 +01:00
Lucas Pleß 33b8ee0ec7 changed temperature from int to float, since the arduino is sending now floats, fixed the typo 2014-11-19 03:18:26 +01:00
Lucas Pleß e116bb2447 added EKG code, since i changed the protocol 2014-11-19 03:14:48 +01:00
Lucas Pleß e9830ca276 removed snmp and status functions
added hearts and breath display
added extra control window
made the main window for external display w/o borders
2014-11-19 03:12:08 +01:00
Lucas Pleß 065006acdb changed ehealth temperature to float output 2014-10-28 19:52:32 +01:00
Lucas Pleß 1b99af1219 Merge branch 'master' of repos.ctdo.de:psychose 2014-10-28 19:33:52 +01:00
Lucas Pleß 1c2b262680 added Snmp client thread (untested) 2014-10-27 22:04:11 +01:00
Stefan Kögl 28036e6205 new version 2014-06-07 11:03:20 +02:00
Stefan Kögl f2963a938d polished 2014-05-29 10:22:04 +02:00
Stefan Kögl 80d6aea666 much rewrite, very kane :) 2014-05-26 23:25:36 +02:00
Stefan Kögl 05745e3c52 consolidate mjpeg streaming server using qtnetwork into a reusable class 2014-05-25 15:53:50 +02:00
Stefan Kögl f3477757c2 intermediate commit 2014-05-25 15:52:40 +02:00
Stefan Kögl b123160470 added icons and cleaned up code 2014-05-11 12:45:43 +02:00
Stefan Kögl 620c7bc3c3 Merge branch 'master' of repos.ctdo.de:psychose 2014-05-10 14:52:39 +02:00
Stefan Kögl d7f3a7daea changed from ffmpeg grabbing to internal grabbing and added a async http server 2014-05-10 14:52:21 +02:00
Lucas Pleß 805330fa27 version bump to 1.1 to bypass problems on our current setup 2014-05-03 11:48:49 +02:00
Lucas Pleß 0fd969766d Merge branch 'master' of repos.ctdo.de:psychose 2014-05-03 11:46:27 +02:00
Lucas Pleß 52e6847fc2 changed snmp timing to 100ms timeout
added control to fake pulse heartrate
disabled snmp check on display mode
2014-05-03 11:46:11 +02:00
Stefan Kögl 28cc9798e7 small changes to texter and ekgplotter 2014-05-02 13:53:42 +02:00
Stefan Kögl ca1d492198 justified text and small improvements 2014-04-29 09:54:58 +02:00
Stefan Kögl 0d2372df12 added per actor sensor scripts, improved grabber performance, started saving server configs and cleaned up the repo 2014-04-28 07:20:28 +02:00
Stefan Kögl 12138a9f57 Merge branch 'master' of repos.ctdo.de:psychose
Conflicts:
	ekgplotter/ekgplotter/main.py
2014-04-27 15:48:32 +02:00
Stefan Kögl a064715e38 removed unsued code 2014-04-27 15:45:58 +02:00
Stefan Kögl 720b7c00a9 more stable frame rate 2014-04-27 15:45:00 +02:00
Stefan Kögl dac236ca12 more stable frame rate 2014-04-27 15:44:38 +02:00
Lucas Pleß ac48b496fb Merge branch 'master' of repos.ctdo.de:psychose 2014-04-24 20:22:54 +02:00
Lucas Pleß cf756d4cf7 fixed bug where ekg does not show "no data" and fixed bug where snmp was not closed correctly 2014-04-24 20:22:41 +02:00
Stefan Kögl eaaddd80f2 minor ekplotter update 2014-04-24 14:20:10 +02:00
Stefan Kögl 97d9e8282e Merge branch 'master' of repos.ctdo.de:psychose 2014-04-24 10:50:16 +02:00
Stefan Kögl 8f57a6d36a fade animation 2014-04-24 10:49:54 +02:00
Stefan Kögl 40ffb2e43d cleaned up ekgplotter 2014-04-24 09:34:37 +02:00
Stefan Kögl f3a8e8c4dd cleaned up dump_grabber 2014-04-24 09:33:43 +02:00
Stefan Kögl 2837ab9389 more init scripts 2014-04-24 09:32:16 +02:00
Lucas Pleß 3c2cb48eed changed offline lines to "no data" 2014-04-23 22:35:04 +02:00
Stefan Kögl dcd8e49f85 better 2014-04-23 19:19:05 +02:00
Stefan Kögl f5352f247a reduced cpu load 2014-04-23 18:35:15 +02:00
Stefan Kögl 28e0cc3bc1 reduced cpu load from 104% with ffmpeg x11grab, ffserver and konsole to 32% with my implementation - yeah 2014-04-23 18:16:47 +02:00
Stefan Kögl 7ac50d1e79 done with this 2014-04-23 17:58:50 +02:00
Stefan Kögl 7e93c46547 fixed layout and colors 2014-04-23 17:46:14 +02:00
Stefan Kögl 2effe315a7 implemented dump_grabber 2014-04-23 16:31:19 +02:00
Stefan Kögl fce69b46ee added better chaosc init script to repo 2014-04-23 14:14:02 +02:00
Lucas Pleß bcdd2e4013 added stats display 2014-04-23 12:53:48 +02:00
Stefan Kögl 007ec565e1 finished animation feature, rearranged buttons and cleaned up the code 2014-04-22 11:10:08 +02:00
Stefan Kögl 0086d0fd8f Merge branch 'master' of repos.ctdo.de:psychose 2014-04-20 11:37:45 +02:00
Stefan Kögl 54d3526d2a sync commit for laptop 2014-04-20 11:37:22 +02:00
Lucas Pleß a53cf435de added stats display, removed border from actor display 2014-04-18 03:06:41 +02:00
Lucas Pleß a6a3666c15 moved code into package, added complete maven support for intellij UI Designer and JAR packaging 2014-04-17 19:03:45 +02:00
Lucas Pleß 3086c96bac Merge branch 'master' of repos.ctdo.de:psychose 2014-04-17 17:27:25 +02:00
Lucas Pleß f396266715 added airflow/breath 2014-04-17 17:27:19 +02:00
Stefan Kögl 8a360d4e84 initial commit of dump_grabber 2014-04-17 16:25:43 +02:00
Stefan Kögl 2caf563b8c Merge branch 'master' of repos.ctdo.de:psychose 2014-04-17 15:37:17 +02:00
Stefan Kögl be8835b94e Merge branch 'small_design'
the small design for texter is much better
2014-04-17 15:33:48 +02:00
Stefan Kögl 2f08c5529a improved exception handling 2014-04-17 15:33:21 +02:00
Lucas Pleß 7e0bc24273 added java based health display to show if values are send by the actors 2014-04-17 11:25:14 +02:00
Lucas Pleß ca3e271eab added binary foo to gitignore 2014-04-17 11:19:32 +02:00
Stefan Kögl 21c59656a3 removed unused method in texter 2014-04-17 01:56:08 +02:00
Stefan Kögl de19433571 searching for a segfault when visited by apple computers :) 2014-04-17 01:55:00 +02:00
Stefan Kögl 2b78252fc3 new version 2014-04-17 01:43:34 +02:00
Stefan Kögl e78c7f41a0 up and down feature, editor and text selection popup will not disturb the live text anymore, better layout 2014-04-16 02:23:36 +02:00
Stefan Kögl 155b2ececd added model 2014-04-15 18:51:50 +02:00
Stefan Kögl ae53e8e3ef implemented real model/view interface 2014-04-15 18:08:00 +02:00
Stefan Kögl 80b31ecaf2 fixed font size issue 2014-04-15 09:18:28 +02:00
Stefan Kögl 012c90744e new version 2014-04-14 12:50:53 +02:00
Lucas Pleß 9be0f3566d added shiny blinky LED 2014-04-12 21:43:39 +02:00
Lucas Pleß ae8d0ea9f5 changed error message 2014-04-12 21:43:16 +02:00
Stefan Kögl d4d4154f92 new layout 2014-04-12 20:51:49 +02:00
Stefan Kögl 7bcf2b1a00 Merge branch 'small_design' of repos.ctdo.de:psychose into small_design 2014-04-12 10:13:17 +02:00
Stefan Kögl 41a2399034 added desktop entry 2014-04-12 10:12:57 +02:00
Stefan Kögl abede11b8f Merge branch 'small_design' of repos.ctdo.de:psychose into small_design 2014-04-12 09:52:38 +02:00
Stefan Kögl 7ac1779ef8 config files for texter 2014-04-12 09:52:16 +02:00
Stefan Kögl 157c95b5ca Merge branch 'small_design' of repos.ctdo.de:psychose into small_design 2014-04-12 09:49:54 +02:00
Stefan Kögl 20319d3cda added missing setup.py 2014-04-12 09:47:45 +02:00
Stefan Kögl 47995b960a Merge branch 'small_design' of repos.ctdo.de:psychose into small_design 2014-04-12 09:45:37 +02:00
Stefan Kögl 27ff7f53b9 ekgplotter better plotting 2014-04-12 09:44:48 +02:00
Stefan Kögl 2fb5177a6c new version of texter with icon and optimized ui for live texting 2014-04-12 09:42:03 +02:00
Stefan Kögl 3a12ff7dc5 new smaller design 2014-04-11 10:11:13 +02:00
Stefan Kögl 3e14468463 added texter demo 2014-04-10 19:00:01 +02:00
Stefan Kögl 823b58488e updated ekgplotter 2014-04-08 09:34:17 +02:00
Stefan Kögl 40f538223f my todos for today 2014-04-08 09:24:21 +02:00
Stefan Kögl 0aa866d394 updated config files 2014-04-08 08:40:00 +02:00
Stefan Kögl 8711d45ab6 added staged stuff 2014-04-03 17:44:36 +02:00
Stefan Kögl 4621abe17c more error resistant 2014-03-30 18:34:26 +02:00
Stefan Kögl 6c642e867c updated targets.conf and sensors2osc 2014-03-30 19:17:38 +02:00
Stefan Kögl 2855d59572 fixed minor issues in ekgplotter 2014-03-27 14:10:26 +01:00
Stefan Kögl e77af368b1 fixed ekgplotter 2014-03-27 14:06:54 +01:00
Stefan Kögl d9295dd05d now the sensors reconnects after connection issues 2014-03-27 14:04:44 +01:00
Stefan Kögl 2df8221eaf improved serial init for sensors 2014-03-26 14:34:05 +01:00
Stefan Kögl d2b6abbbb5 fixed mem leak with adding external qt event processing 2014-03-26 14:25:24 +01:00
Stefan Kögl 7de1019e76 cpu optimized by using select
Conflicts:
	sensors2osc/sensors2osc/ekg2osc.py
	sensors2osc/sensors2osc/pulse2osc.py
	sensors2osc/sensors2osc/socat_ehealth_test.py
2014-03-26 12:27:22 +01:00
Stefan Kögl 21a12bbf95 prepared sensors2osc for ip family selection 2014-03-26 12:12:59 +01:00
Stefan Kögl 60183ae4bb made ekgplotter ready for ipv4_only
Conflicts:
	ekgplotter/ekgplotter/main.py
2014-03-26 12:10:25 +01:00
139 changed files with 19867 additions and 454 deletions

6
.gitignore vendored
View File

@ -33,3 +33,9 @@ nosetests.xml
.mr.developer.cfg
.project
.pydevproject
*.elf
*.hex
*.map
*.d
*.o

10
TODO Normal file
View File

@ -0,0 +1,10 @@
* deploy new chaosc and psychose tools
* deploy/update new configs
* install netplug on all servers
* verkabelungsanleitung für die sensoren schreiben
* server restartsicher machen
* anne texter erklären und installieren
*
11:30 Termin

View File

@ -1,3 +0,0 @@
192.168.1.51, 9000
192.168.1.52, 9000
192.168.1.53, 9000

View File

@ -1,3 +0,0 @@
localhost, 9001
localhost, 9002
localhost, 9003

View File

@ -0,0 +1,58 @@
[chaosc]
chaosc_host = chaosc
ipv4_only = True
subscription_file = ~/dev/psychose/config_files/test_targets.config
[pulsemerle]
chaosc_host = chaosc
ipv4_only = True
actor = merle
device = /dev/psy_spo2_a
[pulseuwe]
chaosc_host = chaosc
ipv4_only = True
actor = uwe
device = /dev/psy_spo2_b
[pulsebjoern]
chaosc_host = chaosc
ipv4_only = True
actor = bjoern
device = /dev/psy_spo2_c
[ehealthmerle]
chaosc_host = chaosc
ipv4_only = True
actor = merle
device = /dev/psy_ehealth_a
[ehealthuwe]
chaosc_host = chaosc
ipv4_only = True
actor = uwe
device = /dev/psy_ehealth_b
[ehealthbjoern]
chaosc_host = chaosc
ipv4_only = True
actor = bjoern
device = /dev/psy_ehealth_c
[ekgmerle]
chaosc_host = chaosc
ipv4_only = True
actor = merle
device = /dev/psy_ekg_a
[ekguwe]
chaosc_host = chaosc
ipv4_only = True
actor = uwe
device = /dev/psy_ekg_b
[ekgbjoern]
chaosc_host = chaosc
ipv4_only = True
actor = bjoern
device = /dev/psy_ekg_c

View File

@ -0,0 +1,21 @@
#!/sbin/runscript
depend() {
need net
use dns localmount
after bootmisc
provide chaosc
}
start() {
ebegin "starting chaosc"
start-stop-daemon --start --pidfile /var/run/chaosc.pid --make-pidfile --user sarah --group sarah --background --exec /usr/bin/chaosc
eend $?
}
stop() {
ebegin "stopping chaosc"
start-stop-daemon --stop --quiet --pidfile /var/run/chaosc.pid
eend $?
}

View File

@ -0,0 +1,21 @@
#!/sbin/runscript
depend() {
need net
use dns localmount
after bootmisc
provide dump_grabber
}
start() {
ebegin "starting dump_grabber"
start-stop-daemon --start --pidfile /var/run/dump_grabber.pid --make-pidfile --user sarah --group sarah --background --exec env DISPLAY=:0 /usr/bin/dump_grabber
eend $?
}
stop() {
ebegin "stopping dump_grabber"
start-stop-daemon --stop --quiet --pidfile /var/run/dump_grabber.pid
eend $?
}

View File

@ -0,0 +1,21 @@
#!/sbin/runscript
depend() {
need net
use dns localmount
after bootmisc
provide ekgplotter
}
start() {
ebegin "starting ekgplotter"
start-stop-daemon --start --pidfile /var/run/ekgplotter.pid --make-pidfile --user sarah --group sarah --background --exec env DISPLAY=:0 /usr/bin/ekgplotter
eend $?
}
stop() {
ebegin "stopping ekgplotter"
start-stop-daemon --stop --quiet --pidfile /var/run/ekgplotter.pid
eend $?
}

View File

@ -0,0 +1,22 @@
#!/sbin/runscript
depend() {
need net
use dns localmount
after bootmisc
provide psydisplay
}
start() {
ebegin "starting psydisplay"
start-stop-daemon --start --pidfile /var/run/psydisplay.pid --make-pidfile --user sarah --group sarah --background --exec /usr/bin/psydisplay
eend $?
}
stop() {
ebegin "stopping psydisplay"
start-stop-daemon --stop --quiet --pidfile /var/run/psydisplay.pid
eend $?
}

View File

@ -0,0 +1,13 @@
[ekgplotter]
ipv4_only = True
chaosc_host = chaosc
client_host = sensors
client_port = 8000
http_port = 9000
[dump_grabber]
ipv4_only = True
chaosc_host = chaosc
client_host = sensors
client_port = 8001
http_port = 9001

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,6 @@
host=tommy;port=8000;label=tommy
host=lucas;port=8000;label=lucas
host=stefan;port=8000;label=stefan
host=chaosc;port=7111;label=mario
host=chaosc;port=7112;label=osc2actor
host=chaosc;port=7113;label=osc2cam
host=localhost;port=9000;label=dumper
host=lucas;port=8000;label=lucas-dump
host=mario;port=8000;label=mario-resolume
host=mario;port=8001;label=mario-max
host=stefan;port=8000;label=stefan-dump
host=tommy;port=8000;label=tommy-live
host=tommy;port=8001;label=tommy-max

View File

@ -0,0 +1,19 @@
[Desktop Entry]
Comment[en_US]=
Comment=
Exec=ffmpeg -f x11grab -s 768x576 -r 30 -i :0.0+9,89 -vcodec mjpeg -vcodec mjpeg http://localhost:8090/webcam.ffm
GenericName[en_US]=Grabs a desktop region
GenericName=Grabs a desktop region
Icon=exec
MimeType=
Name[en_US]=4.48 Desktop Grabber
Name=4.48 Desktop Grabber
Path=
StartupNotify=true
Terminal=true
TerminalOptions=\s--noclose
Type=Application
X-DBUS-ServiceName=
X-DBUS-StartupType=none
X-KDE-SubstituteUID=false
X-KDE-Username=

View File

@ -0,0 +1,19 @@
[Desktop Entry]
Comment[en_US]=
Comment=
Exec=ffserver -d -f /etc/ffserver.conf -v debug\n
GenericName[en_US]=Streams desktop casts
GenericName=Streams desktop casts
Icon=exec
MimeType=
Name[en_US]=4.48 Streamer
Name=4.48 Streamer
Path=
StartupNotify=true
Terminal=true
TerminalOptions=\s--noclose
Type=Application
X-DBUS-ServiceName=
X-DBUS-StartupType=
X-KDE-SubstituteUID=false
X-KDE-Username=

View File

@ -15,47 +15,42 @@ set -g terminal-overrides 'xterm*:smcup@:rmcup@'
new-session -s 'csession'
attach-session -t 'csession'
new-window -n 'chaosc' -t 'csession:1' '/usr/bin/chaosc'
new-window -n 'socat-ekg-merle' -t 'csession:3' 'socat -d -d PTY,raw,echo=0,link=/tmp/ekg2osc-merle-in,b115200,user=sarah PTY,raw,echo=0,link=/tmp/ekg2osc-merle-out,b115200,user=sarah'
new-window -n 'socat-ekg-uwe' -t 'csession:4' 'socat -d -d PTY,raw,echo=0,link=/tmp/ekg2osc-uwe-in,b115200,user=sarah PTY,raw,echo=0,link=/tmp/ekg2osc-uwe-out,b115200,user=sarah'
new-window -n 'socat-ekg-bjoern' -t 'csession:2' 'socat -d -d PTY,raw,echo=0,link=/tmp/ekg2osc-bjoern-in,b115200,user=sarah PTY,raw,echo=0,link=/tmp/ekg2osc-bjoern-out,b115200,user=sarah'
new-window -n 'socat-ekg-bjoern' -t 'csession:2' 'socat -d -d PTY,raw,echo=0,link=/tmp/ekg2osc-bjoern-in,b115200,user=stefan PTY,raw,echo=0,link=/tmp/ekg2osc-bjoern-out,b115200,user=stefan'
new-window -n 'socat-ekg-merle' -t 'csession:3' 'socat -d -d PTY,raw,echo=0,link=/tmp/ekg2osc-merle-in,b115200,user=stefan PTY,raw,echo=0,link=/tmp/ekg2osc-merle-out,b115200,user=stefan'
new-window -n 'socat-ekg-uwe' -t 'csession:4' 'socat -d -d PTY,raw,echo=0,link=/tmp/ekg2osc-uwe-in,b115200,user=stefan PTY,raw,echo=0,link=/tmp/ekg2osc-uwe-out,b115200,user=stefan'
new-window -n 'socat-pulse-merle' -t 'csession:6' 'socat -d -d PTY,raw,echo=0,link=/tmp/pulse2osc-merle-in,b115200,user=sarah PTY,raw,echo=0,link=/tmp/pulse2osc-merle-out,b115200,user=sarah'
new-window -n 'socat-pulse-uwe' -t 'csession:7' 'socat -d -d PTY,raw,echo=0,link=/tmp/pulse2osc-uwe-in,b115200,user=sarah PTY,raw,echo=0,link=/tmp/pulse2osc-uwe-out,b115200,user=sarah'
new-window -n 'socat-pulse-bjoern' -t 'csession:5' 'socat -d -d PTY,raw,echo=0,link=/tmp/pulse2osc-bjoern-in,b115200,user=sarah PTY,raw,echo=0,link=/tmp/pulse2osc-bjoern-out,b115200,user=sarah'
new-window -n 'socat-pulse-bjoern' -t 'csession:5' 'socat -d -d PTY,raw,echo=0,link=/tmp/pulse2osc-bjoern-in,b115200,user=stefan PTY,raw,echo=0,link=/tmp/pulse2osc-bjoern-out,b115200,user=stefan'
new-window -n 'socat-pulse-merle' -t 'csession:6' 'socat -d -d PTY,raw,echo=0,link=/tmp/pulse2osc-merle-in,b115200,user=stefan PTY,raw,echo=0,link=/tmp/pulse2osc-merle-out,b115200,user=stefan'
new-window -n 'socat-pulse-uwe' -t 'csession:7' 'socat -d -d PTY,raw,echo=0,link=/tmp/pulse2osc-uwe-in,b115200,user=stefan PTY,raw,echo=0,link=/tmp/pulse2osc-uwe-out,b115200,user=stefan'
new-window -n 'socat-ehealth-merle' -t 'csession:9' 'socat -d -d PTY,raw,echo=0,link=/tmp/ehealth2osc-merle-in,b115200,user=sarah PTY,raw,echo=0,link=/tmp/ehealth2osc-merle-out,b115200,user=sarah'
new-window -n 'socat-ehealth-uwe' -t 'csession:10' 'socat -d -d PTY,raw,echo=0,link=/tmp/ehealth2osc-uwe-in,b115200,user=sarah PTY,raw,echo=0,link=/tmp/ehealth2osc-uwe-out,b115200,user=sarah'
new-window -n 'socat-ehealth-bjoern' -t 'csession:8' 'socat -d -d PTY,raw,echo=0,link=/tmp/ehealth2osc-bjoern-in,b115200,user=sarah PTY,raw,echo=0,link=/tmp/ehealth2osc-bjoern-out,b115200,user=sarah'
new-window -n 'socat-ehealth-bjoern' -t 'csession:8' 'socat -d -d PTY,raw,echo=0,link=/tmp/ehealth2osc-bjoern-in,b115200,user=stefan PTY,raw,echo=0,link=/tmp/ehealth2osc-bjoern-out,b115200,user=stefan'
new-window -n 'socat-ehealth-merle' -t 'csession:9' 'socat -d -d PTY,raw,echo=0,link=/tmp/ehealth2osc-merle-in,b115200,user=stefan PTY,raw,echo=0,link=/tmp/ehealth2osc-merle-out,b115200,user=stefan'
new-window -n 'socat-ehealth-uwe' -t 'csession:10' 'socat -d -d PTY,raw,echo=0,link=/tmp/ehealth2osc-uwe-in,b115200,user=stefan PTY,raw,echo=0,link=/tmp/ehealth2osc-uwe-out,b115200,user=stefan'
new-window -n 'ekg2osc-merle' -t 'csession:11' 'ekgmerle -D /tmp/ekg2osc-merle-out'
new-window -n 'ekg2osc-uwe' -t 'csession:12' 'ekguwe -D /tmp/ekg2osc-uwe-out'
new-window -n 'ekg2osc-bjoern' -t 'csession:13' 'ekgbjoern -D /tmp/ekg2osc-bjoern-out'
new-window -n 'ekg2osc-bjoern' -t 'csession:11' 'ekg2osc -d /tmp/ekg2osc-bjoern-out -a bjoern'
new-window -n 'ekg2osc-merle' -t 'csession:12' 'ekg2osc -d /tmp/ekg2osc-merle-out -a merle'
new-window -n 'ekg2osc-uwe' -t 'csession:13' 'ekg2osc -d /tmp/ekg2osc-uwe-out -a uwe'
new-window -n 'pulse2osc-merle' -t 'csession:14' 'pulse2osc -D /tmp/pulse2osc-merle-out -a merle'
new-window -n 'pulse2osc-uwe' -t 'csession:15' 'pulse2osc -D /tmp/pulse2osc-uwe-out -a uwe'
new-window -n 'pulse2osc-bjoern' -t 'csession:16' 'pulse2osc -D /tmp/pulse2osc-bjoern-out -a bjoern'
new-window -n 'pulse2osc-bjoern' -t 'csession:14' 'pulse2osc -d /tmp/pulse2osc-bjoern-out -a bjoern'
new-window -n 'pulse2osc-merle' -t 'csession:15' 'pulse2osc -d /tmp/pulse2osc-merle-out -a merle'
new-window -n 'pulse2osc-uwe' -t 'csession:16' 'pulse2osc -d /tmp/pulse2osc-uwe-out -a uwe'
new-window -n 'ehealth2osc-merle' -t 'csession:17' 'sleep 1 && ehealthmerle -D /tmp/ehealth2osc-merle-out'
new-window -n 'ehealth2osc-uwe' -t 'csession:18' 'sleep 1 && ehealthuwe -D /tmp/ehealth2osc-uwe-out'
new-window -n 'ehealth2osc-bjoern' -t 'csession:19' 'sleep 1 && ehealthbjoern -D /tmp/ehealth2osc-bjoern-out'
new-window -n 'ehealth2osc-bjoern' -t 'csession:17' 'ehealth2osc -d /tmp/ehealth2osc-bjoern-out -a bjoern'
new-window -n 'ehealth2osc-merle' -t 'csession:18' 'ehealth2osc -d /tmp/ehealth2osc-merle-out -a merle'
new-window -n 'ehealth2osc-uwe' -t 'csession:19' 'ehealth2osc -d /tmp/ehealth2osc-uwe-out -a uwe'
new-window -n 'test-ekg-merle' -t 'csession:21' 'python /home/sarah/dev/psychose/sensors2osc/sensors2osc/socat_ekg_test.py /tmp/ekg2osc-merle-in'
new-window -n 'test-ekg-uwe' -t 'csession:22' 'python /home/sarah/dev/psychose/sensors2osc/sensors2osc/socat_ekg_test.py /tmp/ekg2osc-uwe-in'
new-window -n 'test-ekg-bjoern' -t 'csession:20' 'python /home/sarah/dev/psychose/sensors2osc/sensors2osc/socat_ekg_test.py /tmp/ekg2osc-bjoern-in'
new-window -n 'test-ekg-bjoern' -t 'csession:20' 'python /home/stefan/dev/psychose/sensors2osc/sensors2osc/socat_ekg_test.py /tmp/ekg2osc-bjoern-in'
new-window -n 'test-ekg-merle' -t 'csession:21' 'python /home/stefan/dev/psychose/sensors2osc/sensors2osc/socat_ekg_test.py /tmp/ekg2osc-merle-in'
new-window -n 'test-ekg-uwe' -t 'csession:22' 'python /home/stefan/dev/psychose/sensors2osc/sensors2osc/socat_ekg_test.py /tmp/ekg2osc-uwe-in'
new-window -n 'test-pulse-merle' -t 'csession:24' 'python /home/sarah/dev/psychose/sensors2osc/sensors2osc/socat_pulse_test.py /tmp/pulse2osc-merle-in'
new-window -n 'test-pulse-uwe' -t 'csession:25' 'python /home/sarah/dev/psychose/sensors2osc/sensors2osc/socat_pulse_test.py /tmp/pulse2osc-uwe-in'
new-window -n 'test-pulse-bjoern' -t 'csession:23' 'python /home/sarah/dev/psychose/sensors2osc/sensors2osc/socat_pulse_test.py /tmp/pulse2osc-bjoern-in'
new-window -n 'test-pulse-bjoern' -t 'csession:23' 'python /home/stefan/dev/psychose/sensors2osc/sensors2osc/socat_pulse_test.py /tmp/pulse2osc-bjoern-in'
new-window -n 'test-pulse-merle' -t 'csession:24' 'python /home/stefan/dev/psychose/sensors2osc/sensors2osc/socat_pulse_test.py /tmp/pulse2osc-merle-in'
new-window -n 'test-pulse-uwe' -t 'csession:25' 'python /home/stefan/dev/psychose/sensors2osc/sensors2osc/socat_pulse_test.py /tmp/pulse2osc-uwe-in'
new-window -n 'test-ehealth-merle' -t 'csession:27' 'python /home/sarah/dev/psychose/sensors2osc/sensors2osc/socat_ehealth_test.py /tmp/ehealth2osc-merle-in'
new-window -n 'test-ehealth-uwe' -t 'csession:28' 'python /home/sarah/dev/psychose/sensors2osc/sensors2osc/socat_ehealth_test.py /tmp/ehealth2osc-uwe-in'
new-window -n 'test-ehealth-bjoern' -t 'csession:26' 'python /home/sarah/dev/psychose/sensors2osc/sensors2osc/socat_ehealth_test.py /tmp/ehealth2osc-bjoern-in'
new-window -n 'test-ehealth-bjoern' -t 'csession:26' 'python /home/stefan/dev/psychose/sensors2osc/sensors2osc/socat_ehealth_test.py /tmp/ehealth2osc-bjoern-in'
new-window -n 'test-ehealth-merle' -t 'csession:27' 'python /home/stefan/dev/psychose/sensors2osc/sensors2osc/socat_ehealth_test.py /tmp/ehealth2osc-merle-in'
new-window -n 'test-ehealth-uwe' -t 'csession:28' 'python /home/stefan/dev/psychose/sensors2osc/sensors2osc/socat_ehealth_test.py /tmp/ehealth2osc-uwe-in'
# new-window -n 'ekgplotter' -t 'csession:29' 'sleep 5 && ekgplotter -s'
# new-window -n 'vlc' -t 'csession:30' 'sleep 10 && vlc "http://localhost:9000/camera.mjpeg"'
select-window -t 'csession:1'
select-window -t 'csession:2'
set aggressive-resize on

View File

@ -1,30 +0,0 @@
from chaosc.transcoders_ng import *
transcoders = [
MappingTranscoder(
"/(.*?)/ekg",
"insert resolume osc address here",
[["osc_arg", 0, "osc_arg", 0, IntRange2FloatConverter(1023)]]),
MappingTranscoder(
"/(.*?)/heartbeat",
"insert resolume osc address here",
[
["osc_arg", 0, "osc_arg", 0, KeepConverter()],
["osc_arg", 1, "osc_arg", 1, KeepConverter()],
["osc_arg", 2, "osc_arg", 2, KeepConverter()]]),
MappingTranscoder(
"/(.*?)/airFlow",
"insert resolume osc address here",
[
["osc_arg", 0, "osc_arg", 0, KeepConverter()]]),
MappingTranscoder(
"/(.*?)/emg",
"insert resolume osc address here",
[
["osc_arg", 0, "osc_arg", 0, KeepConverter()]]),
MappingTranscoder(
"/(.*?)/temperature",
"insert resolume osc address here",
[
["osc_arg", 0, "osc_arg", 0, KeepConverter()]]),
]

View File

View File

@ -0,0 +1,462 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>640</width>
<height>480</height>
</rect>
</property>
<property name="font">
<font>
<family>Monospace</family>
<pointsize>12</pointsize>
<italic>true</italic>
</font>
</property>
<property name="windowTitle">
<string>DumpGrabberMain</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QGraphicsView" name="graphics_view">
<property name="minimumSize">
<size>
<width>640</width>
<height>480</height>
</size>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="ToolTipBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>220</blue>
</color>
</brush>
</colorrole>
<colorrole role="ToolTipText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="ToolTipBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>220</blue>
</color>
</brush>
</colorrole>
<colorrole role="ToolTipText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="ToolTipBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>220</blue>
</color>
</brush>
</colorrole>
<colorrole role="ToolTipText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,191 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'dump_grabber.ui'
#
# Created: Wed Dec 3 19:47:52 2014
# by: PyQt4 UI code generator 4.10.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName(_fromUtf8("MainWindow"))
MainWindow.resize(640, 480)
font = QtGui.QFont()
font.setFamily(_fromUtf8("Monospace"))
font.setPointSize(12)
font.setItalic(True)
MainWindow.setFont(font)
self.centralwidget = QtGui.QWidget(MainWindow)
self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
self.verticalLayout = QtGui.QVBoxLayout(self.centralwidget)
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
self.graphics_view = QtGui.QGraphicsView(self.centralwidget)
self.graphics_view.setMinimumSize(QtCore.QSize(640, 480))
palette = QtGui.QPalette()
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Button, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Light, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Midlight, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Dark, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Mid, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.BrightText, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Window, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Shadow, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.AlternateBase, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipBase, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipText, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Button, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Light, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Midlight, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Dark, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Mid, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.BrightText, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Window, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Shadow, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.AlternateBase, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipBase, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Button, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Light, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Midlight, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Dark, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Mid, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.BrightText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Window, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Shadow, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.AlternateBase, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipBase, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipText, brush)
self.graphics_view.setPalette(palette)
self.graphics_view.setAutoFillBackground(False)
self.graphics_view.setObjectName(_fromUtf8("graphics_view"))
self.horizontalLayout.addWidget(self.graphics_view)
self.verticalLayout.addLayout(self.horizontalLayout)
MainWindow.setCentralWidget(self.centralwidget)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
MainWindow.setWindowTitle(_translate("MainWindow", "DumpGrabberMain", None))

View File

@ -0,0 +1,9 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="icon" type="image/png" href="/icon.png" />
</head>
<body>
<img src="/texter_%d.mjpeg" alt="Smiley face" />
</body>
</html>

View File

@ -0,0 +1,422 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# This file is part of chaosc and psychosis
#
# chaosc is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# chaosc is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with chaosc. If not, see <http://www.gnu.org/licenses/>.
#
# Copyright (C) 2014 Stefan Kögl
from __future__ import absolute_import
import os
import os.path
import re
from collections import deque
import traceback
import signal
import sys
from chaosc.argparser_groups import ArgParser
from chaosc.lib import logger
from PyQt4 import QtCore, QtGui
from PyQt4.QtCore import QByteArray
from PyQt4.QtNetwork import QUdpSocket, QHostAddress
try:
from chaosc.c_osc_lib import OSCMessage, decode_osc
except ImportError:
from chaosc.osc_lib import OSCMessage, decode_osc
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
QTAPP = QtGui.QApplication([])
class ExclusiveTextStorage(object):
"""Stores the text representation of per actor osc messages"""
def __init__(self, columns, default_font, column_width, line_height, scene):
self.column_count = columns
self.colors = (
QtCore.Qt.red, QtCore.Qt.green, QtGui.QColor(46, 100, 254))
self.lines = deque()
self.default_font = default_font
self.column_width = column_width
self.line_height = line_height
self.graphics_scene = scene
self.num_lines, self.offset = divmod(480, self.line_height)
self.data = deque()
def init_columns(self):
color = self.colors[0]
for line_index in range(self.num_lines):
text_item = self.graphics_scene.addSimpleText("fooooo", self.default_font)
text_item.setBrush(color)
text_item.setPos(0, line_index * self.line_height)
self.lines.append(text_item)
def __add_text(self, column, text):
text_item = self.graphics_scene.addSimpleText(text, self.default_font)
text_item.setX(column * self.column_width)
text_item.setBrush(self.colors[column])
old_item = self.lines.popleft()
self.graphics_scene.removeItem(old_item)
self.lines.append(text_item)
def finish(self):
for column, text in self.data:
self.__add_text(column, text)
self.data.clear()
for text_index, text_item in enumerate(self.lines):
text_item.setY(text_index * self.line_height)
def add_text(self, column, text):
self.data.append((column, text))
class MainWindow(QtGui.QMainWindow):
"""This app receives per actor osc messages and provides an mjpeg stream
with colored text representation arranged in columns"""
def __init__(self, args, parent=None):
self.args = args
QtGui.QMainWindow.__init__(self, parent)
self.osc_sock = QUdpSocket(self)
logger.info("osc bind localhost %d", self.args.client_port)
self.osc_sock.bind(QHostAddress(self.args.client_host), self.args.client_port)
self.osc_sock.readyRead.connect(self.got_message)
self.osc_sock.error.connect(self.handle_osc_error)
self.subscribe()
self.graphics_view = QtGui.QGraphicsView(self)
self.resize(640, 480)
font = QtGui.QFont()
font.setFamily(_fromUtf8("Monospace"))
font.setPointSize(12)
font.setItalic(True)
self.setFont(font)
palette = QtGui.QPalette()
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Button, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Light, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Midlight, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Dark, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Mid, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.BrightText, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Window, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Shadow, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.AlternateBase, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipBase, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipText, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Button, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Light, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Midlight, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Dark, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Mid, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.BrightText, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Window, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Shadow, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.AlternateBase, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipBase, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Button, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Light, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Midlight, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Dark, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Mid, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.BrightText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Window, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Shadow, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.AlternateBase, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipBase, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipText, brush)
self.graphics_view.setPalette(palette)
self.graphics_view.setAutoFillBackground(False)
self.graphics_view.setObjectName(_fromUtf8("graphics_view"))
self.setCentralWidget(self.graphics_view)
self.graphics_view.setHorizontalScrollBarPolicy(
QtCore.Qt.ScrollBarAlwaysOff)
self.graphics_view.setVerticalScrollBarPolicy(
QtCore.Qt.ScrollBarAlwaysOff)
self.graphics_view.setRenderHint(QtGui.QPainter.Antialiasing, True)
self.graphics_view.setFrameStyle(QtGui.QFrame.NoFrame)
self.graphics_scene = QtGui.QGraphicsScene(self)
self.graphics_scene.setSceneRect(0, 0, 640, 480)
self.graphics_view.setScene(self.graphics_scene)
self.default_font = QtGui.QFont("Monospace", 12)
self.default_font.setStyleHint(QtGui.QFont.Monospace)
self.default_font.setBold(True)
self.graphics_scene.setFont(self.default_font)
self.font_metrics = QtGui.QFontMetrics(self.default_font)
self.line_height = self.font_metrics.height()
self.setWindowTitle(_translate("MainWindow", "DumpGrabberMain", None))
columns = 3
self.column_width = 640 / columns
self.text_storage = ExclusiveTextStorage(columns, self.default_font,
self.column_width,
self.line_height,
self.graphics_scene)
self.text_storage.init_columns()
self.regex = re.compile("^/(uwe|merle|bjoern)/(.*?)$")
self.osc_sock.readyRead.connect(self.got_message)
self.timer = QtCore.QTimer()
self.timer.timeout.connect(self.render_image)
self.timer.start(100)
def sigint_handler(self, ex_cls, ex, tb):
"""Handler for the SIGINT signal."""
logger.info("sigint_handler")
if ex_cls == KeyboardInterrupt:
logger.info("found KeyboardInterrupt")
self.unsubscribe()
QtGui.QApplication.exit()
else:
logger.critical(''.join(traceback.format_tb(tb)))
logger.critical('{0}: {1}'.format(ex_cls, ex))
def sigterm_handler(self, *args):
logger.info("sigterm_handler")
self.unsubscribe()
QtGui.QApplication.exit()
def subscribe(self):
logger.info("subscribe")
msg = OSCMessage("/subscribe")
logger.info(self.args.client_host)
msg.appendTypedArg(self.args.client_host, "s")
msg.appendTypedArg(self.args.client_port, "i")
msg.appendTypedArg(self.args.authenticate, "s")
if self.args.subscriber_label is not None:
msg.appendTypedArg(self.args.subscriber_label, "s")
self.osc_sock.writeDatagram(QByteArray(msg.encode_osc()), QHostAddress(self.args.chaosc_host),
self.args.chaosc_port)
def unsubscribe(self):
logger.info("unsubscribe")
msg = OSCMessage("/unsubscribe")
msg.appendTypedArg(self.args.client_host, "s")
msg.appendTypedArg(self.args.client_port, "i")
msg.appendTypedArg(self.args.authenticate, "s")
self.osc_sock.writeDatagram(QByteArray(msg.encode_osc()), QHostAddress(self.args.chaosc_host),
self.args.chaosc_port)
def handle_osc_error(self, error):
logger.info("osc socket error %d", error)
def closeEvent(self, event):
logger.info("closeEvent %r", event)
self.unsubscribe()
event.accept()
def pubdir(self):
return os.path.dirname(os.path.abspath(__file__))
def add_text(self, column, text):
self.text_storage.add_text(column, text)
def render_image(self):
# print "render_iamge"
self.text_storage.finish()
# image = QPixmap(768, 576)
# image.fill(QtCore.Qt.black)
# painter = QPainter(image)
#painter.setRenderHints(QPainter.RenderHint(
# QPainter.Antialiasing | QPainter.TextAntialiasing), True)
#painter.setFont(self.default_font)
#self.graphics_view.render(
# painter, target=QtCore.QRectF(0, 0, 768, 576),
# source=QtCore.QRect(0, 0, 768, 576))
#painter.end()
#buf = QBuffer()
#buf.open(QIODevice.WriteOnly)
#image.save(buf, "JPG", 100)
#image_data = buf.data()
#return image_data
def got_message(self):
def convert(value):
if isinstance(value, float):
return "%.1f" % value
else:
return str(value)
while self.osc_sock.hasPendingDatagrams():
data, address, port = self.osc_sock.readDatagram(
self.osc_sock.pendingDatagramSize())
try:
osc_address, typetags, args = decode_osc(data, 0, len(data))
except ValueError:
return
try:
actor, text = self.regex.match(osc_address).groups()
except AttributeError:
pass
else:
if actor == "merle":
self.add_text(0, "%s = %s" % (
text, ", ".join([convert(i) for i in args])))
elif actor == "uwe":
self.add_text(1, "%s = %s" % (
text, ", ".join([convert(i) for i in args])))
elif actor == "bjoern":
self.add_text(2, "%s = %s" % (
text, ", ".join([convert(i) for i in args])))
return True
def main():
arg_parser = ArgParser("dump_grabber")
arg_parser.add_global_group()
client_group = arg_parser.add_client_group()
arg_parser.add_argument(client_group, '-x', "--http_host", default="::",
help='my host, defaults to "::"')
arg_parser.add_argument(client_group, '-X', "--http_port", default=9001,
type=int, help='my port, defaults to 9001')
arg_parser.add_chaosc_group()
arg_parser.add_subscriber_group()
args = arg_parser.finalize()
# args.http_host, args.http_port = resolve_host(
# args.http_host, args.http_port, args.address_family)
# args.chaosc_host, args.chaosc_port = resolve_host(
# args.chaosc_host, args.chaosc_port, args.address_family)
window = MainWindow(args)
window.setWindowFlags(QtCore.Qt.FramelessWindowHint)
window.show()
sys.excepthook = window.sigint_handler
signal.signal(signal.SIGTERM, window.sigterm_handler)
QTAPP.exec_()
if __name__ == '__main__':
main()

49
dump_grabber/setup.py Normal file
View File

@ -0,0 +1,49 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
from setuptools import find_packages, setup
if sys.version_info >= (3,):
extras['use_2to3'] = True
setup(
name='dump_grabber',
version="0.2",
packages=find_packages(exclude=["scripts",]),
include_package_data = True,
exclude_package_data = {'': ['.gitignore']},
install_requires = ["psylib"],
# installing unzipped
zip_safe = False,
# predefined extension points, e.g. for plugins
entry_points = """
[console_scripts]
dump_grabber = dump_grabber.main:main
""",
# pypi metadata
author = "Stefan Kögl",
# FIXME: add author email
author_email = "",
description = "osc messages logging terminal as mjpeg stream, uses 3 columns",
# FIXME: add long_description
long_description = """
""",
# FIXME: add license
license = "LGPL",
# FIXME: add keywords
keywords = "",
# FIXME: add download url
url = "",
test_suite='tests'
)

View File

@ -1,6 +1,9 @@
char zaehler;
void setup() {
Serial.begin(115200);
pinMode(7, OUTPUT);
zaehler = 0;
}
float getTemperature(void)
@ -55,14 +58,26 @@ float getTemperature(void)
void loop() {
int airFlow = analogRead(A1);
int emg = analogRead(0);
int temp = getTemperature();
Serial.print(airFlow);
zaehler++;
// int airFlow = analogRead(A1);
// int emg = analogRead(0);
// int temp = getTemperature();
Serial.print(analogRead(A1));
Serial.print(";");
Serial.print(emg);
Serial.print(analogRead(0));
Serial.print(";");
Serial.println(temp);
Serial.println(getTemperature());
delay(100);
if(zaehler >= 10) {
zaehler = 0;
if(digitalRead(7) == HIGH) {
digitalWrite(7, LOW);
} else {
digitalWrite(7, HIGH);
}
}
}

View File

@ -0,0 +1,556 @@
#!python
"""Bootstrap distribute installation
If you want to use setuptools in your package's setup.py, just include this
file in the same directory with it, and add this to the top of your setup.py::
from distribute_setup import use_setuptools
use_setuptools()
If you want to require a specific version of setuptools, set a download
mirror, or use an alternate download directory, you can do so by supplying
the appropriate options to ``use_setuptools()``.
This file can also be run as a script to install or upgrade setuptools.
"""
import os
import shutil
import sys
import time
import fnmatch
import tempfile
import tarfile
import optparse
from distutils import log
try:
from site import USER_SITE
except ImportError:
USER_SITE = None
try:
import subprocess
def _python_cmd(*args):
args = (sys.executable,) + args
return subprocess.call(args) == 0
except ImportError:
# will be used for python 2.3
def _python_cmd(*args):
args = (sys.executable,) + args
# quoting arguments if windows
if sys.platform == 'win32':
def quote(arg):
if ' ' in arg:
return '"%s"' % arg
return arg
args = [quote(arg) for arg in args]
return os.spawnl(os.P_WAIT, sys.executable, *args) == 0
DEFAULT_VERSION = "0.6.49"
DEFAULT_URL = "http://pypi.python.org/packages/source/d/distribute/"
SETUPTOOLS_FAKED_VERSION = "0.6c11"
SETUPTOOLS_PKG_INFO = """\
Metadata-Version: 1.0
Name: setuptools
Version: %s
Summary: xxxx
Home-page: xxx
Author: xxx
Author-email: xxx
License: xxx
Description: xxx
""" % SETUPTOOLS_FAKED_VERSION
def _install(tarball, install_args=()):
# extracting the tarball
tmpdir = tempfile.mkdtemp()
log.warn('Extracting in %s', tmpdir)
old_wd = os.getcwd()
try:
os.chdir(tmpdir)
tar = tarfile.open(tarball)
_extractall(tar)
tar.close()
# going in the directory
subdir = os.path.join(tmpdir, os.listdir(tmpdir)[0])
os.chdir(subdir)
log.warn('Now working in %s', subdir)
# installing
log.warn('Installing Distribute')
if not _python_cmd('setup.py', 'install', *install_args):
log.warn('Something went wrong during the installation.')
log.warn('See the error message above.')
# exitcode will be 2
return 2
finally:
os.chdir(old_wd)
shutil.rmtree(tmpdir)
def _build_egg(egg, tarball, to_dir):
# extracting the tarball
tmpdir = tempfile.mkdtemp()
log.warn('Extracting in %s', tmpdir)
old_wd = os.getcwd()
try:
os.chdir(tmpdir)
tar = tarfile.open(tarball)
_extractall(tar)
tar.close()
# going in the directory
subdir = os.path.join(tmpdir, os.listdir(tmpdir)[0])
os.chdir(subdir)
log.warn('Now working in %s', subdir)
# building an egg
log.warn('Building a Distribute egg in %s', to_dir)
_python_cmd('setup.py', '-q', 'bdist_egg', '--dist-dir', to_dir)
finally:
os.chdir(old_wd)
shutil.rmtree(tmpdir)
# returning the result
log.warn(egg)
if not os.path.exists(egg):
raise IOError('Could not build the egg.')
def _do_download(version, download_base, to_dir, download_delay):
egg = os.path.join(to_dir, 'distribute-%s-py%d.%d.egg'
% (version, sys.version_info[0], sys.version_info[1]))
if not os.path.exists(egg):
tarball = download_setuptools(version, download_base,
to_dir, download_delay)
_build_egg(egg, tarball, to_dir)
sys.path.insert(0, egg)
import setuptools
setuptools.bootstrap_install_from = egg
def use_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
to_dir=os.curdir, download_delay=15, no_fake=True):
# making sure we use the absolute path
to_dir = os.path.abspath(to_dir)
was_imported = 'pkg_resources' in sys.modules or \
'setuptools' in sys.modules
try:
try:
import pkg_resources
# Setuptools 0.7b and later is a suitable (and preferable)
# substitute for any Distribute version.
try:
pkg_resources.require("setuptools>=0.7b")
return
except (pkg_resources.DistributionNotFound,
pkg_resources.VersionConflict):
pass
if not hasattr(pkg_resources, '_distribute'):
if not no_fake:
_fake_setuptools()
raise ImportError
except ImportError:
return _do_download(version, download_base, to_dir, download_delay)
try:
pkg_resources.require("distribute>=" + version)
return
except pkg_resources.VersionConflict:
e = sys.exc_info()[1]
if was_imported:
sys.stderr.write(
"The required version of distribute (>=%s) is not available,\n"
"and can't be installed while this script is running. Please\n"
"install a more recent version first, using\n"
"'easy_install -U distribute'."
"\n\n(Currently using %r)\n" % (version, e.args[0]))
sys.exit(2)
else:
del pkg_resources, sys.modules['pkg_resources'] # reload ok
return _do_download(version, download_base, to_dir,
download_delay)
except pkg_resources.DistributionNotFound:
return _do_download(version, download_base, to_dir,
download_delay)
finally:
if not no_fake:
_create_fake_setuptools_pkg_info(to_dir)
def download_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
to_dir=os.curdir, delay=15):
"""Download distribute from a specified location and return its filename
`version` should be a valid distribute version number that is available
as an egg for download under the `download_base` URL (which should end
with a '/'). `to_dir` is the directory where the egg will be downloaded.
`delay` is the number of seconds to pause before an actual download
attempt.
"""
# making sure we use the absolute path
to_dir = os.path.abspath(to_dir)
try:
from urllib.request import urlopen
except ImportError:
from urllib2 import urlopen
tgz_name = "distribute-%s.tar.gz" % version
url = download_base + tgz_name
saveto = os.path.join(to_dir, tgz_name)
src = dst = None
if not os.path.exists(saveto): # Avoid repeated downloads
try:
log.warn("Downloading %s", url)
src = urlopen(url)
# Read/write all in one block, so we don't create a corrupt file
# if the download is interrupted.
data = src.read()
dst = open(saveto, "wb")
dst.write(data)
finally:
if src:
src.close()
if dst:
dst.close()
return os.path.realpath(saveto)
def _no_sandbox(function):
def __no_sandbox(*args, **kw):
try:
from setuptools.sandbox import DirectorySandbox
if not hasattr(DirectorySandbox, '_old'):
def violation(*args):
pass
DirectorySandbox._old = DirectorySandbox._violation
DirectorySandbox._violation = violation
patched = True
else:
patched = False
except ImportError:
patched = False
try:
return function(*args, **kw)
finally:
if patched:
DirectorySandbox._violation = DirectorySandbox._old
del DirectorySandbox._old
return __no_sandbox
def _patch_file(path, content):
"""Will backup the file then patch it"""
f = open(path)
existing_content = f.read()
f.close()
if existing_content == content:
# already patched
log.warn('Already patched.')
return False
log.warn('Patching...')
_rename_path(path)
f = open(path, 'w')
try:
f.write(content)
finally:
f.close()
return True
_patch_file = _no_sandbox(_patch_file)
def _same_content(path, content):
f = open(path)
existing_content = f.read()
f.close()
return existing_content == content
def _rename_path(path):
new_name = path + '.OLD.%s' % time.time()
log.warn('Renaming %s to %s', path, new_name)
os.rename(path, new_name)
return new_name
def _remove_flat_installation(placeholder):
if not os.path.isdir(placeholder):
log.warn('Unkown installation at %s', placeholder)
return False
found = False
for file in os.listdir(placeholder):
if fnmatch.fnmatch(file, 'setuptools*.egg-info'):
found = True
break
if not found:
log.warn('Could not locate setuptools*.egg-info')
return
log.warn('Moving elements out of the way...')
pkg_info = os.path.join(placeholder, file)
if os.path.isdir(pkg_info):
patched = _patch_egg_dir(pkg_info)
else:
patched = _patch_file(pkg_info, SETUPTOOLS_PKG_INFO)
if not patched:
log.warn('%s already patched.', pkg_info)
return False
# now let's move the files out of the way
for element in ('setuptools', 'pkg_resources.py', 'site.py'):
element = os.path.join(placeholder, element)
if os.path.exists(element):
_rename_path(element)
else:
log.warn('Could not find the %s element of the '
'Setuptools distribution', element)
return True
_remove_flat_installation = _no_sandbox(_remove_flat_installation)
def _after_install(dist):
log.warn('After install bootstrap.')
placeholder = dist.get_command_obj('install').install_purelib
_create_fake_setuptools_pkg_info(placeholder)
def _create_fake_setuptools_pkg_info(placeholder):
if not placeholder or not os.path.exists(placeholder):
log.warn('Could not find the install location')
return
pyver = '%s.%s' % (sys.version_info[0], sys.version_info[1])
setuptools_file = 'setuptools-%s-py%s.egg-info' % \
(SETUPTOOLS_FAKED_VERSION, pyver)
pkg_info = os.path.join(placeholder, setuptools_file)
if os.path.exists(pkg_info):
log.warn('%s already exists', pkg_info)
return
log.warn('Creating %s', pkg_info)
try:
f = open(pkg_info, 'w')
except EnvironmentError:
log.warn("Don't have permissions to write %s, skipping", pkg_info)
return
try:
f.write(SETUPTOOLS_PKG_INFO)
finally:
f.close()
pth_file = os.path.join(placeholder, 'setuptools.pth')
log.warn('Creating %s', pth_file)
f = open(pth_file, 'w')
try:
f.write(os.path.join(os.curdir, setuptools_file))
finally:
f.close()
_create_fake_setuptools_pkg_info = _no_sandbox(
_create_fake_setuptools_pkg_info
)
def _patch_egg_dir(path):
# let's check if it's already patched
pkg_info = os.path.join(path, 'EGG-INFO', 'PKG-INFO')
if os.path.exists(pkg_info):
if _same_content(pkg_info, SETUPTOOLS_PKG_INFO):
log.warn('%s already patched.', pkg_info)
return False
_rename_path(path)
os.mkdir(path)
os.mkdir(os.path.join(path, 'EGG-INFO'))
pkg_info = os.path.join(path, 'EGG-INFO', 'PKG-INFO')
f = open(pkg_info, 'w')
try:
f.write(SETUPTOOLS_PKG_INFO)
finally:
f.close()
return True
_patch_egg_dir = _no_sandbox(_patch_egg_dir)
def _before_install():
log.warn('Before install bootstrap.')
_fake_setuptools()
def _under_prefix(location):
if 'install' not in sys.argv:
return True
args = sys.argv[sys.argv.index('install') + 1:]
for index, arg in enumerate(args):
for option in ('--root', '--prefix'):
if arg.startswith('%s=' % option):
top_dir = arg.split('root=')[-1]
return location.startswith(top_dir)
elif arg == option:
if len(args) > index:
top_dir = args[index + 1]
return location.startswith(top_dir)
if arg == '--user' and USER_SITE is not None:
return location.startswith(USER_SITE)
return True
def _fake_setuptools():
log.warn('Scanning installed packages')
try:
import pkg_resources
except ImportError:
# we're cool
log.warn('Setuptools or Distribute does not seem to be installed.')
return
ws = pkg_resources.working_set
try:
setuptools_dist = ws.find(
pkg_resources.Requirement.parse('setuptools', replacement=False)
)
except TypeError:
# old distribute API
setuptools_dist = ws.find(
pkg_resources.Requirement.parse('setuptools')
)
if setuptools_dist is None:
log.warn('No setuptools distribution found')
return
# detecting if it was already faked
setuptools_location = setuptools_dist.location
log.warn('Setuptools installation detected at %s', setuptools_location)
# if --root or --preix was provided, and if
# setuptools is not located in them, we don't patch it
if not _under_prefix(setuptools_location):
log.warn('Not patching, --root or --prefix is installing Distribute'
' in another location')
return
# let's see if its an egg
if not setuptools_location.endswith('.egg'):
log.warn('Non-egg installation')
res = _remove_flat_installation(setuptools_location)
if not res:
return
else:
log.warn('Egg installation')
pkg_info = os.path.join(setuptools_location, 'EGG-INFO', 'PKG-INFO')
if (os.path.exists(pkg_info) and
_same_content(pkg_info, SETUPTOOLS_PKG_INFO)):
log.warn('Already patched.')
return
log.warn('Patching...')
# let's create a fake egg replacing setuptools one
res = _patch_egg_dir(setuptools_location)
if not res:
return
log.warn('Patching complete.')
_relaunch()
def _relaunch():
log.warn('Relaunching...')
# we have to relaunch the process
# pip marker to avoid a relaunch bug
_cmd1 = ['-c', 'install', '--single-version-externally-managed']
_cmd2 = ['-c', 'install', '--record']
if sys.argv[:3] == _cmd1 or sys.argv[:3] == _cmd2:
sys.argv[0] = 'setup.py'
args = [sys.executable] + sys.argv
sys.exit(subprocess.call(args))
def _extractall(self, path=".", members=None):
"""Extract all members from the archive to the current working
directory and set owner, modification time and permissions on
directories afterwards. `path' specifies a different directory
to extract to. `members' is optional and must be a subset of the
list returned by getmembers().
"""
import copy
import operator
from tarfile import ExtractError
directories = []
if members is None:
members = self
for tarinfo in members:
if tarinfo.isdir():
# Extract directories with a safe mode.
directories.append(tarinfo)
tarinfo = copy.copy(tarinfo)
tarinfo.mode = 448 # decimal for oct 0700
self.extract(tarinfo, path)
# Reverse sort directories.
if sys.version_info < (2, 4):
def sorter(dir1, dir2):
return cmp(dir1.name, dir2.name)
directories.sort(sorter)
directories.reverse()
else:
directories.sort(key=operator.attrgetter('name'), reverse=True)
# Set correct owner, mtime and filemode on directories.
for tarinfo in directories:
dirpath = os.path.join(path, tarinfo.name)
try:
self.chown(tarinfo, dirpath)
self.utime(tarinfo, dirpath)
self.chmod(tarinfo, dirpath)
except ExtractError:
e = sys.exc_info()[1]
if self.errorlevel > 1:
raise
else:
self._dbg(1, "tarfile: %s" % e)
def _build_install_args(options):
"""
Build the arguments to 'python setup.py install' on the distribute package
"""
install_args = []
if options.user_install:
if sys.version_info < (2, 6):
log.warn("--user requires Python 2.6 or later")
raise SystemExit(1)
install_args.append('--user')
return install_args
def _parse_args():
"""
Parse the command line for options
"""
parser = optparse.OptionParser()
parser.add_option(
'--user', dest='user_install', action='store_true', default=False,
help='install in user site package (requires Python 2.6 or later)')
parser.add_option(
'--download-base', dest='download_base', metavar="URL",
default=DEFAULT_URL,
help='alternative URL from where to download the distribute package')
options, args = parser.parse_args()
# positional arguments are ignored
return options
def main(version=DEFAULT_VERSION):
"""Install or upgrade setuptools and EasyInstall"""
options = _parse_args()
tarball = download_setuptools(download_base=options.download_base)
return _install(tarball, _build_install_args(options))
if __name__ == '__main__':
sys.exit(main())

View File

@ -1,7 +1,7 @@
<HTML>
<BODY>
<img src="/camera.mjpeg" alt="Smiley face">
<img src="/camera_%d.mjpeg" alt="Smiley face">
</BODY>
</HTML>

View File

@ -24,96 +24,121 @@
from __future__ import absolute_import
#import objgraph
from datetime import datetime
import threading
import Queue
import numpy as np
import string,cgi,time, random, socket
from os import curdir, sep
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
from SocketServer import ThreadingMixIn, ForkingMixIn
import select
import re
from collections import deque
from PyQt4.QtCore import QBuffer, QByteArray, QIODevice
from PyQt4 import QtGui
import pyqtgraph as pg
from pyqtgraph.widgets.PlotWidget import PlotWidget
from chaosc.argparser_groups import *
from chaosc.lib import resolve_host
from chaosc.lib import logger, resolve_host
from datetime import datetime
from operator import attrgetter
from PyQt4 import QtGui, QtCore
from PyQt4.QtCore import QBuffer, QByteArray, QIODevice
from SocketServer import ThreadingMixIn, ForkingMixIn
#try:
#from chaosc.c_osc_lib import *
#except ImportError:
from chaosc.osc_lib import *
import logging
import numpy as np
import os.path
import pyqtgraph as pg
import Queue
import re
import select
import socket
import threading
import time
QtGui.QApplication.setGraphicsSystem('opengl')
print "systemInfo", pg.systemInfo()
try:
from chaosc.c_osc_lib import decode_osc
from chaosc.c_osc_lib import OSCMessage, decode_osc
except ImportError as e:
print(e)
from chaosc.osc_lib import decode_osc
QAPP = QtGui.QApplication([])
logging.exception(e)
from chaosc.osc_lib import OSCMessage, decode_osc
class PlotWindow(PlotWidget):
def __init__(self, title=None, **kargs):
self.win = QtGui.QMainWindow()
PlotWidget.__init__(self, **kargs)
self.win.setCentralWidget(self)
for m in ['resize']:
setattr(self, m, getattr(self.win, m))
if title is not None:
self.win.setWindowTitle(title)
class Generator(object):
def __init__(self):
self.count = 0
self.max_count = 200
self.min_puls = 75
self.max_pulse = 160
self.pulse = 83
def run(self):
data_points = 0
min_puls = 70
max_pulse = 130
pulse = random.randint(min_puls, max_pulse)
steps, sleep_time = get_steps(pulse, sleep_time)
count = 0
delta = 1
result = list()
print "pulse", pulse
print "sleep_time", sleep_time
print "steps", steps
while 1:
value = random.randint(0, steps)
if count < int(steps / 100. * 20):
value = random.randint(0,20)
elif count < int(steps / 100. * 30):
value = random.randint(20, 30)
elif count < int(steps / 100. * 40):
value = random.randint(30,100)
elif count < int(steps / 2.):
value = random.randint(100,200)
elif count == int(steps / 2.):
value = 255
elif count < int(steps / 100. * 60):
value = random.randint(100, 200)
elif count < int(steps / 100. * 70):
value = random.randint(50, 100)
elif count < int(steps / 100. * 80):
value = random.randint(20, 50)
elif count <= steps:
value = random.randint(0,20)
elif count >= steps:
count = 0
#if data_points % (5 * steps) == 0:
#print "new steps", steps, delta
#steps += delta
#if steps <= min_steps:
#delta = 1
#elif steps >= max_steps:
#print "change step sign", steps, delta
#delta = -1
time.sleep(sleep_time)
count += 1
#data_points += 1
serial_sock.write(struct.pack("B", value))
class OSCThread(threading.Thread):
def __init__(self, args):
super(OSCThread, self).__init__()
self.args = args
self.running = True
self.own_address = socket.getaddrinfo(args.own_host, args.own_port, socket.AF_INET6, socket.SOCK_DGRAM, 0, socket.AI_V4MAPPED | socket.AI_ALL | socket.AI_CANONNAME)[-1][4][:2]
self.chaosc_address = chaosc_host, chaosc_port = socket.getaddrinfo(args.chaosc_host, args.chaosc_port, socket.AF_INET6, socket.SOCK_DGRAM, 0, socket.AI_V4MAPPED | socket.AI_ALL | socket.AI_CANONNAME)[-1][4][:2]
self.client_address = resolve_host(args.client_host, args.client_port, args.address_family)
self.osc_sock = socket.socket(10, 2, 17)
self.osc_sock.bind(self.own_address)
self.chaosc_address = chaosc_host, chaosc_port = resolve_host(args.chaosc_host, args.chaosc_port, args.address_family)
self.osc_sock = socket.socket(args.address_family, 2, 17)
self.osc_sock.bind(self.client_address)
self.osc_sock.setblocking(0)
print "%s: starting up osc receiver on '%s:%d'" % (
datetime.now().strftime("%x %X"), self.own_address[0], self.own_address[1])
logger.info("%s: starting up osc receiver on '%s:%d'",
datetime.now().strftime("%x %X"), self.client_address[0], self.client_address[1])
self.subscribe_me()
def subscribe_me(self):
"""Use this procedure for a quick'n dirty subscription to your chaosc instance.
:param chaosc_address: (chaosc_host, chaosc_port)
:type chaosc_address: tuple
:param receiver_address: (host, port)
:type receiver_address: tuple
:param token: token to get authorized for subscription
:type token: str
"""
print "%s: subscribing to '%s:%d' with label %r" % (datetime.now().strftime("%x %X"), self.chaosc_address[0], self.chaosc_address[1], self.args.subscriber_label)
logger.info("%s: subscribing to '%s:%d' with label %r", datetime.now().strftime("%x %X"), self.chaosc_address[0], self.chaosc_address[1], self.args.subscriber_label)
msg = OSCMessage("/subscribe")
msg.appendTypedArg(self.own_address[0], "s")
msg.appendTypedArg(self.own_address[1], "i")
msg.appendTypedArg(self.client_address[0], "s")
msg.appendTypedArg(self.client_address[1], "i")
msg.appendTypedArg(self.args.authenticate, "s")
if self.args.subscriber_label is not None:
msg.appendTypedArg(self.args.subscriber_label, "s")
@ -124,135 +149,109 @@ class OSCThread(threading.Thread):
if self.args.keep_subscribed:
return
print "%s: unsubscribing from '%s:%d'" % (datetime.now().strftime("%x %X"), self.chaosc_address[0], self.chaosc_address[1])
logger.info("%s: unsubscribing from '%s:%d'", datetime.now().strftime("%x %X"), self.chaosc_address[0], self.chaosc_address[1])
msg = OSCMessage("/unsubscribe")
msg.appendTypedArg(self.own_address[0], "s")
msg.appendTypedArg(self.own_address[1], "i")
msg.appendTypedArg(self.client_address[0], "s")
msg.appendTypedArg(self.client_address[1], "i")
msg.appendTypedArg(self.args.authenticate, "s")
self.osc_sock.sendto(msg.encode_osc(), self.chaosc_address)
def run(self):
while self.running:
reads, writes, errs = select.select([self.osc_sock], [], [], 0.05)
if reads:
osc_input = reads[0].recv(4096)
osc_address, typetags, messages = decode_osc(osc_input, 0, len(osc_input))
#print "thread osc_address", osc_address
if osc_address.find("ekg") > -1 or osc_address.find("plot") != -1:
queue.put_nowait((osc_address, messages))
try:
reads, writes, errs = select.select([self.osc_sock], [], [], 0.005)
except Exception, e:
logging.exception(e)
pass
else:
queue.put_nowait(("/bjoern/ekg", [0]))
queue.put_nowait(("/merle/ekg", [0]))
queue.put_nowait(("/uwe/ekg", [0]))
if reads:
try:
osc_input, address = self.osc_sock.recvfrom(8192)
osc_address, typetags, messages = decode_osc(osc_input, 0, len(osc_input))
queue.put_nowait((osc_address, messages))
except Exception, e:
logger.info(e)
self.unsubscribe_me()
print "OSCThread is going down"
self.osc_sock.close()
logger.info("OSCThread is going down")
queue = Queue.Queue()
class Actor(object):
shadowPen = pg.mkPen(255, 255, 255)
brush = pg.mkBrush("w")
def __init__(self, name, num_data, color):
self.data = [0] * num_data
self.data_pointer = 0
def __init__(self, name, num_data, color, ix, max_actors, actor_height):
self.name = name
self.active = True
self.plotItem = pg.PlotCurveItem(pen=pg.mkPen(color, width=3), name=name)
self.num_data = num_data
#self.plotItem.setShadowPen(pen=Actor.shadowPen, width=3, cosmetic=True)
self.plotPoint = pg.ScatterPlotItem(pen=Actor.shadowPen, brush=self.brush, size=5)
self.color = color
self.ix = ix
self.max_actors = max_actors
self.actor_height = actor_height
self.updated = 0
self.offset = ix * actor_height
self.data = np.array([self.offset] * num_data)
self.head = 0
self.pre_head = 0
self.plotItem = pg.PlotCurveItem(pen=pg.mkPen(color, width=3), name=name)
self.plotPoint = pg.ScatterPlotItem(pen=pg.mkPen("w", width=5), brush=pg.mkBrush(color), size=5)
def __str__(self):
return "<Actor name:%r, active=%r, position=%r>" % (self.name, self.active, self.head)
__repr__ = __str__
def scale_data(self, ix, max_items):
scale = 255 / max_items * ix
return [value / max_items + scale for value in self.data]
def add_value(self, value):
dp = self.head
self.data[dp] = value / self.max_actors + self.offset
self.pre_head = dp
self.head = (dp + 1) % self.num_data
self.updated += 1
def set_point(self, value, ix, max_items):
scale = 255 / max_items * ix
self.plotPoint.setData(x = [self.data_pointer], y = [value / max_items + scale])
def fill_missing(self, count):
dp = self.head
for i in range(count):
self.data[dp] = self.offset
dp = (dp + 1) % self.num_data
self.updated += 1
#def find_max_value(self, item_data):
#max_index = -1
#for ix, i in enumerate(item_data):
#if i > 250:
#return ix, i
#return None, None
self.pre_head = (dp - 1) % self.num_data
self.head = dp
def render(self):
self.plotItem.setData(y=self.data, clear=True)
self.plotPoint.setData(x=[self.pre_head], y = [self.data[self.pre_head]])
#def rearrange(self, item_data, actual_pos, max_items):
#max_value_index, max_value = find_max_value(item_data)
#if max_value_index is None:
#return actual_pos
#mean = int(max_items / 2.)
#start = mean - max_value_index
#if start != 0:
#item_data.rotate(start)
#pos = (actual_pos + start) % max_items
#else:
#pos = actual_pos
#print "rearrange", mean, start, actual_pos, pos, item_data
#return pos
def set_value(self, value):
self.data[self.data_pointer] = value
self.data_pointer = (self.data_pointer + 1) % self.num_data
#def resize(item_data, max_length, new_max_length, pos):
#print "resize", max_length, new_max_length
#if new_max_length < 15:
#return max_length, pos
#if new_max_length > max_length:
#pad = (new_max_length - max_length)
#print "pad", pad
#for i in range(pad):
#if i % 2 == 0:
#item_data.append(0)
#else:
#item_data.appendleft(0)
#pos += 1
#return new_max_length, pos
#elif new_max_length < max_length:
#pad = (max_length - new_max_length)
#for i in range(pad):
#if i % 2 == 0:
#item_data.pop()
#if pos >= new_max_length:
#pos = 0
#else:
#item_data.popleft()
#if pos > 0:
#pos -= 1
#return new_max_length, pos
#return max_length, pos
class EkgPlot(object):
def __init__(self, actor_names, num_data, colors):
self.plot = pg.PlotWidget(title="<h1>EKG</h1>")
self.plot = pg.PlotWidget()
#self.plot.setConfigOptions(antialias=True)
self.plot.hide()
self.plot.setLabel('left', "<h2>Amplitude</h2>")
self.plot.setLabel('bottom', "<h2><sup>Time</sup></h2>")
self.plot.showGrid(True, True)
self.plot.showGrid(False, False)
self.plot.setYRange(0, 255)
self.plot.setXRange(0, num_data)
self.plot.resize(1280, 720)
self.plot.resize(768, 576)
ba = self.plot.getAxis("bottom")
bl = self.plot.getAxis("left")
ba.setTicks([])
bl.setTicks([])
ba.hide()
bl.hide()
self.active_actors = list()
self.actors = dict()
self.lengths1 = [0]
self.num_data = num_data
for actor_name, color in zip(actor_names, colors):
self.add_actor(actor_name, num_data, color)
self.max_value = 255
self.max_actors = len(actor_names)
self.actor_height = self.max_value / self.max_actors
for ix, (actor_name, color) in enumerate(zip(actor_names, colors)):
self.add_actor(actor_name, num_data, color, ix, self.max_actors, self.actor_height)
self.set_positions()
@ -261,8 +260,8 @@ class EkgPlot(object):
self.updated_actors = set()
def add_actor(self, actor_name, num_data, color):
actor_obj = Actor(actor_name, num_data, color)
def add_actor(self, actor_name, num_data, color, ix, max_actors, actor_height):
actor_obj = Actor(actor_name, num_data, color, ix, max_actors, actor_height)
self.actors[actor_name] = actor_obj
self.plot.addItem(actor_obj.plotItem)
self.plot.addItem(actor_obj.plotPoint)
@ -271,11 +270,30 @@ class EkgPlot(object):
def set_positions(self):
for ix, actor_obj in enumerate(self.active_actors):
actor_obj.plotItem.setPos(0, ix * 6)
actor_obj.plotPoint.setPos(0, ix * 6)
actor_obj.plotItem.setPos(0, ix * 2)
actor_obj.plotPoint.setPos(0, ix * 2)
def active_actor_count(self):
return len(self.active_actors)
return self.max_actors
def new_round(self):
for ix, actor in enumerate(self.active_actors):
actor.updated = 0
def update_missing_actors(self):
liste = sorted(self.active_actors, key=attrgetter("updated"))
max_values = liste[-1].updated
if max_values == 0:
# handling no signal
for actor in self.active_actors:
actor.add_value(0)
return
for ix, actor in enumerate(self.active_actors):
diff = max_values - actor.updated
if diff > 0:
for i in range(diff):
actor.add_value(0)
def update(self, osc_address, value):
@ -283,40 +301,16 @@ class EkgPlot(object):
if res:
actor_name = res.group(1)
actor_obj = self.actors[actor_name]
max_actors = len(self.active_actors)
ix = self.active_actors.index(actor_obj)
actor_data = actor_obj.data
data_pointer = actor_obj.data_pointer
actor_data[data_pointer] = value
actor_obj.set_point(value, ix, max_actors)
actor_obj.data_pointer = (data_pointer + 1) % self.num_data
actor_obj.plotItem.setData(y=np.array(actor_obj.scale_data(ix, max_actors)), clear=True)
return
actor_obj.add_value(value)
res = self.ctl_regex.match(osc_address)
if res:
actor_name = res.group(1)
actor_obj = self.actors[actor_name]
if value == 1 and not actor_obj.active:
print "actor on", actor_name
self.plot.addItem(actor_obj)
actor_obj.active = True
self.active_actors.append(actor_obj)
elif value == 0 and not actor_obj.active:
print "actor off", actor_name
self.plot.removeItem(actor_obj)
actor_obj.active = True
self.active_actors.remove(actor_obj)
self.set_positions()
def render(self):
for ix, actor in enumerate(self.active_actors):
actor.render()
class MyHandler(BaseHTTPRequestHandler):
def __del__(self):
self.thread.running = False
self.thread.join()
def do_GET(self):
try:
@ -324,121 +318,104 @@ class MyHandler(BaseHTTPRequestHandler):
if self.path=="" or self.path==None or self.path[:1]==".":
self.send_error(403,'Forbidden')
if self.path.endswith(".html"):
f = open(curdir + sep + self.path)
directory = os.path.dirname(os.path.abspath(__file__))
data = open(os.path.join(directory, self.path), "rb").read()
self.send_response(200)
self.send_header('Content-type', 'text/html')
self.send_header('Content-type', 'text/html')
self.end_headers()
self.wfile.write(f.read())
f.close()
self.wfile.write(data)
elif self.path.endswith(".mjpeg"):
self.thread = thread = OSCThread(self.server.args)
thread.daemon = True
thread.start()
self.send_response(200)
actor_names = ["bjoern", "merle", "uwe"]
actor_names = ["merle", "uwe", "bjoern" ]
num_data = 100
colors = ["r", "g", "b"]
qtapp = QtGui.QApplication([])
plotter = EkgPlot(actor_names, num_data, colors)
self.wfile.write("Content-Type: multipart/x-mixed-replace; boundary=--aaboundary\r\n\r\n")
#lastTime = time.time()
#fps = None
self.send_response(200)
self.send_header("Content-Type", "multipart/x-mixed-replace; boundary=--2342")
self.end_headers()
event_loop = QtCore.QEventLoop()
last_frame = time.time() - 1.0
frame_rate = 13.0
frame_length = 1. / frame_rate
plotter.new_round()
while 1:
event_loop.processEvents()
qtapp.sendPostedEvents(None, 0)
while 1:
try:
osc_address, args = queue.get_nowait()
plotter.update(osc_address, args[0])
except Queue.Empty:
break
plotter.update(osc_address, args[0])
now = time.time()
delta = now - last_frame
if delta > frame_length:
plotter.update_missing_actors()
plotter.render()
exporter = pg.exporters.ImageExporter.ImageExporter(plotter.plot.plotItem)
exporter.parameters()['width'] = 768
img = exporter.export(toBytes=True)
buffer = QBuffer()
buffer.open(QIODevice.WriteOnly)
img.save(buffer, "JPG")
JpegData = buffer.data()
self.wfile.write("--2342\r\nContent-Type: image/jpeg\r\nContent-length: %d\r\n\r\n%s\r\n\r\n\r\n" % (len(JpegData), JpegData))
last_frame = now
plotter.new_round()
#JpegData = None
#buffer = None
#img = None
#exporter = None
time.sleep(0.01)
exporter = pg.exporters.ImageExporter.ImageExporter(plotter.plot.plotItem)
img = exporter.export("tmpfile", True)
buffer = QBuffer()
buffer.open(QIODevice.WriteOnly)
img.save(buffer, "JPG", 100)
JpegData = buffer.data()
self.wfile.write("--aaboundary\r\nContent-Type: image/jpeg\r\nContent-length: %d\r\n\r\n%s\r\n\r\n\r\n" % (len(JpegData), JpegData))
del JpegData
del buffer
del img
del exporter
#now = time.time()
#dt = now - lastTime
#lastTime = now
#if fps is None:
#fps = 1.0/dt
#else:
#s = np.clip(dt*3., 0, 1)
#fps = fps * (1-s) + (1.0/dt) * s
#print '%0.2f fps' % fps
elif self.path.endswith(".jpeg"):
f = open(curdir + sep + self.path)
self.send_response(200)
self.send_header('Content-type','image/jpeg')
self.end_headers()
self.wfile.write(f.read())
f.close()
return
except (KeyboardInterrupt, SystemError):
print "queue size", queue.qsize()
thread.running = False
thread.join()
except IOError:
self.send_error(404,'File Not Found: %s' % self.path)
except (KeyboardInterrupt, SystemError), e:
raise e
except IOError, e:
if e[0] in (32, 104):
if hasattr(self, "thread") and self.thread is not None:
self.thread.running = False
self.thread.join()
self.thread = None
else:
pass
class JustAHTTPServer(HTTPServer):
address_family = socket.AF_INET6
pass
def main():
a = create_arg_parser("ekgplotter")
own_group = add_main_group(a)
own_group.add_argument('-x', "--http_host", default="::",
help='my host, defaults to "socket.gethostname()"')
own_group.add_argument('-X', "--http_port", default=9000,
arg_parser = ArgParser("ekgplotter")
arg_parser.add_global_group()
client_group = arg_parser.add_client_group()
arg_parser.add_argument(client_group, '-x', "--http_host", default="::",
help='my host, defaults to "::"')
arg_parser.add_argument(client_group, '-X', "--http_port", default=9000,
type=int, help='my port, defaults to 9000')
add_chaosc_group(a)
add_subscriber_group(a, "ekgplotter")
args = finalize_arg_parser(a)
arg_parser.add_chaosc_group()
arg_parser.add_subscriber_group()
args = arg_parser.finalize()
http_host, http_port = resolve_host(args.http_host, args.http_port)
print http_host, http_port
http_host, http_port = resolve_host(args.http_host, args.http_port, args.address_family)
server = JustAHTTPServer((http_host, http_port), MyHandler)
server.address_family = args.address_family
server.args = args
print "%s: starting up http server on '%s:%d'" % (
logger.info("%s: starting up http server on '%s:%d'",
datetime.now().strftime("%x %X"), http_host, http_port)
print "before start:"
#objgraph.show_growth()
try:
server.serve_forever()
except KeyboardInterrupt:
print '^C received, shutting down server'
#print "queue size", queue.qsize()
#print "show growth", objgraph.show_growth()
#import random
#objgraph.show_chain(
#objgraph.find_backref_chain(
#random.choice(objgraph.by_type('function')),
#objgraph.is_proper_module),
#filename='chain.png')
#roots = objgraph.get_leaking_objects()
#print "root", len(roots)
#objgraph.show_most_common_types(objects=roots)
#objgraph.show_refs(roots[:3], refcounts=True, filename='roots.png')
logger.info('^C received, shutting down server')
server.socket.close()
sys.exit(0)
if __name__ == '__main__':
main()

View File

@ -0,0 +1,247 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# This file is part of psychose/ekgplotter package
#
# psychose/ekgplotter is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# psychose/ekgplotter is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with psychose/ekgplotter. If not, see <http://www.gnu.org/licenses/>.
#
# Copyright (C) 2014 Stefan Kögl
from __future__ import absolute_import
import os.path
import re
from PyQt4 import QtCore, QtGui
from PyQt4.QtGui import QPixmap, QMainWindow
from PyQt4.QtCore import QIODevice, QBuffer, QByteArray
from PyQt4.QtNetwork import QUdpSocket, QHostAddress
import numpy as np
import pyqtgraph as pg
from pyqtgraph.widgets.PlotWidget import PlotWidget
from pyqtgraph.graphicsItems.PlotCurveItem import PlotCurveItem
from pyqtgraph.graphicsItems.ScatterPlotItem import ScatterPlotItem
from chaosc.argparser_groups import ArgParser
from chaosc.lib import logger, resolve_host
try:
from chaosc.c_osc_lib import OSCMessage, decode_osc
except ImportError as e:
from chaosc.osc_lib import OSCMessage, decode_osc
qtapp = QtGui.QApplication([])
def get_steps(pulse, delta_ms):
beat_length = 60000. / pulse
steps_pre = int(beat_length / delta_ms) + 1
used_sleep_time = beat_length / steps_pre
steps = int(beat_length / used_sleep_time)
return steps, used_sleep_time
class Actor(object):
def __init__(self, name, num_data, color, ix, max_actors, actor_height):
self.name = name
self.num_data = num_data
self.color = color
self.ix = ix
self.max_actors = max_actors
self.actor_height = actor_height
self.offset = ix * actor_height
self.data = np.array([self.offset + 30] * num_data)
self.head = 0
self.pre_head = 0
self.plotItem = PlotCurveItem(pen=pg.mkPen(color, width=3), width=4, name=name)
self.plotPoint = ScatterPlotItem(pen=pg.mkPen("w", width=5), brush=pg.mkBrush(color), size=5)
self.render()
def __str__(self):
return "<Actor name:%r, position=%r>" % (self.name, self.head)
def __repr__(self):
return "Actor(%r, %r, %r, %r, %r, %r)" % (self.name, self.num_data,
self.color, self.ix, self.max_actors, self.actor_height)
def add_value(self, value):
self.pre_head = self.head
self.data[self.pre_head] = value / self.max_actors + self.offset
self.head = (self.pre_head + 1) % self.num_data
def fill_missing(self, count):
dp = self.head
for i in range(count):
self.data[dp] = self.offset
dp = (dp + 1) % self.num_data
self.pre_head = (dp - 1) % self.num_data
self.head = dp
def render(self):
self.plotItem.setData(y=self.data, clear=True)
self.plotPoint.setData(x=[self.pre_head], y=[self.data[self.pre_head]])
class EkgPlotWidget(QMainWindow):
def __init__(self, args, parent=None):
self.args = args
QMainWindow.__init__(self, parent)
self.mcount = 0
self.osc_sock = QUdpSocket(self)
logger.info("osc bind localhost %d", self.args.client_port)
self.osc_sock.bind(QHostAddress(self.args.client_host), self.args.client_port)
self.osc_sock.readyRead.connect(self.got_message)
self.osc_sock.error.connect(self.handle_osc_error)
self.subscribe()
self.plot_widget = PlotWidget()
self.setCentralWidget(self.plot_widget)
self.resize(args.client_width, args.client_height)
colors = ["r", "g", "b"]
self.active_actors = list()
self.actors = dict()
self.max_value = 255
actor_names = ["merle", "uwe", "bjoern"]
self.max_actors = len(actor_names)
self.actor_height = self.max_value / self.max_actors
self.fps = 12.5
self.num_data = 100
self.plot_widget.showGrid(False, False)
self.plot_widget.setYRange(0, 255)
self.plot_widget.setXRange(0, self.num_data)
self.plot_widget.resize(args.client_width, args.client_height)
bottom_axis = self.plot_widget.getAxis("bottom")
left_axis = self.plot_widget.getAxis("left")
bottom_axis.setTicks([])
left_axis.setTicks([])
bottom_axis.hide()
left_axis.hide()
for ix, (actor_name, color) in enumerate(zip(actor_names, colors)):
self.add_actor(actor_name, self.num_data, color, ix, self.max_actors, self.actor_height)
self.set_positions()
self.ekg_regex = re.compile("^/(.*?)/ekg$")
self.heartbeat_regex = re.compile("^/(.*?)/heartbeat$")
self.timer = QtCore.QTimer()
self.timer.timeout.connect(self.render_image)
self.timer.start(50)
def subscribe(self):
logger.info("subscribe")
msg = OSCMessage("/subscribe")
msg.appendTypedArg(self.args.client_host, "s")
msg.appendTypedArg(self.args.client_port, "i")
msg.appendTypedArg(self.args.authenticate, "s")
if self.args.subscriber_label is not None:
msg.appendTypedArg(self.args.subscriber_label, "s")
self.osc_sock.writeDatagram(QByteArray(msg.encode_osc()), QHostAddress(self.args.chaosc_host),
self.args.chaosc_port)
def unsubscribe(self):
logger.info("unsubscribe")
msg = OSCMessage("/unsubscribe")
msg.appendTypedArg(self.args.client_host, "s")
msg.appendTypedArg(self.args.client_port, "i")
msg.appendTypedArg(self.args.authenticate, "s")
self.osc_sock.writeDatagram(QByteArray(msg.encode_osc()), QHostAddress(self.args.chaosc_host),
self.args.chaosc_port)
def handle_osc_error(self, error):
logger.info("osc socket error %d", error)
def closeEvent(self, event):
logger.info("closeEvent %r", event)
self.unsubscribe()
event.accept()
def pubdir(self):
return os.path.dirname(os.path.abspath(__file__))
def add_actor(self, actor_name, num_data, color, ix, max_actors, actor_height):
actor_obj = Actor(actor_name, num_data, color, ix, max_actors, actor_height)
self.actors[actor_name] = actor_obj
self.plot_widget.addItem(actor_obj.plotItem)
self.plot_widget.addItem(actor_obj.plotPoint)
self.active_actors.append(actor_obj)
def set_positions(self):
for ix, actor_obj in enumerate(self.active_actors):
actor_obj.plotItem.setPos(0, ix * 2)
actor_obj.plotPoint.setPos(0, ix * 2)
def active_actor_count(self):
return self.max_actors
def update(self, osc_address, args):
res = self.ekg_regex.match(osc_address)
if res:
self.mcount += 1
actor_name = res.group(1)
actor_obj = self.actors[actor_name]
actor_obj.add_value(args[0])
logger.info("actor: %r, %r", actor_name, args)
def render_image(self):
for actor_obj in self.active_actors:
actor_obj.add_value(actor_obj.osci.next())
actor_obj.render()
@QtCore.pyqtSlot()
def render_image(self):
for actor_obj in self.active_actors:
actor_obj.render()
print self.mcount
def got_message(self):
while self.osc_sock.hasPendingDatagrams():
data, address, port = self.osc_sock.readDatagram(self.osc_sock.pendingDatagramSize())
try:
osc_address, typetags, args = decode_osc(data, 0, len(data))
self.update(osc_address, args)
except ValueError, error:
logger.exception(error)
def main():
arg_parser = ArgParser("ekgplotter")
arg_parser.add_global_group()
arg_parser.add_chaosc_group()
arg_parser.add_subscriber_group()
client_group = arg_parser.add_client_group()
arg_parser.add_argument(client_group, '-W', "--client_width", type=int, default=640,
help='my host, defaults to "::"')
arg_parser.add_argument(client_group, '-B', "--client_height", type=int, default=480,
help='my port, defaults to 8000')
args = arg_parser.finalize()
args.chaosc_host, args.chaosc_port = resolve_host(args.chaosc_host, args.chaosc_port, args.address_family)
window = EkgPlotWidget(args)
window.setWindowFlags(QtCore.Qt.FramelessWindowHint)
logger.info("foooooooo")
window.setWindowTitle("EKGPlotterMain")
window.show()
# sys.excepthook = window.sigint_handler
# signal.signal(signal.SIGTERM, window.sigterm_handler)
qtapp.exec_()
if __name__ == '__main__':
main()

View File

@ -1,9 +1,6 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
from distribute_setup import use_setuptools
use_setuptools()
import sys
from setuptools import find_packages, setup
@ -12,7 +9,7 @@ if sys.version_info >= (3,):
setup(
name='ekgplotter',
version="0.1",
version="0.2",
packages=find_packages(exclude=["scripts",]),
include_package_data = True,
@ -22,7 +19,7 @@ setup(
exclude_package_data = {'': ['.gitignore']},
install_requires=["pyqtgraph"],
install_requires=["psylib", "pyqtgraph"],
# installing unzipped
zip_safe = False,
@ -30,7 +27,7 @@ setup(
# predefined extension points, e.g. for plugins
entry_points = """
[console_scripts]
ekgplotter = ekgplotter.main:main
ekgplotter = ekgplotter.main_qt:main
""",
# pypi metadata
author = "Stefan Kögl",

View File

@ -0,0 +1 @@
(if (contains (window_name) "VLC media player") (undecorate))

9
fensterkram/datenstrom.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash
dump_grabber -H 192.168.1.23 -P 7110 -s -o 192.168.1.34 -p 6001 -L -4
#dump_grabber -H chaosc -P 7110 -s -o 192.168.1.34 -p 6001 -L -4
#vlc --no-audio --video-on-top --no-video-title-show --no-osd \
# --repeat --qt-notification 0 --no-video-deco --autoscale \
# http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8

7
fensterkram/ekgplotter.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
ekgplotter -o 192.168.1.34 -p 6002 -L
#vlc --no-audio --video-on-top --no-video-title-show --no-osd \
# --repeat --qt-notification 0 --no-video-deco --autoscale \
# http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8

29
fensterkram/positions.sh Executable file
View File

@ -0,0 +1,29 @@
#!/bin/bash
# ekg plotter
STR="EKGPlotterMain"
wmctrl -r $STR -e 0,1600,0,640,480
wmctrl -r $STR -b add,sticky,above
# datenstroeme
STR="DumpGrabberMain"
wmctrl -r $STR -e 0,2240,0,640,480
wmctrl -r $STR -b add,sticky,above
# vlc mit Kamera
STR="Universal Pictures"
wmctrl -r $STR -e 0,2880,0,640,480
wmctrl -r $STR -b add,sticky,above
# vlc mit annes texter
STR="http://walter"
wmctrl -r $STR -e 0,2240,0,640,480
wmctrl -r $STR -b add,sticky,above
#das HealthDisplay
wmctrl -r "HD Main" -e 0,2570,480,950,570
wmctrl -r "HD Main" -b add,sticky,above
killall devilspie
devilspie &

7
fensterkram/vlc_texter.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
vlc --no-audio --video-on-top --no-video-title-show --no-osd \
--repeat --qt-notification 0 --no-video-deco --autoscale \
http://walterebert.com/playground/video/hls/sintel-trailer.m3u8

7
fensterkram/vlc_webcam.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
vlc --no-audio --video-on-top --no-video-title-show --no-osd \
--repeat --qt-notification 0 --no-video-deco --autoscale \
../streaming/Serenity\ -\ HD\ DVD\ Trailer.mp4

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<option name="DEFAULT_COMPILER" value="Javac" />
<resourceExtensions />
<wildcardResourcePatterns>
<entry name="!?*.java" />
<entry name="!?*.form" />
<entry name="!?*.class" />
<entry name="!?*.groovy" />
<entry name="!?*.scala" />
<entry name="!?*.flex" />
<entry name="!?*.kt" />
<entry name="!?*.clj" />
</wildcardResourcePatterns>
<annotationProcessing>
<profile default="true" name="Default" enabled="false">
<processorPath useClasspath="true" />
</profile>
<profile default="false" name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<processorPath useClasspath="true" />
<module name="healthdisplay" />
</profile>
</annotationProcessing>
<bytecodeTargetLevel>
<module name="healthdisplay" target="1.7" />
</bytecodeTargetLevel>
</component>
</project>

View File

@ -0,0 +1,3 @@
<component name="CopyrightManager">
<settings default="" />
</component>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
</project>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: asm:asm:3.0">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/asm/asm/3.0/asm-3.0.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/asm/asm/3.0/asm-3.0-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/asm/asm/3.0/asm-3.0-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: asm:asm-commons:3.0">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/asm/asm-commons/3.0/asm-commons-3.0.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/asm/asm-commons/3.0/asm-commons-3.0-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/asm/asm-commons/3.0/asm-commons-3.0-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: asm:asm-tree:3.0">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/asm/asm-tree/3.0/asm-tree-3.0.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/asm/asm-tree/3.0/asm-tree-3.0-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/asm/asm-tree/3.0/asm-tree-3.0-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.illposed.osc:javaosc-core:0.2">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/illposed/osc/javaosc-core/0.2/javaosc-core-0.2.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/illposed/osc/javaosc-core/0.2/javaosc-core-0.2-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/illposed/osc/javaosc-core/0.2/javaosc-core-0.2-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.intellij:forms_rt:7.0.3">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/intellij/forms_rt/7.0.3/forms_rt-7.0.3.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/intellij/forms_rt/7.0.3/forms_rt-7.0.3-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/intellij/forms_rt/7.0.3/forms_rt-7.0.3-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.jgoodies:forms:1.1-preview">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/jgoodies/forms/1.1-preview/forms-1.1-preview.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/jgoodies/forms/1.1-preview/forms-1.1-preview-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/jgoodies/forms/1.1-preview/forms-1.1-preview-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: jdom:jdom:1.0">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/jdom/jdom/1.0/jdom-1.0.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/jdom/jdom/1.0/jdom-1.0-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/jdom/jdom/1.0/jdom-1.0-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: log4j:log4j:1.2.9">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/log4j/log4j/1.2.9/log4j-1.2.9.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/log4j/log4j/1.2.9/log4j-1.2.9-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/log4j/log4j/1.2.9/log4j-1.2.9-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.jboss.netty:netty:3.2.7.Final">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/jboss/netty/netty/3.2.7.Final/netty-3.2.7.Final.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/jboss/netty/netty/3.2.7.Final/netty-3.2.7.Final-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/jboss/netty/netty/3.2.7.Final/netty-3.2.7.Final-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.snmp4j:snmp4j:1.9.1f">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/snmp4j/snmp4j/1.9.1f/snmp4j-1.9.1f.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/snmp4j/snmp4j/1.9.1f/snmp4j-1.9.1f-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/snmp4j/snmp4j/1.9.1f/snmp4j-1.9.1f-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<entry_points version="2.0" />
</component>
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" assert-keyword="true" jdk-15="true" project-jdk-name="1.7" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/healthdisplay.iml" filepath="$PROJECT_DIR$/healthdisplay.iml" />
</modules>
</component>
</project>

View File

@ -0,0 +1,5 @@
<component name="DependencyValidationManager">
<state>
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
</state>
</component>

View File

@ -0,0 +1,139 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
<item class="de.psychose.StatsDisplay" icon="" removable="true" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="0" />
</item>
<item class="de.psychose.PulseControl" icon="" removable="true" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="0" />
</item>
<item class="de.psychose.ActorHeart" icon="" removable="true" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="0" />
</item>
<item class="de.psychose.ActorDisplay" icon="" removable="true" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="0" />
</item>
<item class="de.psychose.TemperatureControl" icon="" removable="true" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="0" />
</item>
</group>
</component>
</project>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>

10
healthdisplay/README Normal file
View File

@ -0,0 +1,10 @@
you need jdk 1.7 or newer and maven2 installed
compile with
mvn clean compile ideauidesigner:javac2 assembly:single
run with
java -jar psychose-X.X-jar-with-dependencies.jar

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="clibwrapper_jiio" level="project" />
<orderEntry type="library" name="jai_imageio" level="project" />
<orderEntry type="library" name="Maven: com.illposed.osc:javaosc-core:0.2" level="project" />
<orderEntry type="library" name="Maven: com.intellij:forms_rt:7.0.3" level="project" />
<orderEntry type="library" name="Maven: asm:asm-commons:3.0" level="project" />
<orderEntry type="library" name="Maven: asm:asm-tree:3.0" level="project" />
<orderEntry type="library" name="Maven: asm:asm:3.0" level="project" />
<orderEntry type="library" name="Maven: com.jgoodies:forms:1.1-preview" level="project" />
<orderEntry type="library" name="Maven: jdom:jdom:1.0" level="project" />
</component>
</module>

96
healthdisplay/pom.xml Normal file
View File

@ -0,0 +1,96 @@
<project>
<modelVersion>4.0.0</modelVersion>
<name>Maven Default Project</name>
<version>1.1</version>
<artifactId>psychose</artifactId>
<groupId>psy</groupId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>com.illposed.osc</groupId>
<artifactId>javaosc-core</artifactId>
<version>0.2</version>
</dependency>
<!--<dependency>-->
<!--<groupId>org.jboss.netty</groupId>-->
<!--<artifactId>netty</artifactId>-->
<!--<version>3.2.7.Final</version>-->
<!--</dependency>-->
<dependency>
<groupId>com.intellij</groupId>
<artifactId>forms_rt</artifactId>
<version>7.0.3</version>
<scope>compile</scope>
</dependency>
<!--<dependency>-->
<!--<groupId>org.snmp4j</groupId>-->
<!--<artifactId>snmp4j</artifactId>-->
<!--<version>1.9.1f</version>-->
<!--</dependency>-->
</dependencies>
<repositories>
<repository>
<id>central</id>
<name>Maven Repository Switchboard</name>
<layout>default</layout>
<url>http://repo1.maven.org/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>de.psychose.Main</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>ideauidesigner-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>javac2</goal>
</goals>
</execution>
</executions>
<configuration>
<fork>true</fork>
<debug>true</debug>
<failOnError>true</failOnError>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,162 @@
package de.psychose;
/**
* @author: lucas
* @date: 17.11.14 21:07
*/
public class ActorData {
private String actor = "";
private String caption = "";
private PulseData pulseData = new PulseData();
private int airflow;
private int ekg;
private int emg;
private double temperature;
private double temperatureOffset;
private boolean tommyHeartbeat;
private long timestampPulse = 0;
private long timestampHeartbeat = 0;
private long timestampOxygen = 0;
private long timestampTommyHeartbeat = 0;
private long timestampEkg = 0;
private long timestampEmg = 0;
private long timestampTemperature = 0;
private long timestampBreath = 0;
public ActorData(String actor, String caption) {
this.actor = actor;
this.caption = caption;
}
public String getActor() {
return actor;
}
public String getCaption() {
return caption;
}
public int getOxygen() {
return pulseData.getOxygen();
}
public void setOxygen(int oxygen) {
timestampOxygen = System.currentTimeMillis();
pulseData.setOxygen(oxygen);
}
public boolean getHeartbeat() {
return pulseData.getHeartbeat();
}
public void setHeartbeat(boolean heartbeat) {
timestampHeartbeat = System.currentTimeMillis();
pulseData.setHeartbeat(heartbeat);
}
public int getPulse() {
return pulseData.getPulse();
}
public void setPulse(int pulse) {
timestampPulse = System.currentTimeMillis();
pulseData.setPulse(pulse);
}
public int getAirflow() {
return airflow;
}
public void setAirflow(int airflow) {
this.airflow = airflow;
this.timestampBreath = System.currentTimeMillis();
}
public int getEkg() {
return ekg;
}
public void setEkg(int ekg) {
this.ekg = ekg;
this.timestampEkg = System.currentTimeMillis();
}
public int getEmg() {
return emg;
}
public void setEmg(int emg) {
this.emg = emg;
this.timestampEmg = System.currentTimeMillis();
}
public double getTemperature() {
return temperature;
}
public void setTemperature(double temperature) {
this.temperature = temperature;
this.timestampTemperature = System.currentTimeMillis();
}
public boolean getTommyHeartbeat() {
return tommyHeartbeat;
}
public void setTommyHeartbeat(boolean tommyHeartbeat) {
this.tommyHeartbeat = tommyHeartbeat;
this.timestampTommyHeartbeat = System.currentTimeMillis();
}
public double getTemperatureOffset() {
return temperatureOffset;
}
public void setTemperatureOffset(double temperatureOffset) {
this.temperatureOffset = temperatureOffset;
}
public long getTimestampPulse() {
return timestampPulse;
}
public long getTimestampEkg() {
return timestampEkg;
}
public long getTimestampEmg() {
return timestampEmg;
}
public long getTimestampTemperature() {
return timestampTemperature;
}
public long getTimestampBreath() {
return timestampBreath;
}
@Override
public String toString() {
return "ActorData{" +
"actor='" + actor + '\'' +
", caption='" + caption + '\'' +
", airflow=" + airflow +
", ekg=" + ekg +
", emg=" + emg +
", temperature=" + temperature +
", temperatureOffset=" + temperatureOffset +
", tommyHeartbeat=" + tommyHeartbeat +
", timestampPulse=" + timestampPulse +
", timestampHeartbeat=" + timestampHeartbeat +
", timestampOxygen=" + timestampOxygen +
", timestampTommyHeartbeat=" + timestampTommyHeartbeat +
", timestampEkg=" + timestampEkg +
", timestampEmg=" + timestampEmg +
", timestampTemperature=" + timestampTemperature +
", timestampBreath=" + timestampBreath +
'}';
}
}

View File

@ -0,0 +1,175 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="de.psychose.ActorDisplay">
<grid id="27dc6" binding="mainPanel" layout-manager="GridLayoutManager" row-count="9" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="4" left="6" bottom="4" right="6"/>
<constraints>
<xy x="20" y="20" width="316" height="302"/>
</constraints>
<properties>
<background color="-16777216"/>
<foreground color="-1"/>
<minimumSize width="220" height="250"/>
<preferredSize width="0" height="0"/>
</properties>
<border type="none">
<color color="-11447983"/>
</border>
<children>
<component id="bd8cd" class="javax.swing.JLabel">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<font name="Droid Sans Mono" size="20"/>
<foreground color="-1"/>
<text value="Puls"/>
</properties>
</component>
<vspacer id="1290">
<constraints>
<grid row="8" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<component id="d0a2" class="javax.swing.JLabel" binding="lblPulse">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<font name="Droid Sans Mono" size="20"/>
<foreground color="-1"/>
<text value="-"/>
</properties>
</component>
<component id="87d0b" class="javax.swing.JLabel">
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<font name="Droid Sans Mono" size="20"/>
<foreground color="-1"/>
<text value="Oxy"/>
</properties>
</component>
<component id="8ed94" class="javax.swing.JLabel">
<constraints>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<font name="Droid Sans Mono" size="20"/>
<foreground color="-1"/>
<text value="EKG"/>
</properties>
</component>
<component id="6b43c" class="javax.swing.JLabel">
<constraints>
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<font name="Droid Sans Mono" size="20"/>
<foreground color="-1"/>
<text value="EMG"/>
</properties>
</component>
<component id="c92b9" class="javax.swing.JLabel">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<font name="Droid Sans Mono" size="20"/>
<foreground color="-1"/>
<text value="Herz"/>
</properties>
</component>
<component id="e1c6d" class="javax.swing.JLabel" binding="lblOxy">
<constraints>
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<font name="Droid Sans Mono" size="20"/>
<foreground color="-1"/>
<text value="-"/>
</properties>
</component>
<component id="5ed45" class="javax.swing.JLabel" binding="lblEkg">
<constraints>
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<font name="Droid Sans Mono" size="20"/>
<foreground color="-1"/>
<text value="-"/>
</properties>
</component>
<component id="c159" class="javax.swing.JLabel" binding="lblEmg">
<constraints>
<grid row="5" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<font name="Droid Sans Mono" size="20"/>
<foreground color="-1"/>
<text value="-"/>
</properties>
</component>
<component id="a5eac" class="javax.swing.JLabel" binding="lblHeartbeat">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<font name="Droid Sans Mono" size="20"/>
<foreground color="-1"/>
<text value="-"/>
</properties>
</component>
<component id="4d72a" class="javax.swing.JLabel">
<constraints>
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<font name="Droid Sans Mono" size="20"/>
<foreground color="-1"/>
<text value="Temp"/>
</properties>
</component>
<component id="3a160" class="javax.swing.JLabel" binding="lblTemperature">
<constraints>
<grid row="6" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<font name="Droid Sans Mono" size="20"/>
<foreground color="-1"/>
<text value="-"/>
</properties>
</component>
<component id="29a78" class="javax.swing.JLabel">
<constraints>
<grid row="7" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<font name="Droid Sans Mono" size="20"/>
<foreground color="-1"/>
<text value="Atem"/>
</properties>
</component>
<component id="bb84f" class="javax.swing.JLabel" binding="lblBreath">
<constraints>
<grid row="7" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<font name="Droid Sans Mono" size="20"/>
<foreground color="-1"/>
<text value="-"/>
</properties>
</component>
<component id="9b787" class="javax.swing.JLabel" binding="lblCaption">
<constraints>
<grid row="0" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<font name="Droid Sans Mono" size="28" style="1"/>
<foreground color="-1"/>
<text value="Label"/>
</properties>
</component>
</children>
</grid>
</form>

View File

@ -0,0 +1,66 @@
package de.psychose;
import javax.swing.*;
import java.awt.*;
import java.text.DecimalFormat;
/**
* @author: lucas
* @date: 14.04.14 21:44
*/
public class ActorDisplay {
private static final long TIMEOUT_MILLISECONDS = 2000;
private JLabel lblCaption;
private JLabel lblHeartbeat;
private JLabel lblPulse;
private JLabel lblOxy;
private JLabel lblEkg;
private JLabel lblEmg;
private JLabel lblTemperature;
private JLabel lblBreath;
private JPanel mainPanel;
private ActorData actorData;
private boolean showErrors = false;
private DecimalFormat df = new DecimalFormat("#.0");
public void update() {
if (actorData == null) {
return;
}
lblBreath.setText(String.valueOf(actorData.getAirflow()));
lblTemperature.setText(df.format(actorData.getTemperature() + actorData.getTemperatureOffset()));
lblEkg.setText(String.valueOf(actorData.getEkg()));
lblPulse.setText(actorData.getHeartbeat() ? "systole" : "diastole");
lblEmg.setText(String.valueOf(actorData.getEmg()));
lblOxy.setText(String.valueOf(actorData.getOxygen()));
lblHeartbeat.setText(String.valueOf(actorData.getPulse()));
if (showErrors) {
checkTimeout(lblTemperature, actorData.getTimestampTemperature());
checkTimeout(lblPulse, actorData.getTimestampPulse());
checkTimeout(lblOxy, actorData.getTimestampPulse());
checkTimeout(lblHeartbeat, actorData.getTimestampPulse());
checkTimeout(lblEkg, actorData.getTimestampEkg());
checkTimeout(lblEmg, actorData.getTimestampEmg());
checkTimeout(lblBreath, actorData.getTimestampBreath());
}
}
public void init(ActorData actorData, final boolean showErrors) {
this.actorData = actorData;
lblCaption.setText(actorData.getCaption());
this.showErrors = showErrors;
}
private void checkTimeout(final JLabel label, final long time) {
if (time < System.currentTimeMillis() - TIMEOUT_MILLISECONDS) {
label.setText("no data");
label.setForeground(Color.red);
} else {
label.setForeground(Color.white);
}
}
}

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="de.psychose.ActorHeart">
<grid id="27dc6" binding="mainPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints>
<xy x="20" y="20" width="789" height="299"/>
</constraints>
<properties>
<background color="-16777216"/>
<enabled value="true"/>
<focusable value="false"/>
<maximumSize width="789" height="299"/>
<minimumSize width="789" height="299"/>
<preferredSize width="789" height="299"/>
</properties>
<border type="none"/>
<children/>
</grid>
</form>

View File

@ -0,0 +1,57 @@
package de.psychose;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.IOException;
/**
* @author: lucas
* @date: 15.11.14 21:36
*/
public class ActorHeart {
private JPanel mainPanel;
private ActorData[] actorDatas;
private ImagePanel imagePanel;
public ActorHeart() {
imagePanel = new ImagePanel("/de/psychose/heart1_klein_inv.jpg", "/de/psychose/heart2_klein_inv.jpg");
mainPanel.add(imagePanel);
}
public void update() {
imagePanel.repaint();
}
public void setActorDatas(final ActorData[] actorDatas) {
this.actorDatas = actorDatas;
}
private class ImagePanel extends JPanel {
private BufferedImage image1;
private BufferedImage image2;
public ImagePanel(String imageA, String imageB) {
try {
image1 = ImageIO.read(getClass().getResourceAsStream(imageA));
image2 = ImageIO.read(getClass().getResourceAsStream(imageB));
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
if (actorDatas != null) {
for (int i = 0; i < actorDatas.length; i++) {
if (actorDatas[i] != null) {
g.drawImage(actorDatas[i].getTommyHeartbeat() ? image1 : image2, 263 * i, 0, null, null);
}
}
}
}
}
}

View File

@ -0,0 +1,100 @@
package de.psychose;
import com.illposed.osc.OSCListener;
import com.illposed.osc.OSCMessage;
import com.illposed.osc.OSCPortIn;
import com.illposed.osc.OSCPortOut;
import java.io.IOException;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.net.UnknownHostException;
import java.util.Enumeration;
/**
* @author: lucas
* @date: 13.04.14 17:03
*/
public class ChaOSCclient {
private final static int OSC_CLIENT_PORT = 8123;
private OSCPortIn portIn;
private OSCPortOut portOut;
public ChaOSCclient(String host, int port) throws UnknownHostException, SocketException {
portOut = new OSCPortOut(InetAddress.getByName(host), port);
try {
portIn = new OSCPortIn(OSC_CLIENT_PORT);
} catch (SocketException se) {
System.out.println("Port " + OSC_CLIENT_PORT + " already in use. Trying " + OSC_CLIENT_PORT + 1);
portIn = new OSCPortIn(OSC_CLIENT_PORT + 1);
}
}
public void addListener(String address, OSCListener listener) {
portIn.addListener(address, listener);
}
public boolean stopReceiver() {
portIn.stopListening();
return changeChaoscSubscription(false);
}
public boolean startReceiver() {
portIn.startListening();
return changeChaoscSubscription(true);
}
public void sendMessage(final String address, Object... args) {
try {
OSCMessage subscribeMessage = new OSCMessage(address);
for(Object param: args) {
subscribeMessage.addArgument(param);
}
portOut.send(subscribeMessage);
} catch (IOException e) {
System.out.println("could not send pulse OSC Message");
e.printStackTrace();
}
}
private boolean changeChaoscSubscription(boolean subscribe) {
try {
OSCMessage subscribeMessage = new OSCMessage("/" + (subscribe ? "subscribe" : "unsubscribe"));
subscribeMessage.addArgument(getLocalAddress().getHostAddress());
subscribeMessage.addArgument(OSC_CLIENT_PORT);
subscribeMessage.addArgument("sekret");
subscribeMessage.addArgument("statusmonitor");
portOut.send(subscribeMessage);
return true;
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("could not change chaosc subscription message");
return false;
}
private InetAddress getLocalAddress() throws SocketException {
final Enumeration<NetworkInterface> n = NetworkInterface.getNetworkInterfaces();
while (n.hasMoreElements()) {
NetworkInterface e = n.nextElement();
Enumeration<InetAddress> a = e.getInetAddresses();
for (; a.hasMoreElements(); ) {
InetAddress addr = a.nextElement();
if (addr.isSiteLocalAddress()) {
System.out.println("found address: " + addr.getHostAddress());
return addr;
}
}
}
throw new SocketException();
}
}

View File

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="de.psychose.ControlForm">
<grid id="27dc6" binding="rootPanel" layout-manager="GridLayoutManager" row-count="3" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="10" left="10" bottom="10" right="10"/>
<constraints>
<xy x="20" y="20" width="704" height="400"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<nested-form id="680ad" form-file="de/psychose/PulseControl.form" binding="pulse1">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
</nested-form>
<nested-form id="8c36a" form-file="de/psychose/PulseControl.form" binding="pulse2">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
</nested-form>
<nested-form id="94992" form-file="de/psychose/PulseControl.form" binding="pulse3">
<constraints>
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
</nested-form>
<nested-form id="c060f" form-file="de/psychose/ActorDisplay.form" binding="actor1">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
</nested-form>
<nested-form id="abfde" form-file="de/psychose/ActorDisplay.form" binding="actor2">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
</nested-form>
<nested-form id="97d21" form-file="de/psychose/ActorDisplay.form" binding="actor3">
<constraints>
<grid row="2" column="2" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
</nested-form>
<nested-form id="f7ec5" form-file="de/psychose/TemperatureControl.form" binding="temp1">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
</nested-form>
<nested-form id="bcc93" form-file="de/psychose/TemperatureControl.form" binding="temp2">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
</nested-form>
<nested-form id="3726f" form-file="de/psychose/TemperatureControl.form" binding="temp3">
<constraints>
<grid row="1" column="2" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
</nested-form>
</children>
</grid>
</form>

View File

@ -0,0 +1,68 @@
package de.psychose;
import javax.swing.*;
import java.util.Observable;
import java.util.Observer;
/**
* @author: lucas
* @date: 15.11.14 22:23
*/
public class ControlForm extends JFrame {
private PulseControl pulse1;
private PulseControl pulse2;
private PulseControl pulse3;
private JPanel rootPanel;
private ActorDisplay actor1;
private ActorDisplay actor2;
private ActorDisplay actor3;
private TemperatureControl temp1;
private TemperatureControl temp2;
private TemperatureControl temp3;
private final ChaOSCclient osCclient;
public ControlForm(ChaOSCclient chaOSCclient, final ActorData[] actorData) {
super("HD Control");
this.osCclient = chaOSCclient;
setContentPane(rootPanel);
setResizable(false);
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
addActor(pulse1, actor1, temp1, actorData[0]);
addActor(pulse2, actor2, temp2, actorData[1]);
addActor(pulse3, actor3, temp3, actorData[2]);
pack();
setVisible(true);
}
private void addActor(final PulseControl pulse, final ActorDisplay display, final TemperatureControl temp, final ActorData actorData) {
pulse.addObserver(new Observer() {
@Override
public void update(Observable o, Object arg) {
if (arg instanceof PulseData) {
final PulseData data = (PulseData) arg;
osCclient.sendMessage("/" + actorData.getActor().toLowerCase() + "/heartbeat", data.getHeartbeat(),
data.getPulse(), data.getOxygen());
// TODO: delete this line, bc tommy will send the real events
osCclient.sendMessage("/" + actorData.getActor().toLowerCase() + "/tommyheartbeat");
}
}
});
temp.addObserver(new Observer() {
@Override
public void update(Observable o, Object arg) {
if (arg instanceof Double) {
actorData.setTemperatureOffset((double)arg);
}
}
});
display.init(actorData, true);
}
}

View File

@ -0,0 +1,129 @@
package de.psychose;
import com.illposed.osc.OSCListener;
import com.illposed.osc.OSCMessage;
import javax.swing.*;
import java.net.SocketException;
import java.net.UnknownHostException;
import java.util.Date;
/**
* @author: lucas
* @date: 25.04.14 00:23
*/
public class Main {
public static void main(String[] args) {
new Main();
}
public Main() {
final ActorData[] actorDatas = new ActorData[3];
actorDatas[0] = new ActorData("merle", "Körper 1");
actorDatas[1] = new ActorData("uwe", "Körper 2");
actorDatas[2] = new ActorData("bjoern", "Körper 3");
try {
UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
} catch (Exception e) {
e.printStackTrace();
}
try {
final ChaOSCclient chaOSCclient = new ChaOSCclient("chaosc", 7110);
for(int i = 0; i < actorDatas.length; i++) {
addActorOSCListeners(chaOSCclient, actorDatas[i]);
}
chaOSCclient.startReceiver();
new ControlForm(chaOSCclient, actorDatas);
new MainForm(actorDatas);
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
@Override
public void run() {
chaOSCclient.stopReceiver();
}
}));
} catch (UnknownHostException | SocketException e) {
e.printStackTrace();
}
}
private static void addActorOSCListeners(final ChaOSCclient chaOSCclient, final ActorData actorData) {
chaOSCclient.addListener("/" + actorData.getActor().toLowerCase() + "/heartbeat", new OSCListener() {
@Override
public void acceptMessage(Date time, OSCMessage message) {
if (message.getArguments().length == 3) {
// set the beat ( 0 or 1 )
if (message.getArguments()[0] instanceof Integer) {
actorData.setHeartbeat( (int)(message.getArguments()[0]) == 1);
}
// set the heartrate
if (message.getArguments()[1] instanceof Integer) {
final int pulse = (int) (message.getArguments()[1]);
if (pulse > 60) { // try to skip the invalid pulse rate from device
actorData.setPulse(pulse);
}
}
// set the oxy level
if (message.getArguments()[2] instanceof Integer) {
actorData.setOxygen((int) (message.getArguments()[2]));
}
}
}
});
chaOSCclient.addListener("/" + actorData.getActor().toLowerCase() + "/ekg", new OSCListener() {
@Override
public void acceptMessage(Date time, OSCMessage message) {
if (message.getArguments().length == 1 && message.getArguments()[0] instanceof Integer) {
actorData.setEkg((int) (message.getArguments()[0]));
}
}
});
chaOSCclient.addListener("/" + actorData.getActor().toLowerCase() + "/emg", new OSCListener() {
@Override
public void acceptMessage(Date time, OSCMessage message) {
if (message.getArguments().length == 1 && message.getArguments()[0] instanceof Integer) {
actorData.setEmg((int) (message.getArguments()[0]));
}
}
});
chaOSCclient.addListener("/" + actorData.getActor().toLowerCase() + "/temperature", new OSCListener() {
@Override
public void acceptMessage(Date time, OSCMessage message) {
if (message.getArguments().length == 1 && message.getArguments()[0] instanceof Float) {
actorData.setTemperature((float) (message.getArguments()[0]));
}
}
});
chaOSCclient.addListener("/" + actorData.getActor().toLowerCase() + "/airFlow", new OSCListener() {
@Override
public void acceptMessage(Date time, OSCMessage message) {
if (message.getArguments().length == 1 && message.getArguments()[0] instanceof Integer) {
actorData.setAirflow((int) (message.getArguments()[0]));
}
}
});
//TODO: evtl muss das oben hier noch anders
chaOSCclient.addListener("/" + actorData.getActor().toLowerCase() + "/tommyheartbeat", new OSCListener() {
@Override
public void acceptMessage(Date time, OSCMessage message) {
actorData.setTommyHeartbeat(!actorData.getTommyHeartbeat());
}
});
}
}

View File

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="de.psychose.MainForm">
<grid id="27dc6" binding="mainPanel" layout-manager="GridLayoutManager" row-count="2" column-count="5" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="0" y="0" width="930" height="560"/>
</constraints>
<properties>
<background color="-16777216"/>
<foreground color="-1"/>
<maximumSize width="1000" height="1000"/>
<minimumSize width="930" height="560"/>
<preferredSize width="950" height="570"/>
</properties>
<border type="none"/>
<children>
<nested-form id="7ac3d" form-file="de/psychose/ActorDisplay.form" binding="actor1">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
</nested-form>
<nested-form id="e6dc4" form-file="de/psychose/ActorHeart.form" binding="heart">
<constraints>
<grid row="1" column="0" row-span="1" col-span="4" vsize-policy="3" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
</nested-form>
<nested-form id="18353" form-file="de/psychose/ActorDisplay.form" binding="actor2">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
</nested-form>
<nested-form id="d8afa" form-file="de/psychose/ActorDisplay.form" binding="actor3">
<constraints>
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
</nested-form>
<component id="fe39c" class="javax.swing.JLabel" binding="breath">
<constraints>
<grid row="0" column="3" row-span="1" col-span="2" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<enabled value="true"/>
<font size="70"/>
<foreground color="-1"/>
<horizontalAlignment value="0"/>
<horizontalTextPosition value="0"/>
<text value="999"/>
</properties>
</component>
<hspacer id="10ad8">
<constraints>
<grid row="1" column="4" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
</children>
</grid>
</form>

View File

@ -0,0 +1,53 @@
package de.psychose;
import javax.swing.*;
import java.awt.event.ActionEvent;
/**
* @author: lucas
* @date: 14.04.14 21:43
*/
public class MainForm extends JFrame {
private JPanel mainPanel;
private ActorHeart heart;
private ActorDisplay actor1;
private ActorDisplay actor2;
private ActorDisplay actor3;
private JLabel breath;
public MainForm(final ActorData[] actorDatas) {
super("HD Main");
setContentPane(mainPanel);
setResizable(false);
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setUndecorated(true);
actor1.init(actorDatas[0], false);
actor2.init(actorDatas[1], false);
actor3.init(actorDatas[2], false);
heart.setActorDatas(actorDatas);
// this is now our main timer to update all and everything gui related
final Timer timer = new Timer(50, new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
// update the breath display
breath.setText(String.valueOf(actorDatas[0].getAirflow()));
actor1.update();
actor2.update();
actor3.update();
heart.update();
}
});
timer.start();
pack();
setVisible(true);
}
}

View File

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="de.psychose.PulseControl">
<grid id="27dc6" binding="mainPanel" layout-manager="GridLayoutManager" row-count="1" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="179" height="30"/>
</constraints>
<properties>
<foreground color="-1"/>
</properties>
<border type="none"/>
<children>
<component id="a9565" class="javax.swing.JCheckBox" binding="enableCheckBox" default-binding="true">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<focusable value="false"/>
<selected value="false"/>
<text value="Enable"/>
</properties>
</component>
<component id="dadb" class="javax.swing.JSpinner" binding="spinner">
<constraints>
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false">
<minimum-size width="50" height="-1"/>
<preferred-size width="50" height="-1"/>
</grid>
</constraints>
<properties>
<background color="-16711423"/>
<focusable value="false"/>
</properties>
</component>
<component id="b9118" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Pulse"/>
</properties>
</component>
</children>
</grid>
</form>

View File

@ -0,0 +1,54 @@
package de.psychose;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.Observable;
import java.util.Random;
/**
* @author: lucas
* @date: 03.05.14 10:10
*/
public class PulseControl extends Observable {
private final int PULSE_WOBBLE_WIDTH = 10;
private JCheckBox enableCheckBox;
private JSpinner spinner;
private JPanel mainPanel;
private final Timer timer;
private final Random random = new Random();
private boolean heartbeat = false;
public PulseControl() {
spinner.setValue(110);
timer = new Timer(500, new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
heartbeat = !heartbeat;
int pulse = (int) spinner.getValue() - PULSE_WOBBLE_WIDTH / 2 + random.nextInt(PULSE_WOBBLE_WIDTH);
if(pulse < 60) pulse = 60;
if(pulse > 230) pulse = 230;
setChanged();
notifyObservers(new PulseData(heartbeat, pulse, 95 + random.nextInt(4)));
timer.setDelay(60000 / pulse);
}
});
enableCheckBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (enableCheckBox.isSelected() && !timer.isRunning()) {
timer.start();
} else if (timer.isRunning()) {
timer.stop();
}
}
});
}
}

View File

@ -0,0 +1,55 @@
package de.psychose;
/**
* @author: lucas
* @date: 03.05.14 10:58
*/
public class PulseData {
private boolean heartbeat;
private int pulse;
private int oxygen;
public PulseData() {
}
public PulseData(boolean heartbeat, int pulse, int oxygen) {
this.heartbeat = heartbeat;
this.pulse = pulse;
this.oxygen = oxygen;
}
public boolean getHeartbeat() {
return heartbeat;
}
public void setHeartbeat(boolean heartbeat) {
this.heartbeat = heartbeat;
}
public int getPulse() {
return pulse;
}
public void setPulse(int pulse) {
this.pulse = pulse;
}
public int getOxygen() {
return oxygen;
}
public void setOxygen(int oxygen) {
this.oxygen = oxygen;
}
@Override
public String toString() {
return "PulseData{" +
"heartbeat=" + heartbeat +
", pulse=" + pulse +
", oxygen=" + oxygen +
"} ";
}
}

View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="de.psychose.TemperatureControl">
<grid id="27dc6" binding="mainPanel" layout-manager="GridLayoutManager" row-count="1" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="211" height="30"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="c685e" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Temp"/>
</properties>
</component>
<component id="f12ee" class="javax.swing.JCheckBox" binding="enableCheckBox" default-binding="true">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Enable"/>
</properties>
</component>
<component id="27ee3" class="javax.swing.JSpinner" binding="spinner1" default-binding="true">
<constraints>
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
</children>
</grid>
</form>

View File

@ -0,0 +1,34 @@
package de.psychose;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.util.Observable;
/**
* @author: lucas
* @date: 20.11.14 23:11
*/
public class TemperatureControl extends Observable {
private static final double MIN_OFFSET = -20;
private static final double MAX_OFFSET = 20;
private static final double INCREMENT = 0.1;
private JCheckBox enableCheckBox;
private JSpinner spinner1;
private JPanel mainPanel;
public TemperatureControl() {
spinner1.setModel(new SpinnerNumberModel(0, MIN_OFFSET, MAX_OFFSET, INCREMENT));
final ChangeListener changeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
setChanged();
notifyObservers(enableCheckBox.isSelected() ? spinner1.getValue() : 0.0);
}
};
spinner1.addChangeListener(changeListener);
enableCheckBox.addChangeListener(changeListener);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

View File

@ -0,0 +1,462 @@
//*****************************************************************************
// MSP430FG439-Heart Rate Monitor Demo
//
// Description; Uses one Instrumentation Amplifier INA321 and the three
// internal opamps of the MSP430FG439
//
// Murugavel Raju
// Texas Instruments, Inc
// October 2004
// Edited by: M Morales, November 2008
// * Updated to non-depracated intrinsic functions
// * Changed spacing for legibility
// Edited by:
// Penko T. Bozhkov - Olimex LTD, 05.10.2012
// * RTC capcitors changed according to Olimex's crystall requirements
// * Olimex LCD definitions are added and heart rate is visualized at 2 places on LCD
// Built with IAR Embedded Workbench Version: 4.21
//*****************************************************************************
//*****************************************************************************
// THIS PROGRAM IS PROVIDED "AS IS". TI MAKES NO WARRANTIES OR
// REPRESENTATIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
// INCLUDING ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR
// COMPLETENESS OF RESPONSES, RESULTS AND LACK OF NEGLIGENCE.
// TI DISCLAIMS ANY WARRANTY OF TITLE, QUIET ENJOYMENT, QUIET
// POSSESSION, AND NON-INFRINGEMENT OF ANY THIRD PARTY
// INTELLECTUAL PROPERTY RIGHTS WITH REGARD TO THE PROGRAM OR
// YOUR USE OF THE PROGRAM.
//
// IN NO EVENT SHALL TI BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
// CONSEQUENTIAL OR INDIRECT DAMAGES, HOWEVER CAUSED, ON ANY
// THEORY OF LIABILITY AND WHETHER OR NOT TI HAS BEEN ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGES, ARISING IN ANY WAY OUT
// OF THIS AGREEMENT, THE PROGRAM, OR YOUR USE OF THE PROGRAM.
// EXCLUDED DAMAGES INCLUDE, BUT ARE NOT LIMITED TO, COST OF
// REMOVAL OR REINSTALLATION, COMPUTER TIME, LABOR COSTS, LOSS
// OF GOODWILL, LOSS OF PROFITS, LOSS OF SAVINGS, OR LOSS OF
// USE OR INTERRUPTION OF BUSINESS. IN NO EVENT WILL TI'S
// AGGREGATE LIABILITY UNDER THIS AGREEMENT OR ARISING OUT OF
// YOUR USE OF THE PROGRAM EXCEED FIVE HUNDRED DOLLARS
// (U.S.$500).
//
// Unless otherwise stated, the Program written and copyrighted
// by Texas Instruments is distributed as "freeware". You may,
// only under TI's copyright in the Program, use and modify the
// Program without any charge or restriction. You may
// distribute to third parties, provided that you transfer a
// copy of this license to the third party and the third party
// agrees to these terms by its first use of the Program. You
// must reproduce the copyright notice and any other legend of
// ownership on each copy or partial copy, of the Program.
//
// You acknowledge and agree that the Program contains
// copyrighted material, trade secrets and other TI proprietary
// information and is protected by copyright laws,
// international copyright treaties, and trade secret laws, as
// well as other intellectual property laws. To protect TI's
// rights in the Program, you agree not to decompile, reverse
// engineer, disassemble or otherwise translate any object code
// versions of the Program to a human-readable form. You agree
// that in no event will you alter, remove or destroy any
// copyright notice included in the Program. TI reserves all
// rights not specifically granted under this license. Except
// as specifically provided herein, nothing in this agreement
// shall be construed as conferring by implication, estoppel,
// or otherwise, upon you, any license or other right under any
// TI patents, copyrights or trade secrets.
//
// You may not use the Program in non-TI devices.
//*****************************************************************************
#include "msp430fg439.h"
#include "math.h"
//defines
#define PB_2_0 (1 << 0) // Push Button on P2.0
#define PB_2_1 (1 << 1) // Push Button on P2.1
// variables declaration
static char beats;
int i=0, first_detection=0;
long result = 0;
int Datain, Dataout, Dataout_pulse, pulseperiod, counter, heartrate;
int heartrate_buffer[] = {0,0,0,0,0,0,0,0,0,0};
int heartrate_cursor = 0, heartrate_mean;
// Lowpass FIR filter coefficients for 17 taps to filter > 30Hz
static const int coeffslp[9] = {
5225, 5175, 7255, 9453, 11595, 13507, 15016, 15983, 16315 };
// Highpass FIR filter coefficients for 17 taps to filter < 2Hz
static const int coeffshp[9] = {
-763, -1267, -1091, -1867, -1969, -2507, -2619, -2911, 29908 };
// *******************************************
// Definitions related to Olimex LCD Digits!!!!
// *******************************************
// Definitions for Olimex LCD digits 10 and 11
#define a 0x10
#define b 0x01
#define c 0x04
#define d 0x08
#define e 0x40
#define f 0x20
#define g 0x02
#define h 0x80
// Character generator definition for display digits 10 and 11
const char char_gen_10_11[] = {
a+b+c+d+e+f, // 0 Displays "0"
b+c, // 1 Displays "1"
a+b+d+e+g, // 2 Displays "2"
a+b+c+d+g, // 3 Displays "3"
b+c+f+g, // 4 Displays "4"
a+c+d+f+g, // 5 Displays "5"
a+c+d+e+f+g, // 6 Displays "6"
a+b+c, // 7 Displays "7"
a+b+c+d+e+f+g, // 8 Displays "8"
a+b+c+d+f+g, // 9 Displays "9"
};
// undefines
#undef a
#undef b
#undef c
#undef d
#undef e
#undef f
#undef g
#undef h
// Definitions for Olimex LCD digits 8 and 9
#define a 0x01
#define b 0x02
#define c 0x04
#define d 0x80
#define e 0x40
#define f 0x10
#define g 0x20
#define h 0x08
// Character generator definition for display digits 8 and 9
const char char_gen_8_9[] = {
a+b+c+d+e+f, // 0 Displays "0"
b+c, // 1 Displays "1"
a+b+d+e+g, // 2 Displays "2"
a+b+c+d+g, // 3 Displays "3"
b+c+f+g, // 4 Displays "4"
a+c+d+f+g, // 5 Displays "5"
a+c+d+e+f+g, // 6 Displays "6"
a+b+c, // 7 Displays "7"
a+b+c+d+e+f+g, // 8 Displays "8"
a+b+c+d+f+g, // 9 Displays "9"
};
// undefines
#undef a
#undef b
#undef c
#undef d
#undef e
#undef f
#undef g
#undef h
// Definitions for Olimex LCD digits 1 to 7. Here each digit definition require 2 bytes
#define a 0x0080
#define b 0x0040
#define c 0x0020
#define d 0x0010
#define e 0x2000
#define f 0x4000
#define g 0x0402
#define h 0x1000
// Character generator definition for display digits 1 to 7
const int char_gen_1_7[] = {
a+b+c+d+e+f, // 0 Displays "0"
b+c, // 1 Displays "1"
a+b+d+e+g, // 2 Displays "2"
a+b+c+d+g, // 3 Displays "3"
b+c+f+g, // 4 Displays "4"
a+c+d+f+g, // 5 Displays "5"
a+c+d+e+f+g, // 6 Displays "6"
a+b+c, // 7 Displays "7"
a+b+c+d+e+f+g, // 8 Displays "8"
a+b+c+d+f+g, // 9 Displays "9"
};
// undefines
#undef a
#undef b
#undef c
#undef d
#undef e
#undef f
#undef g
#undef h
// function prototypes
void Init(void); // Initializes device for the application
void ClearLCD(void); // Clears the LCD memory
int filterlp(int); // 17 tap lowpass FIR filter
int filterhp(int); // 17 tap highpass FIR filter
long mul16(register int x, register int y); // 16-bit signed multiplication
int itobcd(int i); // 16-bit hex to bcd conversion
// main function
int main(void)
{
Init(); // Initialize device for the application
LCDMEM[7] = 0x80; // Turn on LCD's Olimex row!!!
/*
// For debug purpose only!
for(unsigned char j=0;j<10;j++){
LCDMEM[2] = char_gen_10_11[j]; // LCD -> Digit 11
LCDMEM[3] = char_gen_10_11[j]; // LCD -> Digit 10
LCDMEM[4] = char_gen_8_9[j]; // LCD -> Digit 9
LCDMEM[5] = char_gen_8_9[j]; // LCD -> Digit 8
LCDMEM[7] = ((char)(char_gen_1_7[j]>>8)); // LCD -> Digit 7 High Byte
LCDMEM[6] = ((char)(char_gen_1_7[j]&0x00FF)); // LCD -> Digit 7 Low Byte
LCDMEM[9] = ((char)(char_gen_1_7[j]>>8)); // LCD -> Digit 6 High Byte
LCDMEM[8] = ((char)(char_gen_1_7[j]&0x00FF)); // LCD -> Digit 6 Low Byte
LCDMEM[11] = ((char)(char_gen_1_7[j]>>8)); // LCD -> Digit 5 High Byte
LCDMEM[10] = ((char)(char_gen_1_7[j]&0x00FF)); // LCD -> Digit 5 Low Byte
//LCDMEM[13] = ((char)(char_gen_1_7[j]>>8)); // LCD -> Digit 4 High Byte
//LCDMEM[12] = ((char)(char_gen_1_7[j]&0x00FF)); // LCD -> Digit 4 Low Byte
//LCDMEM[15] = ((char)(char_gen_1_7[j]>>8)); // LCD -> Digit 3 High Byte
//LCDMEM[14] = ((char)(char_gen_1_7[j]&0x00FF)); // LCD -> Digit 3 Low Byte
//LCDMEM[17] = ((char)(char_gen_1_7[j]>>8)); // LCD -> Digit 2 High Byte
//LCDMEM[16] = ((char)(char_gen_1_7[j]&0x00FF)); // LCD -> Digit 2 Low Byte
}
*/
while(1)
{
__bis_SR_register(LPM0_bits); // Enter LPM0 needed for UART TX completion
__no_operation();
Dataout = filterlp(Datain); // Lowpass FIR filter for filtering out 60Hz
Dataout_pulse = filterhp(Dataout)-128; // Highpass FIR filter to filter muscle artifacts
Dataout = Dataout >> 6; // Scale Dataout to use scope program
if(Dataout > 255) Dataout = 255; // Set boundary 255 max
if(Dataout < 0) Dataout = 0; // Set boundary 0 min
//DAC12_0DAT = Dataout; // For scope display
if( 0 ) {
TXBUF0 = Dataout; // Transmit via UART0 for Scope display
} else {
// send the data as ascii values
TXBUF0 = (Dataout / 100) + 48; // hundreds
while (!(IFG1 & UTXIFG0)); // wait for transmission
TXBUF0 = ((Dataout / 10) % 10 ) + 48; // tens
while (!(IFG1 & UTXIFG0));
TXBUF0 = ((Dataout / 1) % 10 ) + 48; // ones
while (!(IFG1 & UTXIFG0));
TXBUF0 = 32; // send a blank
while (!(IFG1 & UTXIFG0));
TXBUF0 = ((heartrate & 0xf00) >> 8) + 48;
while (!(IFG1 & UTXIFG0));
TXBUF0 = ((heartrate & 0xf0) >> 4) + 48;
while (!(IFG1 & UTXIFG0));
TXBUF0 = (heartrate & 0x0f) + 48;
while (!(IFG1 & UTXIFG0));
TXBUF0 = 10; // send a \n
}
counter++; // Debounce counter
pulseperiod++; // Pulse period counter
if (Dataout_pulse > 100) // Check if above threshold (48)
{
LCDMEM[1] = 0xF0; // Heart beat detected enable "<^>" on LCD
counter = 0; // Reset debounce counter
}
if (counter == 128) // Allow 128 sample debounce time
{
LCDMEM[1] = 0x00; // Disable "<^>" on LCD for blinking effect
beats++;
if (beats == 3)
{
beats = 0;
//heartrate_buffer[heartrate_cursor] = 50720/pulseperiod;
//heartrate_cursor++;
//heartrate_cursor = heartrate_cursor % 10;
//int ct;
//for(ct = 0; ct < 10; ct++) {
// heartrate_mean += heartrate_buffer[ct];
//}
//heartrate = itobcd(heartrate_mean / 10);
// heartrate = itobcd(30720/pulseperiod); // Calculate beat to beat heart rate per min
//heartrate = itobcd(92160/pulseperiod); // Calculate 3 beat average heart rate per min
heartrate = itobcd(50720/pulseperiod); // Calculate 3 beat average heart rate per min
//heartrate = (92160/pulseperiod); // Calculate 3 beat average heart rate per min
pulseperiod = 0; // Reset pulse period for next measurement
///*
LCDMEM[2] = char_gen_10_11[heartrate & 0x0f]; // Display current heart rate units -> LCD Digit 11
LCDMEM[3] = char_gen_10_11[(heartrate & 0xf0) >> 4]; // tens -> LCD Digit 10
LCDMEM[4] = char_gen_8_9[(heartrate & 0xf00) >> 8]; // hundreds -> LCD Digit 9
LCDMEM[7] = ((char)(char_gen_1_7[heartrate & 0x0f]>>8)); // LCD -> Digit 7 High Byte
LCDMEM[6] = ((char)(char_gen_1_7[heartrate & 0x0f]&0x00FF)); // LCD -> Digit 7 Low Byte
LCDMEM[9] = ((char)(char_gen_1_7[((heartrate & 0xf0) >> 4)]>>8)); // LCD -> Digit 6 High Byte
LCDMEM[8] = ((char)(char_gen_1_7[((heartrate & 0xf0) >> 4)]&0x00FF)); // LCD -> Digit 6 Low Byte
LCDMEM[11] = ((char)(char_gen_1_7[((heartrate & 0xf00) >> 8)]>>8)); // LCD -> Digit 5 High Byte
LCDMEM[10] = ((char)(char_gen_1_7[((heartrate & 0xf00) >> 8)]&0x00FF)); // LCD -> Digit 5 Low Byte
//*/
}
}
}
}//main
// Initialization function
void Init( void )
{
FLL_CTL0 |= XCAP10PF; // Set load capacitance for xtal
WDTCTL = WDTPW | WDTHOLD; // Disable the Watchdog
while ( LFOF & FLL_CTL0); // wait for watch crystal to stabilize
SCFQCTL = 63; // 32 x 32768 x 2 = 2.097152MHz
BTCTL = BT_fLCD_DIV128; // Set LCD frame freq = ACLK/128
// Initialize and enable LCD peripheral
ClearLCD(); // Clear LCD memory
LCDCTL = LCDSG0_3 + LCD4MUX + LCDON ; // 4mux LCD, segs0-23 enabled
// Initialize and enable GPIO ports
P1OUT = 0x00 + BIT3; // Clear P1OUT register, INA turned ON
P1DIR = 0x3f; // Unused pins as outputs, Comparator pins as inputs
P2OUT = 0x00; // Clear P2OUT register
P2DIR = 0xff; // Unused pins as outputs
P2DIR = ~(PB_2_0+PB_2_1); // P2.0 and P2.1 push buttons
P2IES = 0x00; // Interrupt edge low to high transition
P2IFG = 0x00; // Clear pending P2 interrupts
P2IE = PB_2_0 | PB_2_1; // Enable intterupts for push buttons
P3OUT = 0x00; // Clear P3OUT register
P3DIR = 0x0f; // Unused pins as outputs except P3.<4-7> -> For the new LCD's received at ~04.10.2012 this must be inputs!!
P4OUT = 0x00; // Clear P4OUT register
P4DIR = 0xff; // Unused pins as outputs
P5OUT = 0x00; // Clear P5OUT register
P5DIR = 0xff; // Unused pins as outputs
P5SEL = 0xfc; // Set Rxx and COM pins for LCD
P6OUT = 0x00; // Clear P6OUT register
P6SEL = 0xff; // P6 = Analog
// Initialize and enable UART
P2SEL|=BIT4; // P2.4 = TXD
UCTL0 |= SWRST; // UART SWRST = 1
ME1 |= UTXE0; // Enable UART0 TXD
UCTL0 |= CHAR; // 8-bit char, SWRST=1
UTCTL0 |= SSEL1; // UCLK = SMCLK
UBR00 = 18; // 115200 from 2.097152MHz
UBR10 = 0;
UMCTL0 = 0x2c; // Modulation = 0.2044
UCTL0 &= ~SWRST; // UART SWRST = 0, enable UART
IFG1 &= ~UTXIFG0;
// Initialize and enable ADC12
ADC12CTL0 = ADC12ON + SHT0_4 + REFON + REF2_5V;
// ADC12 ON, Reference = 2.5V for DAC0
ADC12CTL1 = SHP + SHS_1 + CONSEQ_2; // Use sampling timer, TA1 trigger
ADC12MCTL0 = INCH_1 + SREF_1; // Vref, channel = 1 = OA0 Out
ADC12IE = BIT0; // Enable interrupt for ADC12 MEM0
ADC12CTL0 |= ENC; // Enable conversions
// Initialize and enable Timer_A
TACTL = TASSEL0 + MC_1 + TACLR; // ACLK, Clear TAR, Up Mode
TACCTL1 = OUTMOD_2; // Set / Reset
TACCR0 = 63; // 512 samples per second
TACCR1 = 15; //
// Initialize and enable DAC12x
DAC12_0CTL = DAC12OPS + DAC12CALON + DAC12IR + DAC12AMP_2 + DAC12ENC;// DAC0 enable
DAC12_1CTL = DAC12CALON + DAC12IR + DAC12AMP_2 + DAC12ENC; // DAC1 enable
DAC12_1DAT = 0x099A; // Offset level = 1.5V for op amp bias
// Initialize and enable opamps
OA0CTL0 = OAP_1 + OAPM_1 + OAADC1; // OA0 enable power mode 1, OA0- = P6.0, 0A0+ = P6.2, OA0O = P6.1
OA0CTL1 = OARRIP; // General purpose mode, no Rail-to-Rail inputs
OA1CTL0 = OAP_3 + OAPM_1 + OAADC1; // OA1 enable power mode 1, OA1- = P6.4, OA1+ = DAC1, OA1O = P6.3
OA1CTL1 = OARRIP; // General purpose mode, no Rail-to-Rail inputs
OA2CTL0 = OAP_3 + OAPM_1 + OAADC1; // OA2 enable power mode 1, OA2+ = DAC1, OA2O = P6.5, Select inputs, power mode
OA2CTL1 = OAFC_1 + OARRIP; // Unit gain Mode, no Rail-to-Rail inputs
__enable_interrupt(); // Enable global Interrupts
} //init
void ClearLCD(void)
{
int i; //
for( i = 0; i < 20; i++){ // Clear LCDMEM
LCDMEM[i] = 0; //
}
}//clear LCD
int itobcd(int i) // Convert hex word to BCD.
{
int bcd = 0; //
char j = 0; //
while (i > 9) //
{
bcd |= ((i % 10) << j); //
i /= 10; //
j += 4;
} //
return (bcd | (i << j)); // Return converted value
}// itobcd(i)
int filterlp(int sample) // Lowpass FIR filter for EKG
{
static int buflp[32]; // Reserve 32 loactions for circular buffering
static int offsetlp = 0;
long z;
int i;
buflp[offsetlp] = sample;
z = mul16(coeffslp[8], buflp[(offsetlp - 8) & 0x1F]);
__no_operation();
for (i = 0; i < 8; i++){
z += mul16(coeffslp[i], buflp[(offsetlp - i) & 0x1F] + buflp[(offsetlp - 16 + i) & 0x1F]);
}
offsetlp = (offsetlp + 1) & 0x1F;
return z >> 15; // Return filter output
}// int filter
int filterhp(int samplehp) // Highpass FIR filter for hear rate
{
static int bufhp[32]; // Reserve 32 loactions for circular buffering
static int offsethp = 0;
long z;
int i;
bufhp[offsethp] = samplehp;
z = mul16(coeffshp[8], bufhp[(offsethp - 8) & 0x1F]);
for (i = 0; i < 8; i++){
z += mul16(coeffshp[i], bufhp[(offsethp - i) & 0x1F] + bufhp[(offsethp - 16 + i) & 0x1F]);
}
offsethp = (offsethp + 1) & 0x1F;
return z >> 15; // Return filter output
}// int filterhp
long mul16(register int x, register int y)
{
return ((long)x) * y;
}
#pragma vector = PORT2_VECTOR
__interrupt void Port2ISR (void)
{
P2IFG = 0;
}//Push buttons unused
#pragma vector = ADC_VECTOR // ADC12 ISR
__interrupt void ADC12ISR (void)
{
Datain = ADC12MEM0; // Store converted value in Datain
__bic_SR_register_on_exit(LPM0_bits); // Exit LPM0 on return
}// ADC12ISR

View File

@ -0,0 +1,91 @@
#
# Makefile for msp430
#
# 'make' builds everything
# 'make clean' deletes everything except source files and Makefile
# You need to set TARGET, MCU and SOURCES for your project.
# TARGET is the name of the executable file to be produced
# $(TARGET).elf $(TARGET).hex and $(TARGET).txt nad $(TARGET).map are all generated.
# The TXT file is used for BSL loading, the ELF can be used for JTAG use
#
TARGET = mod-pulse-ekg
MCU = msp430fg439
# List all the source files here
# eg if you have a source file foo.c then list it here
SOURCES = MOD-EKG_DemoSoft.c
# Include are located in the Include directory
INCLUDES = -IInclude
# Add or subtract whatever MSPGCC flags you want. There are plenty more
#######################################################################################
CFLAGS = -mmcu=$(MCU) -g -Os -Wall -Wunused $(INCLUDES)
ASFLAGS = -mmcu=$(MCU) -x assembler-with-cpp -Wa,-gstabs
LDFLAGS = -mmcu=$(MCU) -Wl,-Map=$(TARGET).map -lm -lfp -pipe
########################################################################################
CC = msp430-gcc
LD = msp430-ld
AR = msp430-ar
AS = msp430-gcc
GASP = msp430-gasp
NM = msp430-nm
OBJCOPY = msp430-objcopy
RANLIB = msp430-ranlib
STRIP = msp430-strip
SIZE = msp430-size
READELF = msp430-readelf
MAKETXT = srec_cat
CP = cp -p
RM = rm -f
MV = mv
########################################################################################
# the file which will include dependencies
DEPEND = $(SOURCES:.c=.d)
# all the object files
OBJECTS = $(SOURCES:.c=.o)
#all: $(TARGET).elf $(TARGET).hex $(TARGET).txt
all: $(TARGET).elf $(TARGET).hex
$(TARGET).elf: $(OBJECTS)
echo "Linking $@"
$(CC) $(OBJECTS) $(LDFLAGS) $(LIBS) -o $@
echo
echo ">>>> Size of Firmware <<<<"
$(SIZE) $(TARGET).elf
echo
%.hex: %.elf
$(OBJCOPY) -O ihex $< $@
#%.txt: %.hex
# $(MAKETXT) -O $@ -TITXT $< -I
# unix2dos $(TARGET).txt
# The above line is required for the DOS based TI BSL tool to be able to read the txt file generated from linux/unix systems.
%.o: %.c
echo "Compiling $<"
$(CC) -c $(CFLAGS) -o $@ $<
# rule for making assembler source listing, to see the code
%.lst: %.c
$(CC) -c $(ASFLAGS) -Wa,-anlhd $< > $@
# include the dependencies unless we're going to clean, then forget about them.
ifneq ($(MAKECMDGOALS), clean)
-include $(DEPEND)
endif
# dependencies file
# includes also considered, since some of these are our own
# (otherwise use -MM instead of -M)
%.d: %.c
echo "Generating dependencies $@ from $<"
$(CC) -M ${CFLAGS} $< >$@
.SILENT:
.PHONY: clean
clean:
-$(RM) $(OBJECTS)
-$(RM) $(TARGET).*
-$(RM) $(SOURCES:.c=.lst)
-$(RM) $(DEPEND)

2
mod_ekg_psychose/gcc/make.sh Executable file
View File

@ -0,0 +1,2 @@
msp430-gcc -I/usr/msp430/include -Wall mod_ -mmcu=msp430fg439 -o mod-ekg-pyschose -L /usr/msp430/lib/ldscripts/msp430fg439 -lm -lfp -pipe

View File

@ -0,0 +1,571 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<project>
<fileVersion>2</fileVersion>
<configuration>
<name>Debug</name>
<toolchain>
<name>MSP430</name>
</toolchain>
<debug>1</debug>
<settings>
<name>C-SPY</name>
<archiveVersion>4</archiveVersion>
<data>
<version>23</version>
<wantNonLocal>1</wantNonLocal>
<debug>1</debug>
<option>
<name>CInput</name>
<state>1</state>
</option>
<option>
<name>MacOverride</name>
<state>0</state>
</option>
<option>
<name>MacFile</name>
<state></state>
</option>
<option>
<name>IProcessor</name>
<state>0</state>
</option>
<option>
<name>GoToEnable</name>
<state>1</state>
</option>
<option>
<name>GoToName</name>
<state>main</state>
</option>
<option>
<name>DynDriver</name>
<state>430FET</state>
</option>
<option>
<name>dDllSlave</name>
<state>0</state>
</option>
<option>
<name>DdfFileSlave</name>
<state>1</state>
</option>
<option>
<name>DdfOverride</name>
<state>0</state>
</option>
<option>
<name>DdfFileName</name>
<state>$TOOLKIT_DIR$\config\MSP430FG439.ddf</state>
</option>
<option>
<name>ProcTMS</name>
<state>1</state>
</option>
<option>
<name>CExtraOptionsCheck</name>
<state>0</state>
</option>
<option>
<name>CExtraOptions</name>
<state></state>
</option>
<option>
<name>ProcMSP430X</name>
<state>1</state>
</option>
<option>
<name>CompilerDataModel</name>
<state>1</state>
</option>
<option>
<name>IVBASE</name>
<state>1</state>
</option>
<option>
<name>OCImagesSuppressCheck1</name>
<state>0</state>
</option>
<option>
<name>OCImagesPath1</name>
<state></state>
</option>
<option>
<name>OCImagesSuppressCheck2</name>
<state>0</state>
</option>
<option>
<name>OCImagesPath2</name>
<state></state>
</option>
<option>
<name>OCImagesSuppressCheck3</name>
<state>0</state>
</option>
<option>
<name>OCImagesPath3</name>
<state></state>
</option>
<option>
<name>CPUTAG</name>
<state>1</state>
</option>
</data>
</settings>
<settings>
<name>430FET</name>
<archiveVersion>1</archiveVersion>
<data>
<version>15</version>
<wantNonLocal>1</wantNonLocal>
<debug>1</debug>
<option>
<name>CFetMandatory</name>
<state>0</state>
</option>
<option>
<name>Erase</name>
<state>1</state>
</option>
<option>
<name>EMUVerifyDownloadP7</name>
<state>0</state>
</option>
<option>
<name>EraseOptionSlaveP7</name>
<state>0</state>
</option>
<option>
<name>ExitBreakpointP7</name>
<state>0</state>
</option>
<option>
<name>PutcharBreakpointP7</name>
<state>1</state>
</option>
<option>
<name>GetcharBreakpointP7</name>
<state>1</state>
</option>
<option>
<name>derivativeP7</name>
<state>0</state>
</option>
<option>
<name>ParallelPortP7</name>
<version>0</version>
<state>0</state>
</option>
<option>
<name>TargetVoltage</name>
<state>3.3</state>
</option>
<option>
<name>AllowLockedFlashAccessP7</name>
<state>0</state>
</option>
<option>
<name>EMUAttach</name>
<state>0</state>
</option>
<option>
<name>AttachOptionSlave</name>
<state>0</state>
</option>
<option>
<name>OProtocolTypeDefault</name>
<state>0</state>
</option>
<option>
<name>CRadioProtocolType</name>
<state>1</state>
</option>
<option>
<name>CCRadioModuleTypeSlave</name>
<state>1</state>
</option>
<option>
<name>EEMLevel</name>
<state>0</state>
</option>
<option>
<name>DiasbleMemoryCache</name>
<state>0</state>
</option>
<option>
<name>NeedLockedFlashAccess</name>
<state>1</state>
</option>
<option>
<name>UsbComPort</name>
<state>Automatic</state>
</option>
<option>
<name>FetConnection</name>
<version>1</version>
<state>6</state>
</option>
<option>
<name>SoftwareBreakpointEnable</name>
<state>0</state>
</option>
<option>
<name>RadioSoftwareBreakpointType</name>
<state>0</state>
</option>
<option>
<name>TargetSettlingtime</name>
<state>0</state>
</option>
<option>
<name>AllowAccessToBSL</name>
<state>0</state>
</option>
</data>
</settings>
<settings>
<name>SIM430</name>
<archiveVersion>1</archiveVersion>
<data>
<version>3</version>
<wantNonLocal>1</wantNonLocal>
<debug>1</debug>
<option>
<name>SimOddAddressCheckP7</name>
<state>1</state>
</option>
<option>
<name>CSimMandatory</name>
<state>1</state>
</option>
<option>
<name>derivativeSim</name>
<state>0</state>
</option>
</data>
</settings>
<debuggerPlugins>
<plugin>
<file>$TOOLKIT_DIR$\plugins\Lcd\lcd.ewplugin</file>
<loadFlag>1</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin</file>
<loadFlag>1</loadFlag>
</plugin>
<plugin>
<file>$EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin</file>
<loadFlag>1</loadFlag>
</plugin>
<plugin>
<file>$EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin</file>
<loadFlag>1</loadFlag>
</plugin>
<plugin>
<file>$EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin</file>
<loadFlag>1</loadFlag>
</plugin>
</debuggerPlugins>
</configuration>
<configuration>
<name>Release</name>
<toolchain>
<name>MSP430</name>
</toolchain>
<debug>0</debug>
<settings>
<name>C-SPY</name>
<archiveVersion>4</archiveVersion>
<data>
<version>23</version>
<wantNonLocal>1</wantNonLocal>
<debug>0</debug>
<option>
<name>CInput</name>
<state>1</state>
</option>
<option>
<name>MacOverride</name>
<state>0</state>
</option>
<option>
<name>MacFile</name>
<state></state>
</option>
<option>
<name>IProcessor</name>
<state>0</state>
</option>
<option>
<name>GoToEnable</name>
<state>1</state>
</option>
<option>
<name>GoToName</name>
<state>main</state>
</option>
<option>
<name>DynDriver</name>
<state>SIM430</state>
</option>
<option>
<name>dDllSlave</name>
<state>0</state>
</option>
<option>
<name>DdfFileSlave</name>
<state>1</state>
</option>
<option>
<name>DdfOverride</name>
<state>0</state>
</option>
<option>
<name>DdfFileName</name>
<state></state>
</option>
<option>
<name>ProcTMS</name>
<state>1</state>
</option>
<option>
<name>CExtraOptionsCheck</name>
<state>0</state>
</option>
<option>
<name>CExtraOptions</name>
<state></state>
</option>
<option>
<name>ProcMSP430X</name>
<state>1</state>
</option>
<option>
<name>CompilerDataModel</name>
<state>1</state>
</option>
<option>
<name>IVBASE</name>
<state>1</state>
</option>
<option>
<name>OCImagesSuppressCheck1</name>
<state>0</state>
</option>
<option>
<name>OCImagesPath1</name>
<state></state>
</option>
<option>
<name>OCImagesSuppressCheck2</name>
<state>0</state>
</option>
<option>
<name>OCImagesPath2</name>
<state></state>
</option>
<option>
<name>OCImagesSuppressCheck3</name>
<state>0</state>
</option>
<option>
<name>OCImagesPath3</name>
<state></state>
</option>
<option>
<name>CPUTAG</name>
<state>1</state>
</option>
</data>
</settings>
<settings>
<name>430FET</name>
<archiveVersion>1</archiveVersion>
<data>
<version>15</version>
<wantNonLocal>1</wantNonLocal>
<debug>0</debug>
<option>
<name>CFetMandatory</name>
<state>0</state>
</option>
<option>
<name>Erase</name>
<state>1</state>
</option>
<option>
<name>EMUVerifyDownloadP7</name>
<state>0</state>
</option>
<option>
<name>EraseOptionSlaveP7</name>
<state>0</state>
</option>
<option>
<name>ExitBreakpointP7</name>
<state>0</state>
</option>
<option>
<name>PutcharBreakpointP7</name>
<state>1</state>
</option>
<option>
<name>GetcharBreakpointP7</name>
<state>1</state>
</option>
<option>
<name>derivativeP7</name>
<state>0</state>
</option>
<option>
<name>ParallelPortP7</name>
<version>0</version>
<state>0</state>
</option>
<option>
<name>TargetVoltage</name>
<state>###Uninitialized###</state>
</option>
<option>
<name>AllowLockedFlashAccessP7</name>
<state>0</state>
</option>
<option>
<name>EMUAttach</name>
<state>0</state>
</option>
<option>
<name>AttachOptionSlave</name>
<state>0</state>
</option>
<option>
<name>OProtocolTypeDefault</name>
<state>0</state>
</option>
<option>
<name>CRadioProtocolType</name>
<state>1</state>
</option>
<option>
<name>CCRadioModuleTypeSlave</name>
<state>1</state>
</option>
<option>
<name>EEMLevel</name>
<state>0</state>
</option>
<option>
<name>DiasbleMemoryCache</name>
<state>0</state>
</option>
<option>
<name>NeedLockedFlashAccess</name>
<state>1</state>
</option>
<option>
<name>UsbComPort</name>
<state>Automatic</state>
</option>
<option>
<name>FetConnection</name>
<version>1</version>
<state>0</state>
</option>
<option>
<name>SoftwareBreakpointEnable</name>
<state>0</state>
</option>
<option>
<name>RadioSoftwareBreakpointType</name>
<state>0</state>
</option>
<option>
<name>TargetSettlingtime</name>
<state>0</state>
</option>
<option>
<name>AllowAccessToBSL</name>
<state>0</state>
</option>
</data>
</settings>
<settings>
<name>SIM430</name>
<archiveVersion>1</archiveVersion>
<data>
<version>3</version>
<wantNonLocal>1</wantNonLocal>
<debug>0</debug>
<option>
<name>SimOddAddressCheckP7</name>
<state>1</state>
</option>
<option>
<name>CSimMandatory</name>
<state>1</state>
</option>
<option>
<name>derivativeSim</name>
<state>0</state>
</option>
</data>
</settings>
<debuggerPlugins>
<plugin>
<file>$TOOLKIT_DIR$\plugins\Lcd\lcd.ewplugin</file>
<loadFlag>1</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin</file>
<loadFlag>1</loadFlag>
</plugin>
<plugin>
<file>$EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin</file>
<loadFlag>1</loadFlag>
</plugin>
<plugin>
<file>$EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin</file>
<loadFlag>1</loadFlag>
</plugin>
<plugin>
<file>$EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin</file>
<loadFlag>1</loadFlag>
</plugin>
</debuggerPlugins>
</configuration>
</project>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,436 @@
//*****************************************************************************
// MSP430FG439-Heart Rate Monitor Demo
//
// Description; Uses one Instrumentation Amplifier INA321 and the three
// internal opamps of the MSP430FG439
//
// Murugavel Raju
// Texas Instruments, Inc
// October 2004
// Edited by: M Morales, November 2008
// * Updated to non-depracated intrinsic functions
// * Changed spacing for legibility
// Edited by:
// Penko T. Bozhkov - Olimex LTD, 05.10.2012
// * RTC capcitors changed according to Olimex's crystall requirements
// * Olimex LCD definitions are added and heart rate is visualized at 2 places on LCD
// Built with IAR Embedded Workbench Version: 4.21
//*****************************************************************************
//*****************************************************************************
// THIS PROGRAM IS PROVIDED "AS IS". TI MAKES NO WARRANTIES OR
// REPRESENTATIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
// INCLUDING ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR
// COMPLETENESS OF RESPONSES, RESULTS AND LACK OF NEGLIGENCE.
// TI DISCLAIMS ANY WARRANTY OF TITLE, QUIET ENJOYMENT, QUIET
// POSSESSION, AND NON-INFRINGEMENT OF ANY THIRD PARTY
// INTELLECTUAL PROPERTY RIGHTS WITH REGARD TO THE PROGRAM OR
// YOUR USE OF THE PROGRAM.
//
// IN NO EVENT SHALL TI BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
// CONSEQUENTIAL OR INDIRECT DAMAGES, HOWEVER CAUSED, ON ANY
// THEORY OF LIABILITY AND WHETHER OR NOT TI HAS BEEN ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGES, ARISING IN ANY WAY OUT
// OF THIS AGREEMENT, THE PROGRAM, OR YOUR USE OF THE PROGRAM.
// EXCLUDED DAMAGES INCLUDE, BUT ARE NOT LIMITED TO, COST OF
// REMOVAL OR REINSTALLATION, COMPUTER TIME, LABOR COSTS, LOSS
// OF GOODWILL, LOSS OF PROFITS, LOSS OF SAVINGS, OR LOSS OF
// USE OR INTERRUPTION OF BUSINESS. IN NO EVENT WILL TI'S
// AGGREGATE LIABILITY UNDER THIS AGREEMENT OR ARISING OUT OF
// YOUR USE OF THE PROGRAM EXCEED FIVE HUNDRED DOLLARS
// (U.S.$500).
//
// Unless otherwise stated, the Program written and copyrighted
// by Texas Instruments is distributed as "freeware". You may,
// only under TI's copyright in the Program, use and modify the
// Program without any charge or restriction. You may
// distribute to third parties, provided that you transfer a
// copy of this license to the third party and the third party
// agrees to these terms by its first use of the Program. You
// must reproduce the copyright notice and any other legend of
// ownership on each copy or partial copy, of the Program.
//
// You acknowledge and agree that the Program contains
// copyrighted material, trade secrets and other TI proprietary
// information and is protected by copyright laws,
// international copyright treaties, and trade secret laws, as
// well as other intellectual property laws. To protect TI's
// rights in the Program, you agree not to decompile, reverse
// engineer, disassemble or otherwise translate any object code
// versions of the Program to a human-readable form. You agree
// that in no event will you alter, remove or destroy any
// copyright notice included in the Program. TI reserves all
// rights not specifically granted under this license. Except
// as specifically provided herein, nothing in this agreement
// shall be construed as conferring by implication, estoppel,
// or otherwise, upon you, any license or other right under any
// TI patents, copyrights or trade secrets.
//
// You may not use the Program in non-TI devices.
//*****************************************************************************
#include <msp430xG43x.h>
#include "math.h"
//defines
#define PB_2_0 (1 << 0) // Push Button on P2.0
#define PB_2_1 (1 << 1) // Push Button on P2.1
// variables declaration
static char beats;
int i=0, first_detection=0;
long result = 0;
int Datain, Dataout, Dataout_pulse, pulseperiod, counter, heartrate;
int Heart_Rate_Buffer[] = {0,0,0,0};
// Lowpass FIR filter coefficients for 17 taps to filter > 30Hz
static const int coeffslp[9] = {
5225, 5175, 7255, 9453, 11595, 13507, 15016, 15983, 16315 };
// Highpass FIR filter coefficients for 17 taps to filter < 2Hz
static const int coeffshp[9] = {
-763, -1267, -1091, -1867, -1969, -2507, -2619, -2911, 29908 };
// *******************************************
// Definitions related to Olimex LCD Digits!!!!
// *******************************************
// Definitions for Olimex LCD digits 10 and 11
#define a 0x10
#define b 0x01
#define c 0x04
#define d 0x08
#define e 0x40
#define f 0x20
#define g 0x02
#define h 0x80
// Character generator definition for display digits 10 and 11
const char char_gen_10_11[] = {
a+b+c+d+e+f, // 0 Displays "0"
b+c, // 1 Displays "1"
a+b+d+e+g, // 2 Displays "2"
a+b+c+d+g, // 3 Displays "3"
b+c+f+g, // 4 Displays "4"
a+c+d+f+g, // 5 Displays "5"
a+c+d+e+f+g, // 6 Displays "6"
a+b+c, // 7 Displays "7"
a+b+c+d+e+f+g, // 8 Displays "8"
a+b+c+d+f+g, // 9 Displays "9"
};
// undefines
#undef a
#undef b
#undef c
#undef d
#undef e
#undef f
#undef g
#undef h
// Definitions for Olimex LCD digits 8 and 9
#define a 0x01
#define b 0x02
#define c 0x04
#define d 0x80
#define e 0x40
#define f 0x10
#define g 0x20
#define h 0x08
// Character generator definition for display digits 8 and 9
const char char_gen_8_9[] = {
a+b+c+d+e+f, // 0 Displays "0"
b+c, // 1 Displays "1"
a+b+d+e+g, // 2 Displays "2"
a+b+c+d+g, // 3 Displays "3"
b+c+f+g, // 4 Displays "4"
a+c+d+f+g, // 5 Displays "5"
a+c+d+e+f+g, // 6 Displays "6"
a+b+c, // 7 Displays "7"
a+b+c+d+e+f+g, // 8 Displays "8"
a+b+c+d+f+g, // 9 Displays "9"
};
// undefines
#undef a
#undef b
#undef c
#undef d
#undef e
#undef f
#undef g
#undef h
// Definitions for Olimex LCD digits 1 to 7. Here each digit definition require 2 bytes
#define a 0x0080
#define b 0x0040
#define c 0x0020
#define d 0x0010
#define e 0x2000
#define f 0x4000
#define g 0x0402
#define h 0x1000
// Character generator definition for display digits 1 to 7
const int char_gen_1_7[] = {
a+b+c+d+e+f, // 0 Displays "0"
b+c, // 1 Displays "1"
a+b+d+e+g, // 2 Displays "2"
a+b+c+d+g, // 3 Displays "3"
b+c+f+g, // 4 Displays "4"
a+c+d+f+g, // 5 Displays "5"
a+c+d+e+f+g, // 6 Displays "6"
a+b+c, // 7 Displays "7"
a+b+c+d+e+f+g, // 8 Displays "8"
a+b+c+d+f+g, // 9 Displays "9"
};
// undefines
#undef a
#undef b
#undef c
#undef d
#undef e
#undef f
#undef g
#undef h
// function prototypes
void Init(void); // Initializes device for the application
void ClearLCD(void); // Clears the LCD memory
int filterlp(int); // 17 tap lowpass FIR filter
int filterhp(int); // 17 tap highpass FIR filter
long mul16(register int x, register int y); // 16-bit signed multiplication
int itobcd(int i); // 16-bit hex to bcd conversion
// main function
void main(void)
{
Init(); // Initialize device for the application
LCDMEM[7] = 0x80; // Turn on LCD's Olimex row!!!
/*
// For debug purpose only!
for(unsigned char j=0;j<10;j++){
LCDMEM[2] = char_gen_10_11[j]; // LCD -> Digit 11
LCDMEM[3] = char_gen_10_11[j]; // LCD -> Digit 10
LCDMEM[4] = char_gen_8_9[j]; // LCD -> Digit 9
LCDMEM[5] = char_gen_8_9[j]; // LCD -> Digit 8
LCDMEM[7] = ((char)(char_gen_1_7[j]>>8)); // LCD -> Digit 7 High Byte
LCDMEM[6] = ((char)(char_gen_1_7[j]&0x00FF)); // LCD -> Digit 7 Low Byte
LCDMEM[9] = ((char)(char_gen_1_7[j]>>8)); // LCD -> Digit 6 High Byte
LCDMEM[8] = ((char)(char_gen_1_7[j]&0x00FF)); // LCD -> Digit 6 Low Byte
LCDMEM[11] = ((char)(char_gen_1_7[j]>>8)); // LCD -> Digit 5 High Byte
LCDMEM[10] = ((char)(char_gen_1_7[j]&0x00FF)); // LCD -> Digit 5 Low Byte
//LCDMEM[13] = ((char)(char_gen_1_7[j]>>8)); // LCD -> Digit 4 High Byte
//LCDMEM[12] = ((char)(char_gen_1_7[j]&0x00FF)); // LCD -> Digit 4 Low Byte
//LCDMEM[15] = ((char)(char_gen_1_7[j]>>8)); // LCD -> Digit 3 High Byte
//LCDMEM[14] = ((char)(char_gen_1_7[j]&0x00FF)); // LCD -> Digit 3 Low Byte
//LCDMEM[17] = ((char)(char_gen_1_7[j]>>8)); // LCD -> Digit 2 High Byte
//LCDMEM[16] = ((char)(char_gen_1_7[j]&0x00FF)); // LCD -> Digit 2 Low Byte
}
*/
while(1)
{
__bis_SR_register(LPM0_bits); // Enter LPM0 needed for UART TX completion
__no_operation();
Dataout = filterlp(Datain); // Lowpass FIR filter for filtering out 60Hz
Dataout_pulse = filterhp(Dataout)-128; // Highpass FIR filter to filter muscle artifacts
Dataout = Dataout >> 6; // Scale Dataout to use scope program
if(Dataout > 255) Dataout = 255; // Set boundary 255 max
if(Dataout < 0) Dataout = 0; // Set boundary 0 min
//DAC12_0DAT = Dataout; // For scope display
//TXBUF0 = Dataout; // Transmit via UART0 for Scope display
// send the data as ascii values
TXBUF0 = (Dataout / 100) + 48; // hundreds
while (!(IFG1 & UTXIFG0)); // wait for transmission
TXBUF0 = ((Dataout / 10) % 10 ) + 48; // tens
while (!(IFG1 & UTXIFG0));
TXBUF0 = ((Dataout / 1) % 10 ) + 48; // ones
while (!(IFG1 & UTXIFG0));
TXBUF0 = 32; // send a blank
while (!(IFG1 & UTXIFG0));
TXBUF0 = ((heartrate & 0xf00) >> 8) + 48;
while (!(IFG1 & UTXIFG0));
TXBUF0 = ((heartrate & 0xf0) >> 4) + 48;
while (!(IFG1 & UTXIFG0));
TXBUF0 = (heartrate & 0x0f) + 48;
while (!(IFG1 & UTXIFG0));
TXBUF0 = 10; // send a \n
counter++; // Debounce counter
pulseperiod++; // Pulse period counter
if (Dataout_pulse > 110) // Check if above threshold (48)
{
LCDMEM[1] = 0xF0; // Heart beat detected enable "<^>" on LCD
counter = 0; // Reset debounce counter
}
if (counter == 128) // Allow 128 sample debounce time
{
LCDMEM[1] = 0x00; // Disable "<^>" on LCD for blinking effect
beats++;
if (beats == 3)
{
beats = 0;
// heartrate = itobcd(30720/pulseperiod); // Calculate beat to beat heart rate per min
//heartrate = itobcd(92160/pulseperiod); // Calculate 3 beat average heart rate per min
heartrate = itobcd(50720/pulseperiod); // Calculate 3 beat average heart rate per min
//heartrate = (92160/pulseperiod); // Calculate 3 beat average heart rate per min
pulseperiod = 0; // Reset pulse period for next measurement
///*
LCDMEM[2] = char_gen_10_11[heartrate & 0x0f]; // Display current heart rate units -> LCD Digit 11
LCDMEM[3] = char_gen_10_11[(heartrate & 0xf0) >> 4]; // tens -> LCD Digit 10
LCDMEM[4] = char_gen_8_9[(heartrate & 0xf00) >> 8]; // hundreds -> LCD Digit 9
LCDMEM[7] = ((char)(char_gen_1_7[heartrate & 0x0f]>>8)); // LCD -> Digit 7 High Byte
LCDMEM[6] = ((char)(char_gen_1_7[heartrate & 0x0f]&0x00FF)); // LCD -> Digit 7 Low Byte
LCDMEM[9] = ((char)(char_gen_1_7[((heartrate & 0xf0) >> 4)]>>8)); // LCD -> Digit 6 High Byte
LCDMEM[8] = ((char)(char_gen_1_7[((heartrate & 0xf0) >> 4)]&0x00FF)); // LCD -> Digit 6 Low Byte
LCDMEM[11] = ((char)(char_gen_1_7[((heartrate & 0xf00) >> 8)]>>8)); // LCD -> Digit 5 High Byte
LCDMEM[10] = ((char)(char_gen_1_7[((heartrate & 0xf00) >> 8)]&0x00FF)); // LCD -> Digit 5 Low Byte
//*/
}
}
}
}//main
// Initialization function
void Init( void )
{
FLL_CTL0 |= XCAP10PF; // Set load capacitance for xtal
WDTCTL = WDTPW | WDTHOLD; // Disable the Watchdog
while ( LFOF & FLL_CTL0); // wait for watch crystal to stabilize
SCFQCTL = 63; // 32 x 32768 x 2 = 2.097152MHz
BTCTL = BT_fLCD_DIV128; // Set LCD frame freq = ACLK/128
// Initialize and enable LCD peripheral
ClearLCD(); // Clear LCD memory
LCDCTL = LCDSG0_3 + LCD4MUX + LCDON ; // 4mux LCD, segs0-23 enabled
// Initialize and enable GPIO ports
P1OUT = 0x00 + BIT3; // Clear P1OUT register, INA turned ON
P1DIR = 0x3f; // Unused pins as outputs, Comparator pins as inputs
P2OUT = 0x00; // Clear P2OUT register
P2DIR = 0xff; // Unused pins as outputs
P2DIR = ~(PB_2_0+PB_2_1); // P2.0 and P2.1 push buttons
P2IES = 0x00; // Interrupt edge low to high transition
P2IFG = 0x00; // Clear pending P2 interrupts
P2IE = PB_2_0 | PB_2_1; // Enable intterupts for push buttons
P3OUT = 0x00; // Clear P3OUT register
P3DIR = 0x0f; // Unused pins as outputs except P3.<4-7> -> For the new LCD's received at ~04.10.2012 this must be inputs!!
P4OUT = 0x00; // Clear P4OUT register
P4DIR = 0xff; // Unused pins as outputs
P5OUT = 0x00; // Clear P5OUT register
P5DIR = 0xff; // Unused pins as outputs
P5SEL = 0xfc; // Set Rxx and COM pins for LCD
P6OUT = 0x00; // Clear P6OUT register
P6SEL = 0xff; // P6 = Analog
// Initialize and enable UART
P2SEL|=BIT4; // P2.4 = TXD
UCTL0 |= SWRST; // UART SWRST = 1
ME1 |= UTXE0; // Enable UART0 TXD
UCTL0 |= CHAR; // 8-bit char, SWRST=1
UTCTL0 |= SSEL1; // UCLK = SMCLK
UBR00 = 18; // 115200 from 2.097152MHz
UBR10 = 0;
UMCTL0 = 0x2c; // Modulation = 0.2044
UCTL0 &= ~SWRST; // UART SWRST = 0, enable UART
IFG1 &= ~UTXIFG0;
// Initialize and enable ADC12
ADC12CTL0 = ADC12ON + SHT0_4 + REFON + REF2_5V;
// ADC12 ON, Reference = 2.5V for DAC0
ADC12CTL1 = SHP + SHS_1 + CONSEQ_2; // Use sampling timer, TA1 trigger
ADC12MCTL0 = INCH_1 + SREF_1; // Vref, channel = 1 = OA0 Out
ADC12IE = BIT0; // Enable interrupt for ADC12 MEM0
ADC12CTL0 |= ENC; // Enable conversions
// Initialize and enable Timer_A
TACTL = TASSEL0 + MC_1 + TACLR; // ACLK, Clear TAR, Up Mode
TACCTL1 = OUTMOD_2; // Set / Reset
TACCR0 = 63; // 512 samples per second
TACCR1 = 15; //
// Initialize and enable DAC12x
DAC12_0CTL = DAC12OPS + DAC12CALON + DAC12IR + DAC12AMP_2 + DAC12ENC;// DAC0 enable
DAC12_1CTL = DAC12CALON + DAC12IR + DAC12AMP_2 + DAC12ENC; // DAC1 enable
DAC12_1DAT = 0x099A; // Offset level = 1.5V for op amp bias
// Initialize and enable opamps
OA0CTL0 = OAP_1 + OAPM_1 + OAADC1; // OA0 enable power mode 1, OA0- = P6.0, 0A0+ = P6.2, OA0O = P6.1
OA0CTL1 = OARRIP; // General purpose mode, no Rail-to-Rail inputs
OA1CTL0 = OAP_3 + OAPM_1 + OAADC1; // OA1 enable power mode 1, OA1- = P6.4, OA1+ = DAC1, OA1O = P6.3
OA1CTL1 = OARRIP; // General purpose mode, no Rail-to-Rail inputs
OA2CTL0 = OAP_3 + OAPM_1 + OAADC1; // OA2 enable power mode 1, OA2+ = DAC1, OA2O = P6.5, Select inputs, power mode
OA2CTL1 = OAFC_1 + OARRIP; // Unit gain Mode, no Rail-to-Rail inputs
__enable_interrupt(); // Enable global Interrupts
} //init
void ClearLCD(void)
{
int i; //
for( i = 0; i < 20; i++){ // Clear LCDMEM
LCDMEM[i] = 0; //
}
}//clear LCD
int itobcd(int i) // Convert hex word to BCD.
{
int bcd = 0; //
char j = 0; //
while (i > 9) //
{
bcd |= ((i % 10) << j); //
i /= 10; //
j += 4;
} //
return (bcd | (i << j)); // Return converted value
}// itobcd(i)
int filterlp(int sample) // Lowpass FIR filter for EKG
{
static int buflp[32]; // Reserve 32 loactions for circular buffering
static int offsetlp = 0;
long z;
int i;
buflp[offsetlp] = sample;
z = mul16(coeffslp[8], buflp[(offsetlp - 8) & 0x1F]);
__no_operation();
for (i = 0; i < 8; i++){
z += mul16(coeffslp[i], buflp[(offsetlp - i) & 0x1F] + buflp[(offsetlp - 16 + i) & 0x1F]);
}
offsetlp = (offsetlp + 1) & 0x1F;
return z >> 15; // Return filter output
}// int filter
int filterhp(int samplehp) // Highpass FIR filter for hear rate
{
static int bufhp[32]; // Reserve 32 loactions for circular buffering
static int offsethp = 0;
long z;
int i;
bufhp[offsethp] = samplehp;
z = mul16(coeffshp[8], bufhp[(offsethp - 8) & 0x1F]);
for (i = 0; i < 8; i++){
z += mul16(coeffshp[i], bufhp[(offsethp - i) & 0x1F] + bufhp[(offsethp - 16 + i) & 0x1F]);
}
offsethp = (offsethp + 1) & 0x1F;
return z >> 15; // Return filter output
}// int filterhp
#pragma vector = PORT2_VECTOR
__interrupt void Port2ISR (void)
{
P2IFG = 0;
}//Push buttons unused
#pragma vector = ADC_VECTOR // ADC12 ISR
__interrupt void ADC12ISR (void)
{
Datain = ADC12MEM0; // Store converted value in Datain
__bic_SR_register_on_exit(LPM0_bits); // Exit LPM0 on return
}// ADC12ISR

View File

@ -0,0 +1,128 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<project>
<fileVersion>2</fileVersion>
<fileChecksum>475830264</fileChecksum>
<configuration>
<name>Debug</name>
<outputs>
<file>$PROJ_DIR$\MOD-EKG_DemoSoft.c</file>
<file>$TOOLKIT_DIR$\inc\msp430xg43x.h</file>
<file>$PROJ_DIR$\Debug\Exe\MOD-EKG_DemoSoft.d43</file>
<file>$PROJ_DIR$\Debug\Obj\MOD-EKG_DemoSoft.pbd</file>
<file>$PROJ_DIR$\mul.s43</file>
<file>$TOOLKIT_DIR$\inc\intrinsics.h</file>
<file>$PROJ_DIR$\Debug\Obj\MOD-EKG_DemoSoft.pbi</file>
<file>$TOOLKIT_DIR$\lib\dlib\dl430fn.h</file>
<file>$PROJ_DIR$\Debug\Obj\MOD-EKG_DemoSoft.r43</file>
<file>$TOOLKIT_DIR$\lib\dlib\dl430fn.r43</file>
<file>$TOOLKIT_DIR$\inc\in430.h</file>
<file>$PROJ_DIR$\Debug\Exe\MOD-EKG_DemoSoft.ulp</file>
<file>$PROJ_DIR$\Debug\Obj\mul.r43</file>
<file>$TOOLKIT_DIR$\inc\dlib\c\ymath.h</file>
<file>$TOOLKIT_DIR$\inc\dlib\c\math.h</file>
<file>$TOOLKIT_DIR$\inc\dlib\c\ycheck.h</file>
<file>$TOOLKIT_DIR$\inc\dlib\c\DLib_Defaults.h</file>
<file>$TOOLKIT_DIR$\inc\dlib\c\xencoding_limits.h</file>
<file>$TOOLKIT_DIR$\inc\dlib\c\yvals.h</file>
<file>$TOOLKIT_DIR$\inc\dlib\c\DLib_Threads.h</file>
<file>$TOOLKIT_DIR$\inc\dlib\c\DLib_Product.h</file>
<file>$TOOLKIT_DIR$\inc\dlib\c\xtgmath.h</file>
<file>$TOOLKIT_DIR$\config\linker\lnk430fg439.xcl</file>
<file>$PROJ_DIR$\Debug\Exe\MOD-EKG_DemoSoft.a43</file>
<file>$PROJ_DIR$\Debug\Exe\MOD-EKG_DemoSoft.hex</file>
<file>$PROJ_DIR$\Debug\Exe\ekg.hex</file>
</outputs>
<file>
<name>$PROJ_DIR$\MOD-EKG_DemoSoft.c</name>
<outputs>
<tool>
<name>BICOMP</name>
<file> 6</file>
</tool>
<tool>
<name>ICC430</name>
<file> 8</file>
</tool>
</outputs>
<inputs>
<tool>
<name>BICOMP</name>
<file> 1 10 5 14 15 13 18 16 7 20 17 19 21</file>
</tool>
<tool>
<name>ICC430</name>
<file> 1 10 5 14 15 13 18 16 7 20 17 19 21</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\Debug\Exe\MOD-EKG_DemoSoft.d43</name>
<inputs>
<tool>
<name>XLINK</name>
<file> 22 8 12 9</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\mul.s43</name>
<outputs>
<tool>
<name>A430</name>
<file> 12</file>
</tool>
</outputs>
</file>
<file>
<name>$PROJ_DIR$\Debug\Exe\MOD-EKG_DemoSoft.a43</name>
<inputs>
<tool>
<name>XLINK</name>
<file> 22 8 12 9</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\Debug\Exe\MOD-EKG_DemoSoft.hex</name>
<inputs>
<tool>
<name>XLINK</name>
<file> 22 8 12 9</file>
</tool>
</inputs>
</file>
<file>
<name>[ROOT_NODE]</name>
<outputs>
<tool>
<name>XLINK</name>
<file> 25</file>
</tool>
<tool>
<name>ULP430</name>
<file> 11</file>
</tool>
</outputs>
</file>
<file>
<name>$PROJ_DIR$\Debug\Exe\ekg.hex</name>
<inputs>
<tool>
<name>XLINK</name>
<file> 22 8 12 9</file>
</tool>
</inputs>
</file>
</configuration>
<configuration>
<name>Release</name>
<outputs/>
<forcedrebuild>
<name>[MULTI_TOOL]</name>
<tool>XLINK</tool>
</forcedrebuild>
</configuration>
</project>

View File

@ -0,0 +1,819 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<project>
<fileVersion>2</fileVersion>
<configuration>
<name>Debug</name>
<toolchain>
<name>MSP430</name>
</toolchain>
<debug>1</debug>
<settings>
<name>C-SPY</name>
<archiveVersion>4</archiveVersion>
<data>
<version>27</version>
<wantNonLocal>1</wantNonLocal>
<debug>1</debug>
<option>
<name>CInput</name>
<state>1</state>
</option>
<option>
<name>MacOverride</name>
<state>0</state>
</option>
<option>
<name>MacFile</name>
<state></state>
</option>
<option>
<name>IProcessor</name>
<state>0</state>
</option>
<option>
<name>GoToEnable</name>
<state>1</state>
</option>
<option>
<name>GoToName</name>
<state>main</state>
</option>
<option>
<name>DynDriver</name>
<state>430FET</state>
</option>
<option>
<name>dDllSlave</name>
<state>0</state>
</option>
<option>
<name>DdfFileSlave</name>
<state>1</state>
</option>
<option>
<name>DdfOverride</name>
<state>0</state>
</option>
<option>
<name>DdfFileName</name>
<state>$TOOLKIT_DIR$\config\debugger\MSP430FG439.ddf</state>
</option>
<option>
<name>ProcTMS</name>
<state>1</state>
</option>
<option>
<name>CExtraOptionsCheck</name>
<state>0</state>
</option>
<option>
<name>CExtraOptions</name>
<state></state>
</option>
<option>
<name>ProcMSP430X</name>
<state>1</state>
</option>
<option>
<name>CompilerDataModel</name>
<state>1</state>
</option>
<option>
<name>IVBASE</name>
<state>1</state>
</option>
<option>
<name>OCImagesSuppressCheck1</name>
<state>0</state>
</option>
<option>
<name>OCImagesPath1</name>
<state></state>
</option>
<option>
<name>OCImagesSuppressCheck2</name>
<state>0</state>
</option>
<option>
<name>OCImagesPath2</name>
<state></state>
</option>
<option>
<name>OCImagesSuppressCheck3</name>
<state>0</state>
</option>
<option>
<name>OCImagesPath3</name>
<state></state>
</option>
<option>
<name>CPUTAG</name>
<state>1</state>
</option>
<option>
<name>L092Mode</name>
<state>1</state>
</option>
<option>
<name>OCImagesOffset1</name>
<state></state>
</option>
<option>
<name>OCImagesOffset2</name>
<state></state>
</option>
<option>
<name>OCImagesOffset3</name>
<state></state>
</option>
<option>
<name>OCImagesUse1</name>
<state>0</state>
</option>
<option>
<name>OCImagesUse2</name>
<state>0</state>
</option>
<option>
<name>OCImagesUse3</name>
<state>0</state>
</option>
<option>
<name>ENERGYTRACE</name>
<state>1</state>
</option>
<option>
<name>FETIPE</name>
<state>1</state>
</option>
</data>
</settings>
<settings>
<name>430FET</name>
<archiveVersion>1</archiveVersion>
<data>
<version>27</version>
<wantNonLocal>1</wantNonLocal>
<debug>1</debug>
<option>
<name>CFetMandatory</name>
<state>0</state>
</option>
<option>
<name>Erase</name>
<state>1</state>
</option>
<option>
<name>EMUVerifyDownloadP7</name>
<state>0</state>
</option>
<option>
<name>EraseOptionSlaveP7</name>
<state>0</state>
</option>
<option>
<name>ExitBreakpointP7</name>
<state>0</state>
</option>
<option>
<name>PutcharBreakpointP7</name>
<state>1</state>
</option>
<option>
<name>GetcharBreakpointP7</name>
<state>1</state>
</option>
<option>
<name>derivativeP7</name>
<state>0</state>
</option>
<option>
<name>ParallelPortP7</name>
<version>0</version>
<state>0</state>
</option>
<option>
<name>TargetVoltage</name>
<state>3.3</state>
</option>
<option>
<name>AllowLockedFlashAccessP7</name>
<state>0</state>
</option>
<option>
<name>EMUAttach</name>
<state>0</state>
</option>
<option>
<name>AttachOptionSlave</name>
<state>0</state>
</option>
<option>
<name>CRadioProtocolType</name>
<state>0</state>
</option>
<option>
<name>CCRadioModuleTypeSlave</name>
<state>1</state>
</option>
<option>
<name>EEMLevel</name>
<state>0</state>
</option>
<option>
<name>DiasbleMemoryCache</name>
<state>0</state>
</option>
<option>
<name>NeedLockedFlashAccess</name>
<state>1</state>
</option>
<option>
<name>UsbComPort</name>
<state>Automatic</state>
</option>
<option>
<name>FetConnection</name>
<version>3</version>
<state>6</state>
</option>
<option>
<name>SoftwareBreakpointEnable</name>
<state>0</state>
</option>
<option>
<name>RadioSoftwareBreakpointType</name>
<state>0</state>
</option>
<option>
<name>TargetSettlingtime</name>
<state>0</state>
</option>
<option>
<name>AllowAccessToBSL</name>
<state>0</state>
</option>
<option>
<name>OTargetVccTypeDefault</name>
<state>0</state>
</option>
<option>
<name>CCBetaDll</name>
<state>1</state>
</option>
<option>
<name>GPassword</name>
<state></state>
</option>
<option>
<name>DebugLPM5</name>
<state>0</state>
</option>
<option>
<name>LPM5Slave</name>
<state>0</state>
</option>
<option>
<name>CRadioAutoManualType</name>
<state>0</state>
</option>
<option>
<name>ExternalCodeDownload</name>
<state>0</state>
</option>
<option>
<name>CCVCCDefault</name>
<state>1</state>
</option>
<option>
<name>Retain</name>
<state>0</state>
</option>
<option>
<name>jstatebit</name>
<state>0</state>
</option>
<option>
<name>RadioJtagSpeedType</name>
<state>1</state>
</option>
<option>
<name>memoryTypeSlave</name>
<state>0</state>
</option>
<option>
<name>fuseBlowDisabledSlave</name>
<state>0</state>
</option>
<option>
<name>eraseTypeSlave</name>
<state>0</state>
</option>
</data>
</settings>
<settings>
<name>SIM430</name>
<archiveVersion>1</archiveVersion>
<data>
<version>4</version>
<wantNonLocal>1</wantNonLocal>
<debug>1</debug>
<option>
<name>SimOddAddressCheckP7</name>
<state>1</state>
</option>
<option>
<name>CSimMandatory</name>
<state>1</state>
</option>
<option>
<name>derivativeSim</name>
<state>0</state>
</option>
<option>
<name>SimEnablePSP</name>
<state>0</state>
</option>
<option>
<name>SimPspOverrideConfig</name>
<state>0</state>
</option>
<option>
<name>SimPspConfigFile</name>
<state>###Uninitialized###</state>
</option>
</data>
</settings>
<debuggerPlugins>
<plugin>
<file>$TOOLKIT_DIR$\plugins\Lcd\lcd.ewplugin</file>
<loadFlag>1</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\CMX\CmxPlugin.ENU.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyPlugin.ENU.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin</file>
<loadFlag>1</loadFlag>
</plugin>
<plugin>
<file>$EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin</file>
<loadFlag>1</loadFlag>
</plugin>
<plugin>
<file>$EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
</debuggerPlugins>
</configuration>
<configuration>
<name>Release</name>
<toolchain>
<name>MSP430</name>
</toolchain>
<debug>0</debug>
<settings>
<name>C-SPY</name>
<archiveVersion>4</archiveVersion>
<data>
<version>27</version>
<wantNonLocal>1</wantNonLocal>
<debug>0</debug>
<option>
<name>CInput</name>
<state>1</state>
</option>
<option>
<name>MacOverride</name>
<state>0</state>
</option>
<option>
<name>MacFile</name>
<state></state>
</option>
<option>
<name>IProcessor</name>
<state>0</state>
</option>
<option>
<name>GoToEnable</name>
<state>1</state>
</option>
<option>
<name>GoToName</name>
<state>main</state>
</option>
<option>
<name>DynDriver</name>
<state>SIM430</state>
</option>
<option>
<name>dDllSlave</name>
<state>0</state>
</option>
<option>
<name>DdfFileSlave</name>
<state>1</state>
</option>
<option>
<name>DdfOverride</name>
<state>0</state>
</option>
<option>
<name>DdfFileName</name>
<state></state>
</option>
<option>
<name>ProcTMS</name>
<state>1</state>
</option>
<option>
<name>CExtraOptionsCheck</name>
<state>0</state>
</option>
<option>
<name>CExtraOptions</name>
<state></state>
</option>
<option>
<name>ProcMSP430X</name>
<state>1</state>
</option>
<option>
<name>CompilerDataModel</name>
<state>1</state>
</option>
<option>
<name>IVBASE</name>
<state>1</state>
</option>
<option>
<name>OCImagesSuppressCheck1</name>
<state>0</state>
</option>
<option>
<name>OCImagesPath1</name>
<state></state>
</option>
<option>
<name>OCImagesSuppressCheck2</name>
<state>0</state>
</option>
<option>
<name>OCImagesPath2</name>
<state></state>
</option>
<option>
<name>OCImagesSuppressCheck3</name>
<state>0</state>
</option>
<option>
<name>OCImagesPath3</name>
<state></state>
</option>
<option>
<name>CPUTAG</name>
<state>1</state>
</option>
<option>
<name>L092Mode</name>
<state>1</state>
</option>
<option>
<name>OCImagesOffset1</name>
<state></state>
</option>
<option>
<name>OCImagesOffset2</name>
<state></state>
</option>
<option>
<name>OCImagesOffset3</name>
<state></state>
</option>
<option>
<name>OCImagesUse1</name>
<state>0</state>
</option>
<option>
<name>OCImagesUse2</name>
<state>0</state>
</option>
<option>
<name>OCImagesUse3</name>
<state>0</state>
</option>
<option>
<name>ENERGYTRACE</name>
<state>1</state>
</option>
<option>
<name>FETIPE</name>
<state>1</state>
</option>
</data>
</settings>
<settings>
<name>430FET</name>
<archiveVersion>1</archiveVersion>
<data>
<version>27</version>
<wantNonLocal>1</wantNonLocal>
<debug>0</debug>
<option>
<name>CFetMandatory</name>
<state>0</state>
</option>
<option>
<name>Erase</name>
<state>1</state>
</option>
<option>
<name>EMUVerifyDownloadP7</name>
<state>0</state>
</option>
<option>
<name>EraseOptionSlaveP7</name>
<state>0</state>
</option>
<option>
<name>ExitBreakpointP7</name>
<state>0</state>
</option>
<option>
<name>PutcharBreakpointP7</name>
<state>1</state>
</option>
<option>
<name>GetcharBreakpointP7</name>
<state>1</state>
</option>
<option>
<name>derivativeP7</name>
<state>0</state>
</option>
<option>
<name>ParallelPortP7</name>
<version>0</version>
<state>0</state>
</option>
<option>
<name>TargetVoltage</name>
<state>###Uninitialized###</state>
</option>
<option>
<name>AllowLockedFlashAccessP7</name>
<state>0</state>
</option>
<option>
<name>EMUAttach</name>
<state>0</state>
</option>
<option>
<name>AttachOptionSlave</name>
<state>0</state>
</option>
<option>
<name>CRadioProtocolType</name>
<state>1</state>
</option>
<option>
<name>CCRadioModuleTypeSlave</name>
<state>1</state>
</option>
<option>
<name>EEMLevel</name>
<state>0</state>
</option>
<option>
<name>DiasbleMemoryCache</name>
<state>0</state>
</option>
<option>
<name>NeedLockedFlashAccess</name>
<state>1</state>
</option>
<option>
<name>UsbComPort</name>
<state>Automatic</state>
</option>
<option>
<name>FetConnection</name>
<version>3</version>
<state>0</state>
</option>
<option>
<name>SoftwareBreakpointEnable</name>
<state>0</state>
</option>
<option>
<name>RadioSoftwareBreakpointType</name>
<state>0</state>
</option>
<option>
<name>TargetSettlingtime</name>
<state>0</state>
</option>
<option>
<name>AllowAccessToBSL</name>
<state>0</state>
</option>
<option>
<name>OTargetVccTypeDefault</name>
<state>0</state>
</option>
<option>
<name>CCBetaDll</name>
<state>1</state>
</option>
<option>
<name>GPassword</name>
<state>###Uninitialized###</state>
</option>
<option>
<name>DebugLPM5</name>
<state>0</state>
</option>
<option>
<name>LPM5Slave</name>
<state>0</state>
</option>
<option>
<name>CRadioAutoManualType</name>
<state>0</state>
</option>
<option>
<name>ExternalCodeDownload</name>
<state>0</state>
</option>
<option>
<name>CCVCCDefault</name>
<state>1</state>
</option>
<option>
<name>Retain</name>
<state>0</state>
</option>
<option>
<name>jstatebit</name>
<state>0</state>
</option>
<option>
<name>RadioJtagSpeedType</name>
<state>1</state>
</option>
<option>
<name>memoryTypeSlave</name>
<state>0</state>
</option>
<option>
<name>fuseBlowDisabledSlave</name>
<state>0</state>
</option>
<option>
<name>eraseTypeSlave</name>
<state>0</state>
</option>
</data>
</settings>
<settings>
<name>SIM430</name>
<archiveVersion>1</archiveVersion>
<data>
<version>4</version>
<wantNonLocal>1</wantNonLocal>
<debug>0</debug>
<option>
<name>SimOddAddressCheckP7</name>
<state>1</state>
</option>
<option>
<name>CSimMandatory</name>
<state>1</state>
</option>
<option>
<name>derivativeSim</name>
<state>0</state>
</option>
<option>
<name>SimEnablePSP</name>
<state>0</state>
</option>
<option>
<name>SimPspOverrideConfig</name>
<state>0</state>
</option>
<option>
<name>SimPspConfigFile</name>
<state>###Uninitialized###</state>
</option>
</data>
</settings>
<debuggerPlugins>
<plugin>
<file>$TOOLKIT_DIR$\plugins\Lcd\lcd.ewplugin</file>
<loadFlag>1</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\CMX\CmxPlugin.ENU.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyPlugin.ENU.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin</file>
<loadFlag>1</loadFlag>
</plugin>
<plugin>
<file>$EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin</file>
<loadFlag>1</loadFlag>
</plugin>
<plugin>
<file>$EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
</debuggerPlugins>
</configuration>
</project>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<workspace>
<project>
<path>$WS_DIR$\MOD-EKG_DemoSoft.ewp</path>
</project>
<batchBuild/>
</workspace>

View File

@ -0,0 +1,110 @@
//
//16x16=>32 multiply
//long mul16(register int x, register int y)
//
// Edited by: M Morales, November 2008
// * Updated calling conventions in support of IAR compiler >= 4.x
//*****************************************************************************
// THIS PROGRAM IS PROVIDED "AS IS". TI MAKES NO WARRANTIES OR
// REPRESENTATIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
// INCLUDING ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR
// COMPLETENESS OF RESPONSES, RESULTS AND LACK OF NEGLIGENCE.
// TI DISCLAIMS ANY WARRANTY OF TITLE, QUIET ENJOYMENT, QUIET
// POSSESSION, AND NON-INFRINGEMENT OF ANY THIRD PARTY
// INTELLECTUAL PROPERTY RIGHTS WITH REGARD TO THE PROGRAM OR
// YOUR USE OF THE PROGRAM.
//
// IN NO EVENT SHALL TI BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
// CONSEQUENTIAL OR INDIRECT DAMAGES, HOWEVER CAUSED, ON ANY
// THEORY OF LIABILITY AND WHETHER OR NOT TI HAS BEEN ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGES, ARISING IN ANY WAY OUT
// OF THIS AGREEMENT, THE PROGRAM, OR YOUR USE OF THE PROGRAM.
// EXCLUDED DAMAGES INCLUDE, BUT ARE NOT LIMITED TO, COST OF
// REMOVAL OR REINSTALLATION, COMPUTER TIME, LABOR COSTS, LOSS
// OF GOODWILL, LOSS OF PROFITS, LOSS OF SAVINGS, OR LOSS OF
// USE OR INTERRUPTION OF BUSINESS. IN NO EVENT WILL TI'S
// AGGREGATE LIABILITY UNDER THIS AGREEMENT OR ARISING OUT OF
// YOUR USE OF THE PROGRAM EXCEED FIVE HUNDRED DOLLARS
// (U.S.$500).
//
// Unless otherwise stated, the Program written and copyrighted
// by Texas Instruments is distributed as "freeware". You may,
// only under TI's copyright in the Program, use and modify the
// Program without any charge or restriction. You may
// distribute to third parties, provided that you transfer a
// copy of this license to the third party and the third party
// agrees to these terms by its first use of the Program. You
// must reproduce the copyright notice and any other legend of
// ownership on each copy or partial copy, of the Program.
//
// You acknowledge and agree that the Program contains
// copyrighted material, trade secrets and other TI proprietary
// information and is protected by copyright laws,
// international copyright treaties, and trade secret laws, as
// well as other intellectual property laws. To protect TI's
// rights in the Program, you agree not to decompile, reverse
// engineer, disassemble or otherwise translate any object code
// versions of the Program to a human-readable form. You agree
// that in no event will you alter, remove or destroy any
// copyright notice included in the Program. TI reserves all
// rights not specifically granted under this license. Except
// as specifically provided herein, nothing in this agreement
// shall be construed as conferring by implication, estoppel,
// or otherwise, upon you, any license or other right under any
// TI patents, copyrights or trade secrets.
//
// You may not use the Program in non-TI devices.
//*****************************************************************************
public mul16
RSEG CODE
mul16
#define x1 r9
#define z0 r14
#define z1 r15
#define x r12
#define y r13
push r9
clr z0
mov z0,z1
mov z0,x1
tst x
jge xbooth_2
mov #-1,x1
jmp xbooth_2
xbooth_6
add x,z1
addc x1,z0
xbooth_1
rla x
rlc x1
xbooth_2
rra y
jc xbooth_5
jne xbooth_1
jmp xbooth_4
xbooth_5
sub x,z1
subc x1,z0
xbooth_3
rla x
rlc x1
rra y
jnc xbooth_6
cmp #0FFFFh,y
jne xbooth_3
xbooth_4
mov z1,r12
mov z0,r13
pop r9
ret
end

View File

View File

@ -0,0 +1,24 @@
@REM This batch file has been generated by the IAR Embedded Workbench
@REM C-SPY Debugger, as an aid to preparing a command line for running
@REM the cspybat command line utility using the appropriate settings.
@REM
@REM Note that this file is generated every time a new debug session
@REM is initialized, so you may want to move or rename the file before
@REM making changes.
@REM
@REM You can launch cspybat by typing the name of this batch file followed
@REM by the name of the debug file (usually an ELF/DWARF or UBROF file).
@REM
@REM Read about available command line parameters in the C-SPY Debugging
@REM Guide. Hints about additional command line parameters that may be
@REM useful in specific cases:
@REM --download_only Downloads a code image without starting a debug
@REM session afterwards.
@REM --silent Omits the sign-on message.
@REM --timeout Limits the maximum allowed execution time.
@REM
"C:\Program Files (x86)\IAR Systems\Embedded Workbench 7.0_2\common\bin\cspybat" "C:\Program Files (x86)\IAR Systems\Embedded Workbench 7.0_2\430\bin\430proc.dll" "C:\Program Files (x86)\IAR Systems\Embedded Workbench 7.0_2\430\bin\430fet.dll" %1 --plugin "C:\Program Files (x86)\IAR Systems\Embedded Workbench 7.0_2\430\bin\430bat.dll" --backend -B "-p" "C:\Program Files (x86)\IAR Systems\Embedded Workbench 7.0_2\430\config\debugger\MSP430FG439.ddf" "--iv_base" "0xFFE0" "-d" "fet" "--erase_main_and_info" "--derivative" "MSP430FG43x_F43x" "--protocol" "4wire" "--eem" "EMEX_LOW" "--port" "Automatic" "--connection" "olimex" "--settlingtime=0" "--msp430_dll" "msp430.dll" "--vccDefault" "3.3" "--jtag_speed" "medium" "--memtype" "F"

View File

@ -0,0 +1,34 @@
@REM This bat file has been generated by the IAR Embeddded Workbench
@REM C-SPY interactive debugger,as an aid to preparing a command
@REM line for running the cspybat command line utility with the
@REM appropriate settings.
@REM
@REM After making some adjustments to this file, you can launch cspybat
@REM by typing the name of this file followed by the name of the debug
@REM file (usually an ubrof file). Note that this file is generated
@REM every time a new debug session is initialized, so you may want to
@REM move or rename the file before making changes.
@REM
@REM Note: some command line arguments cannot be properly generated
@REM by this process. Specifically, the plugin which is responsible
@REM for the Terminal I/O window (and other C runtime functionality)
@REM comes in a special version for cspybat, and the name of that
@REM plugin dll is not known when generating this file. It resides in
@REM the $TOOLKIT_DIR$\bin folder and is usually called XXXbat.dll or
@REM XXXlibsupportbat.dll, where XXX is the name of the corresponding
@REM tool chain. Replace the '<libsupport_plugin>' parameter
@REM below with the appropriate file name. Other plugins loaded by
@REM C-SPY are usually not needed by, or will not work in, cspybat
@REM but they are listed at the end of this file for reference.
"C:\Program Files\IAR Systems\IAR Embedded Workbench for MSP, v4.21 Evaluation version\common\bin\cspybat" "C:\Program Files\IAR Systems\IAR Embedded Workbench for MSP, v4.21 Evaluation version\430\bin\430proc.dll" "C:\Program Files\IAR Systems\IAR Embedded Workbench for MSP, v4.21 Evaluation version\430\bin\430fet.dll" %1 --plugin "C:\Program Files\IAR Systems\IAR Embedded Workbench for MSP, v4.21 Evaluation version\430\bin\<libsupport_plugin>" --backend -B "-p" "C:\Program Files\IAR Systems\IAR Embedded Workbench for MSP, v4.21 Evaluation version\430\config\MSP430FG439.ddf" "--iv_base" "0xFFE0" "-d" "fet" "--erase_main_and_info" "--derivative" "MSP430FG439" "--vccvoltage=3.3" "--protocol" "4wire" "--eem" "EMEX_LOW" "--connection" "olimex" "--settlingtime=0"
@REM Loaded plugins:
@REM C:\Program Files\IAR Systems\IAR Embedded Workbench for MSP, v4.21 Evaluation version\430\bin\430libsupport.dll
@REM C:\Program Files\IAR Systems\IAR Embedded Workbench for MSP, v4.21 Evaluation version\430\plugins\lcd\lcd.dll
@REM C:\Program Files\IAR Systems\IAR Embedded Workbench for MSP, v4.21 Evaluation version\common\plugins\CodeCoverage\CodeCoverage.dll
@REM C:\Program Files\IAR Systems\IAR Embedded Workbench for MSP, v4.21 Evaluation version\common\plugins\Profiling\Profiling.dll
@REM C:\Program Files\IAR Systems\IAR Embedded Workbench for MSP, v4.21 Evaluation version\common\plugins\stack\stack.dll
@REM C:\Program Files\IAR Systems\IAR Embedded Workbench for MSP, v4.21 Evaluation version\common\plugins\SymList\SymList.dll

View File

@ -0,0 +1,89 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<Project>
<Desktop>
<Static>
<Debug-Log>
<ColumnWidth0>20</ColumnWidth0><ColumnWidth1>1221</ColumnWidth1></Debug-Log>
<Build>
<ColumnWidth0>20</ColumnWidth0><ColumnWidth1>915</ColumnWidth1><ColumnWidth2>244</ColumnWidth2><ColumnWidth3>61</ColumnWidth3></Build>
<Workspace>
<ColumnWidths>
<Column0>174</Column0><Column1>27</Column1><Column2>27</Column2><Column3>27</Column3></ColumnWidths>
</Workspace>
<Disassembly>
<MixedMode>1</MixedMode><CodeCovShow>0</CodeCovShow><InstrProfShow>0</InstrProfShow><col-names><item>Disassembly</item><item>_I0</item></col-names><col-widths><item>500</item><item>20</item></col-widths><DisasmHistory/><ShowCodeCoverage>1</ShowCodeCoverage><ShowInstrProfiling>1</ShowInstrProfiling></Disassembly>
</Static>
<Windows>
<Wnd0>
<Tabs>
<Tab>
<Identity>TabID-32631-32423</Identity>
<TabName>Debug Log</TabName>
<Factory>Debug-Log</Factory>
<Session/>
</Tab>
<Tab>
<Identity>TabID-32108-32433</Identity>
<TabName>Build</TabName>
<Factory>Build</Factory>
<Session/>
</Tab>
</Tabs>
<SelectedTab>0</SelectedTab></Wnd0><Wnd1>
<Tabs>
<Tab>
<Identity>TabID-10611-32426</Identity>
<TabName>Workspace</TabName>
<Factory>Workspace</Factory>
<Session>
<NodeDict><ExpandedNode>MOD-EKG_DemoSoft</ExpandedNode></NodeDict></Session>
</Tab>
</Tabs>
<SelectedTab>0</SelectedTab></Wnd1><Wnd2>
<Tabs>
<Tab>
<Identity>TabID-21360-32430</Identity>
<TabName>Disassembly</TabName>
<Factory>Disassembly</Factory>
<Session/>
</Tab>
</Tabs>
<SelectedTab>0</SelectedTab></Wnd2></Windows>
<Editor>
<Pane><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\MOD-EKG_DemoSoft.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>249</YPos2><SelStart2>11595</SelStart2><SelEnd2>11595</SelEnd2></Tab><ActiveTab>0</ActiveTab></Pane><ActivePane>0</ActivePane><Sizes><Pane><X>1000000</X><Y>1000000</Y></Pane></Sizes><SplitMode>1</SplitMode></Editor>
<Positions>
<Top><Row0><Sizes><Toolbar-00C12E30><key>iaridepm.enu1</key></Toolbar-00C12E30></Sizes></Row0><Row1><Sizes><Toolbar-0B3FCAF8><key>debuggergui.enu1</key></Toolbar-0B3FCAF8></Sizes></Row1><Row2><Sizes><Toolbar-0B3FD5E8><key>430fet1</key></Toolbar-0B3FD5E8></Sizes></Row2></Top><Left><Row0><Sizes><Wnd1><Rect><Top>-2</Top><Left>-2</Left><Bottom>562</Bottom><Right>248</Right><x>-2</x><y>-2</y><xscreen>250</xscreen><yscreen>175</yscreen><sizeHorzCX>156250</sizeHorzCX><sizeHorzCY>211353</sizeHorzCY><sizeVertCX>156250</sizeVertCX><sizeVertCY>681159</sizeVertCY></Rect></Wnd1></Sizes></Row0></Left><Right><Row0><Sizes><Wnd2><Rect><Top>-2</Top><Left>-2</Left><Bottom>562</Bottom><Right>248</Right><x>-2</x><y>-2</y><xscreen>250</xscreen><yscreen>175</yscreen><sizeHorzCX>156250</sizeHorzCX><sizeHorzCY>211353</sizeHorzCY><sizeVertCX>156250</sizeVertCX><sizeVertCY>681159</sizeVertCY></Rect></Wnd2></Sizes></Row0></Right><Bottom><Row0><Sizes><Wnd0><Rect><Top>-2</Top><Left>-2</Left><Bottom>173</Bottom><Right>1602</Right><x>-2</x><y>-2</y><xscreen>1604</xscreen><yscreen>175</yscreen><sizeHorzCX>1002500</sizeHorzCX><sizeHorzCY>211353</sizeHorzCY><sizeVertCX>156250</sizeVertCX><sizeVertCY>211353</sizeVertCY></Rect></Wnd0></Sizes></Row0></Bottom><Float><Sizes/></Float></Positions>
</Desktop>
</Project>

View File

@ -0,0 +1,94 @@
[Interrupts]
Enabled=1
[MemoryMap]
Enabled=0
Base=0
UseAuto=0
TypeViolation=1
UnspecRange=1
ActionState=1
[TraceHelper]
Enabled=0
ShowSource=1
[DebugChecksum]
Checksum=-1742591943
[State Storage]
Control Register=5814
[Sequencer]
Control Register=0
NextState0=0
NextState1=0
[Action Register]
Break=0
State Storage=0
[DisAssemblyWindow]
NumStates=_ 1
State 1=_ 1
[InstructionProfiling]
Enabled=_ 0
[CodeCoverage]
Enabled=_ 0
[Profiling]
Enabled=0
[StackPlugin]
Enabled=1
OverflowWarningsEnabled=1
WarningThreshold=90
SpWarningsEnabled=1
WarnHow=0
UseTrigger=1
TriggerName=main
LimitSize=0
ByteLimit=50
[Stack]
FillEnabled=0
OverflowWarningsEnabled=1
WarningThreshold=90
SpWarningsEnabled=1
WarnLogOnly=1
UseTrigger=1
TriggerName=main
LimitSize=0
ByteLimit=50
[EEM State Storage]
Buffer=BAAAAAAADAAAAAAAAAAAAAAA
[EEM Sequencer]
Buffer=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
[NumberOfSequencerBp]
Number=4
[Breakpoints]
Count=0
[FET]
Clock mode=46
Extended Clock mode=65535
Secure Password=
Extended Clock Control Enable=1
Advanced Extended Clock Control=0
Emulation mode=0
Free running=0
Shutting Down=3
[Memory Dump]
Start address=
Lenghth=
Address info=0
Format=0
Dump registers=0
PC=0
SP=0
SR=0
all registers=0
File name=
[Log file]
LoggingEnabled=_ 0
LogFile=_ ""
Category=_ 0
[TermIOLog]
LoggingEnabled=_ 0
LogFile=_ ""
[Aliases]
Count=0
SuppressDialog=0
[CallStack]
ShowArgs=0
[Disassembly]
MixedMode=1

View File

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<Workspace>
<ConfigDictionary>
<CurrentConfigs><Project>MOD-EKG_DemoSoft/Debug</Project></CurrentConfigs></ConfigDictionary>
<Desktop>
<Static>
<Workspace>
<ColumnWidths>
<Column0>318</Column0><Column1>27</Column1><Column2>27</Column2><Column3>27</Column3></ColumnWidths>
</Workspace>
<Build>
<ColumnWidth0>20</ColumnWidth0><ColumnWidth1>915</ColumnWidth1><ColumnWidth2>244</ColumnWidth2><ColumnWidth3>61</ColumnWidth3></Build>
<Debug-Log>
<ColumnWidth0>20</ColumnWidth0><ColumnWidth1>1221</ColumnWidth1></Debug-Log>
<TerminalIO/>
<Find-in-Files><ColumnWidth0>440</ColumnWidth0><ColumnWidth1>62</ColumnWidth1><ColumnWidth2>754</ColumnWidth2></Find-in-Files></Static>
<Windows>
<Wnd2>
<Tabs>
<Tab>
<Identity>TabID-5007-30075</Identity>
<TabName>Workspace</TabName>
<Factory>Workspace</Factory>
<Session>
<NodeDict><ExpandedNode>MOD-EKG_DemoSoft</ExpandedNode><ExpandedNode>MOD-EKG_DemoSoft/Output</ExpandedNode><ExpandedNode>MOD-EKG_DemoSoft/Output/MOD-EKG_DemoSoft.d43</ExpandedNode></NodeDict></Session>
</Tab>
</Tabs>
<SelectedTab>0</SelectedTab></Wnd2><Wnd3>
<Tabs>
<Tab>
<Identity>TabID-616-32204</Identity>
<TabName>Build</TabName>
<Factory>Build</Factory>
<Session/>
</Tab>
<Tab>
<Identity>TabID-32338-32224</Identity>
<TabName>Debug Log</TabName>
<Factory>Debug-Log</Factory>
<Session/>
</Tab>
<Tab><Identity>TabID-552-6144</Identity><TabName>Find in Files</TabName><Factory>Find-in-Files</Factory><Session/></Tab></Tabs>
<SelectedTab>0</SelectedTab></Wnd3></Windows>
<Editor>
<Pane><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\MOD-EKG_DemoSoft.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>199</YPos2><SelStart2>11905</SelStart2><SelEnd2>11905</SelEnd2></Tab><ActiveTab>0</ActiveTab></Pane><ActivePane>0</ActivePane><Sizes><Pane><X>1000000</X><Y>1000000</Y></Pane></Sizes><SplitMode>1</SplitMode></Editor>
<Positions>
<Top><Row0><Sizes><Toolbar-00C12E30><key>iaridepm.enu1</key></Toolbar-00C12E30></Sizes></Row0><Row1><Sizes/></Row1><Row2><Sizes/></Row2><Row3><Sizes/></Row3><Row4><Sizes/></Row4><Row5><Sizes/></Row5><Row6><Sizes/></Row6></Top><Left><Row0><Sizes><Wnd2><Rect><Top>-2</Top><Left>-2</Left><Bottom>630</Bottom><Right>392</Right><x>-2</x><y>-2</y><xscreen>250</xscreen><yscreen>175</yscreen><sizeHorzCX>156250</sizeHorzCX><sizeHorzCY>211353</sizeHorzCY><sizeVertCX>246250</sizeVertCX><sizeVertCY>763285</sizeVertCY></Rect></Wnd2></Sizes></Row0></Left><Right><Row0><Sizes/></Row0></Right><Bottom><Row0><Sizes><Wnd3><Rect><Top>-2</Top><Left>-2</Left><Bottom>153</Bottom><Right>1602</Right><x>-2</x><y>-2</y><xscreen>1604</xscreen><yscreen>155</yscreen><sizeHorzCX>1002500</sizeHorzCX><sizeHorzCY>187198</sizeHorzCY><sizeVertCX>156250</sizeVertCX><sizeVertCY>211353</sizeVertCY></Rect></Wnd3></Sizes></Row0></Bottom><Float><Sizes/></Float></Positions>
</Desktop>
</Workspace>

View File

@ -0,0 +1,2 @@
[MainWindow]
WindowPlacement=_ 25 25 1225 657 3

556
psylib/distribute_setup.py Normal file
View File

@ -0,0 +1,556 @@
#!python
"""Bootstrap distribute installation
If you want to use setuptools in your package's setup.py, just include this
file in the same directory with it, and add this to the top of your setup.py::
from distribute_setup import use_setuptools
use_setuptools()
If you want to require a specific version of setuptools, set a download
mirror, or use an alternate download directory, you can do so by supplying
the appropriate options to ``use_setuptools()``.
This file can also be run as a script to install or upgrade setuptools.
"""
import os
import shutil
import sys
import time
import fnmatch
import tempfile
import tarfile
import optparse
from distutils import log
try:
from site import USER_SITE
except ImportError:
USER_SITE = None
try:
import subprocess
def _python_cmd(*args):
args = (sys.executable,) + args
return subprocess.call(args) == 0
except ImportError:
# will be used for python 2.3
def _python_cmd(*args):
args = (sys.executable,) + args
# quoting arguments if windows
if sys.platform == 'win32':
def quote(arg):
if ' ' in arg:
return '"%s"' % arg
return arg
args = [quote(arg) for arg in args]
return os.spawnl(os.P_WAIT, sys.executable, *args) == 0
DEFAULT_VERSION = "0.6.49"
DEFAULT_URL = "http://pypi.python.org/packages/source/d/distribute/"
SETUPTOOLS_FAKED_VERSION = "0.6c11"
SETUPTOOLS_PKG_INFO = """\
Metadata-Version: 1.0
Name: setuptools
Version: %s
Summary: xxxx
Home-page: xxx
Author: xxx
Author-email: xxx
License: xxx
Description: xxx
""" % SETUPTOOLS_FAKED_VERSION
def _install(tarball, install_args=()):
# extracting the tarball
tmpdir = tempfile.mkdtemp()
log.warn('Extracting in %s', tmpdir)
old_wd = os.getcwd()
try:
os.chdir(tmpdir)
tar = tarfile.open(tarball)
_extractall(tar)
tar.close()
# going in the directory
subdir = os.path.join(tmpdir, os.listdir(tmpdir)[0])
os.chdir(subdir)
log.warn('Now working in %s', subdir)
# installing
log.warn('Installing Distribute')
if not _python_cmd('setup.py', 'install', *install_args):
log.warn('Something went wrong during the installation.')
log.warn('See the error message above.')
# exitcode will be 2
return 2
finally:
os.chdir(old_wd)
shutil.rmtree(tmpdir)
def _build_egg(egg, tarball, to_dir):
# extracting the tarball
tmpdir = tempfile.mkdtemp()
log.warn('Extracting in %s', tmpdir)
old_wd = os.getcwd()
try:
os.chdir(tmpdir)
tar = tarfile.open(tarball)
_extractall(tar)
tar.close()
# going in the directory
subdir = os.path.join(tmpdir, os.listdir(tmpdir)[0])
os.chdir(subdir)
log.warn('Now working in %s', subdir)
# building an egg
log.warn('Building a Distribute egg in %s', to_dir)
_python_cmd('setup.py', '-q', 'bdist_egg', '--dist-dir', to_dir)
finally:
os.chdir(old_wd)
shutil.rmtree(tmpdir)
# returning the result
log.warn(egg)
if not os.path.exists(egg):
raise IOError('Could not build the egg.')
def _do_download(version, download_base, to_dir, download_delay):
egg = os.path.join(to_dir, 'distribute-%s-py%d.%d.egg'
% (version, sys.version_info[0], sys.version_info[1]))
if not os.path.exists(egg):
tarball = download_setuptools(version, download_base,
to_dir, download_delay)
_build_egg(egg, tarball, to_dir)
sys.path.insert(0, egg)
import setuptools
setuptools.bootstrap_install_from = egg
def use_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
to_dir=os.curdir, download_delay=15, no_fake=True):
# making sure we use the absolute path
to_dir = os.path.abspath(to_dir)
was_imported = 'pkg_resources' in sys.modules or \
'setuptools' in sys.modules
try:
try:
import pkg_resources
# Setuptools 0.7b and later is a suitable (and preferable)
# substitute for any Distribute version.
try:
pkg_resources.require("setuptools>=0.7b")
return
except (pkg_resources.DistributionNotFound,
pkg_resources.VersionConflict):
pass
if not hasattr(pkg_resources, '_distribute'):
if not no_fake:
_fake_setuptools()
raise ImportError
except ImportError:
return _do_download(version, download_base, to_dir, download_delay)
try:
pkg_resources.require("distribute>=" + version)
return
except pkg_resources.VersionConflict:
e = sys.exc_info()[1]
if was_imported:
sys.stderr.write(
"The required version of distribute (>=%s) is not available,\n"
"and can't be installed while this script is running. Please\n"
"install a more recent version first, using\n"
"'easy_install -U distribute'."
"\n\n(Currently using %r)\n" % (version, e.args[0]))
sys.exit(2)
else:
del pkg_resources, sys.modules['pkg_resources'] # reload ok
return _do_download(version, download_base, to_dir,
download_delay)
except pkg_resources.DistributionNotFound:
return _do_download(version, download_base, to_dir,
download_delay)
finally:
if not no_fake:
_create_fake_setuptools_pkg_info(to_dir)
def download_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
to_dir=os.curdir, delay=15):
"""Download distribute from a specified location and return its filename
`version` should be a valid distribute version number that is available
as an egg for download under the `download_base` URL (which should end
with a '/'). `to_dir` is the directory where the egg will be downloaded.
`delay` is the number of seconds to pause before an actual download
attempt.
"""
# making sure we use the absolute path
to_dir = os.path.abspath(to_dir)
try:
from urllib.request import urlopen
except ImportError:
from urllib2 import urlopen
tgz_name = "distribute-%s.tar.gz" % version
url = download_base + tgz_name
saveto = os.path.join(to_dir, tgz_name)
src = dst = None
if not os.path.exists(saveto): # Avoid repeated downloads
try:
log.warn("Downloading %s", url)
src = urlopen(url)
# Read/write all in one block, so we don't create a corrupt file
# if the download is interrupted.
data = src.read()
dst = open(saveto, "wb")
dst.write(data)
finally:
if src:
src.close()
if dst:
dst.close()
return os.path.realpath(saveto)
def _no_sandbox(function):
def __no_sandbox(*args, **kw):
try:
from setuptools.sandbox import DirectorySandbox
if not hasattr(DirectorySandbox, '_old'):
def violation(*args):
pass
DirectorySandbox._old = DirectorySandbox._violation
DirectorySandbox._violation = violation
patched = True
else:
patched = False
except ImportError:
patched = False
try:
return function(*args, **kw)
finally:
if patched:
DirectorySandbox._violation = DirectorySandbox._old
del DirectorySandbox._old
return __no_sandbox
def _patch_file(path, content):
"""Will backup the file then patch it"""
f = open(path)
existing_content = f.read()
f.close()
if existing_content == content:
# already patched
log.warn('Already patched.')
return False
log.warn('Patching...')
_rename_path(path)
f = open(path, 'w')
try:
f.write(content)
finally:
f.close()
return True
_patch_file = _no_sandbox(_patch_file)
def _same_content(path, content):
f = open(path)
existing_content = f.read()
f.close()
return existing_content == content
def _rename_path(path):
new_name = path + '.OLD.%s' % time.time()
log.warn('Renaming %s to %s', path, new_name)
os.rename(path, new_name)
return new_name
def _remove_flat_installation(placeholder):
if not os.path.isdir(placeholder):
log.warn('Unkown installation at %s', placeholder)
return False
found = False
for file in os.listdir(placeholder):
if fnmatch.fnmatch(file, 'setuptools*.egg-info'):
found = True
break
if not found:
log.warn('Could not locate setuptools*.egg-info')
return
log.warn('Moving elements out of the way...')
pkg_info = os.path.join(placeholder, file)
if os.path.isdir(pkg_info):
patched = _patch_egg_dir(pkg_info)
else:
patched = _patch_file(pkg_info, SETUPTOOLS_PKG_INFO)
if not patched:
log.warn('%s already patched.', pkg_info)
return False
# now let's move the files out of the way
for element in ('setuptools', 'pkg_resources.py', 'site.py'):
element = os.path.join(placeholder, element)
if os.path.exists(element):
_rename_path(element)
else:
log.warn('Could not find the %s element of the '
'Setuptools distribution', element)
return True
_remove_flat_installation = _no_sandbox(_remove_flat_installation)
def _after_install(dist):
log.warn('After install bootstrap.')
placeholder = dist.get_command_obj('install').install_purelib
_create_fake_setuptools_pkg_info(placeholder)
def _create_fake_setuptools_pkg_info(placeholder):
if not placeholder or not os.path.exists(placeholder):
log.warn('Could not find the install location')
return
pyver = '%s.%s' % (sys.version_info[0], sys.version_info[1])
setuptools_file = 'setuptools-%s-py%s.egg-info' % \
(SETUPTOOLS_FAKED_VERSION, pyver)
pkg_info = os.path.join(placeholder, setuptools_file)
if os.path.exists(pkg_info):
log.warn('%s already exists', pkg_info)
return
log.warn('Creating %s', pkg_info)
try:
f = open(pkg_info, 'w')
except EnvironmentError:
log.warn("Don't have permissions to write %s, skipping", pkg_info)
return
try:
f.write(SETUPTOOLS_PKG_INFO)
finally:
f.close()
pth_file = os.path.join(placeholder, 'setuptools.pth')
log.warn('Creating %s', pth_file)
f = open(pth_file, 'w')
try:
f.write(os.path.join(os.curdir, setuptools_file))
finally:
f.close()
_create_fake_setuptools_pkg_info = _no_sandbox(
_create_fake_setuptools_pkg_info
)
def _patch_egg_dir(path):
# let's check if it's already patched
pkg_info = os.path.join(path, 'EGG-INFO', 'PKG-INFO')
if os.path.exists(pkg_info):
if _same_content(pkg_info, SETUPTOOLS_PKG_INFO):
log.warn('%s already patched.', pkg_info)
return False
_rename_path(path)
os.mkdir(path)
os.mkdir(os.path.join(path, 'EGG-INFO'))
pkg_info = os.path.join(path, 'EGG-INFO', 'PKG-INFO')
f = open(pkg_info, 'w')
try:
f.write(SETUPTOOLS_PKG_INFO)
finally:
f.close()
return True
_patch_egg_dir = _no_sandbox(_patch_egg_dir)
def _before_install():
log.warn('Before install bootstrap.')
_fake_setuptools()
def _under_prefix(location):
if 'install' not in sys.argv:
return True
args = sys.argv[sys.argv.index('install') + 1:]
for index, arg in enumerate(args):
for option in ('--root', '--prefix'):
if arg.startswith('%s=' % option):
top_dir = arg.split('root=')[-1]
return location.startswith(top_dir)
elif arg == option:
if len(args) > index:
top_dir = args[index + 1]
return location.startswith(top_dir)
if arg == '--user' and USER_SITE is not None:
return location.startswith(USER_SITE)
return True
def _fake_setuptools():
log.warn('Scanning installed packages')
try:
import pkg_resources
except ImportError:
# we're cool
log.warn('Setuptools or Distribute does not seem to be installed.')
return
ws = pkg_resources.working_set
try:
setuptools_dist = ws.find(
pkg_resources.Requirement.parse('setuptools', replacement=False)
)
except TypeError:
# old distribute API
setuptools_dist = ws.find(
pkg_resources.Requirement.parse('setuptools')
)
if setuptools_dist is None:
log.warn('No setuptools distribution found')
return
# detecting if it was already faked
setuptools_location = setuptools_dist.location
log.warn('Setuptools installation detected at %s', setuptools_location)
# if --root or --preix was provided, and if
# setuptools is not located in them, we don't patch it
if not _under_prefix(setuptools_location):
log.warn('Not patching, --root or --prefix is installing Distribute'
' in another location')
return
# let's see if its an egg
if not setuptools_location.endswith('.egg'):
log.warn('Non-egg installation')
res = _remove_flat_installation(setuptools_location)
if not res:
return
else:
log.warn('Egg installation')
pkg_info = os.path.join(setuptools_location, 'EGG-INFO', 'PKG-INFO')
if (os.path.exists(pkg_info) and
_same_content(pkg_info, SETUPTOOLS_PKG_INFO)):
log.warn('Already patched.')
return
log.warn('Patching...')
# let's create a fake egg replacing setuptools one
res = _patch_egg_dir(setuptools_location)
if not res:
return
log.warn('Patching complete.')
_relaunch()
def _relaunch():
log.warn('Relaunching...')
# we have to relaunch the process
# pip marker to avoid a relaunch bug
_cmd1 = ['-c', 'install', '--single-version-externally-managed']
_cmd2 = ['-c', 'install', '--record']
if sys.argv[:3] == _cmd1 or sys.argv[:3] == _cmd2:
sys.argv[0] = 'setup.py'
args = [sys.executable] + sys.argv
sys.exit(subprocess.call(args))
def _extractall(self, path=".", members=None):
"""Extract all members from the archive to the current working
directory and set owner, modification time and permissions on
directories afterwards. `path' specifies a different directory
to extract to. `members' is optional and must be a subset of the
list returned by getmembers().
"""
import copy
import operator
from tarfile import ExtractError
directories = []
if members is None:
members = self
for tarinfo in members:
if tarinfo.isdir():
# Extract directories with a safe mode.
directories.append(tarinfo)
tarinfo = copy.copy(tarinfo)
tarinfo.mode = 448 # decimal for oct 0700
self.extract(tarinfo, path)
# Reverse sort directories.
if sys.version_info < (2, 4):
def sorter(dir1, dir2):
return cmp(dir1.name, dir2.name)
directories.sort(sorter)
directories.reverse()
else:
directories.sort(key=operator.attrgetter('name'), reverse=True)
# Set correct owner, mtime and filemode on directories.
for tarinfo in directories:
dirpath = os.path.join(path, tarinfo.name)
try:
self.chown(tarinfo, dirpath)
self.utime(tarinfo, dirpath)
self.chmod(tarinfo, dirpath)
except ExtractError:
e = sys.exc_info()[1]
if self.errorlevel > 1:
raise
else:
self._dbg(1, "tarfile: %s" % e)
def _build_install_args(options):
"""
Build the arguments to 'python setup.py install' on the distribute package
"""
install_args = []
if options.user_install:
if sys.version_info < (2, 6):
log.warn("--user requires Python 2.6 or later")
raise SystemExit(1)
install_args.append('--user')
return install_args
def _parse_args():
"""
Parse the command line for options
"""
parser = optparse.OptionParser()
parser.add_option(
'--user', dest='user_install', action='store_true', default=False,
help='install in user site package (requires Python 2.6 or later)')
parser.add_option(
'--download-base', dest='download_base', metavar="URL",
default=DEFAULT_URL,
help='alternative URL from where to download the distribute package')
options, args = parser.parse_args()
# positional arguments are ignored
return options
def main(version=DEFAULT_VERSION):
"""Install or upgrade setuptools and EasyInstall"""
options = _parse_args()
tarball = download_setuptools(download_base=options.download_base)
return _install(tarball, _build_install_args(options))
if __name__ == '__main__':
sys.exit(main())

View File

View File

@ -0,0 +1,232 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# This file is part of chaosc/psylib package
#
# chaosc/psylib is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# chaosc/psylib is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with chaosc/psylib. If not, see <http://www.gnu.org/licenses/>.
#
# Copyright (C) 2014 Stefan Kögl
from __future__ import absolute_import
import os
import os.path
import re
from chaosc.lib import logger
from PyQt4 import QtCore
from PyQt4.QtCore import QByteArray
from PyQt4.QtNetwork import QTcpServer, QTcpSocket
__all__ = ["MjpegStreamingConsumerInterface", "MjpegStreamingServer"]
class MjpegStreamingConsumerInterface(object):
def pubdir(self):
""" returns the directory, from where your static files should be served
fast and dirty implementation e.g:
return os.path.dirname(os.path.abspath(__file__))
"""
raise NotImplementedError()
def render_image(self):
"""returns a QByteArray with the binary date of a jpg image
this method should implement the actual window/widget grabbing"""
raise NotImplementedError()
class MjpegStreamingServer(QTcpServer):
"""A simple async http class which provides a mjpeg stream and if found,
an index.html file containing the mjpeg stream.
Parent should implement the interface 'MjpegStreamingConsumerInterface'
"""
def __init__(self, server_address, parent=None, fps=12.5):
super(MjpegStreamingServer, self).__init__(parent)
self.server_address = server_address
self.newConnection.connect(self.new_connection)
assert isinstance(parent, MjpegStreamingConsumerInterface)
self.widget = parent
self.sockets = list()
self.img_data = None
self.fps = fps
self.timer_delta = 1000 / fps
self.timer = QtCore.QTimer()
self.timer.timeout.connect(self.send_image)
self.timer.start(self.timer_delta)
self.stream_clients = list()
self.get_regex = re.compile("^GET /(\w+?)\.(\w+?) HTTP/(\d+\.\d+)$")
self.host_regex = re.compile("^Host: (\w+?):(\d+)$")
self.html_map = dict()
def handle_request(self):
sock = self.sender()
sock_id = id(sock)
logger.info("handle_request: sock_id=%r", sock_id)
if sock.state() in (
QTcpSocket.UnconnectedState, QTcpSocket.ClosingState):
logger.info("connection closed")
self.sockets.remove(sock)
sock.deleteLater()
return
client_data = str(sock.readAll())
logger.info("request %r", client_data)
line = client_data.split("\r\n")[0]
logger.info("first line: %r", line)
try:
resource, ext, http_version = self.get_regex.match(line).groups()
logger.info(
"resource=%r, ext=%r, http_version=%r",
resource, ext, http_version)
except AttributeError:
try:
host, port = self.host_regex.match(line).groups()
logger.info("found host header %r %r", host, port)
#return
#sock.write("HTTP/1.1 501 Not Implemented\r\n")
return
except AttributeError:
logger.info("no matching request - sending 404 not found")
sock.write("HTTP/1.1 404 Not Found\r\n")
return
else:
if ext == "ico":
directory = self.widget.pubdir()
try:
data = open(
os.path.join(directory, "favicon.ico"), "rb").read()
except IOError:
logger.error(
"request not found/handled - sending 404 not found")
sock.write("HTTP/1.1 404 Not Found\r\n")
return
else:
sock.write(QByteArray('HTTP/1.1 200 Ok\r\nContent-Type:' \
'image/x-ico\r\n\r\n%s' % data))
elif ext == "html":
directory = self.widget.pubdir()
try:
data = open(os.path.join(
directory, "index.html"), "rb").read() % sock_id
self.html_map[sock_id] = None
except IOError:
logger.error(
"request not found/handled - sending 404 not found")
sock.write("HTTP/1.1 404 Not Found\r\n")
return
else:
sock.write(QByteArray('HTTP/1.1 200 Ok\r\nContent-Type:"\
"text/html;encoding: utf-8\r\n\r\n%s' % data))
elif ext == "mjpeg":
try:
_, html_sock_id = resource.split("_", 1)
html_sock_id = int(html_sock_id)
except ValueError:
html_sock_id = None
if sock not in self.stream_clients:
logger.info("starting streaming...")
if html_sock_id is not None:
self.html_map[html_sock_id] = sock
self.stream_clients.append(sock)
sock.write(QByteArray('HTTP/1.1 200 Ok\r\n" \
"Content-Type: multipart/x-mixed-replace;" \
"boundary=--2342\r\n\r\n'))
else:
logger.error(
"request not found/handled - sending 404 not found")
sock.write("HTTP/1.1 404 Not Found\r\n")
def slot_remove_connection(self):
try:
sock = self.sender()
except RuntimeError:
return
if sock.state() == QTcpSocket.UnconnectedState:
self.__remove_connection(sock)
def __remove_connection(self, sock):
sock_id = id(sock)
sock.disconnected.disconnect(self.slot_remove_connection)
sock.close()
sock.deleteLater()
try:
self.sockets.remove(sock)
logger.info("connection %r removed", sock_id)
except ValueError, msg:
logger.info("connection %r was not stored?", sock_id)
try:
self.stream_clients.remove(sock)
except ValueError:
logger.info("connection %r was not streaming", sock_id)
# cleaning up streaming connections if that sock is serving index.html
try:
stream_client = self.html_map.pop(sock_id)
except KeyError:
logger.info("connection %r has no child connections", sock_id)
else:
try:
stream_client.close()
stream_client.deleteLater()
except AttributeError, msg:
logger.info("no stream client")
else:
try:
self.stream_clients.remove(stream_client)
logger.info("child connection %r removed from streaming",
id(stream_client))
except ValueError:
pass
try:
self.sockets.remove(stream_client)
logger.info("child connection %r removed from storage",
id(stream_client))
except ValueError:
pass
def send_image(self):
if not self.stream_clients:
return
img_data = self.widget.render_image()
len_data = len(img_data)
array = QByteArray("--2342\r\nContent-Type: image/jpeg\r\n" \
"Content-length: %d\r\n\r\n%s\r\n\r\n\r\n" % (len_data, img_data))
for sock in self.stream_clients:
sock.write(array)
def new_connection(self):
while self.hasPendingConnections():
sock = self.nextPendingConnection()
logger.info("new connection=%r", id(sock))
sock.readyRead.connect(self.handle_request)
sock.disconnected.connect(self.slot_remove_connection)
self.sockets.append(sock)
def stop(self):
self.stream_clients = list()
for sock in self.sockets:
sock.close()
sock.deleteLater()
self.sockets = list()
self.html_map = dict()
self.close()

164
psylib/psylib/other.py Normal file
View File

@ -0,0 +1,164 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# This file is part of chaosc and psychosis
#
# chaosc/psychosis is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# chaosc/psychosis is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with chaosc/psychosis. If not, see <http://www.gnu.org/licenses/>.
#
# Copyright (C) 2014 Stefan Kögl
from __future__ import absolute_import
import os
import os.path
import re
import sys
from datetime import datetime
from chaosc.argparser_groups import *
from chaosc.lib import logger, resolve_host
from PyQt4 import QtCore, QtGui
from PyQt4.QtCore import QBuffer, QByteArray, QIODevice
from PyQt4.QtNetwork import QTcpServer
class MjpegStreamingServer(QTcpServer):
def __init__(self, server_address, parent=None):
super(MjpegStreamingServer, self).__init__(parent)
self.server_address = server_address
self.newConnection.connect(self.new_connection)
self.widget = parent
self.win_id = self.widget.winId()
self.sockets = list()
self.img_data = None
self.timer = QtCore.QTimer()
self.timer.timeout.connect(self.render_image)
self.timer.start(80)
self.stream_clients = list()
self.get_regex = re.compile("^GET /(\w+?)\.(\w+?) HTTP/(\d+\.\d+)$")
self.host_regex = re.compile("^Host: (\w+?):(\d+)$")
self.html_map = dict()
def handle_request(self):
sock = self.sender()
logger.info("handle_request: %s %d", sock.peerAddress(), sock.peerPort())
sock_id = id(sock)
if sock.state() in (QTcpSocket.UnconnectedState, QTcpSocket.ClosingState):
logger.info("connection closed")
self.sockets.remove(sock)
sock.deleteLater()
return
client_data = str(sock.readAll())
logger.info("request %r", client_data)
line = client_data.split("\r\n")[0]
logger.info("first line: %r", line)
try:
resource, ext, http_version = self.get_regex.match(line).groups()
logger.info("resource=%r, ext=%r, http_version=%r", resource, ext, http_version)
except AttributeError:
try:
host, port = self.host_regex.match(line).groups()
print "found host header", host, port
return
#sock.write("HTTP/1.1 501 Not Implemented\r\n")
except AttributeError:
logger.info("no matching request - sending 404 not found")
sock.write("HTTP/1.1 404 Not Found\r\n")
return
else:
if ext == "ico":
directory = os.path.dirname(os.path.abspath(__file__))
data = open(os.path.join(directory, "favicon.ico"), "rb").read()
sock.write(QByteArray('HTTP/1.1 200 Ok\r\nContent-Type: image/x-ico\r\n\r\n%s' % data))
elif ext == "html":
directory = os.path.dirname(os.path.abspath(__file__))
data = open(os.path.join(directory, "index.html"), "rb").read() % sock_id
self.html_map[sock_id] = None
sock.write(QByteArray('HTTP/1.1 200 Ok\r\nContent-Type: text/html;encoding: utf-8\r\n\r\n%s' % data))
elif ext == "mjpeg":
try:
_, html_sock_id = resource.split("_", 1)
html_sock_id = int(html_sock_id)
except ValueError:
html_sock_id = None
if sock not in self.stream_clients:
logger.info("starting streaming...")
if html_sock_id is not None:
self.html_map[html_sock_id] = sock
self.stream_clients.append(sock)
sock.write(QByteArray('HTTP/1.1 200 Ok\r\nContent-Type: multipart/x-mixed-replace; boundary=--2342\r\n\r\n'))
else:
logger.error("request not found/handled - sending 404 not found")
sock.write("HTTP/1.1 404 Not Found\r\n")
def remove_connection(self):
try:
sock = self.sender()
except RuntimeError:
return
sock_id = id(sock)
logger.info("remove_connection: sock=%r, sock_id=%r", sock, sock_id)
if sock.state() == QTcpSocket.UnconnectedState:
sock.disconnected.disconnect(self.remove_connection)
self.sockets.remove(sock)
logger.info("removed sock_id=%r", sock_id)
sock.close()
try:
self.stream_clients.remove(sock)
except ValueError:
pass
try:
stream_client = self.html_map.pop(sock_id)
except KeyError:
logger.info("socket has no child socket")
else:
stream_client.close()
try:
self.stream_clients.remove(stream_client)
logger.info("removed stream_client=%r", id(stream_client))
except ValueError:
pass
try:
self.sockets.remove(stream_client)
logger.info("removed child sock_id=%r", id(stream_client))
except ValueError:
pass
def render_image(self):
if not self.stream_clients:
return
img_data = self.widget.render_image()
len_data = len(img_data)
array = QByteArray("--2342\r\nContent-Type: image/jpeg\r\nContent-length: %d\r\n\r\n%s\r\n\r\n\r\n" % (len_data, img_data))
for sock in self.stream_clients:
sock.write(array)
def new_connection(self):
while self.hasPendingConnections():
sock = self.nextPendingConnection()
logger.info("new connection=%r", id(sock))
sock.readyRead.connect(self.handle_request)
sock.disconnected.connect(self.remove_connection)
self.sockets.append(sock)
def stop(self):
self.stream_clients = list()
self.sockets = list()
self.html_map = dict()
self.close()

109
psylib/psylib/psyqt_base.py Normal file
View File

@ -0,0 +1,109 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# This file is part of chaosc/psylib package
#
# chaosc/psylib is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# chaosc/psylib is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with chaosc/psylib. If not, see <http://www.gnu.org/licenses/>.
#
# Copyright (C) 2014 Stefan Kögl
from __future__ import absolute_import
import sys
import traceback
from PyQt4 import QtCore, QtGui
from PyQt4.QtCore import QBuffer, QByteArray
from PyQt4.QtNetwork import QUdpSocket, QHostAddress
from chaosc.lib import logger
try:
from chaosc.c_osc_lib import OSCMessage, decode_osc
except ImportError as e:
from chaosc.osc_lib import OSCMessage, decode_osc
class PsyQtClientBase(QtCore.QObject):
def __init__(self):
super(PsyQtClientBase, self).__init__()
# periodically trap into python interpreter domain to catch signals etc
timer = QtCore.QTimer()
timer.start(2000)
timer.timeout.connect(lambda: None)
def sigint_handler(self, ex_cls, ex, traceback):
"""Handler for the SIGINT signal."""
if ex_cls == KeyboardInterrupt:
logger.info("found KeyboardInterrupt")
QtGui.QApplication.exit()
else:
logger.critical(''.join(traceback.format_tb(tb)))
logger.critical('{0}: {1}'.format(ex_cls, ex))
class PsyQtChaoscClientBase(PsyQtClientBase):
def __init__(self):
super(PsyQtChaoscClientBase, self).__init__()
self.osc_sock = QUdpSocket(self)
logger.info("osc bind localhost %d", self.args.client_port)
self.osc_sock.bind(QHostAddress(self.args.client_host), self.args.client_port)
self.osc_sock.readyRead.connect(self.got_message)
self.osc_sock.error.connect(self.handle_osc_error)
self.subscribe()
def sigint_handler(self, ex_cls, ex, tb):
"""Handler for the SIGINT signal."""
logger.info("sigint_handler")
if ex_cls == KeyboardInterrupt:
logger.info("found KeyboardInterrupt")
self.unsubscribe()
QtGui.QApplication.exit()
else:
logger.critical(''.join(traceback.format_tb(tb)))
logger.critical('{0}: {1}'.format(ex_cls, ex))
def sigterm_handler(self, *args):
logger.info("sigterm_handler")
self.unsubscribe()
QtGui.QApplication.exit()
def subscribe(self):
logger.info("subscribe")
msg = OSCMessage("/subscribe")
logger.info(self.args.client_host)
msg.appendTypedArg(self.args.client_host, "s")
msg.appendTypedArg(self.args.client_port, "i")
msg.appendTypedArg(self.args.authenticate, "s")
if self.args.subscriber_label is not None:
msg.appendTypedArg(self.args.subscriber_label, "s")
self.osc_sock.writeDatagram(QByteArray(msg.encode_osc()), QHostAddress(self.args.chaosc_host), self.args.chaosc_port)
def unsubscribe(self):
logger.info("unsubscribe")
msg = OSCMessage("/unsubscribe")
msg.appendTypedArg(self.args.client_host, "s")
msg.appendTypedArg(self.args.client_port, "i")
msg.appendTypedArg(self.args.authenticate, "s")
self.osc_sock.writeDatagram(QByteArray(msg.encode_osc()), QHostAddress(self.args.chaosc_host), self.args.chaosc_port)
def handle_osc_error(self, error):
logger.info("osc socket error %d", error)
def closeEvent(self, event):
logger.info("closeEvent", event)
self.unsubscribe()
event.accept()

40
psylib/setup.py Normal file
View File

@ -0,0 +1,40 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
from setuptools import find_packages, setup
if sys.version_info >= (3,):
extras['use_2to3'] = True
setup(
name='psylib',
version="0.2",
packages=find_packages(exclude=["scripts",]),
include_package_data = True,
exclude_package_data = {'': ['.gitignore']},
zip_safe = False,
# pypi metadata
author = "Stefan Kögl",
# FIXME: add author email
author_email = "hotte@ctdo.de",
description = "library for psychosis",
# FIXME: add long_description
long_description = """
""",
# FIXME: add license
license = "GPL",
# FIXME: add keywords
keywords = "",
# FIXME: add download url
url = "",
)

View File

@ -0,0 +1,556 @@
#!python
"""Bootstrap distribute installation
If you want to use setuptools in your package's setup.py, just include this
file in the same directory with it, and add this to the top of your setup.py::
from distribute_setup import use_setuptools
use_setuptools()
If you want to require a specific version of setuptools, set a download
mirror, or use an alternate download directory, you can do so by supplying
the appropriate options to ``use_setuptools()``.
This file can also be run as a script to install or upgrade setuptools.
"""
import os
import shutil
import sys
import time
import fnmatch
import tempfile
import tarfile
import optparse
from distutils import log
try:
from site import USER_SITE
except ImportError:
USER_SITE = None
try:
import subprocess
def _python_cmd(*args):
args = (sys.executable,) + args
return subprocess.call(args) == 0
except ImportError:
# will be used for python 2.3
def _python_cmd(*args):
args = (sys.executable,) + args
# quoting arguments if windows
if sys.platform == 'win32':
def quote(arg):
if ' ' in arg:
return '"%s"' % arg
return arg
args = [quote(arg) for arg in args]
return os.spawnl(os.P_WAIT, sys.executable, *args) == 0
DEFAULT_VERSION = "0.6.49"
DEFAULT_URL = "http://pypi.python.org/packages/source/d/distribute/"
SETUPTOOLS_FAKED_VERSION = "0.6c11"
SETUPTOOLS_PKG_INFO = """\
Metadata-Version: 1.0
Name: setuptools
Version: %s
Summary: xxxx
Home-page: xxx
Author: xxx
Author-email: xxx
License: xxx
Description: xxx
""" % SETUPTOOLS_FAKED_VERSION
def _install(tarball, install_args=()):
# extracting the tarball
tmpdir = tempfile.mkdtemp()
log.warn('Extracting in %s', tmpdir)
old_wd = os.getcwd()
try:
os.chdir(tmpdir)
tar = tarfile.open(tarball)
_extractall(tar)
tar.close()
# going in the directory
subdir = os.path.join(tmpdir, os.listdir(tmpdir)[0])
os.chdir(subdir)
log.warn('Now working in %s', subdir)
# installing
log.warn('Installing Distribute')
if not _python_cmd('setup.py', 'install', *install_args):
log.warn('Something went wrong during the installation.')
log.warn('See the error message above.')
# exitcode will be 2
return 2
finally:
os.chdir(old_wd)
shutil.rmtree(tmpdir)
def _build_egg(egg, tarball, to_dir):
# extracting the tarball
tmpdir = tempfile.mkdtemp()
log.warn('Extracting in %s', tmpdir)
old_wd = os.getcwd()
try:
os.chdir(tmpdir)
tar = tarfile.open(tarball)
_extractall(tar)
tar.close()
# going in the directory
subdir = os.path.join(tmpdir, os.listdir(tmpdir)[0])
os.chdir(subdir)
log.warn('Now working in %s', subdir)
# building an egg
log.warn('Building a Distribute egg in %s', to_dir)
_python_cmd('setup.py', '-q', 'bdist_egg', '--dist-dir', to_dir)
finally:
os.chdir(old_wd)
shutil.rmtree(tmpdir)
# returning the result
log.warn(egg)
if not os.path.exists(egg):
raise IOError('Could not build the egg.')
def _do_download(version, download_base, to_dir, download_delay):
egg = os.path.join(to_dir, 'distribute-%s-py%d.%d.egg'
% (version, sys.version_info[0], sys.version_info[1]))
if not os.path.exists(egg):
tarball = download_setuptools(version, download_base,
to_dir, download_delay)
_build_egg(egg, tarball, to_dir)
sys.path.insert(0, egg)
import setuptools
setuptools.bootstrap_install_from = egg
def use_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
to_dir=os.curdir, download_delay=15, no_fake=True):
# making sure we use the absolute path
to_dir = os.path.abspath(to_dir)
was_imported = 'pkg_resources' in sys.modules or \
'setuptools' in sys.modules
try:
try:
import pkg_resources
# Setuptools 0.7b and later is a suitable (and preferable)
# substitute for any Distribute version.
try:
pkg_resources.require("setuptools>=0.7b")
return
except (pkg_resources.DistributionNotFound,
pkg_resources.VersionConflict):
pass
if not hasattr(pkg_resources, '_distribute'):
if not no_fake:
_fake_setuptools()
raise ImportError
except ImportError:
return _do_download(version, download_base, to_dir, download_delay)
try:
pkg_resources.require("distribute>=" + version)
return
except pkg_resources.VersionConflict:
e = sys.exc_info()[1]
if was_imported:
sys.stderr.write(
"The required version of distribute (>=%s) is not available,\n"
"and can't be installed while this script is running. Please\n"
"install a more recent version first, using\n"
"'easy_install -U distribute'."
"\n\n(Currently using %r)\n" % (version, e.args[0]))
sys.exit(2)
else:
del pkg_resources, sys.modules['pkg_resources'] # reload ok
return _do_download(version, download_base, to_dir,
download_delay)
except pkg_resources.DistributionNotFound:
return _do_download(version, download_base, to_dir,
download_delay)
finally:
if not no_fake:
_create_fake_setuptools_pkg_info(to_dir)
def download_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
to_dir=os.curdir, delay=15):
"""Download distribute from a specified location and return its filename
`version` should be a valid distribute version number that is available
as an egg for download under the `download_base` URL (which should end
with a '/'). `to_dir` is the directory where the egg will be downloaded.
`delay` is the number of seconds to pause before an actual download
attempt.
"""
# making sure we use the absolute path
to_dir = os.path.abspath(to_dir)
try:
from urllib.request import urlopen
except ImportError:
from urllib2 import urlopen
tgz_name = "distribute-%s.tar.gz" % version
url = download_base + tgz_name
saveto = os.path.join(to_dir, tgz_name)
src = dst = None
if not os.path.exists(saveto): # Avoid repeated downloads
try:
log.warn("Downloading %s", url)
src = urlopen(url)
# Read/write all in one block, so we don't create a corrupt file
# if the download is interrupted.
data = src.read()
dst = open(saveto, "wb")
dst.write(data)
finally:
if src:
src.close()
if dst:
dst.close()
return os.path.realpath(saveto)
def _no_sandbox(function):
def __no_sandbox(*args, **kw):
try:
from setuptools.sandbox import DirectorySandbox
if not hasattr(DirectorySandbox, '_old'):
def violation(*args):
pass
DirectorySandbox._old = DirectorySandbox._violation
DirectorySandbox._violation = violation
patched = True
else:
patched = False
except ImportError:
patched = False
try:
return function(*args, **kw)
finally:
if patched:
DirectorySandbox._violation = DirectorySandbox._old
del DirectorySandbox._old
return __no_sandbox
def _patch_file(path, content):
"""Will backup the file then patch it"""
f = open(path)
existing_content = f.read()
f.close()
if existing_content == content:
# already patched
log.warn('Already patched.')
return False
log.warn('Patching...')
_rename_path(path)
f = open(path, 'w')
try:
f.write(content)
finally:
f.close()
return True
_patch_file = _no_sandbox(_patch_file)
def _same_content(path, content):
f = open(path)
existing_content = f.read()
f.close()
return existing_content == content
def _rename_path(path):
new_name = path + '.OLD.%s' % time.time()
log.warn('Renaming %s to %s', path, new_name)
os.rename(path, new_name)
return new_name
def _remove_flat_installation(placeholder):
if not os.path.isdir(placeholder):
log.warn('Unkown installation at %s', placeholder)
return False
found = False
for file in os.listdir(placeholder):
if fnmatch.fnmatch(file, 'setuptools*.egg-info'):
found = True
break
if not found:
log.warn('Could not locate setuptools*.egg-info')
return
log.warn('Moving elements out of the way...')
pkg_info = os.path.join(placeholder, file)
if os.path.isdir(pkg_info):
patched = _patch_egg_dir(pkg_info)
else:
patched = _patch_file(pkg_info, SETUPTOOLS_PKG_INFO)
if not patched:
log.warn('%s already patched.', pkg_info)
return False
# now let's move the files out of the way
for element in ('setuptools', 'pkg_resources.py', 'site.py'):
element = os.path.join(placeholder, element)
if os.path.exists(element):
_rename_path(element)
else:
log.warn('Could not find the %s element of the '
'Setuptools distribution', element)
return True
_remove_flat_installation = _no_sandbox(_remove_flat_installation)
def _after_install(dist):
log.warn('After install bootstrap.')
placeholder = dist.get_command_obj('install').install_purelib
_create_fake_setuptools_pkg_info(placeholder)
def _create_fake_setuptools_pkg_info(placeholder):
if not placeholder or not os.path.exists(placeholder):
log.warn('Could not find the install location')
return
pyver = '%s.%s' % (sys.version_info[0], sys.version_info[1])
setuptools_file = 'setuptools-%s-py%s.egg-info' % \
(SETUPTOOLS_FAKED_VERSION, pyver)
pkg_info = os.path.join(placeholder, setuptools_file)
if os.path.exists(pkg_info):
log.warn('%s already exists', pkg_info)
return
log.warn('Creating %s', pkg_info)
try:
f = open(pkg_info, 'w')
except EnvironmentError:
log.warn("Don't have permissions to write %s, skipping", pkg_info)
return
try:
f.write(SETUPTOOLS_PKG_INFO)
finally:
f.close()
pth_file = os.path.join(placeholder, 'setuptools.pth')
log.warn('Creating %s', pth_file)
f = open(pth_file, 'w')
try:
f.write(os.path.join(os.curdir, setuptools_file))
finally:
f.close()
_create_fake_setuptools_pkg_info = _no_sandbox(
_create_fake_setuptools_pkg_info
)
def _patch_egg_dir(path):
# let's check if it's already patched
pkg_info = os.path.join(path, 'EGG-INFO', 'PKG-INFO')
if os.path.exists(pkg_info):
if _same_content(pkg_info, SETUPTOOLS_PKG_INFO):
log.warn('%s already patched.', pkg_info)
return False
_rename_path(path)
os.mkdir(path)
os.mkdir(os.path.join(path, 'EGG-INFO'))
pkg_info = os.path.join(path, 'EGG-INFO', 'PKG-INFO')
f = open(pkg_info, 'w')
try:
f.write(SETUPTOOLS_PKG_INFO)
finally:
f.close()
return True
_patch_egg_dir = _no_sandbox(_patch_egg_dir)
def _before_install():
log.warn('Before install bootstrap.')
_fake_setuptools()
def _under_prefix(location):
if 'install' not in sys.argv:
return True
args = sys.argv[sys.argv.index('install') + 1:]
for index, arg in enumerate(args):
for option in ('--root', '--prefix'):
if arg.startswith('%s=' % option):
top_dir = arg.split('root=')[-1]
return location.startswith(top_dir)
elif arg == option:
if len(args) > index:
top_dir = args[index + 1]
return location.startswith(top_dir)
if arg == '--user' and USER_SITE is not None:
return location.startswith(USER_SITE)
return True
def _fake_setuptools():
log.warn('Scanning installed packages')
try:
import pkg_resources
except ImportError:
# we're cool
log.warn('Setuptools or Distribute does not seem to be installed.')
return
ws = pkg_resources.working_set
try:
setuptools_dist = ws.find(
pkg_resources.Requirement.parse('setuptools', replacement=False)
)
except TypeError:
# old distribute API
setuptools_dist = ws.find(
pkg_resources.Requirement.parse('setuptools')
)
if setuptools_dist is None:
log.warn('No setuptools distribution found')
return
# detecting if it was already faked
setuptools_location = setuptools_dist.location
log.warn('Setuptools installation detected at %s', setuptools_location)
# if --root or --preix was provided, and if
# setuptools is not located in them, we don't patch it
if not _under_prefix(setuptools_location):
log.warn('Not patching, --root or --prefix is installing Distribute'
' in another location')
return
# let's see if its an egg
if not setuptools_location.endswith('.egg'):
log.warn('Non-egg installation')
res = _remove_flat_installation(setuptools_location)
if not res:
return
else:
log.warn('Egg installation')
pkg_info = os.path.join(setuptools_location, 'EGG-INFO', 'PKG-INFO')
if (os.path.exists(pkg_info) and
_same_content(pkg_info, SETUPTOOLS_PKG_INFO)):
log.warn('Already patched.')
return
log.warn('Patching...')
# let's create a fake egg replacing setuptools one
res = _patch_egg_dir(setuptools_location)
if not res:
return
log.warn('Patching complete.')
_relaunch()
def _relaunch():
log.warn('Relaunching...')
# we have to relaunch the process
# pip marker to avoid a relaunch bug
_cmd1 = ['-c', 'install', '--single-version-externally-managed']
_cmd2 = ['-c', 'install', '--record']
if sys.argv[:3] == _cmd1 or sys.argv[:3] == _cmd2:
sys.argv[0] = 'setup.py'
args = [sys.executable] + sys.argv
sys.exit(subprocess.call(args))
def _extractall(self, path=".", members=None):
"""Extract all members from the archive to the current working
directory and set owner, modification time and permissions on
directories afterwards. `path' specifies a different directory
to extract to. `members' is optional and must be a subset of the
list returned by getmembers().
"""
import copy
import operator
from tarfile import ExtractError
directories = []
if members is None:
members = self
for tarinfo in members:
if tarinfo.isdir():
# Extract directories with a safe mode.
directories.append(tarinfo)
tarinfo = copy.copy(tarinfo)
tarinfo.mode = 448 # decimal for oct 0700
self.extract(tarinfo, path)
# Reverse sort directories.
if sys.version_info < (2, 4):
def sorter(dir1, dir2):
return cmp(dir1.name, dir2.name)
directories.sort(sorter)
directories.reverse()
else:
directories.sort(key=operator.attrgetter('name'), reverse=True)
# Set correct owner, mtime and filemode on directories.
for tarinfo in directories:
dirpath = os.path.join(path, tarinfo.name)
try:
self.chown(tarinfo, dirpath)
self.utime(tarinfo, dirpath)
self.chmod(tarinfo, dirpath)
except ExtractError:
e = sys.exc_info()[1]
if self.errorlevel > 1:
raise
else:
self._dbg(1, "tarfile: %s" % e)
def _build_install_args(options):
"""
Build the arguments to 'python setup.py install' on the distribute package
"""
install_args = []
if options.user_install:
if sys.version_info < (2, 6):
log.warn("--user requires Python 2.6 or later")
raise SystemExit(1)
install_args.append('--user')
return install_args
def _parse_args():
"""
Parse the command line for options
"""
parser = optparse.OptionParser()
parser.add_option(
'--user', dest='user_install', action='store_true', default=False,
help='install in user site package (requires Python 2.6 or later)')
parser.add_option(
'--download-base', dest='download_base', metavar="URL",
default=DEFAULT_URL,
help='alternative URL from where to download the distribute package')
options, args = parser.parse_args()
# positional arguments are ignored
return options
def main(version=DEFAULT_VERSION):
"""Install or upgrade setuptools and EasyInstall"""
options = _parse_args()
tarball = download_setuptools(download_base=options.download_base)
return _install(tarball, _build_install_args(options))
if __name__ == '__main__':
sys.exit(main())

Some files were not shown because too many files have changed in this diff Show More