1 /** 2 * @file IHaasDataInput.h 3 * @author HaasAI Group 4 * @version V1.0.0 5 * @date 2021-01-10 6 * @license GNU General Public License (GPL) 7 * @brief Data input, for example:image.video file,camera ... 8 * @attention 9 * This file is part of HaasAI. \n 10 * This program is free software; you can redistribute it and/or modify \n 11 * it under the terms of the GNU General Public License version 3 as \n 12 * published by the Free Software Foundation. \n 13 * You should have received a copy of the GNU General Public License \n 14 * along with HaasAI.. If not, see <http://www.gnu.org/licenses/>. \n 15 * Unless required by applicable law or agreed to in writing, software \n 16 * distributed under the License is distributed on an "AS IS" BASIS, \n 17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. \n 18 * See the License for the specific language governing permissions and \n 19 * limitations under the License. \n 20 * \n 21 * @htmlonly 22 * <span style="font-weight: bold">History</span> 23 * @endhtmlonly 24 * Version|Author|Date|Describe 25 * ------|----|------|-------- 26 * V1.0|HaasAI Group|2021-01-10|Create File 27 * <h2><center>©COPYRIGHT 2021 WELLCASA All Rights Reserved.</center></h2> 28 */ 29 30 #ifndef IHAAS_DATA_INPUT_H 31 #define IHAAS_DATA_INPUT_H 32 33 #include "base/include/base/HaasDataInputDef.h" 34 /** 35 * @brief All Data input Class 36 * @author HaasAI Group 37 */ 38 class IHaasDataInput 39 { 40 public: ~IHaasDataInput()41 virtual ~IHaasDataInput(){} 42 /** 43 * @brief Open the dataSouce 44 * @param[in] filename : The Name of DataSource 45 * @note Notice that the filename is the full path. 46 * @return 47 * 0 successfully \n 48 * -1 failed \n 49 * @par Sample 50 * @code 51 * IHaasDataInput * mDataInput = NULL; 52 * mDataInput = IHaasDataInputInstance(); 53 * char* filename = "/data/HaasAI/testvideo.jpg" 54 * res_ res = 0; 55 * res = mDataInput->Open(filename); 56 * @endcode 57 */ 58 virtual int Open(char *filename) = 0; 59 /** 60 * @brief Open the Camera 61 * @param[in] cameraNum : the number of Camera 62 * @note Notice that 0 = Front Camera;1 = Back Camera. 63 * @return 64 * 0 successfully \n 65 * -1 failed \n 66 * @par Sample 67 * @code 68 * IHaasDataInput * mDataInput = NULL; 69 * mDataInput = IHaasDataInputInstance(); 70 * int cameraindex = 0 71 * res_ res = 0; 72 * res = mDataInput->Open(cameraindex); 73 * @endcode 74 */ 75 virtual int Open(int cameraNum) = 0; 76 /** 77 * @brief Close the Camera 78 * @note NULL 79 * @return 80 * 0 successfully \n 81 * -1 failed \n 82 * @par Sample 83 * @code 84 * IHaasDataInput * mDataInput = NULL; 85 * mDataInput = IHaasDataInputInstance(); 86 * res_ res = 0; 87 * res = mDataInput->Close(); 88 * @endcode 89 */ 90 virtual int Close() = 0; 91 /** 92 * @brief Check the data Ready state 93 * @note NULL 94 * @return 95 * 0 Ready \n 96 * -1 Not Ready \n 97 * @par Sample 98 * @code 99 * IHaasDataInput * mDataInput = NULL; 100 * mDataInput = IHaasDataInputInstance(); 101 * bool res = false; 102 * res = mDataInput->CheckDataReady(); 103 * @endcode 104 */ 105 virtual bool CheckDataReady() = 0; 106 /** 107 * @brief Request Source Data 108 * @param[in] image : image Struct include data information 109 * @param[in] timeout : set the timoutout value 110 * @note NULL 111 * @return 112 * 0 successfully \n 113 * -1 failed \n 114 * @par Sample 115 * @code 116 * ImageBuffer_t *image = NULL; 117 * IHaasDataInput * mDataInput = NULL; 118 * mDataInput = IHaasDataInputInstance(); 119 * res_ res = 0; 120 * res = mDataInput->RequestData(&image, 1000); 121 * @endcode 122 */ 123 virtual int RequestData(ImageBuffer_t** image, int32_t timeout) = 0; 124 /** 125 * @brief Release Source Data 126 * @param[in] image : image Struct include data information 127 * @note NULL 128 * @return 129 * 0 successfully \n 130 * -1 failed \n 131 * @par Sample 132 * @code 133 * IHaasDataInput * mDataInput = NULL; 134 * mDataInput = IHaasDataInputInstance(); 135 * res_ res = 0; 136 * res = mDataInput->ReleaseData(image, 1000); 137 * @endcode 138 */ 139 virtual int ReleaseData(ImageBuffer_t* image) = 0; 140 141 }; 142 143 extern "C" { 144 /** 145 * @brief Get HaasDataInput Instance 146 * @note NULL 147 * @return 148 * !0 successfully \n 149 * NULL failed \n 150 * @par Sample 151 * @code 152 * IHaasDataInput * mDataInput = NULL; 153 * mDataInput = IHaasDataInputInstance(); 154 * @endcode 155 */ 156 IHaasDataInput* IHaasDataInputInstance(DataInputType_t type); 157 } 158 159 #endif 160