Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
  • 4 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
Showing with 97 additions and 11 deletions.
  1. +19 −2 connman.scm
  2. +72 −7 manager.scm
  3. +6 −2 service.scm
View
21 connman.scm
@@ -90,6 +90,7 @@
;; Service properties
service-properties
service-properties?
+ service-properties-path
service-properties-context
service-properties-type
service-properties-security
@@ -127,9 +128,25 @@
;;;
;;; Manager
;;;
- make-manager-context
- manager-state
+ manager-properties
+ manager-properties-state
+ manager-properties-offline-mode?
+ manager-properties-available-debugs
+ manager-properties-enabled-debugs
+ manager-properties-session-mode?
+ manager-properties-set-offline-mode!
+ manager-properties-set-session-mode!
+
+ ;; Technologies
manager-technologies
+ manager-technology-path
+ manager-technology-name
+ manager-technology-type
+ manager-technology-powered?
+ manager-technology-connected?
+ manager-technology-thetering?
+
+ make-manager-context
manager-services
)
View
79 manager.scm
@@ -5,16 +5,81 @@
interface: 'net.connman.Manager))
-(define (manager-state context)
- (and-let* ((state (dbus-call context "GetState")))
- (car state)))
+;;;
+;;; Manager properties
+;;;
+(define-record manager-properties
+ context
+ state
+ offline-mode?
+ available-debugs
+ enabled-debugs
+ session-mode?)
+(define (manager-properties context)
+ (and-let* ((properties (dbus-call context "GetProperties"))
+ (properties (vector->list (car properties))))
+ (make-manager-properties
+ context
+ (dbus-value "State" properties)
+ (dbus-value "OfflineMode" properties)
+ (dbus-value "AvailableDebugs" properties)
+ (dbus-value "EnabledDebugs" properties)
+ (dbus-value "SessionMode" properties))))
+
+
+(define (manager-properties-set-offline-mode! properties offline?)
+ (manager-properties-offline-mode?-set! properties offline?)
+ (dbus-call
+ (manager-properties-context properties)
+ "SetProperty"
+ "OfflineMode"
+ (make-variant offline?)))
+
+
+(define (manager-properties-set-session-mode! properties session-mode?)
+ (manager-properties-session-mode?-set! properties session-mode?)
+ (dbus-call
+ (manager-properties-context properties)
+ "SetProperty"
+ "SessionMode"
+ (make-variant session-mode?)))
+
+
+;;;
+;;; Manager technologies
+;;;
+(define-record manager-technology
+ path
+ name
+ type
+ powered?
+ connected?
+ thetering?)
(define (manager-technologies context)
- (and-let* ((techs (dbus-call context "GetTechnologies")))
- (car techs)))
+ (and-let* ((techs (dbus-call context "GetTechnologies"))
+ (techs (vector->list (car techs))))
+ (map (lambda (item)
+ (let ((path (object-path->string (struct-ref item 0)))
+ (properties (vector->list (struct-ref item 1))))
+ (make-manager-technology path
+ (dbus-value "Name" properties)
+ (dbus-value "Type" properties)
+ (dbus-value "Powered" properties)
+ (dbus-value "Connected" properties)
+ (dbus-value "Thetering" properties))))
+ techs)))
+;;;
+;;; Manager services
+;;;
(define (manager-services context)
- (and-let* ((services (dbus-call context "GetServices")))
- (car services)))
+ (and-let* ((services (dbus-call context "GetServices"))
+ (services (vector->list (car services))))
+ (map (lambda (item)
+ (let* ((path (object-path->string (struct-ref item 0)))
+ (context (make-service-context path)))
+ (service-properties context)))
+ services)))
View
8 service.scm
@@ -26,6 +26,7 @@
(define-record provider context host domain name type)
(define-record service-properties
+ path
context
type
security
@@ -55,8 +56,10 @@
(dbus-make-context bus: system-bus
service: 'net.connman
interface: 'net.connman.Service
- path: (make-pathname "/net/connman/service"
- service)))
+ path: (if (absolute-pathname? (->string service))
+ service
+ (make-pathname "/net/connman/service"
+ service))))
(define (service-properties service-context)
@@ -67,6 +70,7 @@
#f
(let* ((props (vector->list (car properties))))
(make-service-properties
+ (->string (vector-ref service-context 3))
service-context
(dbus-value "Type" props)
(dbus-value "Security" props)

No commit comments for this range

Something went wrong with that request. Please try again.