Fawkes API
Fawkes Development Version
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
All
Classes
Namespaces
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
comm_thread.h
1
2
/***************************************************************************
3
* comm_thread.h - Fawkes RefBox Communication Thread
4
*
5
* Created: Sun Apr 19 13:10:29 2009
6
* Copyright 2009 Tim Niemueller [www.niemueller.de]
7
*
8
****************************************************************************/
9
10
/* This program is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation; either version 2 of the License, or
13
* (at your option) any later version.
14
*
15
* This program is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU Library General Public License for more details.
19
*
20
* Read the full text in the LICENSE.GPL file in the doc directory.
21
*/
22
23
#ifndef __PLUGINS_REFBOXCOMM_COMM_THREAD_H_
24
#define __PLUGINS_REFBOXCOMM_COMM_THREAD_H_
25
26
#include "processor/state_handler.h"
27
28
#include <core/threading/thread.h>
29
#include <aspect/blocked_timing.h>
30
#include <aspect/logging.h>
31
#include <aspect/configurable.h>
32
#include <aspect/blackboard.h>
33
#include <aspect/blocked_timing.h>
34
35
namespace
fawkes {
36
class
GameStateInterface;
37
class
SwitchInterface;
38
#ifdef HAVE_SPL
39
class
SoccerPenaltyInterface;
40
#endif
41
}
42
43
class
RefBoxProcessor
;
44
45
class
RefBoxCommThread
46
:
public
fawkes::Thread
,
47
public
fawkes::BlockedTimingAspect
,
48
public
fawkes::LoggingAspect
,
49
public
fawkes::ConfigurableAspect
,
50
public
fawkes::BlackBoardAspect
,
51
public
RefBoxStateHandler
52
{
53
public
:
54
RefBoxCommThread
();
55
56
virtual
void
init
();
57
virtual
void
finalize
();
58
virtual
void
loop
();
59
60
// RefBoxStateHandler
61
virtual
void
set_gamestate
(
int
game_state,
62
fawkes::worldinfo_gamestate_team_t
state_team);
63
virtual
void
set_score
(
unsigned
int
score_cyan,
unsigned
int
score_magenta);
64
virtual
void
set_team_goal
(
fawkes::worldinfo_gamestate_team_t
our_team,
65
fawkes::worldinfo_gamestate_goalcolor_t
goal_color);
66
virtual
void
set_half
(
fawkes::worldinfo_gamestate_half_t
half,
bool
kickoff);
67
virtual
void
add_penalty
(
unsigned
int
penalty,
68
unsigned
int
seconds_remaining);
69
70
virtual
void
handle_refbox_state
();
71
72
/** Stub to see name in backtrace for easier debugging. @see Thread::run() */
73
protected
:
virtual
void
run
() {
Thread::run
(); }
74
75
private
:
/* methods */
76
77
private
:
/* members */
78
fawkes::GameStateInterface
*__gamestate_if;
79
#ifdef HAVE_SPL
80
fawkes::SoccerPenaltyInterface
*__penalty_if;
81
#endif
82
RefBoxProcessor
*__refboxproc;
83
84
bool
__gamestate_modified;
85
int
__last_gamestate;
86
fawkes::worldinfo_gamestate_half_t
__last_half;
87
bool
__kickoff;
88
unsigned
int
__last_score_cyan;
89
unsigned
int
__last_score_magenta;
90
fawkes::worldinfo_gamestate_team_t
__our_team;
91
fawkes::worldinfo_gamestate_goalcolor_t
__our_goal_color;
92
unsigned
int
__team_number;
93
unsigned
int
__player_number;
94
95
bool
__cfg_beep_on_change;
96
float
__cfg_beep_frequency;
97
float
__cfg_beep_duration;
98
fawkes::SwitchInterface
*__beep_if;
99
};
100
101
102
#endif
src
plugins
refboxcomm
comm_thread.h
Generated by
1.8.1.2