pict
Documentation for pict is still a work-in-progress
Toggle main menu visibility
Loading...
Searching...
No Matches
cl_data.h
Go to the documentation of this file.
1
2
// PTP data structures. Byte-wise, most of them are very similar to the spec, but
3
// aren't actually compatible (they aren't packed). Don't try and memcpy into them.
4
#ifndef CL_DATA_H
5
#define CL_DATA_H
6
11
12
// To store unpacked device info data, after parsing
13
struct
PtpDeviceInfo
{
14
uint16_t standard_version;
15
uint32_t vendor_ext_id;
16
uint16_t version;
17
char
extensions[128];
18
uint16_t functional_mode;
19
20
int
ops_supported_length;
21
uint16_t ops_supported[256];
22
23
int
events_supported_length;
24
uint16_t events_supported[256];
25
26
int
props_supported_length;
27
uint16_t props_supported[512];
28
29
int
capture_formats_length;
30
uint16_t capture_formats[32];
31
32
int
playback_formats_length;
33
uint16_t playback_formats[32];
34
35
char
manufacturer[128];
36
char
model[128];
37
char
device_version[64];
38
char
serial_number[128];
39
};
40
41
struct
PtpStorageInfo
{
42
uint16_t storage_type;
43
uint16_t fs_type;
44
uint16_t access_capability;
45
uint64_t max_capacity;
46
uint64_t free_space;
47
uint32_t free_objects;
48
char
storage_desc[128];
49
char
volume_identifier[128];
50
};
51
52
struct
PtpObjectInfo
{
53
uint32_t storage_id;
54
uint16_t obj_format;
55
uint16_t protection;
56
uint32_t compressed_size;
57
uint16_t thumb_format;
58
uint32_t thumb_compressed_size;
59
uint32_t thumb_width;
60
uint32_t thumb_height;
61
uint32_t img_width;
62
uint32_t img_height;
63
uint32_t img_bit_depth;
64
uint32_t parent_obj;
65
uint16_t assoc_type;
// association
66
uint32_t assoc_desc;
67
uint32_t sequence_num;
68
69
char
filename[64];
70
char
date_created[32];
71
char
date_modified[32];
72
char
keywords[64];
73
};
74
75
struct
PtpEnumerationForm
{
76
uint16_t length;
77
uint8_t data[];
78
};
79
80
struct
PtpRangeForm
{
81
int
min;
82
int
max;
83
int
step;
84
};
85
86
struct
PtpPropDesc
{
87
uint16_t code;
88
uint16_t data_type;
89
uint8_t read_only;
// (get/set)
90
91
// uint32_t variables will be used for all types <= 4 bytes
92
uint32_t default_value32;
93
uint32_t current_value32;
94
void
*current_value;
95
void
*default_value;
96
97
uint8_t form_type;
98
struct
PtpRangeForm
range_form;
99
struct
PtpEnumerationForm
*enum_form;
100
};
101
102
struct
PtpObjPropDesc
{
103
uint32_t property_code;
104
uint32_t data_type;
105
uint8_t get_set;
106
uint32_t default_value;
107
uint32_t group_code;
108
uint32_t form_flag;
109
// mystery data type follows if form_flag == 0
110
};
111
112
struct
PtpCanonEvent
{
113
int
type;
114
int
code;
115
int
value;
116
int
def;
117
};
118
119
struct
PtpEOSViewFinderData
{
120
uint32_t length;
121
uint32_t type;
122
// standard JPG follows
123
};
124
125
struct
PtpMlLvInfo
{
126
uint32_t lv_pitch;
127
uint32_t lv_width;
128
uint32_t lcd_palette[256];
129
};
130
131
struct
PtpMlLvHeader
{
132
uint8_t digic;
133
uint8_t v1;
134
uint8_t v2;
135
uint8_t v3;
136
};
137
138
enum
PtpMlBmpLvOption {
139
PTP_ML_BMP_LV_GET_FRAME = 0,
140
PTP_ML_BMP_LV_GET_SPEC = 1,
141
};
142
143
enum
PtpCHDKCommands {
144
PTP_CHDK_Version = 0,
145
PTP_CHDK_UploadFile = 5,
146
};
147
148
int
ptp_pack_object_info(
struct
PtpRuntime
*r,
struct
PtpObjectInfo
*oi, uint8_t *buf,
unsigned
int
max);
149
150
int
ptp_parse_prop_value(
struct
PtpRuntime
*r);
151
int
ptp_parse_device_info(
struct
PtpRuntime
*r,
struct
PtpDeviceInfo
*di);
152
int
ptp_device_info_json(
const
struct
PtpDeviceInfo
*di,
char
*buffer,
unsigned
int
max);
153
int
ptp_parse_prop_desc(
struct
PtpRuntime
*r,
struct
PtpPropDesc
*oi);
154
int
ptp_prop_desc_json(
const
struct
PtpPropDesc
*pd,
char
*buffer,
unsigned
int
max);
155
int
ptp_parse_object_info(
struct
PtpRuntime
*r,
struct
PtpObjectInfo
*oi);
156
int
ptp_storage_info_json(
const
struct
PtpStorageInfo
*so,
char
*buffer,
unsigned
int
max);
157
int
ptp_object_info_json(
const
struct
PtpObjectInfo
*so,
char
*buffer,
unsigned
int
max);
158
int
ptp_parse_storage_info(
struct
PtpRuntime
*r,
struct
PtpStorageInfo
*si);
159
__attribute__
((deprecated))
int
ptp_eos_events(
struct
PtpRuntime
*r,
struct
PtpGenericEvent
**p);
162
int
ptp_eos_events_open
(
struct
PtpRuntime
*r,
struct
PtpEventReader
*reader);
165
int
ptp_eos_events_next
(
struct
PtpRuntime
*r,
struct
PtpEventReader
*reader,
struct
PtpGenericEvent
*event);
167
int
ptp_eos_events_json
(
struct
PtpRuntime
*r,
char
*buffer,
unsigned
int
max);
168
169
// Standard property value converters (conv.c)
170
int
ptp_eos_get_shutter(
int
data,
int
*out,
int
dir);
171
int
ptp_eos_get_iso(
int
data,
int
*out,
int
dir);
172
int
ptp_eos_get_aperture(
int
data,
int
*out,
int
dir);
173
int
ptp_eos_get_white_balance(
int
data,
int
*out,
int
dir);
174
int
ptp_eos_get_imgformat_value(uint32_t data[5],
int
*out);
175
176
void
*ptp_pack_chdk_upload_file(
struct
PtpRuntime
*r,
char
*in,
char
*out,
unsigned
int
*length);
177
178
void
*canon_evproc_pack(
struct
PtpRuntime
*r,
int
*out_length,
char
*
string
);
179
180
#endif
ptp_eos_events_next
int ptp_eos_events_next(struct PtpRuntime *r, struct PtpEventReader *reader, struct PtpGenericEvent *event)
ptp_eos_events_open
int ptp_eos_events_open(struct PtpRuntime *r, struct PtpEventReader *reader)
ptp_eos_events_json
int ptp_eos_events_json(struct PtpRuntime *r, char *buffer, unsigned int max)
Reads event list currently in r->data and converts to JSON.
__attribute__
PUB __attribute__((noreturn)) void ptp_panic(char *fmt
Client has no way out, crash the application.
PtpCanonEvent
Definition
cl_data.h:112
PtpDeviceInfo
Definition
cl_data.h:13
PtpEOSViewFinderData
Definition
cl_data.h:119
PtpEnumerationForm
Definition
cl_data.h:75
PtpEventReader
Stream reader state struct for struct PtpGenericEvent.
Definition
libpict.h:197
PtpGenericEvent
Generic event / property change.
Definition
libpict.h:190
PtpMlLvHeader
Definition
cl_data.h:131
PtpMlLvInfo
Definition
cl_data.h:125
PtpObjPropDesc
Definition
cl_data.h:102
PtpObjectInfo
Definition
cl_data.h:52
PtpPropDesc
Definition
cl_data.h:86
PtpRangeForm
Definition
cl_data.h:80
PtpRuntime
Represents a single device connection.
Definition
libpict.h:104
PtpStorageInfo
Definition
cl_data.h:41
src
cl_data.h
Generated by
1.17.0