summaryrefslogtreecommitdiff
path: root/ebus-racket/layer7.rkt
diff options
context:
space:
mode:
authorYves Fischer <yvesf-git@xapek.org>2012-02-26 19:49:39 +0100
committerYves Fischer <yvesf-git@xapek.org>2012-02-26 19:49:39 +0100
commit36f42916cadd07bba5d0812566fba4546641cde9 (patch)
tree761cf941f01d36051e7582c9b863c44fffae5473 /ebus-racket/layer7.rkt
parent0ebb35c9dbd4853924ec4124862eb26bc45b9f12 (diff)
downloadebus-alt-36f42916cadd07bba5d0812566fba4546641cde9.tar.gz
ebus-alt-36f42916cadd07bba5d0812566fba4546641cde9.zip
ebus-racked: rename to layer2-/layer7-
Diffstat (limited to 'ebus-racket/layer7.rkt')
-rw-r--r--ebus-racket/layer7.rkt26
1 files changed, 26 insertions, 0 deletions
diff --git a/ebus-racket/layer7.rkt b/ebus-racket/layer7.rkt
new file mode 100644
index 0000000..5b8f496
--- /dev/null
+++ b/ebus-racket/layer7.rkt
@@ -0,0 +1,26 @@
+#lang racket
+(require (planet lizorkin/sxml:2:1/sxml))
+(require (planet lizorkin/ssax:2:0/ssax))
+
+(define definition
+ (ssax:xml->sxml (open-input-file "../ebus-xml/ebus.xml")
+ '[(#f . "http://xapek.org/ebus/0.1")]))
+
+
+(define (ebus-paket primaryCommand secondaryCommand)
+ ((sxpath (string-append "//packet[@primary=" (number->string primaryCommand)
+ " and @secondary=" (number->string secondaryCommand) "]"))
+ definition))
+
+;; returns the full device-definition
+(define (device address)
+ ((sxpath (string-append "//devices/device[@address=" (number->string address) "]"))
+ definition))
+
+;; returns device-name in a list or empty-list
+(define (device-name address)
+ ((sxpath "@name/text()") (device address)))
+
+(provide (prefix-out layer7- ebus-paket)
+ (prefix-out layer7- device)
+ (prefix-out layer7- device-name)) \ No newline at end of file