2 --------------------------------------------------------------------
4 (note: this is a specification. it is not implemented!)
6 The gPhoto daemon uses the following protocol description. It provides an
7 interactive way for program to talk and use gPhoto without needing to
8 have any sort of C bindings.
10 This document needs better formatting (color syntax highlighting, structure)
13 --------------------------------------------------------------------
14 - The program provides gPhoto with a series of commands. gPhoto can
15 also send message to the program through 4 notification commands.
17 - The arguments to a command are either a number or a string.
18 If it's a string, you must put double-quotes around it.
20 - All commands to gPhoto are answered by an "OK" or "ERROR", possibly
21 followed by additional data.
23 - Designed around simplicity and flexibility.
25 - Picture numbering begins at ZERO!
27 - Notification will come after issuing a command.
30 --------------------------------------------------------------------
32 '>' indicates commands from the program to gPhoto
33 '<' indicates commands from gPhoto to the program
35 To put gphoto2 into a daemon mode, you must run it as "gphoto2 -S".
36 You can open a pipe and then read/write to that file descriptor.
48 > camera_Set "Epson 650Z"
63 > file_get 0 "/home/scottf" "file0.jpg"
64 < confirm "Files exists. Overwrite?"
67 < /home/scottf/file0.jpg
68 > file_get 1 "/home/scottf" "file1.jpg"
70 < /home/scottf/file1.jpg
71 > file_get 2 "/home/scottf" "file2.jpg"
72 < confirm "File exists. Overwrite?"
74 < ERROR "Did not save /home/scottf/file2.jpg"
76 Commands to the gPhoto daemon
77 --------------------------------------------------------------------
79 Description: Saves the value of "key" as "value"
82 Example: > setting_set "foo" "bar"
86 Description: Retrieves the value of "key"
88 if OK, followed by the value of the key
90 Example: > setting_get "foo"
94 notification_set number
95 Description: Turns on (value = 1) or off (value = 0) notification
99 Example: > debug_set 1
104 Description: Turns on (value = 1) or off (value = 0) debugging
108 Example: > debug_set 1
112 Description: Lists the number of cameras and all the camera model names
114 if OK, followed by number of cameras, followed by camera models
116 Example: > camera_count
123 Description: Sets the camera name as the chosen camera model
126 Example: > camera_set "Canon S10"
129 camera_abilities [name]
130 Description: Determines the camera's abilities. The camera name is optional.
131 If not specified, uses currently set camera.
132 Please reference gphoto2-datatypes.h for available abilities and
135 if OK, followed by number of abilities, followed by abilities
137 Example: > camera_abilities "Olympus 3030Z"
156 Description: Display the contents of the folder path on the camera.
158 if OK, followed by number of entries, followed by the list.
159 an entry in the list has a trailing '/' if it is a folder.
161 Example: > folder_list "/"
170 Description: Sets the current folder.
173 Example: > folder_set "/"
177 Description: Determines the number of files (pictures, sounds, etc.) in the
180 if OK, followed by number of files
182 Example: > file_count
186 file_get number [directory] [filename]
187 Description: Downloads picture #number from the current folder
188 * if directory is specified, picture is saved to that directory using
189 the camera-recommended filename.
190 * if directory and filename is specified, picture is saved as filename
194 if just number is specified:
195 followed by mime-type, size of picture, and picture data
196 if directory and/or filename is specified:
197 followed by path and filename of picture
199 Example: > file_get 12
203 < image data ... . . . ....
205 > file_get 12 "/home/scottf/"
207 < /home/scottf/PIC0012.JPG
209 > file_get 12 "/home/scottf/" "picture12.jpg"
211 < /home/scottf/picture12.jpg
213 file_get_preview number [directory] [filename]
214 Description: Downloads preview (thumbnail) #number from the current folder
215 * if directory is specified, preview is saved to that directory using
216 the camera-recommended filename.
217 * if directory and filename is specified, picture is saved as filename
221 if just number is specified:
222 followed by mime-type, size of preview, and preview data
223 if directory and/or filename is specified:
224 followed by path and filename of preview
226 Example: > file_get_preview 12
230 < image data ... . . . ....
232 > file_get_preview 12 "/home/scottf/"
234 < /home/scottf/THUMB0012.JPG
236 > file_get_preview 12 "/home/scottf/" "thumbnail12.jpg"
238 < /home/scottf/thumbnail12.jpg
241 Description: Uploads the file specified by filename to the camera into the current folder
244 Example: > file_put /home/scottf/picture02.jpg
248 Description: Deletes the file #number in the current folder
251 Example: > file_delete 12
254 Description: Gets a set of meta-widgets that describe camera configuration options.
255 (needs explanation on structure)
256 widget-type "label" value [min max step | choice]
257 * WINDOW and PAGE are containers. any widget coming after that is put into
259 * value is a number, except for TEXT (then value requires double-quotes)
261 if OK, followed by number of lines, followed by the meta-widgets
263 Example: > config_get
266 < WINDOW "Olympus Configuration"
268 < RADIO "Resolution" 0 "Standard"
269 < RADIO "Resolution" 1 "High"
270 < RADIO "Resolution" 0 "Best"
271 < RADIO "Compression" 0 "None"
272 < RADIO "Compression" 0 "Low"
273 < RADIO "Compression" 1 "High"
274 < PAGE "Miscellaneous"
276 < TEXT "Camera Name" "Scott's Olympus D-220L"
277 < MENU "Flash Setting" 0 "Red-eye reduction"
278 < MENU "Flash Setting" 1 "Auto"
279 < MENU "Flash Setting" 0 "Forced"
280 < MENU "Flash Setting" 0 "Blind me"
282 config_set "label"=[choice|value] "label"=[choice|value] "label"=[choice|value] ...
283 Description: Sets the camera configuration
284 * if RADIO or MENU, "label"="choice"
285 * for others, "label"=value
288 Example: > config_set "Resolution"="Best" "Compression"="None" "Zoom"=0.00
291 capture_to_disk path [filename]
292 Description: Causes camera to press the shutter, then download and save to disk.
295 if OK, followed by picture filename
297 Example: > capture_to_disk "/home/scottf"
299 < /home/scottf/PIC00012.JPG
301 > capture_to_disk "/home/scottf" "livepicture.jpg"
303 < /home/scottflivepicture.jpg
306 Description: Displays information about the camera library
308 if OK, followed by number of lines, then camera library information
313 < Scott <scottf@unr.edu>
314 < Camera library for foo-bar cameras
315 < These cameras are kinda silly.
318 Description: Displays the camera library manual
320 if OK, followed by number of lines, then camera library manual
325 < This camera library is a good library.
326 < It does not support capturing image though.
327 < The company that make the camera helped
328 < by providing information about the communication
332 Description: Displays the camera summary
334 if OK, followed by number of lines, then camera summary
339 < Battery Percent = 65%
340 < Free memory is 31Meg
341 < My height is around 6'4"
344 --------------------------------------------------------------------
345 These depend on whether or not "notification_set" has been called.
346 By default, they are turned off. Use "notification_set 1" to turn them
350 Description: Should display the percent done in the current operation
352 Example: < progress 50
355 Description: Should display a message to the user (pop-up window)
358 Example: < message "Don't you want to be a pepper too?"
361 Description: Should display the status to the user (status bar)
364 Example: < status "Done with current operation."
367 Description: Should display a "yes" or "no" confirmation box to the user.
368 Response: confirm 0 (no), confirm 1 (yes), or ERROR
370 Example: < confirm "Do you want to delete that file?"
372 (gPhoto will not answer this).