Compare commits
7 Commits
Author | SHA1 | Date |
---|---|---|
Stefan Kögl | e865fe53d2 | |
Stefan Kögl | e889b3a88c | |
Stefan Kögl | 41e512c9ef | |
Stefan Kögl | 9bf6f97781 | |
Stefan Kögl | 8dc6e67d1d | |
Stefan Kögl | 9bcdc6b377 | |
Stefan Kögl | 7c0f56bf20 |
|
@ -33,9 +33,3 @@ nosetests.xml
|
|||
.mr.developer.cfg
|
||||
.project
|
||||
.pydevproject
|
||||
|
||||
*.elf
|
||||
*.hex
|
||||
*.map
|
||||
*.d
|
||||
*.o
|
||||
|
|
10
TODO
10
TODO
|
@ -1,10 +0,0 @@
|
|||
* 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
|
|
@ -0,0 +1,3 @@
|
|||
192.168.1.51, 9000
|
||||
192.168.1.52, 9000
|
||||
192.168.1.53, 9000
|
|
@ -0,0 +1,3 @@
|
|||
localhost, 9001
|
||||
localhost, 9002
|
||||
localhost, 9003
|
|
@ -1,58 +0,0 @@
|
|||
[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
|
|
@ -1,21 +0,0 @@
|
|||
#!/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 $?
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
#!/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 $?
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
#!/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 $?
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
#!/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 $?
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
[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
|
@ -1,6 +1,7 @@
|
|||
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
|
||||
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
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
[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=
|
|
@ -1,19 +0,0 @@
|
|||
[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=
|
|
@ -15,42 +15,48 @@ set -g terminal-overrides 'xterm*:smcup@:rmcup@'
|
|||
new-session -s 'csession'
|
||||
attach-session -t 'csession'
|
||||
|
||||
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 'chaosc' -t 'csession:1' '/usr/bin/chaosc -4'
|
||||
|
||||
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-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-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-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 '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 '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 '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 'ekg2osc-bjoern' -t 'csession:11' 'ekg2osc -4 -d /tmp/ekg2osc-bjoern-out -a bjoern'
|
||||
new-window -n 'ekg2osc-merle' -t 'csession:12' 'ekg2osc -4 -d /tmp/ekg2osc-merle-out -a merle'
|
||||
new-window -n 'ekg2osc-uwe' -t 'csession:13' 'ekg2osc -4 -d /tmp/ekg2osc-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 'pulse2osc-bjoern' -t 'csession:14' 'pulse2osc -4 -d /tmp/pulse2osc-bjoern-out -a bjoern'
|
||||
new-window -n 'pulse2osc-merle' -t 'csession:15' 'pulse2osc -4 -d /tmp/pulse2osc-merle-out -a merle'
|
||||
new-window -n 'pulse2osc-uwe' -t 'csession:16' 'pulse2osc -4 -d /tmp/pulse2osc-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 'ehealth2osc-bjoern' -t 'csession:17' 'ehealth2osc -4 -d /tmp/ehealth2osc-bjoern-out -a bjoern'
|
||||
new-window -n 'ehealth2osc-merle' -t 'csession:18' 'ehealth2osc -4 -d /tmp/ehealth2osc-merle-out -a merle'
|
||||
new-window -n 'ehealth2osc-uwe' -t 'csession:19' 'ehealth2osc -4 -d /tmp/ehealth2osc-uwe-out -a uwe'
|
||||
|
||||
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-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-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-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'
|
||||
|
||||
select-window -t 'csession:2'
|
||||
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"'
|
||||
new-window -n 'chaosc_emitter' -t 'csession:31' 'chaosc_emitter'
|
||||
|
||||
select-window -t 'csession:1'
|
||||
|
||||
set aggressive-resize on
|
||||
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
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()]]),
|
||||
]
|
|
@ -1,462 +0,0 @@
|
|||
<?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>
|
|
@ -1,191 +0,0 @@
|
|||
# -*- 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))
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
<!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>
|
|
@ -1,422 +0,0 @@
|
|||
#!/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()
|
|
@ -1,49 +0,0 @@
|
|||
#!/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'
|
||||
)
|
|
@ -1,9 +1,6 @@
|
|||
char zaehler;
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
pinMode(7, OUTPUT);
|
||||
zaehler = 0;
|
||||
}
|
||||
|
||||
float getTemperature(void)
|
||||
|
@ -58,26 +55,14 @@ float getTemperature(void)
|
|||
|
||||
|
||||
void loop() {
|
||||
zaehler++;
|
||||
// int airFlow = analogRead(A1);
|
||||
// int emg = analogRead(0);
|
||||
// int temp = getTemperature();
|
||||
Serial.print(analogRead(A1));
|
||||
int airFlow = analogRead(A1);
|
||||
int emg = analogRead(0);
|
||||
int temp = getTemperature();
|
||||
Serial.print(airFlow);
|
||||
Serial.print(";");
|
||||
Serial.print(analogRead(0));
|
||||
Serial.print(emg);
|
||||
Serial.print(";");
|
||||
Serial.println(getTemperature());
|
||||
Serial.println(temp);
|
||||
delay(100);
|
||||
|
||||
if(zaehler >= 10) {
|
||||
zaehler = 0;
|
||||
if(digitalRead(7) == HIGH) {
|
||||
digitalWrite(7, LOW);
|
||||
} else {
|
||||
digitalWrite(7, HIGH);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,556 +0,0 @@
|
|||
#!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())
|
|
@ -0,0 +1,106 @@
|
|||
data = [20, 14, 9, 9, 37, 42, 33, 31, 20, 42, 255, 47, 29, 34, 8, 16, 4, 5, 10, 18, 7, 10, 19, 4, 12, 11, 29, 46, 48,
|
||||
44, 25, 27, 255, 46, 48, 28, 13, 13, 13, 10, 17, 16, 20, 12, 8, 13, 0, 2, 40, 45, 37, 37, 39, 29, 255, 21, 25, 23,
|
||||
18, 8, 14, 3, 16, 19, 2, 6, 20, 13, 5, 5, 37, 36, 38, 34, 21, 27, 255, 35, 31, 48, 11, 17, 1, 17, 14, 12, 20, 0, 6,
|
||||
17, 1, 9, 27, 46, 21, 50, 44, 26, 255, 50, 38, 36, 35, 17, 20, 4, 18, 20, 6, 16, 20, 12, 10, 20, 8, 20, 20, 45, 40,
|
||||
21, 37, 38, 255, 35, 44, 29, 17, 7, 6, 14, 6, 13, 16, 9, 8, 10, 7, 13, 49, 43, 41, 49, 40, 50, 49, 255, 29, 42, 36,
|
||||
7, 5, 10, 20, 0, 19, 6, 18, 18, 13, 16, 3, 50, 40, 46, 26, 45, 49, 36, 255, 24, 39, 36, 2, 7, 3, 1, 1, 15, 12, 6,
|
||||
6, 5, 0, 7, 32, 43, 30, 50, 39, 50, 47, 255, 23, 41, 24, 6, 6, 1, 11, 9, 16, 5, 6, 3, 11, 7, 17, 12, 28, 47, 31,
|
||||
23, 31, 37, 32, 255, 50, 21, 22, 50, 1, 2, 1, 6, 12, 15, 9, 2, 4, 10, 14, 13, 46, 35, 39, 44, 39, 42, 29, 255, 20,
|
||||
45, 38, 29, 13, 20, 7, 13, 12, 12, 3, 12, 10, 14, 15, 20, 26, 30, 44, 27, 48, 46, 21, 255, 39, 40, 38, 22, 18, 3, 20,
|
||||
20, 4, 14, 11, 14, 10, 0, 12, 0, 25, 25, 28, 24, 44, 22, 31, 255, 29, 25, 39, 28, 7, 1, 6, 7, 7, 11, 15, 7, 10, 17,
|
||||
0, 0, 27, 23, 41, 21, 21, 41, 45, 45, 255, 27, 36, 46, 10, 13, 14, 8, 3, 15, 14, 4, 15, 12, 11, 2, 14, 35, 42, 50, 26,
|
||||
37, 30, 35, 38, 255, 34, 47, 33, 20, 3, 2, 2, 14, 11, 11, 7, 3, 15, 18, 9, 13, 27, 30, 27, 47, 34, 22, 38, 20, 255,
|
||||
22, 46, 50, 3, 9, 18, 19, 11, 19, 6, 2, 4, 0, 14, 13, 5, 39, 40, 48, 43, 33, 25, 43, 20, 255, 45, 42, 47, 11, 4, 0,
|
||||
1, 6, 8, 15, 16, 18, 1, 11, 0, 6, 5, 38, 47, 32, 23, 40, 37, 39, 255, 26, 30, 36, 37, 7, 5, 7, 11, 8, 13, 12, 12, 17,
|
||||
12, 1, 11, 8, 14, 44, 25, 31, 41, 50, 39, 46, 255, 49, 39, 44, 23, 4, 5, 14, 15, 1, 13, 7, 9, 7, 5, 4, 7, 16, 2, 41,
|
||||
30, 37, 36, 34, 23, 32, 255, 49, 32, 33, 41, 2, 13, 17, 8, 19, 18, 15, 4, 12, 18, 6, 19, 10, 8, 38, 31, 36, 34, 44,
|
||||
50, 20, 255, 39, 39, 24, 30, 11, 5, 12, 16, 20, 18, 2, 8, 17, 14, 24, 7, 10, 13, 6, 27, 41, 31, 46, 29, 46, 39, 28,
|
||||
255, 43, 28, 38, 49, 11, 11, 19, 1, 12, 14, 0, 18, 4, 21, 4, 16, 11, 16, 42, 44, 49, 23, 38, 31, 35, 47, 255, 30, 23,
|
||||
23, 45, 1, 10, 3, 8, 16, 16, 6, 17, 10, 24, 3, 19, 11, 3, 24, 27, 42, 45, 27, 46, 26, 41, 255, 31, 44, 39, 49, 10,
|
||||
4, 20, 3, 9, 15, 7, 15, 5, 19, 4, 10, 9, 13, 30, 29, 47, 21, 24, 36, 45, 20, 255, 33, 45, 25, 24, 2, 9, 19, 2, 20,
|
||||
17, 19, 10, 20, 12, 10, 19, 20, 9, 20, 30, 38, 34, 22, 46, 26, 24, 26, 255, 23, 26, 29, 37, 0, 10, 9, 20, 14, 19,
|
||||
2, 0, 1, 4, 12, 19, 6, 17, 17, 46, 47, 42, 34, 32, 29, 40, 47, 255, 27, 30, 25, 36, 14, 3, 11, 20, 4, 0, 1, 9, 19,
|
||||
15, 13, 2, 19, 1, 7, 42, 20, 25, 46, 30, 49, 39, 28, 255, 34, 43, 24, 34, 6, 1, 18, 9, 8, 11, 11, 17, 11, 6, 26,
|
||||
7, 3, 1, 14, 49, 41, 37, 27, 34, 22, 47, 20, 24, 255, 36, 34, 20, 26, 13, 7, 18, 10, 6, 9, 4, 0, 14, 14, 27, 5,
|
||||
13, 0, 7, 39, 21, 42, 34, 36, 45, 24, 28, 43, 255, 20, 26, 36, 31, 8, 8, 0, 0, 14, 0, 1, 8, 15, 1, 19, 13, 15,
|
||||
17, 9, 44, 38, 33, 21, 37, 48, 32, 30, 34, 255, 32, 32, 33, 40, 19, 6, 5, 2, 7, 3, 10, 19, 10, 12, 14, 16, 15,
|
||||
14, 7, 29, 29, 50, 31, 26, 36, 31, 22, 32, 255, 48, 45, 42, 31, 50, 13, 9, 5, 16, 7, 12, 12, 4, 6, 1, 24, 14, 12,
|
||||
6, 3, 25, 27, 50, 40, 25, 35, 37, 25, 47, 255, 30, 29, 45, 36, 34, 0, 13, 20, 13, 18, 11, 16, 16, 0, 9, 23, 8,
|
||||
7, 4, 18, 41, 50, 20, 45, 48, 43, 31, 36, 30, 255, 37, 30, 22, 38, 39, 10, 16, 9, 7, 13, 18, 1, 5, 14, 20, 21,
|
||||
13, 19, 15, 13, 34, 26, 21, 45, 35, 44, 39, 23, 21, 255, 27, 47, 45, 41, 39, 9, 11, 12, 10, 13, 4, 8, 15, 4,
|
||||
19, 3, 1, 15, 9, 5, 2, 8, 33, 38, 35, 26, 48, 42, 25, 50, 23, 255, 24, 26, 29, 20, 32, 12, 1, 9, 10, 12, 6,
|
||||
14, 6, 14, 1, 19, 14, 20, 2, 8, 4, 31, 43, 27, 24, 33, 33, 27, 23, 21, 255, 41, 37, 23, 28, 33, 2, 17, 8, 9,
|
||||
16, 10, 17, 11, 4, 4, 4, 17, 19, 13, 3, 0, 20, 36, 31, 50, 48, 31, 43, 36, 34, 255, 31, 41, 29, 47, 21, 18,
|
||||
15, 11, 20, 14, 14, 11, 4, 12, 2, 12]
|
||||
|
||||
|
||||
from collections import deque
|
||||
|
||||
data_points = 20
|
||||
item_data1 = deque([0] * data_points)
|
||||
|
||||
pos1 = 0
|
||||
|
||||
lengths = [0]
|
||||
|
||||
item_point1 = 0
|
||||
|
||||
def set_point(plotPoint, pos, value, ix, max_items):
|
||||
scale = 254 / max_items * ix
|
||||
return 6 * ix + value / max_items + scale
|
||||
|
||||
|
||||
def find_max_value(item_data):
|
||||
max_value = 0
|
||||
max_index = 0
|
||||
for ix, i in enumerate(item_data):
|
||||
if i > max_value:
|
||||
max_value = i
|
||||
max_index = ix
|
||||
return max_index, max_value
|
||||
|
||||
|
||||
def rearrange(item_data, actual_pos, max_items):
|
||||
max_value_index, max_value = find_max_value(item_data)
|
||||
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(item_data, pos, max_pos, value):
|
||||
print "setValue before", pos, None, max_pos, value, item_data
|
||||
item_data[pos] = value
|
||||
new_pos = (pos + 1) % max_pos
|
||||
print "setValue after ", pos, new_pos, max_pos, value, item_data
|
||||
return new_pos
|
||||
|
||||
def resize(item_data, max_length, new_max_length):
|
||||
if new_max_length > max_length:
|
||||
pad = (new_max_length - max_length)
|
||||
print "pad", pad
|
||||
item_data.extend([0] * pad)
|
||||
return new_max_length
|
||||
else:
|
||||
return max_length
|
||||
|
||||
for value in data:
|
||||
if value > 250:
|
||||
data_points = resize(item_data1, data_points, lengths[-1])
|
||||
lengths.append(0)
|
||||
else:
|
||||
lengths[-1] += 1
|
||||
|
||||
ix = 0
|
||||
set_point(None, pos1, value, ix, 3)
|
||||
pos1 = set_value(item_data1, pos1, data_points, value)
|
||||
pos1 = rearrange(item_data1, pos1, data_points)
|
||||
|
||||
print
|
||||
|
||||
print "lengths", lengths
|
|
@ -0,0 +1,266 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Demonstrates use of PlotWidget class. This is little more than a
|
||||
GraphicsView with a PlotItem placed in its center.
|
||||
"""
|
||||
|
||||
|
||||
|
||||
from collections import deque
|
||||
|
||||
from PyQt4 import QtNetwork
|
||||
from pyqtgraph.Qt import QtGui, QtCore
|
||||
import numpy as np
|
||||
import pyqtgraph as pg
|
||||
|
||||
import numpy as np
|
||||
|
||||
|
||||
try:
|
||||
from chaosc.c_osc_lib import decode_osc
|
||||
except ImportError as e:
|
||||
print(e)
|
||||
from chaosc.osc_lib import decode_osc
|
||||
|
||||
|
||||
|
||||
class OSCPlotter(QtGui.QWidget):
|
||||
def __init__(self, parent=None):
|
||||
super(OSCPlotter, self).__init__(parent)
|
||||
self.plot_data1 = deque([0] * 100)
|
||||
self.plot_data2 = deque([254 * 0.3] * 100)
|
||||
self.plot_data3 = deque([254 * 0.6] * 100)
|
||||
self.is_item1 = True
|
||||
self.is_item2 = True
|
||||
self.is_item3 = True
|
||||
self.osc_sock = QtNetwork.QUdpSocket(self)
|
||||
self.osc_sock.bind(10000)
|
||||
self.osc_sock.readyRead.connect(self.receive_osc)
|
||||
self.tcpServer = QtNetwork.QTcpServer(self)
|
||||
self.tcpServer.listen(QtNetwork.QHostAddress("0.0.0.0"), 9000)
|
||||
self.tcpServer.newConnection.connect(self.addConnection)
|
||||
self.connections = []
|
||||
self.streams = []
|
||||
self.streaming_timer = QtCore.QTimer(self)
|
||||
self.streaming_timer.timeout.connect(self.sendMJpeg)
|
||||
self.streaming_timer.start(20)
|
||||
|
||||
|
||||
def addConnection(self):
|
||||
clientConnection = self.tcpServer.nextPendingConnection()
|
||||
#clientConnection.nextBlockSize = 0
|
||||
self.connections.append(clientConnection)
|
||||
|
||||
clientConnection.readyRead.connect(self.receiveMessage)
|
||||
clientConnection.disconnected.connect(self.removeConnection)
|
||||
clientConnection.error.connect(self.socketError)
|
||||
|
||||
def removeConnection(self):
|
||||
pass
|
||||
|
||||
def socketError(self):
|
||||
pass
|
||||
|
||||
def receiveMessage(self):
|
||||
for ix, s in enumerate(self.connections):
|
||||
if s.bytesAvailable() > 0:
|
||||
stream = QtCore.QDataStream(s)
|
||||
stream.setVersion(QtCore.QDataStream.Qt_4_8)
|
||||
|
||||
#if s.nextBlockSize == 0:
|
||||
#if s.bytesAvailable() < 4:
|
||||
#return
|
||||
#s.nextBlockSize = stream.readUInt32()
|
||||
#if s.bytesAvailable() < s.nextBlockSize:
|
||||
#return
|
||||
|
||||
textFromClient = stream.readRawData(s.bytesAvailable())
|
||||
print "data", repr(textFromClient)
|
||||
socketId = s.socketDescriptor()
|
||||
if textFromClient.startswith("GET /index.html"):
|
||||
self.sendMessage("HTTP/1.1 200 Ok\r\nContent-Language: en\r\nContent-type: text/html; charset=\"utf-8\"\r\n\r\n" + open("index.html").read() + "\r\n\r\n",
|
||||
s.socketDescriptor())
|
||||
elif textFromClient.startswith("GET /camera.jpg"):
|
||||
self.sendImage(socketId)
|
||||
elif textFromClient.startswith("GET /camera.mjpeg"):
|
||||
self.prepareMJpeg(socketId)
|
||||
#self.sendImage(s.socketDescriptor())
|
||||
else:
|
||||
self.sendMessage("HTTP/1.1 404 Not Found\r\n\r\n", s.socketDescriptor())
|
||||
|
||||
|
||||
def sendMessage(self, text, socketId):
|
||||
for s in self.connections:
|
||||
if s.socketDescriptor() == socketId:
|
||||
print "sendMessage"
|
||||
|
||||
reply = QtCore.QByteArray()
|
||||
stream = QtCore.QDataStream(reply, QtCore.QIODevice.WriteOnly)
|
||||
#stream.setVersion(QtCore.QDataStream.Qt_4_8)
|
||||
stream.writeString(text)
|
||||
|
||||
s.write(reply)
|
||||
s.close()
|
||||
|
||||
|
||||
def prepareMJpeg(self, socketId):
|
||||
for s in self.connections:
|
||||
if s.socketDescriptor() == socketId:
|
||||
self.streams.append(socketId)
|
||||
reply = QtCore.QByteArray()
|
||||
stream = QtCore.QDataStream(reply, QtCore.QIODevice.WriteOnly)
|
||||
stream.setVersion(QtCore.QDataStream.Qt_4_8)
|
||||
stream.writeRawData("HTTP/1.1 200 OK\r\nContent-Type: multipart/x-mixed-replace; boundary=--aaboundary\r\n\r\n")
|
||||
s.write(reply)
|
||||
#s.close()
|
||||
|
||||
|
||||
def sendMJpeg(self):
|
||||
reply = QtCore.QByteArray()
|
||||
stream = QtCore.QDataStream(reply, QtCore.QIODevice.WriteOnly)
|
||||
stream.setVersion(QtCore.QDataStream.Qt_4_8)
|
||||
stream.writeRawData("--aaboundary\r\nContent-Type: image/jpeg\r\nContent-length: %d\r\n\r\n%s\r\n\r\n\r\n" % (len(self.jpeg_data), self.jpeg_data))
|
||||
for socketId in self.streams:
|
||||
for connection in self.connections:
|
||||
if connection.socketDescriptor() == socketId:
|
||||
connection.write(reply)
|
||||
#connection.close()
|
||||
|
||||
|
||||
def sendImage(self, socketId):
|
||||
for connection in self.connections:
|
||||
if connection.socketDescriptor() == socketId:
|
||||
reply = QtCore.QByteArray()
|
||||
stream = QtCore.QDataStream(reply, QtCore.QIODevice.WriteOnly)
|
||||
stream.setVersion(QtCore.QDataStream.Qt_4_8)
|
||||
|
||||
#tmp = open("camera.jpg", "rb").read()
|
||||
header = QtCore.QString("HTTP/1.1 200 OK\r\nContent-Type: image/jpeg\r\nContent-length: %d\r\n\r\n" % len(self.jpeg_data))
|
||||
stream.writeRawData(header)
|
||||
stream.writeRawData(self.jpeg_data)
|
||||
stream.writeRawData("\r\n\r\n\r\n")
|
||||
connection.write(reply)
|
||||
connection.close()
|
||||
|
||||
|
||||
def init(self):
|
||||
self.plt = pg.PlotWidget(name='EKG') ## giving the plots names allows us to link their axes together
|
||||
#self.legend = self.plt.addLegend()
|
||||
|
||||
l = QtGui.QVBoxLayout()
|
||||
self.statusLabel = QtGui.QLabel("Listening for broadcasted messages")
|
||||
self.setLayout(l)
|
||||
l.addWidget(self.plt)
|
||||
l.addWidget(self.statusLabel)
|
||||
|
||||
self.plotItem1 = pg.PlotCurveItem(pen=pg.mkPen('r', width=4), name="bjoern")
|
||||
self.plotItem2 = pg.PlotCurveItem(pen=pg.mkPen('g', width=4), name="merle")
|
||||
self.plotItem3 = pg.PlotCurveItem(pen=pg.mkPen('b', width=4), name="uwe")
|
||||
#self.plotItem1.setPos(0, 0*6)
|
||||
#self.plotItem2.setPos(0, 1*6)
|
||||
#self.plotItem3.setPos(0, 2*6)
|
||||
self.plt.addItem(self.plotItem1)
|
||||
self.plt.addItem(self.plotItem2)
|
||||
self.plt.addItem(self.plotItem3)
|
||||
self.plt.setLabel('left', "EKG")
|
||||
self.plt.setLabel('bottom', "Time")
|
||||
self.plt.showGrid(True, True)
|
||||
ba = self.plt.getAxis("bottom")
|
||||
bl = self.plt.getAxis("left")
|
||||
ba.setTicks([])
|
||||
bl.setTicks([])
|
||||
self.plt.setYRange(0, 254)
|
||||
self.plotItem1.setData(y=np.array(self.plot_data1), clear=True)
|
||||
self.plotItem2.setData(y=np.array(self.plot_data2), clear=True)
|
||||
self.plotItem3.setData(y=np.array(self.plot_data3), clear=True)
|
||||
#self.plotItem1.setShadowPen(pg.mkPen((200, 200, 200), width=6, cosmetic=True))
|
||||
#self.plotItem2.setShadowPen(pg.mkPen((200, 200, 200), width=6, cosmetic=True))
|
||||
#self.plotItem3.setShadowPen(pg.mkPen((200, 200, 200), width=6, cosmetic=True))
|
||||
|
||||
|
||||
|
||||
def receive_osc(self):
|
||||
#print "receive_osc"
|
||||
while self.osc_sock.hasPendingDatagrams():
|
||||
packet, address, port = self.osc_sock.readDatagram(self.osc_sock.pendingDatagramSize())
|
||||
osc_address, typetags, args = decode_osc(packet, 0, len(packet))
|
||||
|
||||
#print "osc", osc_address, args[0]
|
||||
self.statusLabel.setText(osc_address)
|
||||
update = False
|
||||
if osc_address == "/bjoern/ekg":
|
||||
self.plot_data1.appendleft(args[0] / 3)
|
||||
self.plot_data1.pop()
|
||||
update = True
|
||||
elif osc_address == "/merle/ekg":
|
||||
self.plot_data2.appendleft(args[0] / 3 + 254/3)
|
||||
self.plot_data2.pop()
|
||||
update = True
|
||||
elif osc_address == "/uwe/ekg":
|
||||
self.plot_data3.appendleft(args[0] /3 + 254/3*2)
|
||||
self.plot_data3.pop()
|
||||
update = True
|
||||
#elif osc_address == "/plot/uwe":
|
||||
#if args[0] == 1 and self.is_item3 == False:
|
||||
#self.plt.addItem(self.plotItem3)
|
||||
#self.is_item3 = True
|
||||
##self.legend.addItem(self.plotItem3, "uwe")
|
||||
#elif args[0] == 0 and self.is_item3 == True:
|
||||
#self.plt.removeItem(self.plotItem3)
|
||||
#self.is_item3 = False
|
||||
##self.legend.removeItem("uwe")
|
||||
#elif osc_address == "/plot/merle":
|
||||
#if args[0] == 1 and self.is_item2 == False:
|
||||
#self.plt.addItem(self.plotItem2)
|
||||
#self.is_item2 = True
|
||||
##self.legend.addItem(self.plotItem2, "merle")
|
||||
#elif args[0] == 0 and self.is_item2 == True:
|
||||
#self.plt.removeItem(self.plotItem2)
|
||||
#self.is_item2 = True
|
||||
##self.legend.removeItem("merle")
|
||||
#elif osc_address == "/plot/bjoern":
|
||||
#if args[0] == 1 and self.is_item1 == False:
|
||||
#self.plt.addItem(self.plotItem1)
|
||||
#self.is_item1 = True
|
||||
##self.legend.addItem(self.plotItem1, name="bjoern")
|
||||
#elif args[0] == 0 and self.is_item1 == True:
|
||||
#self.plt.removeItem(self.plotItem1)
|
||||
#self.is_item1 = False
|
||||
##self.legend.removeItem("bjoern")
|
||||
|
||||
if update:
|
||||
self.plotItem1.setData(y=np.array(self.plot_data1), clear=True)
|
||||
self.plotItem2.setData(y=np.array(self.plot_data2), clear=True)
|
||||
self.plotItem3.setData(y=np.array(self.plot_data3), clear=True)
|
||||
#item = plt.plot(plot_data1, pen=(0, 3*1.3), clear=True)
|
||||
|
||||
exporter = pg.exporters.ImageExporter.ImageExporter(self.plt.plotItem)
|
||||
exporter.parameters()['width'] = 1280
|
||||
#exporter.parameters()['height'] = 720
|
||||
name = 'tmpfile'
|
||||
img = exporter.export(name, True)
|
||||
buffer = QtCore.QBuffer()
|
||||
buffer.open(QtCore.QIODevice.ReadWrite)
|
||||
img.save(buffer, "JPG", 100)
|
||||
self.jpeg_data = buffer.data()
|
||||
|
||||
|
||||
|
||||
#QtGui.QApplication.setGraphicsSystem('raster')
|
||||
app = QtGui.QApplication([])
|
||||
mw = QtGui.QMainWindow()
|
||||
mw.setWindowTitle('pyqtgraph example: PlotWidget')
|
||||
mw.resize(1280, 720)
|
||||
cw = OSCPlotter()
|
||||
cw.init()
|
||||
mw.setCentralWidget(cw)
|
||||
|
||||
mw.show()
|
||||
|
||||
|
||||
|
||||
## Start Qt event loop unless running in interactive mode or using pyside.
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
|
||||
QtGui.QApplication.instance().exec_()
|
|
@ -1,7 +1,7 @@
|
|||
<HTML>
|
||||
<BODY>
|
||||
|
||||
<img src="/camera_%d.mjpeg" alt="Smiley face">
|
||||
<img src="/camera.mjpeg" alt="Smiley face">
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
|
|
@ -22,126 +22,92 @@
|
|||
#
|
||||
# Copyright (C) 2014 Stefan Kögl
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
|
||||
from chaosc.argparser_groups import *
|
||||
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
|
||||
|
||||
import logging
|
||||
|
||||
#import objgraph
|
||||
|
||||
#import gc
|
||||
#gc.set_debug(gc.DEBUG_LEAK)
|
||||
|
||||
from datetime import datetime
|
||||
from queue import Empty
|
||||
import numpy as np
|
||||
import string,cgi,time, random, socket
|
||||
from os import curdir, sep
|
||||
import os.path
|
||||
import pyqtgraph as pg
|
||||
import Queue
|
||||
import re
|
||||
from http.server import BaseHTTPRequestHandler, HTTPServer
|
||||
from socketserver import ThreadingMixIn, ForkingMixIn
|
||||
import select
|
||||
import socket
|
||||
import threading
|
||||
import time
|
||||
import re
|
||||
|
||||
from collections import deque
|
||||
|
||||
|
||||
from PyQt4.QtCore import QBuffer, QByteArray, QIODevice
|
||||
from PyQt4 import QtGui, QtCore
|
||||
|
||||
import pyqtgraph as pg
|
||||
|
||||
from pyqtgraph.widgets.PlotWidget import PlotWidget
|
||||
|
||||
from chaosc.argparser_groups import *
|
||||
from chaosc.lib import resolve_host
|
||||
|
||||
from multiprocessing import Process, Queue
|
||||
|
||||
try:
|
||||
from chaosc.c_osc_lib import *
|
||||
except ImportError:
|
||||
from chaosc.osc_lib import *
|
||||
|
||||
|
||||
try:
|
||||
from chaosc.c_osc_lib import OSCMessage, decode_osc
|
||||
from chaosc.c_osc_lib import decode_osc
|
||||
except ImportError as e:
|
||||
logging.exception(e)
|
||||
from chaosc.osc_lib import OSCMessage, decode_osc
|
||||
print(e)
|
||||
from chaosc.osc_lib import decode_osc
|
||||
|
||||
|
||||
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):
|
||||
class OSCThread(Process):
|
||||
def __init__(self, args, queue):
|
||||
super(OSCThread, self).__init__()
|
||||
self.msg_queue = queue
|
||||
self.args = args
|
||||
self.running = True
|
||||
|
||||
self.client_address = resolve_host(args.client_host, args.client_port, args.address_family)
|
||||
self.own_address = resolve_host(args.own_host, args.own_port, args.address_family)
|
||||
|
||||
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.bind(self.own_address)
|
||||
self.osc_sock.setblocking(0)
|
||||
|
||||
logger.info("%s: starting up osc receiver on '%s:%d'",
|
||||
datetime.now().strftime("%x %X"), self.client_address[0], self.client_address[1])
|
||||
print("%s: starting up osc receiver on '%s:%d'" % (
|
||||
datetime.now().strftime("%x %X"), self.own_address[0], self.own_address[1]))
|
||||
|
||||
self.subscribe_me()
|
||||
|
||||
def subscribe_me(self):
|
||||
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.client_address[0], "s")
|
||||
msg.appendTypedArg(self.client_address[1], "i")
|
||||
msg.appendTypedArg(self.args.authenticate, "s")
|
||||
"""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))
|
||||
msg = OSCMessage(b"/subscribe")
|
||||
msg.appendTypedArg(bytes(self.own_address[0], "ascii"), b"s")
|
||||
msg.appendTypedArg(self.own_address[1], b"i")
|
||||
msg.appendTypedArg(bytes(self.args.authenticate, "ascii"), b"s")
|
||||
if self.args.subscriber_label is not None:
|
||||
msg.appendTypedArg(self.args.subscriber_label, "s")
|
||||
msg.appendTypedArg(bytes(self.args.subscriber_label, "ascii"), b"s")
|
||||
self.osc_sock.sendto(msg.encode_osc(), self.chaosc_address)
|
||||
|
||||
|
||||
|
@ -149,119 +115,146 @@ class OSCThread(threading.Thread):
|
|||
if self.args.keep_subscribed:
|
||||
return
|
||||
|
||||
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.client_address[0], "s")
|
||||
msg.appendTypedArg(self.client_address[1], "i")
|
||||
msg.appendTypedArg(self.args.authenticate, "s")
|
||||
print("%s: unsubscribing from '%s:%d'" % (datetime.now().strftime("%x %X"), self.chaosc_address[0], self.chaosc_address[1]))
|
||||
msg = OSCMessage(b"/unsubscribe")
|
||||
msg.appendTypedArg(bytes(self.own_address[0], "ascii"), b"s")
|
||||
msg.appendTypedArg(self.own_address[1], b"i")
|
||||
msg.appendTypedArg(bytes(self.args.authenticate, "ascii"), b"s")
|
||||
self.osc_sock.sendto(msg.encode_osc(), self.chaosc_address)
|
||||
|
||||
def run(self):
|
||||
|
||||
while self.running:
|
||||
try:
|
||||
reads, writes, errs = select.select([self.osc_sock], [], [], 0.005)
|
||||
except Exception, e:
|
||||
logging.exception(e)
|
||||
pass
|
||||
reads, writes, errs = select.select([self.osc_sock], [], [], 0.05)
|
||||
if reads:
|
||||
osc_input = reads[0].recv(128)
|
||||
osc_address, typetags, messages = decode_osc(osc_input, 0, len(osc_input))
|
||||
print("thread: osc_address", osc_address)
|
||||
if osc_address.find(b"ekg") > -1 or osc_address.find(b"plot") != -1:
|
||||
#print("send", osc_address)
|
||||
self.msg_queue.put_nowait((osc_address, messages))
|
||||
else:
|
||||
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)
|
||||
|
||||
print("thread: dummy values")
|
||||
self.msg_queue.put_nowait((b"/bjoern/ekg", [0]))
|
||||
self.msg_queue.put_nowait((b"/merle/ekg", [0]))
|
||||
self.msg_queue.put_nowait((b"/uwe/ekg", [0]))
|
||||
time.sleep(0.01)
|
||||
self.unsubscribe_me()
|
||||
self.osc_sock.close()
|
||||
logger.info("OSCThread is going down")
|
||||
print("OSCThread is going down")
|
||||
|
||||
|
||||
queue = Queue.Queue()
|
||||
|
||||
class Actor(object):
|
||||
def __init__(self, name, num_data, color, ix, max_actors, actor_height):
|
||||
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
|
||||
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.updated = 0
|
||||
|
||||
self.offset = ix * actor_height
|
||||
self.data = np.array([self.offset] * num_data)
|
||||
self.head = 0
|
||||
self.pre_head = 0
|
||||
self.active = True
|
||||
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__
|
||||
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)
|
||||
|
||||
|
||||
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 scale_data(self, ix, max_items):
|
||||
scale = 255 / max_items * ix
|
||||
return [value / max_items + scale for value in self.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.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])
|
||||
|
||||
self.pre_head = (dp - 1) % self.num_data
|
||||
self.head = dp
|
||||
#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
|
||||
|
||||
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()
|
||||
#self.plot.setConfigOptions(antialias=True)
|
||||
self.plot = pg.PlotWidget(title="<h1>EKG</h1>")
|
||||
self.plot.setAttribute(QtCore.Qt.WA_DeleteOnClose)
|
||||
self.plot.hide()
|
||||
self.plot.showGrid(False, False)
|
||||
self.plot.setLabel('left', "<h2>Amplitude</h2>")
|
||||
self.plot.setLabel('bottom', "<h2><sup>Time</sup></h2>")
|
||||
self.plot.showGrid(True, True)
|
||||
self.plot.setYRange(0, 255)
|
||||
self.plot.setXRange(0, num_data)
|
||||
self.plot.resize(768, 576)
|
||||
self.plot.resize(1280, 720)
|
||||
|
||||
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
|
||||
|
||||
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)
|
||||
for actor_name, color in zip(actor_names, colors):
|
||||
self.add_actor(actor_name, num_data, color)
|
||||
|
||||
self.set_positions()
|
||||
|
||||
self.ekg_regex = re.compile("^/(.*?)/ekg$")
|
||||
self.ctl_regex = re.compile("^/plot/(.*?)$")
|
||||
self.ekg_regex = re.compile(b"^/(.*?)/ekg$")
|
||||
self.ctl_regex = re.compile(b"^/plot/(.*?)$")
|
||||
self.updated_actors = set()
|
||||
|
||||
|
||||
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)
|
||||
def add_actor(self, actor_name, num_data, color):
|
||||
actor_obj = Actor(actor_name, num_data, color)
|
||||
self.actors[actor_name] = actor_obj
|
||||
self.plot.addItem(actor_obj.plotItem)
|
||||
self.plot.addItem(actor_obj.plotPoint)
|
||||
|
@ -270,120 +263,168 @@ class EkgPlot(object):
|
|||
|
||||
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)
|
||||
actor_obj.plotItem.setPos(0, ix * 6)
|
||||
actor_obj.plotPoint.setPos(0, ix * 6)
|
||||
|
||||
def active_actor_count(self):
|
||||
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)
|
||||
|
||||
return len(self.active_actors)
|
||||
|
||||
def update(self, osc_address, value):
|
||||
|
||||
|
||||
res = self.ekg_regex.match(osc_address)
|
||||
if res:
|
||||
#print("matched data")
|
||||
actor_name = res.group(1)
|
||||
actor_obj = self.actors[actor_name]
|
||||
max_actors = len(self.active_actors)
|
||||
actor_data = actor_obj.data
|
||||
data_pointer = actor_obj.data_pointer
|
||||
actor_data[data_pointer] = value
|
||||
try:
|
||||
ix = self.active_actors.index(actor_obj)
|
||||
actor_obj.set_point(value, ix, max_actors)
|
||||
actor_obj.plotItem.setData(y=np.array(actor_obj.scale_data(ix, max_actors)), clear=True)
|
||||
except ValueError as e:
|
||||
#print("data", e)
|
||||
pass
|
||||
actor_obj.data_pointer = (data_pointer + 1) % self.num_data
|
||||
return
|
||||
|
||||
res = self.ctl_regex.match(osc_address)
|
||||
if res:
|
||||
actor_name = res.group(1)
|
||||
actor_obj = self.actors[actor_name]
|
||||
actor_obj.add_value(value)
|
||||
if value == 1 and not actor_obj.active:
|
||||
#print("actor on", actor_name, actor_obj, self.active_actors)
|
||||
actor_obj.active = True
|
||||
if actor_obj not in self.active_actors:
|
||||
self.plot.addItem(actor_obj.plotItem)
|
||||
self.plot.addItem(actor_obj.plotPoint)
|
||||
self.active_actors.append(actor_obj)
|
||||
elif value == 0 and actor_obj.active:
|
||||
#print "actor off", actor_name
|
||||
actor_obj.active = False
|
||||
self.plot.removeItem(actor_obj.plotItem)
|
||||
self.plot.removeItem(actor_obj.plotPoint)
|
||||
try:
|
||||
self.active_actors.remove(actor_obj)
|
||||
except ValueError as e:
|
||||
pass
|
||||
assert actor_obj not in self.active_actors
|
||||
|
||||
|
||||
def render(self):
|
||||
for ix, actor in enumerate(self.active_actors):
|
||||
actor.render()
|
||||
self.set_positions()
|
||||
|
||||
|
||||
class MyHandler(BaseHTTPRequestHandler):
|
||||
|
||||
|
||||
def do_GET(self):
|
||||
|
||||
try:
|
||||
self.path=re.sub('[^.a-zA-Z0-9]', "",str(self.path))
|
||||
if self.path=="" or self.path==None or self.path[:1]==".":
|
||||
self.send_error(403,'Forbidden')
|
||||
self.send_error(403)
|
||||
|
||||
|
||||
if self.path.endswith(".html"):
|
||||
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(data)
|
||||
elif self.path.endswith(".mjpeg"):
|
||||
self.thread = thread = OSCThread(self.server.args)
|
||||
thread.daemon = True
|
||||
msg_queue = Queue()
|
||||
self.thread = thread = OSCThread(self.server.args, msg_queue)
|
||||
thread.start()
|
||||
actor_names = ["merle", "uwe", "bjoern" ]
|
||||
num_data = 100
|
||||
colors = ["r", "g", "b"]
|
||||
qtapp = QtGui.QApplication([])
|
||||
plotter = EkgPlot(actor_names, num_data, colors)
|
||||
|
||||
self.send_response(200)
|
||||
self.send_header("Content-Type", "multipart/x-mixed-replace; boundary=--2342")
|
||||
actor_names = [b"bjoern", b"merle", b"uwe"]
|
||||
num_data = 100
|
||||
colors = ["r", "g", "b"]
|
||||
|
||||
qtapp = QtGui.QApplication([])
|
||||
self.plotter = plotter = EkgPlot(actor_names, num_data, colors)
|
||||
|
||||
self.send_header("Content-Type", "multipart/x-mixed-replace; boundary=--aaboundary\r\n\r\n")
|
||||
self.end_headers()
|
||||
#lastTime = time.time()
|
||||
#fps = None
|
||||
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:
|
||||
osc_address, args = msg_queue.get_nowait()
|
||||
except Empty as e:
|
||||
print("queue error", e, type(e))
|
||||
break
|
||||
print("main: got value", osc_address, args)
|
||||
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().data()
|
||||
try:
|
||||
self.send_header("--aaboundary", None)
|
||||
self.send_header("Content-Type", "image/jpeg")
|
||||
self.send_header("Content-length", len(JpegData))
|
||||
self.end_headers()
|
||||
self.wfile.write(JpegData + b"\r\n\r\n\r\n")
|
||||
except (BrokenPipeError, ConnectionResetError) as e:
|
||||
print("Error:", e)
|
||||
if hasattr(self, "plotter"):
|
||||
print("children", plotter.plot.children())
|
||||
plotter.plot.deleteLater()
|
||||
plotter.plot.close()
|
||||
del self.plotter.plot
|
||||
del self.plotter
|
||||
del plotter
|
||||
thread.running = False
|
||||
thread.join()
|
||||
return
|
||||
|
||||
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
|
||||
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"):
|
||||
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','image/jpeg')
|
||||
self.end_headers()
|
||||
self.wfile.write(data)
|
||||
return
|
||||
except (KeyboardInterrupt, SystemError):
|
||||
print("queue size", msg_queue.qsize())
|
||||
thread.running = False
|
||||
thread.join()
|
||||
if hasattr(self, "plotter"):
|
||||
plotter.plot.deleteLater()
|
||||
except IOError as e:
|
||||
print("ioerror", e)
|
||||
print('-'*40)
|
||||
print('Exception happened during processing of request from')
|
||||
import traceback
|
||||
traceback.print_exc() # XXX But this goes to stderr!
|
||||
print( '-'*40)
|
||||
self.send_error(404, 'File Not Found: %s' % self.path)
|
||||
|
||||
|
||||
class JustAHTTPServer(HTTPServer):
|
||||
|
@ -391,31 +432,30 @@ class JustAHTTPServer(HTTPServer):
|
|||
|
||||
|
||||
def main():
|
||||
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,
|
||||
arg_parser = create_arg_parser("ekgplotter")
|
||||
own_group = add_main_group(arg_parser)
|
||||
own_group.add_argument('-x', "--http_host", default="::",
|
||||
help='my host, defaults to "socket.gethostname()"')
|
||||
own_group.add_argument('-X', "--http_port", default=9000,
|
||||
type=int, help='my port, defaults to 9000')
|
||||
arg_parser.add_chaosc_group()
|
||||
arg_parser.add_subscriber_group()
|
||||
args = arg_parser.finalize()
|
||||
add_chaosc_group(arg_parser)
|
||||
add_subscriber_group(arg_parser, "ekgplotter")
|
||||
args = finalize_arg_parser(arg_parser)
|
||||
|
||||
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
|
||||
logger.info("%s: starting up http server on '%s:%d'",
|
||||
datetime.now().strftime("%x %X"), http_host, http_port)
|
||||
print("%s: starting up http server on '%s:%d'" % (
|
||||
datetime.now().strftime("%x %X"), http_host, http_port))
|
||||
|
||||
try:
|
||||
server.serve_forever()
|
||||
except KeyboardInterrupt:
|
||||
logger.info('^C received, shutting down server')
|
||||
server.socket.close()
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
|
|
|
@ -0,0 +1,217 @@
|
|||
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, QThread, QObject
|
||||
from PyQt4 import QtGui
|
||||
from PyQt4 import QtCore
|
||||
import pyqtgraph as pg
|
||||
|
||||
from pyqtgraph.widgets.PlotWidget import PlotWidget
|
||||
|
||||
|
||||
try:
|
||||
from chaosc.c_osc_lib import decode_osc
|
||||
except ImportError as e:
|
||||
print(e)
|
||||
from chaosc.osc_lib import decode_osc
|
||||
|
||||
QAPP = None
|
||||
|
||||
def mkQApp():
|
||||
if QtGui.QApplication.instance() is None:
|
||||
global QAPP
|
||||
QAPP = QtGui.QApplication([])
|
||||
|
||||
|
||||
class PlotWindow(PlotWidget):
|
||||
def __init__(self, title=None, **kargs):
|
||||
mkQApp()
|
||||
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 WorkThread(QThread):
|
||||
osc_received = QtCore.pyqtSignal(str, int, name='osc_received')
|
||||
|
||||
def __init__(self):
|
||||
QThread.__init__(self)
|
||||
self.osc_sock = socket.socket(2, 2, 17)
|
||||
self.osc_sock.setblocking(0)
|
||||
self.osc_sock.setsockopt(socket.SOL_SOCKET,
|
||||
socket.SO_RCVBUF, 4096 * 8)
|
||||
self.osc_sock.bind(("", 10000))
|
||||
|
||||
|
||||
def __del__(self):
|
||||
self.wait()
|
||||
|
||||
def run(self):
|
||||
while 1:
|
||||
reads, writes, errs = select.select([self.osc_sock], [], [], 0.01)
|
||||
if reads:
|
||||
osc_input = reads[0].recv(4096)
|
||||
osc_address, typetags, args = decode_osc(osc_input, 0, len(osc_input))
|
||||
print "signal", osc_address, args[0]
|
||||
self.osc_received.emit(osc_address, args[0])
|
||||
|
||||
|
||||
class MyHandler(QtCore.QObject, BaseHTTPRequestHandler):
|
||||
|
||||
def __init__(self, request, client_address, parent):
|
||||
self.plot_data1 = deque([0] * 100)
|
||||
self.plot_data2 = deque([254/3] * 100)
|
||||
self.plot_data3 = deque([254/3*2] * 100)
|
||||
self.is_item1 = True
|
||||
self.is_item2 = True
|
||||
self.is_item3 = True
|
||||
QtCore.QObject.__init__(self)
|
||||
BaseHTTPRequestHandler.__init__(self, request, client_address, parent)
|
||||
|
||||
@QtCore.pyqtSlot('QString', int, name="receive_osc")
|
||||
def receive_osc(self, osc_address, value):
|
||||
print "change", osc_address, value
|
||||
if osc_address == "/bjoern/ekg":
|
||||
self.plot_data1.appendleft(args[0] / 3)
|
||||
self.plot_data1.pop()
|
||||
elif osc_address == "/merle/ekg":
|
||||
self.plot_data2.appendleft(args[0] / 3 + 254/3)
|
||||
self.plot_data2.pop()
|
||||
elif osc_address == "/uwe/ekg":
|
||||
self.plot_data3.appendleft(args[0] / 3 + 254/3*2)
|
||||
self.plot_data3.pop()
|
||||
elif osc_address == "/plot/uwe":
|
||||
if value == 1 and self.is_item3 == False:
|
||||
self.plt.addItem(self.plotItem3)
|
||||
elif value == 0 and self.is_item3 == True:
|
||||
self.plt.removeItem(self.plotItem3)
|
||||
elif osc_address == "/plot/merle":
|
||||
if value == 1 and self.is_item2 == False:
|
||||
self.plt.addItem(self.plotItem2)
|
||||
elif value == 0 and self.is_item2 == True:
|
||||
self.plt.removeItem(self.plotItem2)
|
||||
elif osc_address == "/plot/bjoern":
|
||||
if value == 1 and self.is_item1 == False:
|
||||
self.plt.addItem(self.plotItem1)
|
||||
elif value == 0 and self.is_item1 == True:
|
||||
self.plt.removeItem(self.plotItem1)
|
||||
|
||||
def do_GET(self):
|
||||
print "get"
|
||||
global plotValues
|
||||
try:
|
||||
self.path=re.sub('[^.a-zA-Z0-9]', "",str(self.path))
|
||||
if self.path=="" or self.path==None or self.path[:1]==".":
|
||||
return
|
||||
if self.path.endswith(".html"):
|
||||
f = open(curdir + sep + self.path)
|
||||
self.send_response(200)
|
||||
self.send_header('Content-type', 'text/html')
|
||||
self.end_headers()
|
||||
self.wfile.write(f.read())
|
||||
f.close()
|
||||
return
|
||||
if self.path.endswith(".mjpeg"):
|
||||
self.thread = WorkThread()
|
||||
#self.thread.osc_received.connect(self.change)
|
||||
#self.connect(self.thread, thread.osc_received, self.change)
|
||||
self.thread.osc_received.connect(self.receive_osc)
|
||||
self.thread.start()
|
||||
|
||||
self.send_response(200)
|
||||
|
||||
self.plt = plt = PlotWindow(title="EKG", name="Merle")
|
||||
plt.addLegend()
|
||||
#plt = pg.plot(pen=(0, 3*1.3))
|
||||
plt.resize(1280, 720)
|
||||
self.plotItem1 = plotItem1 = pg.PlotCurveItem(pen=pg.mkPen('r', width=4), name="bjoern")
|
||||
self.plotItem2 = plotItem2 = pg.PlotCurveItem(pen=pg.mkPen('g', width=4), name="merle")
|
||||
self.plotItem3 = plotItem3 = pg.PlotCurveItem(pen=pg.mkPen('b', width=4), name="uwe")
|
||||
plotItem1.setPos(0, 0*6)
|
||||
plotItem2.setPos(0, 1*6)
|
||||
plotItem3.setPos(0, 2*6)
|
||||
plt.addItem(plotItem1)
|
||||
plt.addItem(plotItem2)
|
||||
plt.addItem(plotItem3)
|
||||
|
||||
plt.setLabel('left', "EKG")
|
||||
plt.setLabel('bottom', "Time")
|
||||
plt.showGrid(True, True)
|
||||
ba = plt.getAxis("bottom")
|
||||
bl = plt.getAxis("left")
|
||||
ba.setTicks([])
|
||||
bl.setTicks([])
|
||||
plt.setYRange(0, 254)
|
||||
#print type(plt)
|
||||
self.wfile.write("Content-Type: multipart/x-mixed-replace; boundary=--aaboundary")
|
||||
self.wfile.write("\r\n\r\n")
|
||||
|
||||
last = time.time()
|
||||
now = last
|
||||
|
||||
while 1:
|
||||
plotItem1.setData(y=np.array(self.plot_data1), clear=True)
|
||||
plotItem2.setData(y=np.array(self.plot_data2), clear=True)
|
||||
plotItem3.setData(y=np.array(self.plot_data3), clear=True)
|
||||
#item = plt.plot(plot_data1, pen=(0, 3*1.3), clear=True)
|
||||
|
||||
exporter = pg.exporters.ImageExporter.ImageExporter(plt.plotItem)
|
||||
exporter.parameters()['width'] = 1280
|
||||
#exporter.parameters()['height'] = 720
|
||||
name = 'tmpfile'
|
||||
img = exporter.export(name, True)
|
||||
buffer = QBuffer()
|
||||
buffer.open(QIODevice.ReadWrite)
|
||||
img.save(buffer, "JPG", 100)
|
||||
JpegData = buffer.data()
|
||||
self.wfile.write("--aaboundary\r\n")
|
||||
self.wfile.write("Content-Type: image/jpeg\r\n")
|
||||
self.wfile.write("Content-length: %d\r\n\r\n" % len(JpegData))
|
||||
self.wfile.write(JpegData)
|
||||
self.wfile.write("\r\n\r\n\r\n")
|
||||
now = time.time()
|
||||
dur = now - last
|
||||
#print dur
|
||||
wait = 0.04 - dur
|
||||
if wait > 0:
|
||||
time.sleep(wait)
|
||||
last = now
|
||||
return
|
||||
if 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
|
||||
return
|
||||
except IOError:
|
||||
self.send_error(404,'File Not Found: %s' % self.path)
|
||||
|
||||
|
||||
class ThreadedHTTPServer(HTTPServer, ForkingMixIn):
|
||||
"""Handle requests in a separate process."""
|
||||
|
||||
def main():
|
||||
try:
|
||||
server = ThreadedHTTPServer(('0.0.0.0', 9000), MyHandler)
|
||||
print 'started httpserver...'
|
||||
server.serve_forever()
|
||||
except KeyboardInterrupt:
|
||||
print '^C received, shutting down server'
|
||||
server.socket.close()
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
|
@ -1,247 +0,0 @@
|
|||
#!/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()
|
|
@ -0,0 +1,461 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# This file is part of sensors2osc package
|
||||
#
|
||||
# sensors2osc 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.
|
||||
#
|
||||
# sensors2osc 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 sensors2osc. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# found the mjpeg part here, thanks for the nice code :)
|
||||
# http://hardsoftlucid.wordpress.com/2013/04/11/mjpeg-server-for-webcam-in-python-with-opencv/
|
||||
# the osc integration stuff is implemented by me
|
||||
#
|
||||
# Copyright (C) 2014 Stefan Kögl
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
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 *
|
||||
|
||||
try:
|
||||
from chaosc.c_osc_lib import *
|
||||
except ImportError:
|
||||
from chaosc.osc_lib import *
|
||||
|
||||
QtGui.QApplication.setGraphicsSystem('opengl')
|
||||
|
||||
|
||||
try:
|
||||
from chaosc.c_osc_lib import decode_osc
|
||||
except ImportError as e:
|
||||
print(e)
|
||||
from chaosc.osc_lib import decode_osc
|
||||
|
||||
QAPP = QtGui.QApplication([])
|
||||
|
||||
|
||||
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 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.osc_sock = socket.socket(2, 2, 17)
|
||||
self.osc_sock.bind(self.own_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])
|
||||
|
||||
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)
|
||||
msg = OSCMessage("/subscribe")
|
||||
msg.appendTypedArg(self.own_address[0], "s")
|
||||
msg.appendTypedArg(self.own_address[1], "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.sendto(msg.encode_osc(), self.chaosc_address)
|
||||
|
||||
|
||||
def unsubscribe_me(self):
|
||||
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])
|
||||
msg = OSCMessage("/unsubscribe")
|
||||
msg.appendTypedArg(self.own_address[0], "s")
|
||||
msg.appendTypedArg(self.own_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))
|
||||
if osc_address.find("ekg") > -1 or osc_address.find("plot") != -1:
|
||||
queue.put_nowait((osc_address, messages))
|
||||
else:
|
||||
queue.put_nowait(("/bjoern/ekg", [0]))
|
||||
queue.put_nowait(("/merle/ekg", [0]))
|
||||
queue.put_nowait(("/uwe/ekg", [0]))
|
||||
self.unsubscribe_me()
|
||||
print "OSCThread is going down"
|
||||
|
||||
|
||||
queue = Queue.Queue()
|
||||
|
||||
class MyHandler(BaseHTTPRequestHandler):
|
||||
|
||||
def __del__(self):
|
||||
self.thread.running = False
|
||||
self.thread.join()
|
||||
|
||||
def do_GET(self):
|
||||
print "get"
|
||||
|
||||
self.thread = thread = OSCThread(self.server.args)
|
||||
thread.daemon = True
|
||||
thread.start()
|
||||
|
||||
actors = list()
|
||||
is_item1 = True
|
||||
is_item2 = True
|
||||
is_item3 = True
|
||||
|
||||
def setPositions():
|
||||
for ix, item in enumerate(actors):
|
||||
item.setPos(0, ix*6)
|
||||
|
||||
|
||||
def scale_data(data, ix, max_items):
|
||||
scale = 254 / max_items * ix
|
||||
return [value / max_items + scale for value in data]
|
||||
|
||||
|
||||
def set_point(plotPoint, pos, value, ix, max_items):
|
||||
scale = 254 / max_items * ix
|
||||
y = 6 * ix + value / max_items + scale
|
||||
plotPoint.setData(x = [pos], y = [y])
|
||||
|
||||
|
||||
def find_max_value(item_data):
|
||||
max_index = -1
|
||||
for ix, i in enumerate(item_data):
|
||||
if i > 250:
|
||||
return ix, i
|
||||
return None, None
|
||||
|
||||
|
||||
def rearrange(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(item_data, pos, max_pos, value):
|
||||
#print "setValue before", pos, None, max_pos, value, item_data, len(item_data)
|
||||
item_data[pos] = value
|
||||
new_pos = (pos + 1) % max_pos
|
||||
#print "setValue after ", pos, new_pos, max_pos, value, item_data, len(item_data)
|
||||
return new_pos
|
||||
|
||||
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
|
||||
|
||||
try:
|
||||
self.path=re.sub('[^.a-zA-Z0-9]', "",str(self.path))
|
||||
if self.path=="" or self.path==None or self.path[:1]==".":
|
||||
return
|
||||
|
||||
if self.path.endswith(".html"):
|
||||
f = open(curdir + sep + self.path)
|
||||
self.send_response(200)
|
||||
self.send_header('Content-type', 'text/html')
|
||||
self.end_headers()
|
||||
self.wfile.write(f.read())
|
||||
f.close()
|
||||
elif self.path.endswith(".mjpeg"):
|
||||
data_points = 43
|
||||
|
||||
self.send_response(200)
|
||||
pos1 = 0
|
||||
pos2 = 0
|
||||
pos3 = 0
|
||||
|
||||
lengths1 = [0]
|
||||
|
||||
data1_max_value = 0
|
||||
data2_max_value = 0
|
||||
data3_max_value = 0
|
||||
|
||||
data1_distance = data_points
|
||||
data2_distance = data_points
|
||||
data3_distance = data_points
|
||||
|
||||
plot_data1 = deque([0] * data_points)
|
||||
plot_data2 = deque([0] * data_points)
|
||||
plot_data3 = deque([0] * data_points)
|
||||
plt = PlotWidget(title="<h1>EKG</h1>")
|
||||
plt.hide()
|
||||
plotItem1 = pg.PlotCurveItem(pen=pg.mkPen('r', width=1), width=1, name="bjoern")
|
||||
plotItem2 = pg.PlotCurveItem(pen=pg.mkPen('g', width=1), width=1, name="merle")
|
||||
plotItem3 = pg.PlotCurveItem(pen=pg.mkPen('b', width=1), width=1, name="uwe")
|
||||
shadowPen = pg.mkPen("w", width=10)
|
||||
plotItem1.setShadowPen(pen=shadowPen, width=3, cosmetic=True)
|
||||
plotItem2.setShadowPen(pen=shadowPen, width=3, cosmetic=True)
|
||||
plotItem3.setShadowPen(pen=shadowPen, width=3, cosmetic=True)
|
||||
pen = pg.mkPen("w", size=1)
|
||||
brush = pg.mkBrush("w")
|
||||
plotPoint1 = pg.ScatterPlotItem(pen=pen, brush=brush, size=15)
|
||||
plotPoint2 = pg.ScatterPlotItem(pen=pen, brush=brush, size=10)
|
||||
plotPoint3 = pg.ScatterPlotItem(pen=pen, brush=brush, size=10)
|
||||
actors.append(plotItem1)
|
||||
actors.append(plotItem2)
|
||||
actors.append(plotItem3)
|
||||
plotItem1.setPos(0, 0*6)
|
||||
plotItem2.setPos(0, 1*6)
|
||||
plotItem3.setPos(0, 2*6)
|
||||
plt.addItem(plotItem1)
|
||||
plt.addItem(plotItem2)
|
||||
plt.addItem(plotItem3)
|
||||
plt.addItem(plotPoint1)
|
||||
plt.addItem(plotPoint2)
|
||||
plt.addItem(plotPoint3)
|
||||
|
||||
plt.setLabel('left', "<h2>Amplitude</h2>")
|
||||
plt.setLabel('bottom', "<h2><sup>Time</sup></h2>")
|
||||
plt.showGrid(True, True)
|
||||
ba = plt.getAxis("bottom")
|
||||
bl = plt.getAxis("left")
|
||||
ba.setTicks([])
|
||||
bl.setTicks([])
|
||||
ba.setWidth(0)
|
||||
ba.setHeight(0)
|
||||
bl.setWidth(0)
|
||||
bl.setHeight(0)
|
||||
plt.setYRange(0, 255)
|
||||
|
||||
self.wfile.write("Content-Type: multipart/x-mixed-replace; boundary=--aaboundary")
|
||||
self.wfile.write("\r\n\r\n")
|
||||
|
||||
|
||||
plt.resize(1280, 720)
|
||||
|
||||
while 1:
|
||||
while 1:
|
||||
try:
|
||||
osc_address, args = queue.get_nowait()
|
||||
except Queue.Empty:
|
||||
break
|
||||
max_items = len(actors)
|
||||
value = args[0]
|
||||
|
||||
if osc_address == "/bjoern/ekg":
|
||||
#if value > 250:
|
||||
#data_points, pos1 = resize(plot_data1, len(plot_data1), lengths1[-1], pos1)
|
||||
#foo, pos2 = resize(plot_data2, len(plot_data2), lengths1[-1], pos2)
|
||||
#foo, pos3 = resize(plot_data3, len(plot_data3), lengths1[-1], pos3)
|
||||
#print "length1", lengths1
|
||||
#lengths1.append(0)
|
||||
#else:
|
||||
#lengths1[-1] += 1
|
||||
|
||||
ix = actors.index(plotItem1)
|
||||
|
||||
#pos1 = rearrange(plot_data1, pos1, data_points)
|
||||
set_point(plotPoint1, pos1, value, ix, max_items)
|
||||
pos1 = set_value(plot_data1, pos1, data_points, value)
|
||||
try:
|
||||
plotItem1.setData(y=np.array(scale_data(plot_data1, ix, max_items)), clear=True)
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
elif osc_address == "/merle/ekg":
|
||||
ix = actors.index(plotItem2)
|
||||
|
||||
#pos2 = rearrange(plot_data2, pos2, data_points)
|
||||
set_point(plotPoint2, pos2, value, ix, max_items)
|
||||
pos2 = set_value(plot_data2, pos2, data_points, value)
|
||||
try:
|
||||
plotItem2.setData(y=np.array(scale_data(plot_data2, ix, max_items)), clear=True)
|
||||
except ValueError:
|
||||
pass
|
||||
elif osc_address == "/uwe/ekg":
|
||||
ix = actors.index(plotItem3)
|
||||
#pos3 = rearrange(plot_data3, pos3, data_points)
|
||||
set_point(plotPoint3, pos3, value, ix, max_items)
|
||||
pos3 = set_value(plot_data3, pos3, data_points, value)
|
||||
try:
|
||||
plotItem3.setData(y=np.array(scale_data(plot_data3, ix, max_items)), clear=True)
|
||||
except ValueError:
|
||||
pass
|
||||
elif osc_address == "/plot/uwe":
|
||||
if value == 1 and is_item3 == False:
|
||||
print "uwe on"
|
||||
plt.addItem(plotItem3)
|
||||
is_item3 = True
|
||||
actors.append(plotItem3)
|
||||
setPositions()
|
||||
elif value == 0 and is_item3 == True:
|
||||
print "uwe off"
|
||||
plt.removeItem(plotItem3)
|
||||
is_item3 = False
|
||||
actors.remove(plotItem3)
|
||||
setPositions()
|
||||
elif osc_address == "/plot/merle":
|
||||
if value == 1 and is_item2 == False:
|
||||
print "merle on"
|
||||
plt.addItem(plotItem2)
|
||||
is_item2 = True
|
||||
actors.append(plotItem2)
|
||||
setPositions()
|
||||
elif value == 0 and is_item2 == True:
|
||||
print "merle off"
|
||||
plt.removeItem(plotItem2)
|
||||
is_item2 = False
|
||||
actors.remove(plotItem2)
|
||||
setPositions()
|
||||
elif osc_address == "/plot/bjoern":
|
||||
if value == 1 and is_item1 == False:
|
||||
print "bjoern on"
|
||||
plt.addItem(plotItem1)
|
||||
is_item1 = True
|
||||
actors.append(plotItem1)
|
||||
setPositions()
|
||||
elif value == 0 and is_item1 == True:
|
||||
print "bjoern off"
|
||||
plt.removeItem(plotItem1)
|
||||
is_item1 = False
|
||||
actors.remove(plotItem1)
|
||||
setPositions()
|
||||
|
||||
exporter = pg.exporters.ImageExporter.ImageExporter(plt.plotItem)
|
||||
img = exporter.export("tmpfile", True)
|
||||
buffer = QBuffer()
|
||||
buffer.open(QIODevice.WriteOnly)
|
||||
img.save(buffer, "JPG", 100)
|
||||
JpegData = buffer.data()
|
||||
del buffer
|
||||
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))
|
||||
|
||||
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):
|
||||
thread.running = False
|
||||
thread.join()
|
||||
except IOError:
|
||||
self.send_error(404,'File Not Found: %s' % self.path)
|
||||
|
||||
|
||||
class JustAHTTPServer(HTTPServer):
|
||||
|
||||
pass
|
||||
|
||||
|
||||
def main():
|
||||
a = create_arg_parser("ekgplotter")
|
||||
own_group = add_main_group(a)
|
||||
own_group.add_argument('-x', "--http_host", default="0.0.0.0",
|
||||
help='my host, defaults to "socket.gethostname()"')
|
||||
own_group.add_argument('-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)
|
||||
|
||||
try:
|
||||
host, port = socket.getaddrinfo(args.http_host, args.http_port, socket.AF_INET6, socket.SOCK_DGRAM, 0, socket.AI_V4MAPPED | socket.AI_ALL | socket.AI_CANONNAME)[-1][4][:2]
|
||||
|
||||
server = JustAHTTPServer(("0.0.0.0", 9000), MyHandler)
|
||||
server.args = args
|
||||
print "%s: starting up http server on '%s:%d'" % (
|
||||
datetime.now().strftime("%x %X"), host, port)
|
||||
server.serve_forever()
|
||||
except KeyboardInterrupt:
|
||||
print '^C received, shutting down server'
|
||||
server.socket.close()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
@ -0,0 +1,408 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# This file is part of sensors2osc package
|
||||
#
|
||||
# sensors2osc 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.
|
||||
#
|
||||
# sensors2osc 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 sensors2osc. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# found the mjpeg part here, thanks for the nice code :)
|
||||
# http://hardsoftlucid.wordpress.com/2013/04/11/mjpeg-server-for-webcam-in-python-with-opencv/
|
||||
# the osc integration stuff is implemented by me
|
||||
#
|
||||
# Copyright (C) 2014 Stefan Kögl
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
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 *
|
||||
|
||||
try:
|
||||
from chaosc.c_osc_lib import *
|
||||
except ImportError:
|
||||
from chaosc.osc_lib import *
|
||||
|
||||
QtGui.QApplication.setGraphicsSystem('opengl')
|
||||
|
||||
|
||||
try:
|
||||
from chaosc.c_osc_lib import decode_osc
|
||||
except ImportError as e:
|
||||
print(e)
|
||||
from chaosc.osc_lib import decode_osc
|
||||
|
||||
QAPP = QtGui.QApplication([])
|
||||
|
||||
|
||||
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 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.osc_sock = socket.socket(2, 2, 17)
|
||||
self.osc_sock.bind(self.own_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])
|
||||
|
||||
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)
|
||||
msg = OSCMessage("/subscribe")
|
||||
msg.appendTypedArg(self.own_address[0], "s")
|
||||
msg.appendTypedArg(self.own_address[1], "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.sendto(msg.encode_osc(), self.chaosc_address)
|
||||
|
||||
|
||||
def unsubscribe_me(self):
|
||||
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])
|
||||
msg = OSCMessage("/unsubscribe")
|
||||
msg.appendTypedArg(self.own_address[0], "s")
|
||||
msg.appendTypedArg(self.own_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))
|
||||
if osc_address.find("ekg") > -1 or osc_address.find("plot") != -1:
|
||||
queue.put_nowait((osc_address, messages))
|
||||
else:
|
||||
queue.put_nowait(("/bjoern/ekg", [0]))
|
||||
queue.put_nowait(("/merle/ekg", [0]))
|
||||
queue.put_nowait(("/uwe/ekg", [0]))
|
||||
self.unsubscribe_me()
|
||||
print "OSCThread is going down"
|
||||
|
||||
|
||||
queue = Queue.Queue()
|
||||
|
||||
class MyHandler(BaseHTTPRequestHandler):
|
||||
|
||||
def do_GET(self):
|
||||
print "get"
|
||||
|
||||
self.thread = thread = OSCThread(self.server.args)
|
||||
thread.daemon = True
|
||||
thread.start()
|
||||
|
||||
actors = list()
|
||||
is_item1 = True
|
||||
is_item2 = True
|
||||
is_item3 = True
|
||||
|
||||
def setPositions():
|
||||
for ix, item in enumerate(actors):
|
||||
item.setPos(0, ix*6)
|
||||
|
||||
|
||||
def scale_data(data, ix, max_items):
|
||||
scale = 254 / max_items * ix
|
||||
return [value / max_items + scale for value in data]
|
||||
|
||||
def set_point(plotPoint, pos, value, ix, max_items):
|
||||
scale = 254 / max_items * ix
|
||||
plotPoint.setData(x = [pos], y = [6*ix + value / max_items + scale])
|
||||
|
||||
|
||||
def setValue(dataItem, pos, maxPos, value):
|
||||
dataItem[pos] = value
|
||||
return (pos + 1) % maxPos
|
||||
|
||||
def find_max_index(dataItem):
|
||||
max_value = 0
|
||||
max_index = 0
|
||||
for ix, i in enumerate(dataItem):
|
||||
if i > max_value:
|
||||
max_value = i
|
||||
max_index = ix
|
||||
return max_index, max_value
|
||||
|
||||
def rearrange(data, index, max_items):
|
||||
max_value_index, max_value = findMax(data)
|
||||
mean = int(max_items / 2.)
|
||||
start = mean - max_value_index
|
||||
data.rotate(start)
|
||||
pos = (index + start) % max_items
|
||||
print "rearrange", index, max_items, pos
|
||||
return pos
|
||||
|
||||
def checkDataPoints(value, data_max_value):
|
||||
if value > max_value and value > 200:
|
||||
return True, value
|
||||
return False, data_max_value
|
||||
|
||||
try:
|
||||
self.path=re.sub('[^.a-zA-Z0-9]', "",str(self.path))
|
||||
if self.path=="" or self.path==None or self.path[:1]==".":
|
||||
return
|
||||
|
||||
if self.path.endswith(".html"):
|
||||
f = open(curdir + sep + self.path)
|
||||
self.send_response(200)
|
||||
self.send_header('Content-type', 'text/html')
|
||||
self.end_headers()
|
||||
self.wfile.write(f.read())
|
||||
f.close()
|
||||
elif self.path.endswith(".mjpeg"):
|
||||
data_points = 21
|
||||
|
||||
self.send_response(200)
|
||||
pos1 = 0
|
||||
pos2 = 0
|
||||
pos3 = 0
|
||||
|
||||
data1_max_value = 0
|
||||
data2_max_value = 0
|
||||
data3_max_value = 0
|
||||
|
||||
data1_distance = data_points
|
||||
data2_distance = data_points
|
||||
data3_distance = data_points
|
||||
|
||||
plot_data1 = deque([0] * data_points)
|
||||
plot_data2 = deque([0] * data_points)
|
||||
plot_data3 = deque([0] * data_points)
|
||||
plt = PlotWidget(title="<h1>EKG</h1>", name="Merle")
|
||||
plt.hide()
|
||||
plotItem1 = pg.PlotCurveItem(pen=pg.mkPen('r', width=2), width=2, name="bjoern")
|
||||
plotItem2 = pg.PlotCurveItem(pen=pg.mkPen('g', width=2), width=2, name="merle")
|
||||
plotItem3 = pg.PlotCurveItem(pen=pg.mkPen('b', width=2), width=2, name="uwe")
|
||||
shadowPen = pg.mkPen("w", width=10)
|
||||
plotItem1.setShadowPen(pen=shadowPen, width=6, cosmetic=True)
|
||||
plotItem2.setShadowPen(pen=shadowPen, width=6, cosmetic=True)
|
||||
plotItem3.setShadowPen(pen=shadowPen, width=6, cosmetic=True)
|
||||
pen = pg.mkPen("w", size=1)
|
||||
brush = pg.mkBrush("w")
|
||||
plotPoint1 = pg.ScatterPlotItem(pen=pen, brush=brush, size=10)
|
||||
plotPoint2 = pg.ScatterPlotItem(pen=pen, brush=brush, size=10)
|
||||
plotPoint3 = pg.ScatterPlotItem(pen=pen, brush=brush, size=10)
|
||||
actors.append(plotItem1)
|
||||
actors.append(plotItem2)
|
||||
actors.append(plotItem3)
|
||||
plotItem1.setPos(0, 0*6)
|
||||
plotItem2.setPos(0, 1*6)
|
||||
plotItem3.setPos(0, 2*6)
|
||||
plt.addItem(plotItem1)
|
||||
plt.addItem(plotItem2)
|
||||
plt.addItem(plotItem3)
|
||||
plt.addItem(plotPoint1)
|
||||
plt.addItem(plotPoint2)
|
||||
plt.addItem(plotPoint3)
|
||||
|
||||
plt.setLabel('left', "<h2>Amplitude</h2>")
|
||||
plt.setLabel('bottom', "<h2>Time</h2>")
|
||||
plt.showGrid(True, True)
|
||||
ba = plt.getAxis("bottom")
|
||||
bl = plt.getAxis("left")
|
||||
ba.setTicks([])
|
||||
bl.setTicks([])
|
||||
plt.setYRange(0, 254)
|
||||
|
||||
self.wfile.write("Content-Type: multipart/x-mixed-replace; boundary=--aaboundary")
|
||||
self.wfile.write("\r\n\r\n")
|
||||
|
||||
|
||||
plt.resize(1280, 720)
|
||||
|
||||
while 1:
|
||||
while 1:
|
||||
try:
|
||||
osc_address, args = queue.get_nowait()
|
||||
except Queue.Empty:
|
||||
break
|
||||
max_items = len(actors)
|
||||
value = args[0]
|
||||
|
||||
if osc_address == "/bjoern/ekg":
|
||||
ix = actors.index(plotItem1)
|
||||
res, tmp = checkDataPoints(value, data1_max_value)
|
||||
if res and res > 20:
|
||||
data_points = tmp
|
||||
data1_maxdata1_max_value = 0
|
||||
set_point(plotPoint1, pos1, value, ix, max_items)
|
||||
pos1 = setValue(plot_data1, pos1, data_points, value)
|
||||
pos1 = rearrange(plot_data1, pos1, data_points)
|
||||
try:
|
||||
plotItem1.setData(y=np.array(scale_data(plot_data1, ix, max_items)), clear=True)
|
||||
except ValueError:
|
||||
pass
|
||||
elif osc_address == "/merle/ekg":
|
||||
ix = actors.index(plotItem2)
|
||||
set_point(plotPoint2, pos2, value, ix, max_items)
|
||||
pos2 = setValue(plot_data2, pos2, data_points, value)
|
||||
pos2 = rearrange(plot_data2, pos2, data_points)
|
||||
try:
|
||||
plotItem2.setData(y=np.array(scale_data(plot_data2, ix, max_items)), clear=True)
|
||||
except ValueError:
|
||||
pass
|
||||
elif osc_address == "/uwe/ekg":
|
||||
ix = actors.index(plotItem3)
|
||||
set_point(plotPoint3, pos3, value, ix, max_items)
|
||||
pos3 = setValue(plot_data3, pos3, data_points, value)
|
||||
pos3 = rearrange(plot_data3, pos3, data_points)
|
||||
try:
|
||||
plotItem3.setData(y=np.array(scale_data(plot_data3, ix, max_items)), clear=True)
|
||||
except ValueError:
|
||||
pass
|
||||
elif osc_address == "/plot/uwe":
|
||||
if value == 1 and is_item3 == False:
|
||||
print "uwe on"
|
||||
plt.addItem(plotItem3)
|
||||
is_item3 = True
|
||||
actors.append(plotItem3)
|
||||
setPositions()
|
||||
elif value == 0 and is_item3 == True:
|
||||
print "uwe off"
|
||||
plt.removeItem(plotItem3)
|
||||
is_item3 = False
|
||||
actors.remove(plotItem3)
|
||||
setPositions()
|
||||
elif osc_address == "/plot/merle":
|
||||
if value == 1 and is_item2 == False:
|
||||
print "merle on"
|
||||
plt.addItem(plotItem2)
|
||||
is_item2 = True
|
||||
actors.append(plotItem2)
|
||||
setPositions()
|
||||
elif value == 0 and is_item2 == True:
|
||||
print "merle off"
|
||||
plt.removeItem(plotItem2)
|
||||
is_item2 = False
|
||||
actors.remove(plotItem2)
|
||||
setPositions()
|
||||
elif osc_address == "/plot/bjoern":
|
||||
if value == 1 and is_item1 == False:
|
||||
print "bjoern on"
|
||||
plt.addItem(plotItem1)
|
||||
is_item1 = True
|
||||
actors.append(plotItem1)
|
||||
setPositions()
|
||||
elif value == 0 and is_item1 == True:
|
||||
print "bjoern off"
|
||||
plt.removeItem(plotItem1)
|
||||
is_item1 = False
|
||||
actors.remove(plotItem1)
|
||||
setPositions()
|
||||
|
||||
exporter = pg.exporters.ImageExporter.ImageExporter(plt.plotItem)
|
||||
img = exporter.export("tmpfile", True)
|
||||
buffer = QBuffer()
|
||||
buffer.open(QIODevice.WriteOnly)
|
||||
img.save(buffer, "JPG", 100)
|
||||
JpegData = buffer.data()
|
||||
del buffer
|
||||
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))
|
||||
|
||||
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):
|
||||
thread.running = False
|
||||
thread.join()
|
||||
except IOError:
|
||||
self.send_error(404,'File Not Found: %s' % self.path)
|
||||
|
||||
|
||||
class JustAHTTPServer(HTTPServer):
|
||||
pass
|
||||
|
||||
|
||||
def main():
|
||||
a = create_arg_parser("ekgplotter")
|
||||
own_group = add_main_group(a)
|
||||
own_group.add_argument('-x', "--http_host", default="0.0.0.0",
|
||||
help='my host, defaults to "socket.gethostname()"')
|
||||
own_group.add_argument('-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)
|
||||
|
||||
try:
|
||||
host, port = socket.getaddrinfo(args.http_host, args.http_port, socket.AF_INET6, socket.SOCK_DGRAM, 0, socket.AI_V4MAPPED | socket.AI_ALL | socket.AI_CANONNAME)[-1][4][:2]
|
||||
|
||||
server = JustAHTTPServer(("0.0.0.0", 9000), MyHandler)
|
||||
server.args = args
|
||||
print "%s: starting up http server on '%s:%d'" % (
|
||||
datetime.now().strftime("%x %X"), host, port)
|
||||
server.serve_forever()
|
||||
except KeyboardInterrupt:
|
||||
print '^C received, shutting down server'
|
||||
server.socket.close()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
@ -1,15 +1,19 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from distribute_setup import use_setuptools
|
||||
use_setuptools()
|
||||
|
||||
import sys
|
||||
from setuptools import find_packages, setup
|
||||
|
||||
extras = dict()
|
||||
if sys.version_info >= (3,):
|
||||
extras['use_2to3'] = True
|
||||
|
||||
setup(
|
||||
name='ekgplotter',
|
||||
version="0.2",
|
||||
version="0.1",
|
||||
packages=find_packages(exclude=["scripts",]),
|
||||
|
||||
include_package_data = True,
|
||||
|
@ -19,7 +23,7 @@ setup(
|
|||
|
||||
exclude_package_data = {'': ['.gitignore']},
|
||||
|
||||
install_requires=["psylib", "pyqtgraph"],
|
||||
install_requires=["pyqtgraph"],
|
||||
|
||||
# installing unzipped
|
||||
zip_safe = False,
|
||||
|
@ -27,7 +31,7 @@ setup(
|
|||
# predefined extension points, e.g. for plugins
|
||||
entry_points = """
|
||||
[console_scripts]
|
||||
ekgplotter = ekgplotter.main_qt:main
|
||||
ekgplotter = ekgplotter.main:main
|
||||
""",
|
||||
# pypi metadata
|
||||
author = "Stefan Kögl",
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
(if (contains (window_name) "VLC media player") (undecorate))
|
|
@ -1,9 +0,0 @@
|
|||
#!/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
|
|
@ -1,7 +0,0 @@
|
|||
#!/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
|
|
@ -1,29 +0,0 @@
|
|||
#!/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 &
|
|
@ -1,7 +0,0 @@
|
|||
#!/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
|
|
@ -1,7 +0,0 @@
|
|||
#!/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
|
|
@ -1,33 +0,0 @@
|
|||
<?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>
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
<component name="CopyrightManager">
|
||||
<settings default="" />
|
||||
</component>
|
|
@ -1,5 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
|
||||
</project>
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
<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>
|
|
@ -1,13 +0,0 @@
|
|||
<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>
|
|
@ -1,13 +0,0 @@
|
|||
<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>
|
|
@ -1,13 +0,0 @@
|
|||
<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>
|
|
@ -1,13 +0,0 @@
|
|||
<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>
|
|
@ -1,13 +0,0 @@
|
|||
<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>
|
|
@ -1,13 +0,0 @@
|
|||
<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>
|
|
@ -1,13 +0,0 @@
|
|||
<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>
|
|
@ -1,13 +0,0 @@
|
|||
<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>
|
|
@ -1,13 +0,0 @@
|
|||
<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>
|
|
@ -1,17 +0,0 @@
|
|||
<?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>
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
<?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>
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
<component name="DependencyValidationManager">
|
||||
<state>
|
||||
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
|
||||
</state>
|
||||
</component>
|
|
@ -1,139 +0,0 @@
|
|||
<?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>
|
|
@ -1,7 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
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
|
|
@ -1,23 +0,0 @@
|
|||
<?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>
|
|
@ -1,96 +0,0 @@
|
|||
<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>
|
|
@ -1,162 +0,0 @@
|
|||
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 +
|
||||
'}';
|
||||
}
|
||||
}
|
|
@ -1,175 +0,0 @@
|
|||
<?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>
|
|
@ -1,66 +0,0 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
<?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>
|
|
@ -1,57 +0,0 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,100 +0,0 @@
|
|||
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();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
<?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>
|
|
@ -1,68 +0,0 @@
|
|||
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);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,129 +0,0 @@
|
|||
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());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
<?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>
|
|
@ -1,53 +0,0 @@
|
|||
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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
<?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>
|
|
@ -1,54 +0,0 @@
|
|||
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();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
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 +
|
||||
"} ";
|
||||
}
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
<?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>
|
|
@ -1,34 +0,0 @@
|
|||
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.
Before Width: | Height: | Size: 42 KiB |
Binary file not shown.
Before Width: | Height: | Size: 36 KiB |
Binary file not shown.
Before Width: | Height: | Size: 51 KiB |
Binary file not shown.
Before Width: | Height: | Size: 44 KiB |
|
@ -1,462 +0,0 @@
|
|||
//*****************************************************************************
|
||||
// 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
|
||||
|
||||
|
|
@ -1,91 +0,0 @@
|
|||
#
|
||||
# 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)
|
|
@ -1,2 +0,0 @@
|
|||
msp430-gcc -I/usr/msp430/include -Wall mod_ -mmcu=msp430fg439 -o mod-ekg-pyschose -L /usr/msp430/lib/ldscripts/msp430fg439 -lm -lfp -pipe
|
||||
|
|
@ -1,571 +0,0 @@
|
|||
<?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
|
@ -1,436 +0,0 @@
|
|||
//*****************************************************************************
|
||||
// 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
|
||||
|
||||
|
|
@ -1,128 +0,0 @@
|
|||
<?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>
|
||||
|
||||
|
|
@ -1,819 +0,0 @@
|
|||
<?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
|
@ -1,10 +0,0 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
|
||||
<workspace>
|
||||
<project>
|
||||
<path>$WS_DIR$\MOD-EKG_DemoSoft.ewp</path>
|
||||
</project>
|
||||
<batchBuild/>
|
||||
</workspace>
|
||||
|
||||
|
|
@ -1,110 +0,0 @@
|
|||
//
|
||||
//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
|
|
@ -1,24 +0,0 @@
|
|||
@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"
|
||||
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
@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
|
|
@ -1,89 +0,0 @@
|
|||
<?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>
|
||||
|
||||
|
|
@ -1,94 +0,0 @@
|
|||
[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
|
|
@ -1,77 +0,0 @@
|
|||
<?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>
|
||||
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
[MainWindow]
|
||||
WindowPlacement=_ 25 25 1225 657 3
|
|
@ -1,556 +0,0 @@
|
|||
#!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
Loading…
Reference in New Issue