Ignore:
Timestamp:
02/08/12 23:55:13 (9 years ago)
Author:
ecloud
Message:

Actually reading of variants works fine. Improved connman example. Still no way to write variants though.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/4/dbus/trunk/examples/introspect-connman.scm

    r25880 r25881  
    44        bus: dbus:system-bus
    55        service: 'net.connman
    6         ;path: '/net/connman
    76))
    87
    9 (let ([response (dbus:discover-api-xml ctxt)])
    10         (display response)
    11 )
     8(display (dbus:discover-api-xml ctxt))
     9
     10(define (device-properties device)
     11  (let ((c (dbus:make-context bus: dbus:system-bus
     12                              service: 'net.connman
     13                              interface: 'net.connman.Service
     14                              path: device)))
     15    (dbus:call c "GetProperties")))
    1216
    1317(define mgr-ctxt (dbus:make-context bus: dbus:system-bus
    1418        service: 'net.connman interface: 'net.connman.Manager))
    1519
    16 (printf "~%==== Manager Properties:~%")
    17 (pretty-print (dbus:call mgr-ctxt "GetProperties"))
     20(printf "~%==== Clock Properties:~%")
     21(define clock-ctxt (dbus:make-context bus: dbus:system-bus
     22        service: 'net.connman interface: 'net.connman.Clock))
     23(pretty-print (dbus:call clock-ctxt "GetProperties"))
    1824
    1925(printf "~%==== Manager Services:~%")
    2026(pretty-print (dbus:call mgr-ctxt "GetServices"))
    2127
    22 (define clock-ctxt (dbus:make-context bus: dbus:system-bus
    23         service: 'net.connman interface: 'net.connman.Clock))
    24 
    25 (printf "~%==== Clock Properties:~%")
    26 (pretty-print (dbus:call clock-ctxt "GetProperties"))
     28(printf "~%==== Manager Properties:~%")
     29(let ([mgr-props (dbus:call mgr-ctxt "GetProperties")])
     30        (pretty-print mgr-props)
     31        (let ([ifaces (assoc "Services" (vector->list (car mgr-props)))])
     32                (when (pair? ifaces)
     33                        (set! ifaces (vector->list (cdr ifaces)))
     34(printf "~%==== Network interface Properties:~%")
     35                        (for-each (lambda (path)
     36                                        (printf "---- ~a~%" path)
     37                                        (pp (vector->list (car (device-properties path))))
     38                                ) ifaces)
     39                )))
    2740
    2841(sleep 1)
Note: See TracChangeset for help on using the changeset viewer.