source: project/release/4/dbus/trunk/examples/receive-car-turn.scm @ 31085

Last change on this file since 31085 was 31085, checked in by ecloud, 6 years ago

default-signal-handler is a parameter taking a single-arg function to handle warnings

Preformatting the warnings is nice but maybe the individual args are more useful.

File size: 834 bytes
Line 
1(use (prefix dbus dbus:))
2
3(dbus:default-signal-handler (lambda (w) (printf "warning: ~a~%" w)))
4
5(define (turn-right) (printf "car is turning to the right~%"))
6(define (turn-left) (printf "car is turning to the left~%"))
7
8(define rc-car-context (dbus:make-context
9        ; bus: dbus:session-bus         ;; would be the session-bus by default anyway
10        service: 'org.example.CarExample
11        path: '/Car
12        interface: 'org.example.Examples.CarInterface ))
13
14(dbus:enable-polling-thread!
15        ; bus: dbus:session-bus         ;; would be the session-bus by default anyway
16        enable: #f)
17
18(dbus:register-method rc-car-context "turnRight" turn-right)
19(dbus:register-method rc-car-context "turnLeft" turn-left)
20
21(let loop ()
22        ; (printf "poll~%")
23        ; (dbus:poll-for-message bus: dbus:session-bus) ;; would be the session-bus by default anyway
24        (dbus:poll-for-message)
25        (loop))
Note: See TracBrowser for help on using the repository browser.