summaryrefslogtreecommitdiffstats
path: root/stack/include/dun_api.h
blob: 2b3679f0628a7d09b45521739fc83f7c8cef6c94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
/************************************************************************************
**
**  Name:          dun_api.h
**
**  Description:   this file contains the DUN API declaration
**
**
**  Copyright (c) 1999-2004, WIDCOMM Inc., All Rights Reserved.
**  WIDCOMM Bluetooth Core. Proprietary and confidential.
*************************************************************************************/
#ifndef DUN_API_H
#define DUN_API_H

#include "bt_target.h"
#include "btm_api.h"
#include "sdp_api.h"
#include "port_api.h"

/*****************************************************************************
**  Constants
*****************************************************************************/

/* API function return values */
#define DUN_SUCCESS             0
#define DUN_FAIL                1

/* Values for the options parameter.  It is an integer bit mask that
** contains information used in the DUN or Fax SDP record.  These values
** can be or'ed together to indicate more than one option.  Fax class options
** are not allowed for the DUN profile.
*/
#define DUN_OPTIONS_AUDIO       (1<<0)      /* Audio feedback supported */
#define DUN_OPTIONS_CLASS1      (1<<1)      /* Fax class 1 supported */
#define DUN_OPTIONS_CLASS20     (1<<2)      /* Fax class 2.0 supported */
#define DUN_OPTIONS_CLASS2      (1<<3)      /* Fax class 2 supported */

/*****************************************************************************
**  Type definitions
*****************************************************************************/

/* This callback function returns service discovery information to the
** application after the DUN_FindService() API function is called.  The
** implementation of this callback function must copy the p_name parameter
** passed to it as it is not guaranteed to remain after the callback
** function exits.
*/
typedef void (tDUN_FIND_CBACK)(BOOLEAN found, UINT8 scn, char* p_name,
                               UINT16 name_len, UINT16 options);


/*****************************************************************************
**  External Function Declarations
*****************************************************************************/
#ifdef __cplusplus
extern "C"
{
#endif

/******************************************************************************
**
** Function         DUN_Listen
**
** Description      This function opens a DUN or Fax connection in server mode.
**                  It configures the security settings for the connection,
**                  opens an RFCOMM connection in server mode, and sets the
**                  class of device as required by the profile.  It returns
**                  the handle for the RFCOMM connection.
**
** Returns          DUN_SUCCESS if function execution succeeded,
**                  DUN_FAIL if function execution failed.
**
******************************************************************************/
DUN_API extern UINT8 DUN_Listen(UINT16 service_uuid, char *p_service_name,
                                UINT8 scn, UINT16 mtu, UINT8 security_mask,
                                UINT16 *p_handle, tPORT_CALLBACK *p_cback);

/******************************************************************************
**
** Function         DUN_Connect
**
** Description      This function opens a DUN or Fax client connection.
**                  It configures the security settings for the connection
**                  and opens an RFCOMM connection in server mode.
**                  It returns the handle for the RFCOMM connection.
**
** Returns          DUN_SUCCESS if function execution succeeded,
**                  DUN_FAIL if function execution failed.
**
******************************************************************************/
DUN_API extern UINT8 DUN_Connect(UINT16 service_uuid, BD_ADDR bd_addr, UINT8 scn,
                                 UINT16 mtu, UINT8 security_mask, UINT16 *p_handle,
                                 tPORT_CALLBACK *p_cback);

/******************************************************************************
**
** Function         DUN_Close
**
** Description      This function closes a DUN or Fax client connection
**                  previously opened with DUN_Connect().
**
** Returns          DUN_SUCCESS if function execution succeeded,
**                  DUN_FAIL if function execution failed.
**
******************************************************************************/
DUN_API extern UINT8 DUN_Close(UINT16 handle);

/******************************************************************************
**
** Function         DUN_Shutdown
**
** Description      This function closes a DUN or Fax server connection
**                  previously opened with DUN_Listen().  It is called if
**                  the application wishes to close the DUN or Fax server
**                  connection at any time.
**
** Returns          DUN_SUCCESS if function execution succeeded,
**                  DUN_FAIL if function execution failed.
**
******************************************************************************/
DUN_API extern UINT8 DUN_Shutdown(UINT16 handle);

/******************************************************************************
**
** Function         DUN_AddRecord
**
** Description      This function is called by a server application to add
**                  DUN or Fax information to an SDP record.  Prior to
**                  calling this function the application must call
**                  SDP_CreateRecord() to create an SDP record.
**
** Returns          DUN_SUCCESS if function execution succeeded,
**                  DUN_FAIL if function execution failed.
**
******************************************************************************/
DUN_API extern UINT8 DUN_AddRecord(UINT16 service_uuid, char *p_service_name,
                                   UINT8 scn, UINT16 options, UINT32 sdp_handle);

/******************************************************************************
**
** Function         DUN_FindService
**
** Description      This function is called by a client application to
**                  perform service discovery and retrieve DUN or Fax SDP
**                  record information from a server.  Information is
**                  returned for the first service record found on the
**                  server that matches the service UUID.  The callback
**                  function will be executed when service discovery is
**                  complete.  There can only be one outstanding call to
**                  DUN_FindService() at a time; the application must wait
**                  for the callback before it makes another call to
**                  the function.
**
** Returns          DUN_SUCCESS if function execution succeeded,
**                  DUN_FAIL if function execution failed.
**
******************************************************************************/
DUN_API extern UINT8 DUN_FindService(UINT16 service_uuid, BD_ADDR bd_addr,
                                     tSDP_DISCOVERY_DB *p_db, UINT32 db_len,
                                     tDUN_FIND_CBACK *p_cback);

/******************************************************************************
**
** Function         DUN_SetTraceLevel
**
** Description      Sets the trace level for DUN. If 0xff is passed, the
**                  current trace level is returned.
**
**                  Input Parameters:
**                      new_level:  The level to set the DUN tracing to:
**                      0xff-returns the current setting.
**                      0-turns off tracing.
**                      >= 1-Errors.
**                      >= 2-Warnings.
**                      >= 3-APIs.
**                      >= 4-Events.
**                      >= 5-Debug.
**
** Returns          The new trace level or current trace level if
**                  the input parameter is 0xff.
**
******************************************************************************/
DUN_API extern UINT8 DUN_SetTraceLevel (UINT8 new_level);

/*******************************************************************************
**
** Function         DUN_Init
**
** Description      This function is called before accessing the DUN APIs in order
**                  to initialize the control block.
**
** Returns          void
**
*******************************************************************************/
DUN_API extern void DUN_Init(void);

#ifdef __cplusplus
}
#endif

#endif /* DUN_API_H */