Permalink
Browse files

manager: Implemented manager properties object

`manager-state' has been removed
  • Loading branch information...
1 parent 5ae25e3 commit c9c9845e0b31858a9d6d4561aa31cc1a07c46fa9 @mario-goulart mario-goulart committed Mar 28, 2012
Showing with 49 additions and 5 deletions.
  1. +9 −1 connman.scm
  2. +40 −4 manager.scm
View
10 connman.scm
@@ -127,8 +127,16 @@
;;;
;;; Manager
;;;
+ 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!
+
make-manager-context
- manager-state
manager-technologies
manager-services
)
View
44 manager.scm
@@ -5,9 +5,45 @@
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?)))
(define (manager-technologies context)
@@ -17,4 +53,4 @@
(define (manager-services context)
(and-let* ((services (dbus-call context "GetServices")))
- (car services)))
+ (car services)))

0 comments on commit c9c9845

Please sign in to comment.