3 * Copyright (c) 2006 acmesystems.it - john@acmesystems.it
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA02111-1307USA
19 * Feedback, Bugs... info@acmesystems.it
23 typedef struct _EVENT
{
27 typedef struct _EVENT_PARAM
{
32 typedef void (*STATE_ENTER
)(int state_last
, int event
, EVENT_PARAM
*param
);
33 typedef void (*STATE_LEAVE
)(int state_new
, int event
);
35 typedef struct _STATE
{
41 typedef struct _TRANSITION
{
47 // a = id, b = name, c = enter, d = leave
48 #define STATE_ADD(a, b, c, d) { \
49 if((a > 0) && (a < MAX_STATE_COUNT)){ \
50 states[a].name = strdup(b); \
51 states[a].enter = c; \
52 states[a].leave = d; \
56 // a = old, b = event, c = new
57 #define TRANSITION_ADD(a, b, c) { \
58 if((transition_count >= 0) && \
59 (transition_count < MAX_TRANSITION_COUNT)){ \
60 transitions[transition_count].old_state = a; \
61 transitions[transition_count].event = b; \
62 transitions[transition_count].new_state = c; \
68 #define EVENT_ADD(a, b) { \
69 if((a > 0) && (a < MAX_EVENT_COUNT)){ \
70 events[a].name = strdup(b); \
73 #define MAX_EVENT_COUNT 20
74 #define MAX_STATE_COUNT 20
75 #define MAX_TRANSITION_COUNT 60
77 #define MP3_STATE_NONE 0
78 #define MP3_STATE_STARTUP 1
79 #define MP3_STATE_IDLE 2
80 #define MP3_STATE_FILE_START 3
81 #define MP3_STATE_FILE_HANDLE 4
82 #define MP3_STATE_STREAM_START 5
83 #define MP3_STATE_STREAM_HANDLE 6
84 #define MP3_STATE_ERROR 7
85 #define MP3_STATE_SHUTDOWN 8
86 #define MP3_STATE_DEFAULT 9
88 #define MP3_EVENT_TIMEOUT 1
89 #define MP3_EVENT_FILE 2
90 #define MP3_EVENT_STREAM 3
91 #define MP3_EVENT_STOP 4
92 #define MP3_EVENT_ERROR 5
93 #define MP3_EVENT_SHUTDOWN 6
94 #define MP3_EVENT_END 7
96 #define MP3_EVENT_GENERIC_VOLUME 0
97 #define MP3_EVENT_GENERIC_STATE 1
98 #define MP3_EVENT_GENERIC_BASS 2
99 #define MP3_EVENT_GENERIC_PLAYTIME 3
101 void state_startup_enter(int state_last
, int event
, EVENT_PARAM
*param
);
102 void state_idle_enter(int state_last
, int event
, EVENT_PARAM
*param
);
103 void state_file_startup_enter(int state_last
, int event
, EVENT_PARAM
*param
);
104 void state_file_startup_leave(int state_new
, int event
);
105 void state_file_handle_enter(int state_last
, int event
, EVENT_PARAM
*param
);
106 void state_file_handle_leave(int state_new
, int event
);
107 void state_stream_startup_enter(int state_last
, int event
, EVENT_PARAM
*param
);
108 void state_stream_startup_leave(int state_last
, int event
);
109 void state_stream_handle_enter(int state_last
, int event
, EVENT_PARAM
*param
);
110 void state_stream_handle_leave(int state_new
, int event
);
111 void state_error_enter(int state_last
, int event
, EVENT_PARAM
*param
);
112 void state_shutdown_enter(int state_last
, int event
, EVENT_PARAM
*param
);
113 void state_generic_event(unsigned int event
, unsigned char in_int
,
114 unsigned char *out_uchar
);
This page took 0.064097 seconds and 5 git commands to generate.