Property Cases - Canon Camera Hackers Manual

Camera hackers manual berthold daum
Table of Contents

Advertisement

128
C H A P T E R 5
Scripting
id = capmode.get_canon()
Returns the current Canon shooting mode ID (section 5.6). The values are ANDed
bitwise with 0xFFFF so that negative values are returned as 65536-id.
r = capmode.set(modeid)
Sets the shooting mode specified in modeid. This can be a CHDK shooting mode
number or a mode name. Returns true on success.
index = capmode.valid(modeid)
Returns the CHDK shooting mode number derived from modeid. It can be a CHDK
shooting mode number or a mode name. nil is returned if modeid is not a valid
shooting mode.
5.6

Property Cases

Both uBasic and Lua scripts feature commands for accessing so-called
Property Cases. These are pieces of data used by the camera's operating
system. Each property case is identified by a property ID (a number > = 0).
uBasic: get_prop id
Lua: get_prop(id)
and
uBasic: set_prop id value
Lua: set_prop(id, value)
Unfortunately, the property IDs differ between the VxWorks and DryOS
operating systems (section 2.2), as you can see in the table below. In conse-
quence, a script accessing properties and developed for Digic II cameras
will not run on most Digic III and all Digic IV cameras, and vice versa. This is
okay if you write a script for your own camera, but if you plan to publish
your script in the CHDK community you should identify which cameras are
supported.
If you want to make your script as widely applicable as possible, you
should make it independent from the actual operating system. Under
uBasic, you can use the command get_propset (section 5.5.10) to find out
the operating system where your script is running. For example:
x = get_propset
if x = 1 then
s = get_prop 205
else
s = get_prop 206
endif
retrieves the shooting state of the camera under both operating systems.

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Powershot sx10 is

Table of Contents