15738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/******************************************************************************
25738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *
35738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *  Copyright (C) 1999-2012 Broadcom Corporation
45738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *
55738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *  Licensed under the Apache License, Version 2.0 (the "License");
65738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *  you may not use this file except in compliance with the License.
75738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *  You may obtain a copy of the License at:
85738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *
95738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *  http://www.apache.org/licenses/LICENSE-2.0
105738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *
115738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *  Unless required by applicable law or agreed to in writing, software
125738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *  distributed under the License is distributed on an "AS IS" BASIS,
135738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
145738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *  See the License for the specific language governing permissions and
155738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *  limitations under the License.
165738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *
175738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project ******************************************************************************/
185738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
195738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/****************************************************************************
205738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *
215738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *  This file contains definitions for the RFCOMM protocol
225738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *
235738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project ****************************************************************************/
245738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
255738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#ifndef RFCDEFS_H
265738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCDEFS_H
275738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
285738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define PORT_MAX_RFC_PORTS              31
295738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
305738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/*
315738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project**  If nothing is negotiated MTU should be 127
325738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project*/
335738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_DEFAULT_MTU              127
345738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
355738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/*
365738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Define used by RFCOMM TS frame types
375738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project*/
385738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_SABME                    0x2F
395738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_UA                       0x63
405738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_DM                       0x0F
415738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_DISC                     0x43
425738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_UIH                      0xEF
435738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
445738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/*
455738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Defenitions for the TS control frames
465738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project*/
475738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_CTRL_FRAME_LEN           3
485738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_MIN_OFFSET               5 /* ctrl 2 , len 1 or 2 bytes, credit 1 byte */
495738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_DATA_OVERHEAD            (RFCOMM_MIN_OFFSET + 1)  /* add 1 for checksum */
505738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
515738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_EA                       1
525738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_EA_MASK                  0x01
535738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_CR_MASK                  0x02
545738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_SHIFT_CR                 1
555738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_SHIFT_DLCI               2
565738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_SHIFT_DLCI2              6
575738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_PF                       0x10
585738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_PF_MASK                  0x10
595738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_PF_OFFSET                4
605738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_SHIFT_LENGTH1            1
615738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_SHIFT_LENGTH2            7
625738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_SHIFT_MX_CTRL_TYPE       2
635738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
645738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_INITIATOR_CMD            1
655738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_INITIATOR_RSP            0
665738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_RESPONDER_CMD            0
675738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_RESPONDER_RSP            1
685738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
695738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_PARSE_CTRL_FIELD(ea, cr, dlci, p_data)       \
705738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project{                                                           \
715738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project    ea = *p_data & RFCOMM_EA;                               \
725738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project    cr = (*p_data & RFCOMM_CR_MASK) >> RFCOMM_SHIFT_CR;     \
735738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project    dlci = *p_data++ >> RFCOMM_SHIFT_DLCI;                  \
745738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project    if (!ea) dlci += *p_data++ << RFCOMM_SHIFT_DLCI2;       \
755738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project}
765738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
775738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_FORMAT_CTRL_FIELD(p_data, ea, cr, dlci)      \
785738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project    *p_data++ = ea | cr | (dlci << RFCOMM_SHIFT_DLCI)
795738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
805738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_PARSE_TYPE_FIELD(type, pf, p_data)           \
815738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project{                                                           \
825738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project    type = *p_data & ~RFCOMM_PF_MASK;                       \
835738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project    pf   = (*p_data++ & RFCOMM_PF_MASK) >> RFCOMM_PF_OFFSET;\
845738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project}
855738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
865738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_FORMAT_TYPE_FIELD(p_data, type, pf)          \
875738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project    *p_data++ = (type | (pf << RFCOMM_PF_OFFSET))           \
885738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project{                                                           \
895738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project    type = *p_data & ~RFCOMM_PF_MASK;                       \
905738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project    pf   = (*p_data++ & RFCOMM_PF_MASK) >> RFCOMM_PF_OFFSET;\
915738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project}
925738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
935738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_PARSE_LEN_FIELD(ea, length, p_data)          \
945738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project{                                                           \
955738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project    ea = (*p_data & RFCOMM_EA);                             \
965738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project    length = (*p_data++ >> RFCOMM_SHIFT_LENGTH1);           \
975738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project    if (!ea) length += (*p_data++ << RFCOMM_SHIFT_LENGTH2); \
985738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project}
995738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1005738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_FRAME_IS_CMD(initiator, cr)                  \
1015738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project    (( (initiator) && !(cr)) || (!(initiator) &&  (cr)))
1025738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1035738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_FRAME_IS_RSP(initiator, cr)                  \
1045738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project    (( (initiator) &&  (cr)) || (!(initiator) && !(cr)))
1055738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1065738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_CR(initiator, is_command)                    \
1075738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project    (( ( (initiator) &&  (is_command))                      \
1085738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project    || (!(initiator) && !(is_command))) << 1)
1095738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1105738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_I_CR(is_command) ((is_command) ? 0x02 : 0x00)
1115738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1125738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_MAX_DLCI             61
1135738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1145738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_VALID_DLCI(dlci)                             \
1155738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project    (((dlci) == 0) || (((dlci) >= 2) && ((dlci) <= RFCOMM_MAX_DLCI)))
1165738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1175738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1185738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/* Port Negotiation (PN) */
1195738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_PN_DLCI_MASK         0x3F
1205738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1215738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_PN_FRAM_TYPE_UIH     0x00
1225738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_PN_FRAME_TYPE_MASK   0x0F
1235738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1245738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_PN_CONV_LAYER_MASK   0xF0
1255738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_PN_CONV_LAYER_TYPE_1 0
1265738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_PN_CONV_LAYER_CBFC_I 0xF0
1275738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_PN_CONV_LAYER_CBFC_R 0xE0
1285738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1295738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_PN_PRIORITY_MASK     0x3F
1305738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_PN_PRIORITY_0        0
1315738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1325738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_PN_K_MASK            0x07
1335738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1345738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_T1_DSEC              0 /* None negotiable in RFCOMM */
1355738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_N2                   0 /* Number of retransmissions */
1365738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_K                    0 /* Window size */
1375738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_K_MAX                7 /* Max value of K for credit based flow control */
1385738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1395738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_MSC_FC               0x02          /* Flow control*/
1405738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_MSC_RTC              0x04          /* Ready to communicate*/
1415738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_MSC_RTR              0x08          /* Ready to receive*/
1425738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_MSC_IC               0x40          /* Incomming call indicator*/
1435738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_MSC_DV               0x80          /* Data Valid*/
1445738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1455738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_MSC_SHIFT_BREAK          4
1465738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_MSC_BREAK_MASK           0xF0
1475738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_MSC_BREAK_PRESENT_MASK   0x02
1485738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1495738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_BAUD_RATE_2400           0x00
1505738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_BAUD_RATE_4800           0x01
1515738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_BAUD_RATE_7200           0x02
1525738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_BAUD_RATE_9600           0x03
1535738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_BAUD_RATE_19200          0x04
1545738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_BAUD_RATE_38400          0x05
1555738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_BAUD_RATE_57600          0x06
1565738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_BAUD_RATE_115200         0x07
1575738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_BAUD_RATE_230400         0x08
1585738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1595738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_5_BITS                   0x00
1605738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_6_BITS                   0x01
1615738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_7_BITS                   0x02
1625738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_8_BITS                   0x03
1635738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1645738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_RPN_BITS_MASK            0x03
1655738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_RPN_BITS_SHIFT           0
1665738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1675738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_ONESTOPBIT               0x00
1685738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_ONE5STOPBITS             0x01
1695738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1705738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_RPN_STOP_BITS_MASK       0x01
1715738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_RPN_STOP_BITS_SHIFT      2
1725738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1735738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_PARITY_NO                0x00
1745738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_PARITY_YES               0x01
1755738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_RPN_PARITY_MASK          0x01
1765738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_RPN_PARITY_SHIFT         3
1775738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1785738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_ODD_PARITY               0x00
1795738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_EVEN_PARITY              0x01
1805738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_MARK_PARITY              0x02
1815738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_SPACE_PARITY             0x03
1825738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1835738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_RPN_PARITY_TYPE_MASK     0x03
1845738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_RPN_PARITY_TYPE_SHIFT    4
1855738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1865738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_FC_OFF                   0x00
1875738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_FC_XONXOFF_ON_INPUT      0x01
1885738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_FC_XONXOFF_ON_OUTPUT     0x02
1895738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_FC_RTR_ON_INPUT          0x04
1905738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_FC_RTR_ON_OUTPUT         0x08
1915738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_FC_RTC_ON_INPUT          0x10
1925738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_FC_RTC_ON_OUTPUT         0x20
1935738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_FC_MASK                  0x3F
1945738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1955738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_RPN_PM_BIT_RATE          0x0001
1965738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_RPN_PM_DATA_BITS         0x0002
1975738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_RPN_PM_STOP_BITS         0x0004
1985738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_RPN_PM_PARITY            0x0008
1995738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_RPN_PM_PARITY_TYPE       0x0010
2005738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_RPN_PM_XON_CHAR          0x0020
2015738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_RPN_PM_XOFF_CHAR         0x0040
2025738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_RPN_PM_XONXOFF_ON_INPUT  0x0100
2035738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_RPN_PM_XONXOFF_ON_OUTPUT 0x0200
2045738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_RPN_PM_RTR_ON_INPUT      0x0400
2055738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_RPN_PM_RTR_ON_OUTPUT     0x0800
2065738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_RPN_PM_RTC_ON_INPUT      0x1000
2075738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_RPN_PM_RTC_ON_OUTPUT     0x2000
2085738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_RPN_PM_MASK              0x3F7F
2095738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
2105738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_RLS_ERROR                0x01
2115738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_RLS_OVERRUN              0x02
2125738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_RLS_PARITY               0x04
2135738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_RLS_FRAMING              0x08
2145738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
2155738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/* Multiplexor channel uses DLCI 0 */
2165738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_MX_DLCI                  0
2175738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
2185738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/*
2195738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Define RFCOMM Multiplexer message types
2205738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project*/
2215738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_MX_PN                    0x80
2225738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_MX_PN_LEN                8
2235738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
2245738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_MX_CLD                   0xC0
2255738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_MX_CLD_LEN               0
2265738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
2275738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_MX_TEST                  0x20
2285738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
2295738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_MX_FCON                  0xA0
2305738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_MX_FCON_LEN              0
2315738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
2325738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_MX_FCOFF                 0x60
2335738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_MX_FCOFF_LEN             0
2345738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
2355738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_MX_MSC                   0xE0
2365738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_MX_MSC_LEN_NO_BREAK      2
2375738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_MX_MSC_LEN_WITH_BREAK    3
2385738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
2395738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_MX_NSC                   0x10
2405738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_MX_NSC_LEN               1
2415738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
2425738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_MX_RPN                   0x90
2435738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_MX_RPN_REQ_LEN           1
2445738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_MX_RPN_LEN               8
2455738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
2465738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_MX_RLS                   0x50
2475738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define RFCOMM_MX_RLS_LEN               2
2485738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#endif
249