1 /*
2 * Copyright (c) 2022 HiSilicon (Shanghai) Technologies CO., LIMITED.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15 #include "higv_cextfile.h"
16 #include "sample_utils.h"
17 #include "hi_gv_parser.h"
18
19 #ifdef __cplusplus
20 #if __cplusplus
21 extern "C" {
22 #endif
23 #endif /* __cplusplus */
24
25 #define TIMER_SPEED (3000)
26
27 static HI_U32 g_timerId = 1;
28
BUTTON_WIN_Onrefresh(HIGV_HANDLE widget,HI_PARAM wParam,HI_PARAM lParam)29 HI_S32 BUTTON_WIN_Onrefresh(HIGV_HANDLE widget, HI_PARAM wParam, HI_PARAM lParam)
30 {
31 HIGV_UNUSED(wParam);
32 HIGV_UNUSED(lParam);
33
34 HI_S32 ret = HI_GV_Timer_Create(widget, g_timerId, TIMER_SPEED);
35 HIGV_CHECK("HI_GV_Timer_Create", ret);
36
37 ret = HI_GV_Timer_Start(widget, g_timerId);
38 HIGV_CHECK("HI_GV_Timer_Start", ret);
39
40 return HIGV_PROC_GOON;
41 }
42
BUTTON_WIN_Ontimer(HIGV_HANDLE widget,HI_PARAM wParam,HI_PARAM lParam)43 HI_S32 BUTTON_WIN_Ontimer(HIGV_HANDLE widget, HI_PARAM wParam, HI_PARAM lParam)
44 {
45 HIGV_UNUSED(widget);
46 HIGV_UNUSED(wParam);
47 HIGV_UNUSED(lParam);
48
49 HI_U32 ret = (HI_U32)HI_GV_PARSER_LoadViewById(LABEL_WIN);
50 ret |= (HI_U32)HI_GV_Widget_Show(LABEL_WIN);
51 ret |= (HI_U32)HI_GV_Widget_Active(LABEL_WIN);
52 ret |= (HI_U32)HI_GV_Widget_Hide(BUTTON_WIN);
53
54 HIGV_CHECK("HI_GV_Widget_Show", ret);
55
56 return HIGV_PROC_GOON;
57 }
58
BUTTON_WIN_Onhide(HIGV_HANDLE widget,HI_PARAM wParam,HI_PARAM lParam)59 HI_S32 BUTTON_WIN_Onhide(HIGV_HANDLE widget, HI_PARAM wParam, HI_PARAM lParam)
60 {
61 HIGV_UNUSED(wParam);
62 HIGV_UNUSED(lParam);
63
64 HI_U32 ret = (HI_U32)HI_GV_Timer_Stop(widget, g_timerId);
65 ret |= (HI_U32)HI_GV_Timer_Destroy(widget, g_timerId);
66
67 HIGV_CHECK("HI_GV_Timer_Destory", ret);
68
69 return HIGV_PROC_GOON;
70 }
71
72 #ifdef __cplusplus
73 #if __cplusplus
74 }
75 #endif
76 #endif /* __cplusplus */
77