commit 2371059101830718d88370665d20319a82a28b60
parent 122080c3cbb2b50ad04a8d1b75447ca7ffe9fe84
Author: Tomas Hlavaty <tom@logand.com>
Date:   Mon, 12 Aug 2013 23:44:40 +0200
send-document sketched
Diffstat:
| M | ipp.lisp |  |  | 58 | +++++++++++++++++++++++++++++++++++++++++++++++++++++----- | 
1 file changed, 53 insertions(+), 5 deletions(-)
diff --git a/ipp.lisp b/ipp.lisp
@@ -607,6 +607,24 @@
 (defun release-job (job)
   (funcall job :release-job))
 
+(defun send-document (job data-file last-document
+                      &key (ipp-attribute-fidelity t)
+                        document-name document-format
+                        document-natural-language compression
+                        job-k-octets job-impressions
+                        job-media-sheets copies sides)
+  (funcall job :send-document data-file last-document
+           :ipp-attribute-fidelity ipp-attribute-fidelity
+           :document-name document-name
+           :document-format document-format
+           :document-natural-language document-natural-language
+           :compression compression
+           :job-k-octets job-k-octets
+           :job-impressions job-impressions
+           :job-media-sheets job-media-sheets
+           :copies copies
+           :sides sides))
+
 (defun make-job (ipp-client
                  printer-uri
                  request-file
@@ -618,8 +636,8 @@
                    (attributes-natural-language "en")
                    (requesting-user-name (user-name)))
   (lambda (msg &rest args)
-    (flet ((%ipp (&optional attributes)
-             (ipp ipp-client printer-uri request-file response-file nil
+    (flet ((%ipp (&optional oa ja data-file)
+             (ipp ipp-client printer-uri request-file response-file data-file
                   request-id msg
                   `((,(tag :operation-attributes-tag)
                       :attributes-charset ,attributes-charset
@@ -627,7 +645,8 @@
                       :requesting-user-name ,requesting-user-name
                       :printer-uri ,printer-uri
                       :job-id ,job-id
-                      ,@attributes)))))
+                      ,@oa)
+                    (,(tag :job-attributes-tag) ,@ja)))))
       (ecase msg
         (:cancel-job
          (destructuring-bind (&optional message) args
@@ -644,9 +663,28 @@
            (%ipp (list :job-hold-until job-hold-until))))
         (:release-job
          (destructuring-bind () args
-           (%ipp)))))))
+           (%ipp)))
+        (:send-document
+         (destructuring-bind (data-file
+                              last-document
+                              &key (ipp-attribute-fidelity t)
+                              document-name document-format
+                              document-natural-language compression
+                              job-k-octets job-impressions
+                              job-media-sheets copies sides) args
+           (%ipp (list :last-document last-document)
+                 (list :ipp-attribute-fidelity ipp-attribute-fidelity
+                       :document-name document-name
+                       :document-format document-format
+                       :document-natural-language document-natural-language
+                       :compression compression
+                       :job-k-octets job-k-octets
+                       :job-impressions job-impressions
+                       :job-media-sheets job-media-sheets
+                       :copies copies
+                       :sides sides)
+                 data-file)))))))
 
-;; TODO send-document
 ;; TODO ? set-job-attributes
 ;; TODO ? create-printer-subscription
 ;; TODO ? create-job-subscription
@@ -863,3 +901,13 @@
   ;;(ipp:restart-job x)
   ;;(ipp:release-job x)
   )
+
+#+nil ;; TODO
+(let* ((p (ipp:make-printer
+           'ipp.wget:ipp-client
+           "http://localhost:631/printers/Virtual_PDF_Printer"
+           "request2.dat"
+           "response2.dat"
+           314))
+       (j (ipp:create-job p)))
+  (ipp:send-jdocument j "test.txt" :ipp-attribute-fidelity nil :copies 2 :sides "two-sided-long-edge"))