commit 6d7c4756690a788f2d1cbcf4c5eb1c9aff91c91e
parent c47983e198a6e33409550b45b6ece9414a2aad97
Author: Tomas Hlavaty <tom@logand.com>
Date:   Sun, 11 Aug 2013 22:09:16 +0200
added cancel-job get-job-attributes hold-job release-job restart-job
- and minor stuff
Diffstat:
| M | ipp.lisp |  |  | 140 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---- | 
1 file changed, 133 insertions(+), 7 deletions(-)
diff --git a/ipp.lisp b/ipp.lisp
@@ -538,8 +538,60 @@
            :printer-uri ,printer-uri))))
 
 ;; TODO send-document
-;; TODO cancel-job
-;; TODO get-job-attributes
+
+(defun cancel-job (ipp-client
+                   printer-uri
+                   request-file
+                   response-file
+                   request-id
+                   job-id
+                   &key
+                     (attributes-charset "utf-8")
+                     (attributes-natural-language "en")
+                     (requesting-user-name (user-name))
+                     message)
+  (ipp ipp-client
+       printer-uri
+       request-file
+       response-file
+       nil
+       request-id
+       :cancel-job
+       `((,(tag :operation-attributes-tag)
+           :attributes-charset ,attributes-charset
+           :attributes-natural-language ,attributes-natural-language
+           :printer-uri ,printer-uri
+           :requesting-user-name ,requesting-user-name
+           :job-id ,job-id
+           :message ,message))))
+
+(defun get-job-attributes (ipp-client
+                           printer-uri
+                           request-file
+                           response-file
+                           request-id
+                           job-id
+                           &key
+                             (attributes-charset "utf-8")
+                             (attributes-natural-language "en")
+                             limit
+                             requested-attributes)
+  (assert (let ((x '(:job-template :job-description :all)))
+            (equal x (union x requested-attributes))))
+  (ipp ipp-client
+       printer-uri
+       request-file
+       response-file
+       nil
+       request-id
+       :get-job-attributes
+       `((,(tag :operation-attributes-tag)
+           :attributes-charset ,attributes-charset
+           :attributes-natural-language ,attributes-natural-language
+           :printer-uri ,printer-uri
+           :job-id ,job-id
+           :limit ,limit
+           :requested-attributes ,requested-attributes))))
 
 (defun get-jobs (ipp-client
                  printer-uri
@@ -585,6 +637,8 @@
                                  (attributes-natural-language "en")
                                  limit
                                  requested-attributes)
+  (assert (let ((x '(:job-template :printer-description :all)))
+            (equal x (union x requested-attributes))))
   (ipp ipp-client
        printer-uri
        request-file
@@ -599,9 +653,81 @@
            :limit ,limit
            :requested-attributes ,requested-attributes))))
 
-;; TODO hold-job
-;; TODO release-job
-;; TODO restart-job
+(defun hold-job (ipp-client
+                 printer-uri
+                 request-file
+                 response-file
+                 request-id
+                 job-id
+                 &key
+                   (attributes-charset "utf-8")
+                   (attributes-natural-language "en")
+                   (requesting-user-name (user-name))
+                   job-hold-until)
+  (ipp ipp-client
+       printer-uri
+       request-file
+       response-file
+       nil
+       request-id
+       :hold-job
+       `((,(tag :operation-attributes-tag)
+           :attributes-charset ,attributes-charset
+           :attributes-natural-language ,attributes-natural-language
+           :printer-uri ,printer-uri
+           :requesting-user-name ,requesting-user-name
+           :job-id ,job-id
+           :job-hold-until ,job-hold-until))))
+
+(defun release-job (ipp-client
+                    printer-uri
+                    request-file
+                    response-file
+                    request-id
+                    job-id
+                    &key
+                      (attributes-charset "utf-8")
+                      (attributes-natural-language "en")
+                      (requesting-user-name (user-name)))
+  (ipp ipp-client
+       printer-uri
+       request-file
+       response-file
+       nil
+       request-id
+       :release-job
+       `((,(tag :operation-attributes-tag)
+           :attributes-charset ,attributes-charset
+           :attributes-natural-language ,attributes-natural-language
+           :printer-uri ,printer-uri
+           :requesting-user-name ,requesting-user-name
+           :job-id ,job-id))))
+
+(defun restart-job (ipp-client
+                    printer-uri
+                    request-file
+                    response-file
+                    request-id
+                    job-id
+                    &key
+                      (attributes-charset "utf-8")
+                      (attributes-natural-language "en")
+                      (requesting-user-name (user-name))
+                      job-hold-until)
+  (ipp ipp-client
+       printer-uri
+       request-file
+       response-file
+       nil
+       request-id
+       :restart-job
+       `((,(tag :operation-attributes-tag)
+           :attributes-charset ,attributes-charset
+           :attributes-natural-language ,attributes-natural-language
+           :printer-uri ,printer-uri
+           :requesting-user-name ,requesting-user-name
+           :job-id ,job-id
+           :job-hold-until ,job-hold-until))))
 
 (defun pause-printer (ipp-client
                       printer-uri
@@ -872,7 +998,7 @@
                 314)
 
 #+nil
-(ipp:get-printer-attributes ;; TODO fix read-attribute
+(ipp:get-printer-attributes
  'ipp-client
  "http://localhost:631/printers/Virtual_PDF_Printer"
  "request2.dat"
@@ -880,7 +1006,7 @@
  314)
 
 #+nil
-(ipp:get-printer-attributes
+(ipp:get-printer-attributes ;; TODO fix
  'ipp-client
  "http://localhost:631/printers/Virtual_PDF_Printer"
  "request2.dat"