blob: f5f7bdb7ae3e3e5f1417ba32e18fbcbb1cf8b9a6 [file] [log] [blame]
The Android Open Source Project7f81d9b2009-03-03 19:30:08 -08001/*
2 * Copyright (C) 2008 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef btk_SDK_EM_H
18#define btk_SDK_EM_H
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24/**
25 * Visual Sensing SDK
26 * SDK Context object
27 */
28
29/* ---- includes ----------------------------------------------------------- */
30
31#include "Types.h"
Marcus Oakland677f6692013-02-07 15:11:09 +000032#include <sys/types.h>
The Android Open Source Project7f81d9b2009-03-03 19:30:08 -080033
34/* ---- related objects --------------------------------------------------- */
35
36/** SDK context object */
37struct btk_SDK;
38
39/* ---- typedefs ----------------------------------------------------------- */
40
41/** handle for SDK context */
42typedef struct btk_SDK* btk_HSDK;
43
44/** malloc function pointer */
Marcus Oakland677f6692013-02-07 15:11:09 +000045typedef void* ( *btk_fpMalloc )( size_t sizeA );
The Android Open Source Project7f81d9b2009-03-03 19:30:08 -080046
47/** free function pointer */
48typedef void ( *btk_fpFree )( void* memPtrA );
49
50/** error handler function pointer */
51typedef void ( *btk_fpError )( btk_HSDK hsdkA );
52
53/** SDK creation parameters */
54typedef struct
55{
56 /** (optional) handler to error-handler function */
57 btk_fpError fpError;
58
59 /** handler to malloc function */
60 btk_fpMalloc fpMalloc;
61
62 /** handler to free function */
63 btk_fpFree fpFree;
64
65 /** pointer to preallocated exclusive (=persistent) memory (alternative to fpMalloc) */
66 void* pExMem;
67
68 /** size of external memory */
69 u32 sizeExMem;
70
71 /** pointer to preallocated shared memory (alternative to fpMalloc) */
72 void* pShMem;
73
74 /** size of external memory */
75 u32 sizeShMem;
76
77 /** pointer to 0-terminated license key string */
78 const char* licenseKey;
79
80 /** maximum image witdh used */
81 u32 maxImageWidth;
82
83 /** maximum image height used */
84 u32 maxImageHeight;
85
86} btk_SDKCreateParam;
87
88/* ---- constants ---------------------------------------------------------- */
89
90/* ---- functions ---------------------------------------------------------- */
91
92/** returns default SDK parameters */
93btk_DECLSPEC
94btk_SDKCreateParam btk_SDK_defaultParam( void );
95
96/** creates an SDK context using dynamic memory management */
97btk_DECLSPEC
98btk_Status btk_SDK_create( const btk_SDKCreateParam* pCreateParamA,
99 btk_HSDK* hpsdkA );
100
101/** closes an SDK context */
102btk_DECLSPEC
103btk_Status btk_SDK_close( btk_HSDK hsdkA );
104
105/** returns last occurred error and removes it from the error stack */
106btk_DECLSPEC
107btk_Error btk_SDK_getError( btk_HSDK hsdkA,
108 char* msgBufA,
109 u32 msgBufSizeA );
110
111/** returns amount of allocated exclusive memory in bytes */
112btk_DECLSPEC
113u32 btk_SDK_exAllocSize( btk_HSDK hsdkA );
114
115/** returns amount of allocated shared memory in bytes */
116btk_DECLSPEC
117u32 btk_SDK_shAllocSize( btk_HSDK hsdkA );
118
119/** returns total amount of allocated memory in bytes */
120btk_DECLSPEC
121u32 btk_SDK_allocSize( btk_HSDK hsdkA );
122
123#ifdef __cplusplus
124}
125#endif
126
127#endif /* btk_SDK_EM_H */