2 ;; This is a sort of elephants' graveyard of usage examples/snippets. Will be
3 ;; removed/replaced when the library is fully bound and I can write some proper
8 (:use
:sane
:cl
:trivial-gray-streams
:iterate
))
10 (in-package :sane-user
)
12 ;; With-init runs forms with the library initialised. It can bind a
13 ;; variable to the version - in this case, V.
18 ;; devices lists the devices sane can find.
20 (mapcar #'name
(devices t
)))
22 ;; List all the options of the device
24 (with-device d
"test:0"
25 (dump-option-list d
)))
27 ;; Read from the device.
29 (with-device d
"test:0"
30 (setf (value (option "mode" d
)) "Color")
31 (setf (value (option "test-picture" d
)) "Color pattern")
33 (with-open-file (f "out.raw"
35 :element-type
'(unsigned-byte 8)
36 :if-exists
:supersede
:if-does-not-exist
:create
)
37 (with-open-scanner-stream s d
40 (setf byte
(stream-read-byte s
))
41 (when (eq byte
:eof
) (terminate))
42 (write-byte byte f
)))))))