| 1 |
/* library.h |
| 2 |
* |
| 3 |
* Copyright (C) 2000,2001,2002 donn morrison - [email protected] |
| 4 |
* |
| 5 |
* This library is free software; you can redistribute it and/or |
| 6 |
* modify it under the terms of the GNU Lesser General Public |
| 7 |
* License as published by the Free Software Foundation; either |
| 8 |
* version 2 of the License, or (at your option) any later version. |
| 9 |
* |
| 10 |
* This library is distributed in the hope that it will be useful, |
| 11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 |
* Lesser General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU Lesser General Public |
| 16 |
* License along with this library; if not, write to the |
| 17 |
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 18 |
* Boston, MA 02110-1301 USA |
| 19 |
*/ |
| 20 |
|
| 21 |
/**************************************************** |
| 22 |
* kodak dc3200 digital camera driver library * |
| 23 |
* for gphoto2 * |
| 24 |
* * |
| 25 |
* author: donn morrison - [email protected] * |
| 26 |
* date: dec 2000 - jan 2002 * |
| 27 |
* license: gpl * |
| 28 |
* version: 1.6 * |
| 29 |
* * |
| 30 |
****************************************************/ |
| 31 |
|
| 32 |
#ifndef CAMLIBS_KODAK_DC3200_LIBRARY_H |
| 33 |
#define CAMLIBS_KODAK_DC3200_LIBRARY_H |
| 34 |
|
| 35 |
#include <gphoto2/gphoto2-camera.h> |
| 36 |
|
| 37 |
/* retries */ |
| 38 |
#define READ_RETRIES 2 |
| 39 |
#define ACK_RETRIES 2 |
| 40 |
#define SEND_RETRIES 4 |
| 41 |
|
| 42 |
/* packet sizes */ |
| 43 |
#define DEF_PACKET_LEN 256 |
| 44 |
#define ACK_PACKET_LEN 2 |
| 45 |
#define INI_PACKET_LEN 3 |
| 46 |
|
| 47 |
/* command types */ |
| 48 |
#define SETBAUD1 0xAF |
| 49 |
#define SETBAUD2 0x9F |
| 50 |
#define PING 0xCF |
| 51 |
#define COMMAND 0x01 |
| 52 |
|
| 53 |
/* dc3200 baud rate values |
| 54 |
* |
| 55 |
* baud baudcode(ask) baudcode2(confirm) |
| 56 |
* 9600 0x00 -- |
| 57 |
* 19200 0x01 0x01 |
| 58 |
* 38400 0x03 0x02 |
| 59 |
* 57600 0x07 0x04 |
| 60 |
* 115200 0x0F 0x08 |
| 61 |
* |
| 62 |
* except for 9600, baudcode = (baudcode2 + 1) / 2 |
| 63 |
* |
| 64 |
*/ |
| 65 |
#define C9600 0x00 |
| 66 |
#define C19200 0x01 |
| 67 |
#define C38400 0x03 |
| 68 |
#define C57600 0x07 |
| 69 |
#define C115200 0x0F |
| 70 |
|
| 71 |
int dc3200_set_speed(Camera *camera, int baudrate); |
| 72 |
int dc3200_setup(Camera *camera); |
| 73 |
|
| 74 |
int dc3200_get_data(Camera *camera, unsigned char **data, unsigned long *data_len, int command, const char *folder, const char *filename); |
| 75 |
int dc3200_cancel_get_data(Camera *camera); |
| 76 |
|
| 77 |
int dc3200_send_command(Camera *camera, unsigned char *cmd, int cmd_len, unsigned char *ack, int *ack_len); |
| 78 |
int dc3200_recv_response(Camera *camera, unsigned char *resp, int *resp_len); |
| 79 |
|
| 80 |
int dc3200_send_packet(Camera *camera, unsigned char *data, int data_len); |
| 81 |
int dc3200_recv_packet(Camera *camera, unsigned char *data, int *data_len); |
| 82 |
|
| 83 |
int dc3200_compile_packet(Camera *camera, unsigned char **data, int *data_len); |
| 84 |
int dc3200_process_packet(Camera *camera, unsigned char *data, int *data_len); |
| 85 |
|
| 86 |
int dc3200_send_ack(Camera *camera, int seqnum); |
| 87 |
int dc3200_check_ack(Camera *camera, unsigned char *ack, int ack_len); |
| 88 |
|
| 89 |
int dc3200_calc_checksum(Camera *camera, unsigned char *data, int data_len); |
| 90 |
int dc3200_calc_seqnum(Camera *camera); |
| 91 |
|
| 92 |
int dc3200_keep_alive(Camera *camera); |
| 93 |
int dc3200_clear_read_buffer(Camera *camera); |
| 94 |
|
| 95 |
int dump_buffer(unsigned char * buffer, int len, char *title, int bytesperline); |
| 96 |
unsigned long bytes_to_l(int a, int b, int c, int d); |
| 97 |
|
| 98 |
#endif /* !defined(CAMLIBS_KODAK_DC3200_LIBRARY_H) */ |