Fix build break for rpm
[framework/connectivity/bluez.git] / health / hdp_types.h
1 /*
2  *
3  *  BlueZ - Bluetooth protocol stack for Linux
4  *
5  *  Copyright (C) 2010 GSyC/LibreSoft, Universidad Rey Juan Carlos.
6  *
7  *  This program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation; either version 2 of the License, or
10  *  (at your option) any later version.
11  *
12  *  This program is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *  GNU General Public License for more details.
16  *
17  *  You should have received a copy of the GNU General Public License
18  *  along with this program; if not, write to the Free Software
19  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20  *
21  */
22
23 #ifndef __HDP_TYPES_H__
24 #define __HDP_TYPES_H__
25
26 #define MANAGER_PATH            "/org/bluez"
27
28 #define HEALTH_MANAGER          "org.bluez.HealthManager"
29 #define HEALTH_DEVICE           "org.bluez.HealthDevice"
30 #define HEALTH_CHANNEL          "org.bluez.HealthChannel"
31
32 #define HDP_VERSION             0x0100
33
34 #define HDP_SERVICE_NAME        "Bluez HDP"
35 #define HDP_SERVICE_DSC         "A Bluez health device profile implementation"
36 #define HDP_SERVICE_PROVIDER    "Bluez"
37
38 #define HDP_MDEP_ECHO           0x00
39 #define HDP_MDEP_INITIAL        0x01
40 #define HDP_MDEP_FINAL          0x7F
41
42 #define HDP_ERROR               g_quark_from_static_string("hdp-error-quark")
43
44 #define HDP_NO_PREFERENCE_DC    0x00
45 #define HDP_RELIABLE_DC         0x01
46 #define HDP_STREAMING_DC        0x02
47
48 #define HDP_SINK_ROLE_AS_STRING         "sink"
49 #define HDP_SOURCE_ROLE_AS_STRING       "source"
50
51 typedef enum {
52         HDP_SOURCE = 0x00,
53         HDP_SINK = 0x01
54 } HdpRole;
55
56 typedef enum {
57         HDP_DIC_PARSE_ERROR,
58         HDP_DIC_ENTRY_PARSE_ERROR,
59         HDP_CONNECTION_ERROR,
60         HDP_UNSPECIFIED_ERROR,
61         HDP_UNKNOWN_ERROR
62 } HdpError;
63
64 enum data_specs {
65         DATA_EXCHANGE_SPEC_11073 = 0x01
66 };
67
68 struct hdp_application {
69         DBusConnection          *conn;          /* For dbus watcher */
70         char                    *path;          /* The path of the application */
71         uint16_t                data_type;      /* Data type handled for this application */
72         gboolean                data_type_set;  /* Flag for dictionary parsing */
73         uint8_t                 role;           /* Role of this application */
74         gboolean                role_set;       /* Flag for dictionary parsing */
75         uint8_t                 chan_type;      /* QoS preferred by source applications */
76         gboolean                chan_type_set;  /* Flag for dictionary parsing */
77         char                    *description;   /* Options description for SDP record */
78         uint8_t                 id;             /* The identification is also the mdepid */
79         char                    *oname;         /* Name of the owner application */
80         guint                   dbus_watcher;   /* Watch for clients disconnection */
81         gint                    ref;            /* Reference counter */
82 };
83
84 struct hdp_adapter {
85         struct btd_adapter      *btd_adapter;   /* Bluetooth adapter */
86         struct mcap_instance    *mi;            /* Mcap instance in */
87         uint16_t                ccpsm;          /* Control channel psm */
88         uint16_t                dcpsm;          /* Data channel psm */
89         uint32_t                sdp_handler;    /* SDP record handler */
90         uint32_t                record_state;   /* Service record state */
91 };
92
93 struct hdp_device {
94         DBusConnection          *conn;          /* For name listener handling */
95         struct btd_device       *dev;           /* Device reference */
96         struct hdp_adapter      *hdp_adapter;   /* hdp_adapater */
97         struct mcap_mcl         *mcl;           /* The mcap control channel */
98         gboolean                mcl_conn;       /* Mcl status */
99         gboolean                sdp_present;    /* Has an sdp record */
100         GSList                  *channels;      /* Data Channel list */
101         struct hdp_channel      *ndc;           /* Data channel being negotiated */
102         struct hdp_channel      *fr;            /* First reliable data channel */
103         gint                    ref;            /* Reference counting */
104 };
105
106 struct hdp_echo_data;
107
108 struct hdp_channel {
109         struct hdp_device       *dev;           /* Device where this channel belongs */
110         struct hdp_application  *app;           /* Application */
111         struct mcap_mdl         *mdl;           /* The data channel reference */
112         char                    *path;          /* The path of the channel */
113         uint8_t                 config;         /* Channel configuration */
114         uint8_t                 mdep;           /* Remote MDEP */
115         uint16_t                mdlid;          /* Data channel Id */
116         uint16_t                imtu;           /* Channel incoming MTU */
117         uint16_t                omtu;           /* Channel outgoing MTU */
118         struct hdp_echo_data    *edata;         /* private data used by echo channels */
119         gint                    ref;            /* Reference counter */
120 };
121
122 #endif /* __HDP_TYPES_H__ */