comparison service.h @ 0:e70ea46d6073

Initial import from http://wouhanegaine.free.fr/dev/DSPad02b_neo07.zip
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sun, 22 Feb 2015 01:38:06 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:e70ea46d6073
1 #ifndef SERVICE_H
2 #define SERVICE_H
3
4 #include "uinput.h"
5 #include "ds.h"
6 #include "restartOp.h"
7
8 #include <stdio.h>
9 #include <sys/types.h>
10 #include <sys/socket.h>
11 #include <netinet/in.h>
12 #include <stdlib.h>
13 #include <string.h>
14
15 #define DEFAULT_DEV_QTY 2 /* How many jsX devices */
16 #define DEFAULT_BASE_UDP_PORT 16150 /* Listen DS datagrams */
17
18
19 /* Globals... */
20 #ifndef __MAIN_FILE__
21 extern uint8_t nbdev;
22 extern uint8_t curdev;
23 extern uint16_t base_port;
24 extern char* uinput_dev;
25 #else
26 uint8_t nbdev = DEFAULT_DEV_QTY;
27 uint8_t curdev;
28 uint16_t base_port = DEFAULT_BASE_UDP_PORT;
29 char* uinput_dev = NULL;
30 #endif
31
32
33 /*
34 Create a socket
35 Returns socket descriptor (-1 if error)
36 */
37 extern int create_socket(unsigned short *port, int type);
38
39 /*
40 Receive a DS datagram
41 */
42 extern ssize_t receive_ds_info(int socket, ds_t* ds);
43
44 /*
45 Start the listening service yeah!
46 */
47 extern void start_service(void);
48
49
50
51 #endif /* SERVICE_H */