460b9539 |
1 | /* |
2 | * This file is part of DisOrder |
3 | * Copyright (C) 2005 Richard Kettlewell |
4 | * |
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. |
9 | * |
10 | * This program is distributed in the hope that it will be useful, but |
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | * General Public License for more details. |
14 | * |
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, MA 02111-1307 |
18 | * USA |
19 | */ |
20 | |
21 | #ifndef SPEAKER_H |
22 | #define SPEAKER_H |
23 | |
24 | struct speaker_message { |
25 | int type; /* message type */ |
26 | long data; /* whatever */ |
27 | char id[24]; /* ID including terminator */ |
28 | }; |
29 | |
30 | /* messages from the main DisOrder server */ |
31 | #define SM_PREPARE 0 /* prepare ID */ |
32 | #define SM_PLAY 1 /* play ID */ |
33 | #define SM_PAUSE 2 /* pause current track */ |
34 | #define SM_RESUME 3 /* resume current track */ |
35 | #define SM_CANCEL 4 /* cancel ID */ |
36 | #define SM_RELOAD 5 /* reload configuration */ |
37 | |
38 | /* messages from the speaker */ |
39 | #define SM_PAUSED 128 /* paused ID, DATA seconds in */ |
40 | #define SM_FINISHED 129 /* finished ID */ |
41 | #define SM_PLAYING 131 /* playing ID, DATA seconds in */ |
42 | |
43 | void speaker_send(int fd, const struct speaker_message *sm, int datafd); |
44 | /* Send a message. DATAFD is passed too if not -1. Does not close DATAFD. */ |
45 | |
46 | int speaker_recv(int fd, struct speaker_message *sm, int *datafd); |
47 | /* Receive a message. If DATAFD is not null then can receive an FD. Return 0 |
48 | * on EOF, +ve if a message is read, -1 on EAGAIN, terminates on any other |
49 | * error. */ |
50 | |
51 | #endif /* SPEAKER_H */ |
52 | |
53 | /* |
54 | Local Variables: |
55 | c-basic-offset:2 |
56 | comment-column:40 |
57 | fill-column:79 |
58 | indent-tabs-mode:nil |
59 | End: |
60 | */ |