Perception Tool Kit (PTK) API Guide
c/dbconfig.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) 2018 Texas Instruments Incorporated
4  *
5  * All rights reserved not granted herein.
6  *
7  * Limited License.
8  *
9  * Texas Instruments Incorporated grants a world-wide, royalty-free, non-exclusive
10  * license under copyrights and patents it now or hereafter owns or controls to make,
11  * have made, use, import, offer to sell and sell ("Utilize") this software subject to the
12  * terms herein. With respect to the foregoing patent license, such license is granted
13  * solely to the extent that any such patent is necessary to Utilize the software alone.
14  * The patent license shall not apply to any combinations which include this software,
15  * other than combinations with devices manufactured by or for TI ("TI Devices").
16  * No hardware patent is licensed hereunder.
17  *
18  * Redistributions must preserve existing copyright notices and reproduce this license
19  * (including the above copyright notice and the disclaimer and (if applicable) source
20  * code license limitations below) in the documentation and/or other materials provided
21  * with the distribution
22  *
23  * Redistribution and use in binary form, without modification, are permitted provided
24  * that the following conditions are met:
25  *
26  * * No reverse engineering, decompilation, or disassembly of this software is
27  * permitted with respect to any software provided in binary form.
28  *
29  * * any redistribution and use are licensed by TI for use only with TI Devices.
30  *
31  * * Nothing shall obligate TI to provide you with source code for the software
32  * licensed and provided to you in object code.
33  *
34  * If software source code is provided to you, modification and redistribution of the
35  * source code are permitted provided that the following conditions are met:
36  *
37  * * any redistribution and use of the source code, including any resulting derivative
38  * works, are licensed by TI for use only with TI Devices.
39  *
40  * * any redistribution and use of any object code compiled from the source code
41  * and any resulting derivative works, are licensed by TI for use only with TI Devices.
42  *
43  * Neither the name of Texas Instruments Incorporated nor the names of its suppliers
44  *
45  * may be used to endorse or promote products derived from this software without
46  * specific prior written permission.
47  *
48  * DISCLAIMER.
49  *
50  * THIS SOFTWARE IS PROVIDED BY TI AND TI'S LICENSORS "AS IS" AND ANY EXPRESS
51  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
52  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
53  * IN NO EVENT SHALL TI AND TI'S LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT,
54  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
55  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
56  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
57  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
58  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
59  * OF THE POSSIBILITY OF SUCH DAMAGE.
60  *
61  */
62 #ifndef PTK_C_DBCONFIG_H
63 #define PTK_C_DBCONFIG_H
64 
78 #ifdef __cplusplus
79 extern "C" {
80 #endif
81 
82 #include <stdint.h>
83 #include <stdlib.h>
84 
86 
87 #define DBCONFIG_MAX_PATH_LEN (4096U)
88 
89 /*
90  * \brief Maximum word length. Words are tags, folder names, file names, etc.
91  *
92  * \ingroup group_ptk_db_config
93  */
94 #define DBCONFIG_MAX_WORD_LEN (256U)
95 
101 #define DBCONFIG_MAX_NUM_SENSORS (20U)
102 
108 #define DBCONFIG_MAX_NUM_OUTPUTS (10U)
109 
116 #define DBCONFIG_MAX_DESC_FILES (10U)
117 
123 typedef enum dbconfig_sensor_type_e
124 {
134 
136 
142 typedef struct dbconfig_sensor_t
143 {
145  char folder[DBCONFIG_MAX_WORD_LEN];
146 
148  PTK_DBConfig_SensorType type;
149 
151  char appTag[DBCONFIG_MAX_WORD_LEN];
152 
154 
160 typedef struct dbconfig_virtual_sensor_t
161 {
163  char folder[DBCONFIG_MAX_WORD_LEN];
164 
166  char appTag[DBCONFIG_MAX_WORD_LEN];
167 
170 
172  char parentSensorFolder[DBCONFIG_MAX_WORD_LEN];
173 
175  uint32_t dataType;
176 
178  uint32_t numDescFiles;
179 
182 
184 
190 typedef struct dbconfig_t
191 {
193  char databasePath[DBCONFIG_MAX_PATH_LEN];
194 
196  uint32_t dataSeqId;
197 
200 
202  uint32_t startFrame;
203 
205  uint32_t endFrame;
206 
208  uint32_t numFrames;
209 
210  /* INPUT SENSORS */
211 
213  uint32_t numSensors;
214 
217 
219  uint32_t numSensorsPerType[dbconfig_sensor_type_MAX];
220 
224  uint32_t numOutputs;
225 
228 
231 
232 } PTK_DBConfig;
233 
246 int32_t PTK_DBConfig_parse(PTK_DBConfig *config, const char *configFilePath);
247 
255 void PTK_DBConfig_print(PTK_DBConfig *config);
256 
269 int32_t PTK_DBConfig_exist_sensor_apptag(PTK_DBConfig *config, const char *appTag);
270 
283 int32_t PTK_DBConfig_exist_output_apptag(PTK_DBConfig *config, const char *appTag);
284 
285 #ifdef __cplusplus
286 }
287 #endif
288 
289 #endif
#define DBCONFIG_MAX_NUM_SENSORS
Maximum number of sensors per data sequence.
Definition: c/dbconfig.h:101
Definition: c/dbconfig.h:125
void PTK_DBConfig_print(PTK_DBConfig *config)
Print a config file via PTK_print()
Definition: sensor_types.h:72
int32_t PTK_DBConfig_exist_output_apptag(PTK_DBConfig *config, const char *appTag)
Check if an output with this apptag exists.
Definition: c/dbconfig.h:131
Database configuration.
Definition: c/dbconfig.h:190
uint32_t parentSensorSpecified
Definition: c/dbconfig.h:169
PTK_DBConfig_Sensor refSensor
Definition: c/dbconfig.h:199
Definition: c/dbconfig.h:128
#define DBCONFIG_MAX_PATH_LEN
Definition: c/dbconfig.h:87
Definition: sensor_types.h:75
uint32_t dataType
Definition: c/dbconfig.h:175
Definition: sensor_types.h:74
Definition: c/dbconfig.h:133
int32_t PTK_DBConfig_exist_sensor_apptag(PTK_DBConfig *config, const char *appTag)
Check if a sensor with this apptag exists.
uint32_t startFrame
Definition: c/dbconfig.h:202
#define DBCONFIG_MAX_WORD_LEN
Definition: c/dbconfig.h:94
#define DBCONFIG_MAX_NUM_OUTPUTS
Maximum number of virtual sensor outputs.
Definition: c/dbconfig.h:108
Definition: sensor_types.h:76
int32_t PTK_DBConfig_parse(PTK_DBConfig *config, const char *configFilePath)
Parse a config file to initialize the DBConfig struct.
Definition: sensor_types.h:77
uint32_t dataSeqId
Definition: c/dbconfig.h:196
Definition: c/dbconfig.h:126
PTK_DBConfig_SensorType type
Definition: c/dbconfig.h:148
Definition: sensor_types.h:78
Definition: sensor_types.h:71
Definition: sensor_types.h:79
Definition: c/dbconfig.h:129
Definition: c/dbconfig.h:130
uint32_t overwriteExistingData
Definition: c/dbconfig.h:230
uint32_t numOutputs
Definition: c/dbconfig.h:224
uint32_t numFrames
Definition: c/dbconfig.h:208
uint32_t numSensors
Definition: c/dbconfig.h:213
uint32_t numDescFiles
Definition: c/dbconfig.h:178
Virtual sensor output.
Definition: c/dbconfig.h:160
Definition: c/dbconfig.h:132
Definition: c/dbconfig.h:127
uint32_t endFrame
Definition: c/dbconfig.h:205
PTK_DBConfig_SensorType
Sensor type enumeration.
Definition: c/dbconfig.h:123
Sensor Input.
Definition: c/dbconfig.h:142
Definition: sensor_types.h:73
#define DBCONFIG_MAX_DESC_FILES
Maximum number of description text files that can be passed to create a virtual sensor.
Definition: c/dbconfig.h:116