Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1702 | - | 1 | /* Copyright (C) 2010-2011 Circuits At Home, LTD. All rights reserved. |
2 | |||
3 | This software may be distributed and modified under the terms of the GNU |
||
4 | General Public License version 2 (GPL2) as published by the Free Software |
||
5 | Foundation and appearing in the file GPL2.TXT included in the packaging of |
||
6 | this file. Please note that GPL2 Section 2[b] requires that all works based |
||
7 | on this software must also be made publicly available under the terms of |
||
8 | the GPL2 ("Copyleft"). |
||
9 | |||
10 | Contact information |
||
11 | ------------------- |
||
12 | |||
13 | Circuits At Home, LTD |
||
14 | Web : http://www.circuitsathome.com |
||
15 | e-mail : support@circuitsathome.com |
||
16 | */ |
||
17 | #ifndef __CANONEOS_H__ |
||
18 | #define __CANONEOS_H__ |
||
19 | |||
20 | #include "WProgram.h" |
||
21 | #include "ptp.h" |
||
22 | |||
23 | // PTP Operation Codes (EOS specific) |
||
24 | #define EOS_OC_GetStorageIDs 0x9101 |
||
25 | #define EOS_OC_GetStorageInfo 0x9102 |
||
26 | #define EOS_OC_GetObject 0x9107 |
||
27 | #define EOS_OC_GetDeviceInfoEx 0x9108 |
||
28 | #define EOS_OC_GetObjectIDs 0x9109 |
||
29 | #define EOS_OC_Capture 0x910f |
||
30 | #define EOS_OC_SetDevicePropValue 0x9110 |
||
31 | #define EOS_OC_SetPCConnectMode 0x9114 |
||
32 | #define EOS_OC_SetExtendedEventInfo 0x9115 |
||
33 | #define EOS_OC_GetEvent 0x9116 |
||
34 | #define EOS_OC_TransferComplete 0x9117 |
||
35 | #define EOS_OC_CancelTransfer 0x9118 |
||
36 | #define EOS_OC_ResetTransfer 0x9119 |
||
37 | #define EOS_OC_GetDevicePropValue 0x9127 |
||
38 | #define EOS_OC_GetLiveViewPicture 0x9153 |
||
39 | #define EOS_OC_MoveFocus 0x9155 |
||
40 | |||
41 | // PTP Device Properties |
||
42 | #define EOS_DPC_CameraDescription 0xD402 |
||
43 | |||
44 | // Non-PTP Device properties |
||
45 | #define EOS_DPC_Aperture 0xD101 |
||
46 | #define EOS_DPC_ShutterSpeed 0xD102 |
||
47 | #define EOS_DPC_Iso 0xD103 |
||
48 | #define EOS_DPC_ExposureCompensation 0xD104 |
||
49 | #define EOS_DPC_ShootingMode 0xD105 |
||
50 | #define EOS_DPC_DriveMode 0xD106 |
||
51 | #define EOS_DPC_ExpMeterringMode 0xD107 |
||
52 | #define EOS_DPC_AFMode 0xD108 |
||
53 | #define EOS_DPC_WhiteBalance 0xD109 |
||
54 | #define EOS_DPC_PictureStyle 0xD110 |
||
55 | #define EOS_DPC_TransferOption 0xD111 |
||
56 | #define EOS_DPC_UnixTime 0xD113 |
||
57 | #define EOS_DPC_ImageQuality 0xD120 |
||
58 | #define EOS_DPC_LiveView 0xD1B0 |
||
59 | #define EOS_DPC_AvailableShots 0xD11B |
||
60 | #define EOS_DPC_CaptureDestination 0xD11C |
||
61 | #define EOS_DPC_BracketMode 0xD11D |
||
62 | |||
63 | // Non-PTP Events |
||
64 | #define EOS_EC_DevPropChanged 0xC189 |
||
65 | #define EOS_EC_ObjectCreated 0xC181 |
||
66 | #define EOS_EC_DevPropValuesAccepted 0xC18A |
||
67 | #define EOS_EC_Capture 0xC18B |
||
68 | #define EOS_EC_HalfPushReleaseButton 0xC18E |
||
69 | |||
70 | |||
71 | class EOSStateHandlers : public PTPStateHandlers |
||
72 | { |
||
73 | public: |
||
74 | virtual void OnSessionOpenedState(PTP *ptp); |
||
75 | }; |
||
76 | |||
77 | class ImgQualitySupplier : PTPDataSupplier |
||
78 | { |
||
79 | uint32_t pictFormat; |
||
80 | |||
81 | public: |
||
82 | ImgQualitySupplier() {}; |
||
83 | void SetPictureFormat(uint32_t format) { pictFormat = format; }; |
||
84 | virtual uint32_t GetDataSize(); |
||
85 | virtual void GetData(const uint16_t len, uint8_t *pbuf); |
||
86 | }; |
||
87 | |||
88 | class CanonEOS : public PTP |
||
89 | { |
||
90 | public: |
||
91 | enum { modeADEP=5, modeM=3, modeAv=2, modeTv=1, modeP=0, modeAuto=9, modePortrait=0xC, modeLandscape=0xD, |
||
92 | modeMacro=0xE, modeSport=0xB, modeNight=0xA, modeFlashOff=0xF}; |
||
93 | |||
94 | enum { driveSingleShot = 0, driveSelf = 1, driveContinuous = 0x10 }; |
||
95 | |||
96 | enum { iso100 = 0x48, iso200 = 0x50, iso400 = 0x58, iso800 = 0x60, iso1600 = 0x68 }; |
||
97 | |||
98 | enum { styleStandard = 0x81, stylePortrait, styleLandscape, styleNeutral, styleFaithful, styleMonochrome, |
||
99 | styleUser1 = 0x21, styleUser2, styleUser3 }; |
||
100 | |||
101 | enum { afmodeOneShot, afmodeAIServo, afmodeAIFocus }; |
||
102 | |||
103 | enum { pictSFine = 0x00000321, pictSNormal = 0x00000221, pictMFine = 0x00000311, pictMNormal = 0x00000211, |
||
104 | pictLFine = 0x00000301, pictLNormal = 0x00000201, pictRaw = 0x00000406, pictRawPlusL = 0x00301406 }; |
||
105 | |||
106 | enum { wbAuto, wbDaylight, wbCloudy, wbTungsten, wbFluorescent, wbStrobe, wbWhitePaper, wbShade = 8 }; |
||
107 | |||
108 | enum |
||
109 | { |
||
110 | ecPlus2 = 0x10, //"+2" |
||
111 | ecPlus1_2d3 = 0x0d, //"+1 2/3" |
||
112 | ecPlus1_1d3 = 0x0b, //"+1 1/3" |
||
113 | ecPlus1 = 0x08, //"+1" |
||
114 | ecPlus0_2d3 = 0x05, //"+2/3" |
||
115 | ecPlus0_1d3 = 0x03, //"+1/3" |
||
116 | ecZerro = 0x00, //"0" |
||
117 | ecMinus0_1d3= 0xfd, //"-1/3" |
||
118 | ecMinus0_2d3= 0xfb, //"-2/3" |
||
119 | ecMinus1 = 0xf8, //"-1" |
||
120 | ecMinus1_1d3= 0xf5, //"-1 1/3" |
||
121 | ecMinus1_2d3= 0xf3, //"-1 2/3" |
||
122 | ecMinus2 = 0xf0, //"-2" |
||
123 | }; |
||
124 | |||
125 | CanonEOS(uint8_t addr, uint8_t epin, uint8_t epout, uint8_t epint, uint8_t nconf, PTPStateHandlers *s); |
||
126 | |||
127 | uint16_t SetPCConnectMode(uint8_t mode); |
||
128 | uint16_t SetExtendedEventInfo(uint8_t mode); |
||
129 | uint16_t Capture(); |
||
130 | uint16_t StartBulb(); |
||
131 | uint16_t StopBulb(); |
||
132 | uint16_t SwitchLiveView(bool on); |
||
133 | uint16_t MoveFocus(uint16_t step); |
||
134 | uint16_t SetProperty(uint16_t prop, uint32_t val); |
||
135 | |||
136 | uint16_t GetProperty(uint16_t prop, PTPReadParser *parser); |
||
137 | |||
138 | uint16_t GetDeviceInfoEx(PTPReadParser *parser); |
||
139 | uint16_t SetImageQuality(uint32_t format); |
||
140 | |||
141 | uint16_t GetObject(uint32_t object_id, uint32_t parent_id, PTPReadParser *parser); |
||
142 | uint16_t ResetTransfer(uint32_t object_id); |
||
143 | uint16_t CancelTransfer(uint32_t object_id); |
||
144 | |||
145 | virtual uint16_t EventCheck(PTPReadParser *parser); |
||
146 | uint16_t DigitalZoom(uint16_t magnify); |
||
147 | |||
148 | }; |
||
149 | |||
150 | |||
151 | #endif // __CANONEOS_H__ |