aboutsummaryrefslogtreecommitdiffstats
path: root/o3000.h
blob: 17aa6a5585b414eb4d1796d3a4fe8e53841c7c76 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/**
* @file			o3000.h
* @brief		O-3000 Camera driver API
* @author		Patrick Brunner - brunner@stettbacher.ch
* @author		Patrick Roth - roth@stettbacher.ch
* @version		1.1
* @date			2016-03-01
* @copyright	2012-2016 Stettbacher Signal Processing AG
* 
* @remarks
*
* <PRE>
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* </PRE>
*
*/

#ifndef _O3000_H
#define _O3000_H

#include "o3000_portable.h"
#include "image_header.h"


#define O3000_VID	0x0483			///< O3000 vendor ID
#define O3000_PID	0xA098			///< O3000 product ID

/*
 * All possible error codes
 */
#define O3000_SUCCESS						0 				///< success (no error)
#define O3000_ERROR_NOCALLBACK				-1				///< one or more callback functions are missing
#define O3000_ERROR_NOMEM					-2				///< failed to allocate memory
#define O3000_ERROR_NODEV					-3				///< device not found
#define O3000_ERROR_NO_FREE_SESSION			-4				///< all session are in used
#define O3000_ERROR_INVALID_SESSION_ID		-5				///< session ID is invalid
#define O3000_ERROR_ACCESS					-6				///< user has insufficient permissions
#define O3000_ERROR_BUSY					-7				///< another program or driver has claimed the device
#define O3000_ERROR_DRV_NOT_CONNECTED		-8				///< O-3000 driver is not running (call o3000_connect() first)
#define O3000_ERROR_XML_XFER_RUNNING		-9				///< XML transfer to device in progress
#define O3000_ERROR_USB_TRANSFER_TIMEOUT	-10				///< USB transfer timeout
#define O3000_ERROR_USB_EP_HALTED			-11				///< USB endpoint halted
#define O3000_ERROR_LESS_DATA				-12				///< USB received less data than expected
#define O3000_ERROR_NOT_VALID_ARGUMENT		-13				///< at least one function argument is not valid
#define O3000_ERROR_SESSION_STILL_OPEN		-14				///< there is at least one session still open
#define O3000_ERROR_BOOTLOADER_TIMEOUT		-15				///< camera could not start in bootloader mode in given time
#define O3000_ERROR_USB_INIT_FAILURE		-16				///< failed to initialize the usb

#define O3000_ERROR_OTHER					-1000			///< other (unspecified) error


/*
 * All possible logging levels (don't touch it!!)
 */
#define	O3000_LOG_NONE			0		///< nothing is logged
#define	O3000_LOG_ERROR			1		///< error message (top priority log message)
#define	O3000_LOG_WARNING		2 		///< warning message
#define O3000_LOG_INFO			3		///< info message
#define O3000_LOG_DEBUG			4		///< debug message
#define O3000_LOG_VERBOSE		5		///< verbose debug message, libusb is debugging too (lowest priority log message)


#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif


int __stdcall o3000_init(int vid, int pid, unsigned int video_cache_size,
						 void __stdcall (*xml_cb)(int id, char* buf, int len),
						 void __stdcall (*video_cb)(int id, unsigned char* buf, struct img_header_t* img_header),
						 void __stdcall (*log_cb)(int id, char* msg),
						 int loglevel);

void __stdcall o3000_exit(int id);

int __stdcall o3000_get_num_cam(void);
int __stdcall o3000_device_discovery(int id);
int __stdcall o3000_connect(int id, int device_nr, char *config_msg, int config_msg_len);
int __stdcall o3000_disconnect(int id);

int __stdcall o3000_send_xml(int id, const char *msg, int msg_len);

int __stdcall o3000_firmware_upgrade(unsigned char *data, int data_len);

#if defined(__cplusplus) || defined(c_plusplus)
} // extern "C"
#endif

#endif // _O3000_H