|
| 1 | +/* -------------------------------------------------------------- |
| 2 | +Project: ATP(A Tentative Plan) 3 |
| 3 | +Purpose: |
| 4 | +Author: Ho-Jung Kim (godmode2k@hotmail.com) |
| 5 | +Date: Since Dec 2, 2014 |
| 6 | +Filename: incl_timer_handler.cxx |
| 7 | +
|
| 8 | +Last modified: Jun 2, 2015 |
| 9 | +License: |
| 10 | +
|
| 11 | +* |
| 12 | +* Copyright (C) 2014 Ho-Jung Kim (godmode2k@hotmail.com) |
| 13 | +* |
| 14 | +* Licensed under the Apache License, Version 2.0 (the "License"); |
| 15 | +* you may not use this file except in compliance with the License. |
| 16 | +* You may obtain a copy of the License at |
| 17 | +* |
| 18 | +* http://www.apache.org/licenses/LICENSE-2.0 |
| 19 | +* |
| 20 | +* Unless required by applicable law or agreed to in writing, software |
| 21 | +* distributed under the License is distributed on an "AS IS" BASIS, |
| 22 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 23 | +* See the License for the specific language governing permissions and |
| 24 | +* limitations under the License. |
| 25 | +* |
| 26 | +----------------------------------------------------------------- |
| 27 | +Note: |
| 28 | + - DO NOT INCLUDE "incl_timer_handler.hxx" here |
| 29 | +----------------------------------------------------------------- |
| 30 | +1. Build: |
| 31 | + $ g++ ... -D__LINUX__ -D_REENTRANT -lpthread -lrt \ |
| 32 | + `pkg-config --cflags --libs gtk+-2.0 libglade-2.0` |
| 33 | + or |
| 34 | + `pkg-config --cflags --libs gtk+-3.0 libglade-2.0` |
| 35 | +
|
| 36 | +TODO: |
| 37 | + - |
| 38 | +-------------------------------------------------------------- */ |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | +//! Header |
| 43 | +// --------------------------------------------------------------- |
| 44 | +// --------------------------------------------------------------- |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | +//! Definition |
| 49 | +// --------------------------------------------------------------- |
| 50 | +// --------------------------------------------------------------- |
| 51 | + |
| 52 | + |
| 53 | + |
| 54 | +//! Prototype |
| 55 | +// --------------------------------------------------------------- |
| 56 | +// --------------------------------------------------------------- |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | +//! Class |
| 61 | +// --------------------------------------------------------------- |
| 62 | +// --------------------------------------------------------------- |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | +//! Implementation |
| 67 | +// --------------------------------------------------------------- |
| 68 | + |
| 69 | + |
| 70 | +// class Cxxx |
| 71 | +CTimerHandler::CTimerHandler(void) : TAG("CTimerHandler") { |
| 72 | + //__LOGT__( TAG, "CTimerHandler()" ); |
| 73 | +} |
| 74 | + |
| 75 | +CTimerHandler::~CTimerHandler(void) { |
| 76 | + //__LOGT__( TAG, "~CTimerHandler()" ); |
| 77 | +} |
| 78 | + |
| 79 | +void CTimerHandler::__init(void) { |
| 80 | + //__LOGT__( TAG, "__init()" ); |
| 81 | + |
| 82 | + //m_update = false; |
| 83 | +} |
| 84 | + |
| 85 | +void CTimerHandler::__release(void) { |
| 86 | + //__LOGT__( TAG, "__release()" ); |
| 87 | +} |
| 88 | + |
| 89 | +void CTimerHandler::task_in_thread(void* user_data) { |
| 90 | + //__LOGT__( TAG, "task_in_thread()" ); |
| 91 | + |
| 92 | + |
| 93 | + goto _RELEASE; |
| 94 | + |
| 95 | +/* |
| 96 | + { |
| 97 | + CAtp3* main = NULL; |
| 98 | + CViewMain* view = NULL; |
| 99 | + |
| 100 | +
|
| 101 | + main = (CAtp3*)user_data; |
| 102 | + if ( !main ) { |
| 103 | + __LOGT__( TAG, "task_in_thread(): Main object == NULL" ); |
| 104 | + goto _RELEASE; |
| 105 | + } |
| 106 | + //__LOGT__( TAG, "task_in_thread(): Main object = %p, TAG = %s", main, main->get_tag() ); |
| 107 | +
|
| 108 | + view = main->get_view_main(); |
| 109 | + if ( !view ) { |
| 110 | + __LOGT__( TAG, "task_in_thread(): MainView object == NULL" ); |
| 111 | + goto _RELEASE; |
| 112 | + } |
| 113 | + //__LOGT__( TAG, "task_in_thread(): MainView object = %p, TAG = %s", view, view->get_tag() ); |
| 114 | +
|
| 115 | +
|
| 116 | + while ( 1 ) { |
| 117 | + //__LOGT__( TAG, "task_in_thread(): waiting..." ); |
| 118 | +
|
| 119 | + // Interrupt |
| 120 | + if ( get_cancel_state() ) break; |
| 121 | +
|
| 122 | +
|
| 123 | + // Update |
| 124 | + if ( view->get_attach_animstask_update() ) { |
| 125 | + //__LOGT__( TAG, "task_in_thread(): redraw..." ); |
| 126 | + //view->invalidate(); |
| 127 | +
|
| 128 | +
|
| 129 | + Widgets_st* widget = main->get_widget_st(); |
| 130 | +
|
| 131 | + if ( !widget ) { |
| 132 | + __LOGT__( TAG, "task_in_thread(): Widget object == NULL" ); |
| 133 | + break; |
| 134 | + } |
| 135 | + if ( !widget->pDrawingArea ) { |
| 136 | + __LOGT__( TAG, "task_in_thread(): DrawingArea object == NULL" ); |
| 137 | + break; |
| 138 | + } |
| 139 | +
|
| 140 | + if ( !GTK_IS_WIDGET(widget->pDrawingArea) ) |
| 141 | + __LOGT__( TAG, "task_in_thread(): DrawingArea == widget [FALSE]" ); |
| 142 | +
|
| 143 | +
|
| 144 | + print_datetime_d(); |
| 145 | + gtk_widget_queue_draw( widget->pDrawingArea ); |
| 146 | + } |
| 147 | +
|
| 148 | +
|
| 149 | + // Latency |
| 150 | + __usleep( TIMER_HANDLER_LATENCY ); |
| 151 | + } |
| 152 | + } |
| 153 | +*/ |
| 154 | + |
| 155 | + |
| 156 | + |
| 157 | +_RELEASE: |
| 158 | + __usleep( TIMER_HANDLER_LATENCY_OUTER ); |
| 159 | + stop(); |
| 160 | +} |
| 161 | +// --------------------------------------------------------------- |
| 162 | + |
0 commit comments