40#define PORT_BAUD_RATE_2400 0x00
41#define PORT_BAUD_RATE_4800 0x01
42#define PORT_BAUD_RATE_7200 0x02
43#define PORT_BAUD_RATE_9600 0x03
44#define PORT_BAUD_RATE_19200 0x04
45#define PORT_BAUD_RATE_38400 0x05
46#define PORT_BAUD_RATE_57600 0x06
47#define PORT_BAUD_RATE_115200 0x07
48#define PORT_BAUD_RATE_230400 0x08
52#define PORT_5_BITS 0x00
53#define PORT_6_BITS 0x01
54#define PORT_7_BITS 0x02
55#define PORT_8_BITS 0x03
59#define PORT_ONESTOPBIT 0x00
60#define PORT_ONE5STOPBITS 0x01
63#define PORT_PARITY_NO 0x00
64#define PORT_PARITY_YES 0x01
67#define PORT_ODD_PARITY 0x00
68#define PORT_EVEN_PARITY 0x01
69#define PORT_MARK_PARITY 0x02
70#define PORT_SPACE_PARITY 0x03
74#define PORT_FC_OFF 0x00
75#define PORT_FC_XONXOFF_ON_INPUT 0x01
76#define PORT_FC_XONXOFF_ON_OUTPUT 0x02
77#define PORT_FC_CTS_ON_INPUT 0x04
78#define PORT_FC_CTS_ON_OUTPUT 0x08
79#define PORT_FC_DSR_ON_INPUT 0x10
80#define PORT_FC_DSR_ON_OUTPUT 0x20
86#define PORT_XON_DC1 0x11
89#define PORT_XOFF_DC3 0x13
99typedef int (tPORT_DATA_CALLBACK) (UINT16 port_handle,
void *p_data, UINT16 len);
101#define DATA_CO_CALLBACK_TYPE_INCOMING 1
102#define DATA_CO_CALLBACK_TYPE_OUTGOING_SIZE 2
103#define DATA_CO_CALLBACK_TYPE_OUTGOING 3
104typedef int (tPORT_DATA_CO_CALLBACK) (UINT16 port_handle, UINT8* p_buf, UINT16 len,
int type);
106typedef void (tPORT_CALLBACK) (UINT32 code, UINT16 port_handle);
112#define PORT_EV_RXCHAR 0x00000001
113#define PORT_EV_RXFLAG 0x00000002
114#define PORT_EV_TXEMPTY 0x00000004
115#define PORT_EV_CTS 0x00000008
116#define PORT_EV_DSR 0x00000010
117#define PORT_EV_RLSD 0x00000020
118#define PORT_EV_BREAK 0x00000040
119#define PORT_EV_ERR 0x00000080
120#define PORT_EV_RING 0x00000100
121#define PORT_EV_CTSS 0x00000400
122#define PORT_EV_DSRS 0x00000800
123#define PORT_EV_RLSDS 0x00001000
124#define PORT_EV_OVERRUN 0x00002000
125#define PORT_EV_TXCHAR 0x00004000
127#define PORT_EV_CONNECTED 0x00000200
128#define PORT_EV_CONNECT_ERR 0x00008000
130#define PORT_EV_FC 0x00010000
131#define PORT_EV_FCS 0x00020000
138#define PORT_MASK_ALL (PORT_EV_RXCHAR | PORT_EV_TXEMPTY | PORT_EV_CTS | \
139 PORT_EV_DSR | PORT_EV_RLSD | PORT_EV_BREAK | \
140 PORT_EV_ERR | PORT_EV_RING | PORT_EV_CONNECT_ERR | \
141 PORT_EV_DSRS | PORT_EV_CTSS | PORT_EV_RLSDS | \
142 PORT_EV_RXFLAG | PORT_EV_TXCHAR | PORT_EV_OVERRUN | \
143 PORT_EV_FC | PORT_EV_FCS | PORT_EV_CONNECTED)
149#define PORT_SUCCESS 0
151#define PORT_ERR_BASE 0
153#define PORT_UNKNOWN_ERROR (PORT_ERR_BASE + 1)
154#define PORT_ALREADY_OPENED (PORT_ERR_BASE + 2)
155#define PORT_CMD_PENDING (PORT_ERR_BASE + 3)
156#define PORT_APP_NOT_REGISTERED (PORT_ERR_BASE + 4)
157#define PORT_NO_MEM (PORT_ERR_BASE + 5)
158#define PORT_NO_RESOURCES (PORT_ERR_BASE + 6)
159#define PORT_BAD_BD_ADDR (PORT_ERR_BASE + 7)
160#define PORT_BAD_HANDLE (PORT_ERR_BASE + 9)
161#define PORT_NOT_OPENED (PORT_ERR_BASE + 10)
162#define PORT_LINE_ERR (PORT_ERR_BASE + 11)
163#define PORT_START_FAILED (PORT_ERR_BASE + 12)
164#define PORT_PAR_NEG_FAILED (PORT_ERR_BASE + 13)
165#define PORT_PORT_NEG_FAILED (PORT_ERR_BASE + 14)
166#define PORT_SEC_FAILED (PORT_ERR_BASE + 15)
167#define PORT_PEER_CONNECTION_FAILED (PORT_ERR_BASE + 16)
168#define PORT_PEER_FAILED (PORT_ERR_BASE + 17)
169#define PORT_PEER_TIMEOUT (PORT_ERR_BASE + 18)
170#define PORT_CLOSED (PORT_ERR_BASE + 19)
171#define PORT_TX_FULL (PORT_ERR_BASE + 20)
172#define PORT_LOCAL_CLOSED (PORT_ERR_BASE + 21)
173#define PORT_LOCAL_TIMEOUT (PORT_ERR_BASE + 22)
174#define PORT_TX_QUEUE_DISABLED (PORT_ERR_BASE + 23)
175#define PORT_PAGE_TIMEOUT (PORT_ERR_BASE + 24)
176#define PORT_INVALID_SCN (PORT_ERR_BASE + 25)
218RFC_API
extern int RFCOMM_CreateConnection (UINT16 uuid, UINT8 scn,
219 BOOLEAN is_server, UINT16 mtu,
220 BD_ADDR bd_addr, UINT16 *p_handle,
221 tPORT_CALLBACK *p_mgmt_cb);
233RFC_API
extern int RFCOMM_RemoveConnection (UINT16 handle);
245RFC_API
extern int RFCOMM_RemoveServer (UINT16 handle);
260RFC_API
extern int PORT_SetEventCallback (UINT16 port_handle,
261 tPORT_CALLBACK *p_port_cb);
276RFC_API
extern int PORT_SetDataCallback (UINT16 port_handle,
277 tPORT_DATA_CALLBACK *p_cb);
279RFC_API
extern int PORT_SetDataCOCallback (UINT16 port_handle, tPORT_DATA_CO_CALLBACK *p_port_cb);
291RFC_API
extern int PORT_SetEventMask (UINT16 port_handle, UINT32 mask);
306RFC_API
extern int PORT_CheckConnection (UINT16 handle, BD_ADDR bd_addr,
320RFC_API
extern BOOLEAN PORT_IsOpening (BD_ADDR bd_addr);
334RFC_API
extern int PORT_SetState (UINT16 handle,
tPORT_STATE *p_settings);
346RFC_API
extern int PORT_GetRxQueueCnt (UINT16 handle, UINT16 *p_rx_queue_count);
360RFC_API
extern int PORT_GetState (UINT16 handle,
tPORT_STATE *p_settings);
374#define PORT_SET_DTRDSR 0x01
375#define PORT_CLR_DTRDSR 0x02
376#define PORT_SET_CTSRTS 0x03
377#define PORT_CLR_CTSRTS 0x04
378#define PORT_SET_RI 0x05
379#define PORT_CLR_RI 0x06
380#define PORT_SET_DCD 0x07
381#define PORT_CLR_DCD 0x08
382#define PORT_BREAK 0x09
384RFC_API
extern int PORT_Control (UINT16 handle, UINT8 signal);
399RFC_API
extern int PORT_FlowControl (UINT16 handle, BOOLEAN enable);
416#define PORT_DTRDSR_ON 0x01
417#define PORT_CTSRTS_ON 0x02
418#define PORT_RING_ON 0x04
419#define PORT_DCD_ON 0x08
424#define PORT_OBEX_DEFAULT_SIGNAL_STATE (PORT_DTRDSR_ON | PORT_CTSRTS_ON | PORT_DCD_ON)
425#define PORT_SPP_DEFAULT_SIGNAL_STATE (PORT_DTRDSR_ON | PORT_CTSRTS_ON | PORT_DCD_ON)
426#define PORT_PPP_DEFAULT_SIGNAL_STATE (PORT_DTRDSR_ON | PORT_CTSRTS_ON | PORT_DCD_ON)
427#define PORT_DUN_DEFAULT_SIGNAL_STATE (PORT_DTRDSR_ON | PORT_CTSRTS_ON)
429RFC_API
extern int PORT_GetModemStatus (UINT16 handle, UINT8 *p_control_signal);
449#define PORT_ERR_BREAK 0x01
450#define PORT_ERR_OVERRUN 0x02
451#define PORT_ERR_FRAME 0x04
452#define PORT_ERR_RXOVER 0x08
453#define PORT_ERR_TXFULL 0x10
457#define PORT_FLAG_CTS_HOLD 0x01
458#define PORT_FLAG_DSR_HOLD 0x02
459#define PORT_FLAG_RLSD_HOLD 0x04
462 UINT16 in_queue_size;
463 UINT16 out_queue_size;
468RFC_API
extern int PORT_ClearError (UINT16 handle, UINT16 *p_errors,
482RFC_API
extern int PORT_SendError (UINT16 handle, UINT8 errors);
496RFC_API
extern int PORT_GetQueueStatus (UINT16 handle,
tPORT_STATUS *p_status);
510#define PORT_PURGE_TXCLEAR 0x01
511#define PORT_PURGE_RXCLEAR 0x02
513RFC_API
extern int PORT_Purge (UINT16 handle, UINT8 purge_flags);
531RFC_API
extern int PORT_Read (UINT16 handle,
BT_HDR **pp_buf);
548RFC_API
extern int PORT_ReadData (UINT16 handle,
char *p_data, UINT16 max_len,
563RFC_API
extern int PORT_Write (UINT16 handle,
BT_HDR *p_buf);
579RFC_API
extern int PORT_WriteData (UINT16 handle,
char *p_data, UINT16 max_len,
592RFC_API
extern int PORT_WriteDataCO (UINT16 handle,
int* p_len);
605RFC_API
extern int PORT_Test (UINT16 handle, UINT8 *p_data, UINT16 len);
615RFC_API
extern void RFCOMM_Init (
void);
628RFC_API
extern UINT8 PORT_SetTraceLevel (UINT8 new_level);