summaryrefslogtreecommitdiff
path: root/ebus-racket/parser.rkt
diff options
context:
space:
mode:
authorYves Fischer <yvesf-git@xapek.org>2012-02-26 18:34:22 +0100
committerYves Fischer <yvesf-git@xapek.org>2012-02-26 18:34:22 +0100
commite01f36c90c19ddf52c4c3b2f9d14f1fb52349c4a (patch)
tree94d26be665c5812766ba36f7faaa50bb0a4f2b93 /ebus-racket/parser.rkt
parente29ae1a6042978ed2e231889b0cd52b6d8e5155e (diff)
downloadebus-alt-e01f36c90c19ddf52c4c3b2f9d14f1fb52349c4a.tar.gz
ebus-alt-e01f36c90c19ddf52c4c3b2f9d14f1fb52349c4a.zip
ebus-racket: simple unittest
Diffstat (limited to 'ebus-racket/parser.rkt')
-rw-r--r--ebus-racket/parser.rkt11
1 files changed, 8 insertions, 3 deletions
diff --git a/ebus-racket/parser.rkt b/ebus-racket/parser.rkt
index 1b9ed5b..51b9b55 100644
--- a/ebus-racket/parser.rkt
+++ b/ebus-racket/parser.rkt
@@ -19,7 +19,7 @@
(crc payloadSlaveLength payloadSlave crcSlave)
#:transparent)
-(struct ebus-paket (header body) #:transparent)
+(struct ebus-paket (header payload body) #:transparent)
(define parse-ebus-header (token (seq source <- any-byte
destination <- any-byte
@@ -64,7 +64,7 @@
payload <- (repeat ebus-payload (ebus-header-payloadLength header) (ebus-header-payloadLength header))
body <- (cond ((= (ebus-header-destination header) ebus-const-broadcastaddr) parse-ebus-broadcast)
(else parse-ebus-master-or-slave))
- (return (ebus-paket header body)))))
+ (return (ebus-paket header payload body)))))
(define ebus-sync (tokens syncs <- (seq (repeat (string->bytes/latin-1 "\xaa")))
(return (length syncs))))
@@ -95,4 +95,9 @@
(cond ((not (eof-object? paket)) (read-ebus-loop input-port)))))
(provide read-ebus
- read-ebus-loop) \ No newline at end of file
+ read-ebus-loop
+ (struct-out ebus-paket)
+ (struct-out ebus-header)
+ (struct-out ebus-body-broadcast)
+ (struct-out ebus-body-mastermaster)
+ (struct-out ebus-body-masterslave)) \ No newline at end of file