1 
2 /**
3   * @file     	IHaasUI.h
4   * @author   	HaasAI Group
5   * @version	V1.0.0
6   * @date    	2021-01-10
7   * @license  	GNU General Public License (GPL)
8   * @brief
9   * @attention
10   *  This file is part of HaasAI.                                \n
11   *  This program is free software; you can redistribute it and/or modify 		\n
12   *  it under the terms of the GNU General Public License version 3 as 		    \n
13   *  published by the Free Software Foundation.                               	\n
14   *  You should have received a copy of the GNU General Public License   		\n
15   *  along with HaasAI. If not, see <http://www.gnu.org/licenses/>.       			\n
16   *  Unless required by applicable law or agreed to in writing, software       	\n
17   *  distributed under the License is distributed on an "AS IS" BASIS,         	\n
18   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  	\n
19   *  See the License for the specific language governing permissions and     	\n
20   *  limitations under the License.   											\n
21   *   																			\n
22   * @htmlonly
23   * <span style="font-weight: bold">History</span>
24   * @endhtmlonly
25   * Version|Author|Date|Describe
26   * ------|----|------|--------
27   * V1.0|HaasAI Group|2021-01-10|Create File
28   * <h2><center>&copy;COPYRIGHT 2021 WELLCASA All Rights Reserved.</center></h2>
29   */
30 #ifndef IHAAS_UI_H
31 #define IHAAS_UI_H
32 
33 #include "string.h"
34 #include "base/include/base/HaasCommonImage.h"
35 #include "base/include/base/HaasUIDef.h"
36 
37 /**
38 * @brief Haas UI Control Class
39 * @author HaasAI Group
40 */
41 class IHaasUI
42 {
43 public:
~IHaasUI()44 	virtual ~IHaasUI(){}
45 
46 	/**
47 		* @brief		Get display device width
48 		* @note
49 		* @return
50 		*	 !0 successfully \n
51 		*	 -1 failed \n
52 		* @par Sample
53 		* @code
54 		*	IHaasUI * mHaasUI = NULL;
55 		*	mHaasUI = IHaasUIInstance();
56 		*	res_ res = 0;
57 		*   res = mHaasUI->GetDisplayWidth();
58 		* @endcode
59 		*/
60 	virtual int GetDisplayWidth() = 0;
61 	/**
62 		* @brief		Get display device height
63 		* @note
64 		* @return
65 		*	 !0 successfully \n
66 		*	 -1 failed \n
67 		* @par Sample
68 		* @code
69 		*	IHaasUI * mHaasUI = NULL;
70 		*	mHaasUI = IHaasUIInstance();
71 		*	res_ res = 0;
72 		*   res = mHaasUI->GetDisplayHeight();
73 		* @endcode
74 		*/
75 	virtual int GetDisplayHeight() = 0;
76 
77 	/**
78 		* @brief		Get display device backlight value
79 		* @note
80 		* @return
81 		*	 !0 successfully \n
82 		*	 -1 failed \n
83 		* @par Sample
84 		* @code
85 		*	IHaasUI * mHaasUI = NULL;
86 		*	mHaasUI = IHaasUIInstance();
87 		*	res_ res = 0;
88 		*   res = mHaasUI->GetDisplayBacklight();
89 		* @endcode
90 		*/
91 	virtual int GetDisplayBacklight() = 0;
92 	/**
93 		* @brief		Set display device backlight value
94 		* @param[in]    value:backlight value
95 		* @note
96 		* @return
97 		*	 !0 successfully \n
98 		*	 -1 failed \n
99 		* @par Sample
100 		* @code
101 		*	IHaasUI * mHaasUI = NULL;
102 		*	mHaasUI = IHaasUIInstance();
103 		*	int res = 0;
104         *	int32_t value = xx;
105 		*   res = mHaasUI->SetDisplayBacklight(value);
106 		* @endcode
107 		*/
108 	virtual int SetDisplayBacklight(int32_t value) = 0;
109 
110 	/**
111 		* @brief		Get display device type
112 		* @note
113 		* @return
114 		*	 !0 successfully \n
115 		*	 -1 failed \n
116 		* @par Sample
117 		* @code
118 		*	IHaasUI * mHaasUI = NULL;
119 		*	mHaasUI = IHaasUIInstance();
120 		*	res_ res = 0;
121 		*   res = mHaasUI->GetDisplayType();
122 		* @endcode
123 		*/
124 	virtual int GetDisplayType() = 0;
125 
126 	/**
127 		* @brief		Get display device freq
128 		* @note
129 		* @return
130 		*	 !0 successfully \n
131 		*	 -1 failed \n
132 		* @par Sample
133 		* @code
134 		*	IHaasUI * mHaasUI = NULL;
135 		*	mHaasUI = IHaasUIInstance();
136 		*	res_ res = 0;
137 		*   res = mHaasUI->GetDisplayFreq();
138 		* @endcode
139 		*/
140 	virtual int GetDisplayFreq() = 0;
141 	/**
142 		* @brief		Set display device freq
143 		* @param[in]    freq:display device freq
144 		* @note
145 		* @return
146 		*	 !0 successfully \n
147 		*	 -1 failed \n
148 		* @par Sample
149 		* @code
150 		*	IHaasUI * mHaasUI = NULL;
151 		*	mHaasUI = IHaasUIInstance();
152 		*	int res = 0;
153         *	int32_t freq = xx;
154 		*   res = mHaasUI->SetDisplayFreq(freq);
155 		* @endcode
156 		*/
157 	virtual int SetDisplayFreq(int32_t freq) = 0;
158 
159 	/**
160 		* @brief		Draw a point on screen
161 		* @param[in]    pt: the point position
162 		* @param[in]    color: point color
163 		* @note
164 		* @return
165 		*	 !0 successfully \n
166 		*	 -1 failed \n
167 		* @par Sample
168 		* @code
169 		*	IHaasUI * mHaasUI = NULL;
170 		*	mHaasUI = IHaasUIInstance();
171 		*	int res = 0;
172         *   Point_t point;
173         *   point.x = 10;
174         *   point.y = 20;
175         *	int32_t color = xx;
176 		*   res = mHaasUI->DrawPoint(&point, color);
177 		* @endcode
178 		*/
179     virtual int DrawPoint(Point_t *pt, int32_t color) = 0;
180 	/**
181 		* @brief		Draw a line on screen
182 		* @param[in]    start: start point position
183 		* @param[in]    end: stop point position
184 		* @param[in]    color: point color
185 		* @note
186 		* @return
187 		*	 !0 successfully \n
188 		*	 -1 failed \n
189 		* @par Sample
190 		* @code
191 		*	IHaasUI * mHaasUI = NULL;
192 		*	mHaasUI = IHaasUIInstance();
193 		*	int res = 0;
194         *   Point_t start;
195         *   start.x = 10;
196         *   start.y = 20;
197         *   Point_t end;
198         *   end.x = 10;
199         *   end.y = 20;
200         *	int32_t color = xx;
201 		*   res = mHaasUI->DrawLine(&start, &end, color);
202 		* @endcode
203 		*/
204     virtual int DrawLine(Point_t *start, Point_t *end, int32_t color) = 0;
205 	/**
206 		* @brief		Draw a Rectangle on screen
207 		* @param[in]    left: Rectangle left
208 		* @param[in]    top: Rectangle top
209 		* @param[in]    right: Rectangle right
210 		* @param[in]    bottom: Rectangle bottom
211 		* @param[in]    color: point color
212 		* @note
213 		* @return
214 		*	 !0 successfully \n
215 		*	 -1 failed \n
216 		* @par Sample
217 		* @code
218 		*	IHaasUI * mHaasUI = NULL;
219 		*	mHaasUI = IHaasUIInstance();
220 		*	int res = 0;
221         *	int32_t left = 10;
222         *	int32_t top = 10;
223         *	int32_t right = 50;
224         *	int32_t bottom = 100;
225         *	int32_t color = xx;
226 		*   res = mHaasUI->DrawRectangle(left, top, right, bottom, color);
227 		* @endcode
228 		*/
229     virtual int DrawRectangle(int32_t left, int32_t top, int32_t right, int32_t bottom,
230             int32_t color) = 0;
231 	/**
232 		* @brief		Draw a circle on screen
233 		* @param[in]    center: circle point
234 		* @param[in]    radius: circle radius
235 		* @param[in]    color: point color
236 		* @note
237 		* @return
238 		*	 !0 successfully \n
239 		*	 -1 failed \n
240 		* @par Sample
241 		* @code
242 		*	IHaasUI * mHaasUI = NULL;
243 		*	mHaasUI = IHaasUIInstance();
244 		*	int res = 0;
245         *	Point_t point;
246         *	point.x = 10;
247         *	point.y = 50;
248         *	int32_t radius = 100;
249         *	int32_t color = xx;
250 		*   res = mHaasUI->DrawCircle(&point, radius, color);
251 		* @endcode
252 		*/
253     virtual int DrawCircle(Point_t * center, int32_t radius, int32_t color) = 0;
254 	/**
255 		* @brief		Draw a String on screen
256 		* @param[in]    text: String value
257 		* @param[in]    size: String size
258 		* @param[in]    color: point color
259 		* @param[in]    left: Rectangle left
260 		* @param[in]    top: Rectangle top
261 		* @param[in]    right: Rectangle right
262 		* @param[in]    bottom: Rectangle bottom
263 		* @note
264 		* @return
265 		*	 !0 successfully \n
266 		*	 -1 failed \n
267 		* @par Sample
268 		* @code
269 		*	IHaasUI * mHaasUI = NULL;
270 		*	mHaasUI = IHaasUIInstance();
271         *	char* text = "for test"
272         *	int32_t size = 10;
273         *	int32_t color = xx;
274 		*	int res = 0;
275         *	int32_t left = 10;
276         *	int32_t top = 10;
277         *	int32_t right = 50;
278         *	int32_t bottom = 100;
279 		*   res = mHaasUI->DrawText(text, size, color, left, top, right, bottom);
280 		* @endcode
281 		*/
282     virtual void DrawText(char* text, int32_t size, int32_t color, int32_t left,
283             int32_t top, int32_t right, int32_t bottom) = 0;
284 	/**
285 		* @brief		Draw Pixel on screen
286 		* @param[in]    pixles: data address
287 		* @param[in]    pt: pixles draw position
288 		* @param[in]    width: draw width
289 		* @param[in]    height: draw height
290 		* @note
291 		* @return
292 		*	 !0 successfully \n
293 		*	 -1 failed \n
294 		* @par Sample
295 		* @code
296 		*	IHaasUI * mHaasUI = NULL;
297 		*	mHaasUI = IHaasUIInstance();
298 		*	int res = 0;
299         *	int32_t* pixels = address;
300         *	Point_t point;
301         *	point.x = 10;
302         *	point.y = 50;
303         *	int32_t width = 100;
304         *	int32_t height = 200;
305 		*   res = mHaasUI->DrawCircle(pixels, &point, width, heigt);
306 		* @endcode
307 		*/
308     virtual bool DrawPixels(int32_t* pixels, Point_t *pt, int32_t width, int32_t height) = 0;
309 	/**
310 		* @brief		Draw a image on screen
311 		* @param[in]    path: image path
312 		* @param[in]    pt: pixles draw position
313 		* @param[in]    width: draw width
314 		* @param[in]    height: draw height
315 		* @note
316 		* @return
317 		*	 !0 successfully \n
318 		*	 -1 failed \n
319 		* @par Sample
320 		* @code
321 		*	IHaasUI * mHaasUI = NULL;
322 		*	mHaasUI = IHaasUIInstance();
323 		*	int res = 0;
324         *	char* path = "/data/HaasAI/test.jpg";
325         *	Point_t point;
326         *	point.x = 10;
327         *	point.y = 50;
328         *	int32_t width = 100;
329         *	int32_t height = 200;
330 		*   res = mHaasUI->DrawCircle(path, &point, width, heigt);
331 		* @endcode
332 		*/
333     virtual bool DrawImage(char * path, Point_t *pt, int32_t width, int32_t height) = 0;
334 
335 	/**
336 		* @brief		update Displat Content
337 		* @note
338 		* @return
339 		*	 always successfully \n
340 		* @par Sample
341 		* @code
342 		*	IHaasUI * mHaasUI = NULL;
343 		*	mHaasUI = IHaasUIInstance();
344 		*	res_ res = 0;
345 		*   res = mHaasUI->UpdateDisplay();
346 		* @endcode
347 		*/
348 	virtual void UpdateDisplay() = 0;
349 };
350 
351 extern "C" {
352 	/**
353 		* @brief		Get HaasUI Instance
354 		* @param[in]    type: UIFrameworkType_t
355 		* @note	        NULL
356 		* @return
357 		*	 !0  successfully \n
358 		*	NULL failed \n
359 		* @par Sample
360 		* @code
361 		*	IHaasUI * mHaasUI = NULL;
362 		*	mHaasUI = IHaasUIInstance();
363 		* @endcode
364 		*/
365 IHaasUI* IHaasUIInstance(UIFrameworkType_t type);
366 }
367 #endif
368