1- /* ****************************************************************************
2- *
3- * Copyright (C) 2010 Circuits At Home, LTD. All rights reserved.
4- *
5- * This software may be distributed and modified under the terms of the GNU
6- * General Public License version 2 (GPL) as published by the Free Software
7- * Foundation and appearing in the file GPL.TXT included in the packaging of
8- * this file. Please note that GPL Section 2[b] requires that all works based
9- * on this software must also be made publicly available under the terms of
10- * the GPL ("Copyleft").
11- *
12- * Contact information:
13- * Circuits At Home Web site: http://www.circuitsathome.com
14- * e-mail: support@circuitsathome.com
15- *****************************************************************************/
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+ */
1617#include " canoneos.h"
1718
1819
@@ -59,8 +60,8 @@ uint16_t CanonEOS::SetImageQuality(uint32_t format)
5960 ImgQualitySupplier sup;
6061 sup.SetPictureFormat (format);
6162
62- if ( (ptp_error = Transaction (PTP_OC_EOS_SetDevicePropValue , &flags, NULL , (void *)&sup)) != PTP_RC_OK )
63- Message ( PSTR ( " SetImageQuality error" ) , ptp_error);
63+ if ( (ptp_error = Transaction (EOS_OC_SetDevicePropValue , &flags, NULL , (void *)&sup)) != PTP_RC_OK )
64+ PTPTRACE2 ( " SetImageQuality error" , ptp_error);
6465
6566 return ptp_error;
6667}
@@ -69,14 +70,14 @@ uint16_t CanonEOS::SetPCConnectMode(uint8_t mode)
6970{
7071 uint32_t params[1 ];
7172 params[0 ] = (uint32_t ) mode;
72- return Operation (PTP_OC_EOS_SetPCConnectMode , 1 , params);
73+ return Operation (EOS_OC_SetPCConnectMode , 1 , params);
7374}
7475
7576uint16_t CanonEOS::SetExtendedEventInfo (uint8_t mode)
7677{
7778 uint32_t params[1 ];
7879 params[0 ] = (uint32_t ) mode;
79- return Operation (PTP_OC_EOS_SetExtendedEventInfo , 1 , params);
80+ return Operation (EOS_OC_SetExtendedEventInfo , 1 , params);
8081}
8182
8283uint16_t CanonEOS::StartBulb ()
@@ -98,18 +99,15 @@ uint16_t CanonEOS::StopBulb()
9899{
99100 uint32_t params[3 ];
100101
101- params[0 ] = 0xffffffff ;
102+ params[0 ] = 0xffffffff ;
102103 params[1 ] = 0x00001000 ;
103104 params[2 ] = 0x00000000 ;
104105 Operation (0x911A , 3 , params);
105106
106- params[0 ] = 0xfffffffc ;
107+ params[0 ] = 0xfffffffc ;
107108 Operation (0x911A , 3 , params);
108-
109109 Operation (0x9126 , 0 , NULL );
110- delay (50 );
111110 Operation (0x911C , 0 , NULL );
112- delay (50 );
113111
114112 return PTP_RC_OK ;
115113}
@@ -119,15 +117,15 @@ uint16_t CanonEOS::CancelTransfer(uint32_t object_id)
119117 uint32_t params[1 ];
120118 params[0 ] = object_id;
121119
122- return Operation (PTP_OC_EOS_CancelTransfer , 1 , params);
120+ return Operation (EOS_OC_CancelTransfer , 1 , params);
123121}
124122
125123uint16_t CanonEOS::ResetTransfer (uint32_t object_id)
126124{
127125 uint32_t params[1 ];
128126 params[0 ] = object_id;
129127
130- return Operation (PTP_OC_EOS_ResetTransfer , 1 , params);
128+ return Operation (EOS_OC_ResetTransfer , 1 , params);
131129}
132130
133131uint16_t CanonEOS::SwitchLiveView (bool on)
@@ -140,7 +138,7 @@ uint16_t CanonEOS::SwitchLiveView(bool on)
140138 {
141139 if ((ptp_error = SetProperty (0xD1B3 , 0 )) != PTP_RC_OK )
142140 {
143- Message ( PSTR ( " LiveView start failure:" ) , ptp_error);
141+ PTPTRACE2 ( " LiveView start failure:" , ptp_error);
144142 SetProperty (EOS_DPC_LiveView, 0 );
145143 return PTP_RC_GeneralError;
146144 }
@@ -157,10 +155,8 @@ uint16_t CanonEOS::MoveFocus(uint16_t step)
157155
158156 params[0 ] = (uint32_t ) step;
159157
160- if ( (ptp_error = Transaction (PTP_OC_EOS_MoveFocus, &flags, params, NULL )) != PTP_RC_OK )
161- Message (PSTR (" MoveFocus error." ), ptp_error);
162- else
163- Message (PSTR (" MoveFocus: Success." ), ptp_error);
158+ if ( (ptp_error = Transaction (EOS_OC_MoveFocus, &flags, params, NULL )) != PTP_RC_OK )
159+ PTPTRACE2 (" MoveFocus error: " , ptp_error);
164160
165161 return ptp_error;
166162}
@@ -171,14 +167,14 @@ uint16_t CanonEOS::EventCheck(PTPReadParser *parser)
171167 OperFlags flags = { 0 , 0 , 0 , 1 , 1 , 0 };
172168
173169 if ( (ptp_error = Transaction (0x9116 , &flags, NULL , parser)) != PTP_RC_OK )
174- Message ( PSTR ( " EOSEventCheck error:" ) , ptp_error);
170+ PTPTRACE2 ( " EOSEventCheck error:" , ptp_error);
175171
176172 return ptp_error;
177173}
178174
179175uint16_t CanonEOS::Capture ()
180176{
181- return Operation (PTP_OC_EOS_Capture , 0 , NULL );
177+ return Operation (EOS_OC_Capture , 0 , NULL );
182178}
183179
184180
@@ -192,8 +188,8 @@ uint16_t CanonEOS::SetProperty(uint16_t prop, uint32_t val)
192188 params[1 ] = (uint32_t )prop;
193189 params[2 ] = val;
194190
195- if ( (ptp_error = Transaction (PTP_OC_EOS_SetDevicePropValue , &flags, NULL , (void *)params)) != PTP_RC_OK )
196- Message ( PSTR ( " SetProperty error:" ) , ptp_error);
191+ if ( (ptp_error = Transaction (EOS_OC_SetDevicePropValue , &flags, NULL , (void *)params)) != PTP_RC_OK )
192+ PTPTRACE2 ( " SetProperty error:" , ptp_error);
197193
198194 return ptp_error;
199195}
@@ -206,8 +202,8 @@ uint16_t CanonEOS::GetProperty(uint16_t prop, PTPReadParser *parser)
206202
207203 params[0 ] = (uint32_t )prop;
208204
209- if ( (ptp_error = Transaction (PTP_OC_EOS_GetDevicePropValue , &flags, params, (void *)parser)) != PTP_RC_OK )
210- Message ( PSTR ( " GetProperty error:" ) , ptp_error);
205+ if ( (ptp_error = Transaction (EOS_OC_GetDevicePropValue , &flags, params, (void *)parser)) != PTP_RC_OK )
206+ PTPTRACE2 ( " GetProperty error:" , ptp_error);
211207
212208 return ptp_error;
213209}
@@ -217,8 +213,8 @@ uint16_t CanonEOS::GetDeviceInfoEx(PTPReadParser *parser)
217213 uint16_t ptp_error = PTP_RC_GeneralError;
218214 OperFlags flags = { 0 , 0 , 0 , 1 , 1 , 0 };
219215
220- if ( (ptp_error = Transaction (PTP_OC_EOS_GetDeviceInfoEx , &flags, NULL , (void *)parser)) != PTP_RC_OK )
221- Message ( PSTR ( " GetDeviceInfo error:" ) , ptp_error);
216+ if ( (ptp_error = Transaction (EOS_OC_GetDeviceInfoEx , &flags, NULL , (void *)parser)) != PTP_RC_OK )
217+ PTPTRACE2 ( " GetDeviceInfo error:" , ptp_error);
222218
223219 return ptp_error;
224220}
@@ -232,8 +228,8 @@ uint16_t CanonEOS::GetObject(uint32_t object_id, uint32_t parent_id, PTPReadPars
232228 params[0 ] = object_id;
233229 params[1 ] = parent_id;
234230
235- if ( (ptp_error = Transaction (PTP_OC_EOS_GetObject , &flags, params, (void *)parser)) != PTP_RC_OK )
236- Message ( PSTR ( " GetObject error:" ) , ptp_error);
231+ if ( (ptp_error = Transaction (EOS_OC_GetObject , &flags, params, (void *)parser)) != PTP_RC_OK )
232+ PTPTRACE2 ( " GetObject error:" , ptp_error);
237233
238234 return ptp_error;
239235}
0 commit comments