6 * Copyright (c) 2006 Maksim Yevmenkin <m_evmenkin@yahoo.com>
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * $Id: bthidd.h,v 1.7 2006/09/07 21:06:53 max Exp $
37 #define BTHIDD_IDENT "bthidd"
38 #define BTHIDD_PIDFILE "/var/run/" BTHIDD_IDENT ".pid"
44 bdaddr_t bdaddr; /* local bdaddr */
45 int32_t cons; /* /dev/consolectl */
46 int32_t ctrl; /* control channel (listen) */
47 int32_t intr; /* intr. channel (listen) */
48 int32_t maxfd; /* max fd in sets */
49 fd_set rfdset; /* read descriptor set */
50 fd_set wfdset; /* write descriptor set */
51 LIST_HEAD(, bthid_session) sessions;
54 typedef struct bthid_server bthid_server_t;
55 typedef struct bthid_server * bthid_server_p;
59 bthid_server_p srv; /* pointer back to server */
60 int32_t ctrl; /* control channel */
61 int32_t intr; /* interrupt channel */
62 int32_t vkbd; /* virual keyboard */
63 bdaddr_t bdaddr;/* remote bdaddr */
64 uint16_t state; /* session state */
69 bitstr_t *keys1; /* keys map (new) */
70 bitstr_t *keys2; /* keys map (old) */
71 LIST_ENTRY(bthid_session) next; /* link to next */
74 typedef struct bthid_session bthid_session_t;
75 typedef struct bthid_session * bthid_session_p;
77 int32_t server_init (bthid_server_p srv);
78 void server_shutdown (bthid_server_p srv);
79 int32_t server_do (bthid_server_p srv);
81 int32_t client_rescan (bthid_server_p srv);
82 int32_t client_connect (bthid_server_p srv, int fd);
84 bthid_session_p session_open (bthid_server_p srv, hid_device_p const d);
85 bthid_session_p session_by_bdaddr(bthid_server_p srv, bdaddr_p bdaddr);
86 bthid_session_p session_by_fd (bthid_server_p srv, int32_t fd);
87 void session_close (bthid_session_p s);
89 int32_t hid_control (bthid_session_p s, uint8_t *data, int32_t len);
90 int32_t hid_interrupt (bthid_session_p s, uint8_t *data, int32_t len);
92 #endif /* ndef _BTHIDD_H_ */