Changeset 25880 in project for release/4/dbus/trunk/dbus.scm


Ignore:
Timestamp:
02/08/12 22:52:49 (9 years ago)
Author:
ecloud
Message:

Added support for dict and variant and a connman introspection example.

Not sure if the variant support is quite right, because what's inside
is often unsupported.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/4/dbus/trunk/dbus.scm

    r25785 r25880  
    8585(define dbus:type-string-string  (foreign-value DBUS_TYPE_STRING_AS_STRING int))
    8686(define dbus:type-object-path  (foreign-value DBUS_TYPE_OBJECT_PATH int))
    87 (define dbus:type-object-path-string  (foreign-value DBUS_TYPE_OBJECT_PATH_AS_STRING int))
    8887(define dbus:type-signature  (foreign-value DBUS_TYPE_SIGNATURE int))
    8988(define dbus:type-signature-string  (foreign-value DBUS_TYPE_SIGNATURE_AS_STRING int))
    9089(define dbus:type-array (foreign-value DBUS_TYPE_ARRAY int))
    9190(define dbus:type-array-string  (foreign-value DBUS_TYPE_ARRAY_AS_STRING int))
     91(define dbus:type-dict  (foreign-value DBUS_TYPE_DICT_ENTRY int))
     92(define dbus:type-variant (foreign-value DBUS_TYPE_VARIANT int))
    9293
    9394(define dbus:make-context)
     
    308309
    309310        ;; TODO: iter-append-basic-T for each possible type:
    310         ;; especially array, variant and struct might be possible
     311        ;; especially variant, array and struct might still be possible
    311312
    312313        ;; val would usually be a single value, but
     
    348349                        (cond
    349350                                [(memq type `(,dbus:type-string ,dbus:type-invalid-string
    350                                                                 ,dbus:type-string-string ,dbus:type-object-path-string
     351                                                                ,dbus:type-string-string ,dbus:type-object-path
    351352                                                                ,dbus:type-signature-string
    352353                                                                ;; TODO maybe the following types ought to be converted?
     
    388389                                [(eq? type dbus:type-array)
    389390                                        (iter->vector (make-sub-iter iter))]
     391                                [(eq? type dbus:type-dict)
     392                                        (iter->pair (make-sub-iter iter))]
     393                                [(eq? type dbus:type-variant)
     394                                        ((make-sub-iter iter))]
    390395                                ;; unsupported so far (not understood well enough):
    391396                                ;;      dbus:type-object-path and dbus:type-signature
    392397                                ;; dbus:type-invalid is returned as #f (could be (void) but that
    393398                                ;; would be the termination condition for the iterator)
     399                                ;[else (format "unsupported-~c" (integer->char type))] )))
    394400                                [else #f] )))
    395401
     
    440446                                        (reverse retval)
    441447                                        (loop (cons next retval))))))
     448
     449        (define (iter->pair iter)
     450                (cons (iter) (iter)))
    442451
    443452        (define (iter->vector iter)
     
    711720                                (and (pair? xml) (car xml))))))
    712721
    713 )
    714 )
     722)) ;; end module
Note: See TracChangeset for help on using the changeset viewer.