📄 bt_if.h
字号:
/* * bt_if.h -- Interface functions towards kernel / userstack * * Copyright (C) 2000, 2001 Axis Communications AB * * Author: Mattias Agren <mattias.agren@axis.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * Exceptionally, Axis Communications AB grants discretionary and * conditional permissions for additional use of the text contained * in the company's release of the AXIS OpenBT Stack under the * provisions set forth hereunder. * * Provided that, if you use the AXIS OpenBT Stack with other files, * that do not implement functionality as specified in the Bluetooth * System specification, to produce an executable, this does not by * itself cause the resulting executable to be covered by the GNU * General Public License. Your use of that executable is in no way * restricted on account of using the AXIS OpenBT Stack code with it. * * This exception does not however invalidate any other reasons why * the executable file might be covered by the provisions of the GNU * General Public License. * * $Id: bt_if.h,v 1.28 2001/10/15 08:48:53 anderstj Exp $ * */ #ifndef __BT_IF_H__#define __BT_IF_H__#include "btd.h"#ifdef BT_USERSTACK#include <pthread.h>#include "include/rfcomm.h"#endif/* ============================================================== *//* General defines */ /* NOTE ! N_BT should be defined in /include/asm/termios.h However, if you are compiling this source standalone the following define can be useful. If this number is taken simply change it to something not taken.*/#ifndef N_BT#define N_BT 15#endif#define HOST_NAME_LENGTH 100#define DOMAIN_NAME_LENGTH 100/* ============================================================== *//* BT defines */#define INQUIRY_SCAN_ENABLE 1#define PAGE_SCAN_ENABLE 2#define SDP_LAYER 1#define RFCOMM_LAYER 3#define TCS_LAYER 5#define L2CAP_TEST_LAYER 0x1231#define L2CAP_TEST2_LAYER 0x1233#define L2CAP_TEST3_LAYER 0x4461/* ============================================================== *//* SDP server */#define PID_FILE "/var/run/btd.pid"#ifdef BT_USERSTACK#define SDPSRV_CMD "sdp_user"#define SDPSRV_PROC "/tmp/sdp_sock"#else#define SDPSRV_CMD "sdp_server"#define SDPSRV_PROC "/proc/sdp_srv"#endif#define SDPSRV_CONF "/etc/sdp.xml"#ifndef BT_USERSTACK/* ============================================================== *//* IF Macros */#define CREATE_RFCOMM_ID(line, dlci) ( ((RFCOMM_LAYER << 16)&0xffff0000) | ((line<<8)&0xff00) | ((dlci) & 0xff) )#define CREATE_SDP_ID(line, dlci) ( ((SDP_LAYER << 16)&0xffff0000) | ((line<<8)&0xff00) | ((dlci) & 0xff) )#define GET_PSM(con_id) (con_id >> 16)#define ANY_LINE 255#define NO_LINE 256/* ============================================================== *//* Ioctls for the BT driver */#define BT_IOC_MAGIC 'B' /* Use B as a magic number */#define BT_IOC_MAXNR 255#define BTCONNECT _IOW(BT_IOC_MAGIC, 0x00, bt_connection)#define BTDISCONNECT _IOW(BT_IOC_MAGIC, 0x01, unsigned int)#define BTSETSPEED _IOW(BT_IOC_MAGIC, 0x02, int)#define BTINITSTACK _IO(BT_IOC_MAGIC, 0x03)#define BTSETSERTTY _IO(BT_IOC_MAGIC, 0x04)#define BTSETMODEMDUMMY _IOW(BT_IOC_MAGIC, 0x05, int)#define BTSHUTDOWN _IO(BT_IOC_MAGIC, 0x06)#define BTREADREMOTEBDADDR _IOWR(BT_IOC_MAGIC, 0x07, unsigned char[6])#define BTRESETPHYSICALHW _IO(BT_IOC_MAGIC, 0x08)#define BTISINITIATED _IOR(BT_IOC_MAGIC, 0x09, int)#define BTHWVENDOR _IOR(BT_IOC_MAGIC, 0x0a, char[20])#define BTFIRMWAREINFO _IOR(BT_IOC_MAGIC, 0x0B, char[80])#define BTWAITFORCONNECTION _IOW(BT_IOC_MAGIC, 0x0C, int)#define BTWAITNEWCONNECTIONS _IO(BT_IOC_MAGIC, 0x0D)#define BTISLOWERCONNECTED _IOW(BT_IOC_MAGIC, 0x0E, int)//#define BT_SDP_REQUEST _IOW(BT_IOC_MAGIC, 0x0F, bt_sdp_request)#define BT_GETCACHEDLINKKEY _IOWR(BT_IOC_MAGIC, 0x10, unsigned char[22])/* ============================================================== *//* Ioctls for executing HCI commands *//* Link Control Command */#define HCIINQUIRY _IOWR(BT_IOC_MAGIC, 0x20, inquiry_results)#define HCILINKKEYREPLY _IOWR(BT_IOC_MAGIC, 0x21, unsigned char[22])#define HCILINKKEYNEGATIVEREPLY _IOWR(BT_IOC_MAGIC, 0x22, unsigned char[6])#define HCIPINCODEREPLY _IOWR(BT_IOC_MAGIC, 0x23, unsigned char[23])#define HCIPINCODENEGATIVEREPLY _IOWR(BT_IOC_MAGIC, 0x24, unsigned char[6])#define HCIAUTHENTICATION_REQUESTED _IOW(BT_IOC_MAGIC, 0x25, unsigned char[6])#define HCISETCONNECTION_ENCRYPTION _IOW(BT_IOC_MAGIC, 0x26, unsigned char[7])/* Link Policy Commands */#define HCISWITCHROLE _IOW(BT_IOC_MAGIC, 0x28, unsigned char[7])/* Host Controller & Baseband Commands */#define HCIRESET _IO(BT_IOC_MAGIC, 0x30)#define HCIFLUSH _IO(BT_IOC_MAGIC, 0x31)#define HCICREATE_NEW_UNIT_KEY _IO(BT_IOC_MAGIC, 0x32)#define HCIREADSTOREDLINKKEY _IOWR(BT_IOC_MAGIC, 0x33, unsigned char[7])#define HCIWRITESTOREDLINKKEY _IOWR(BT_IOC_MAGIC, 0x34, unsigned char[22])#define HCIDELETESTOREDLINKKEY _IOWR(BT_IOC_MAGIC, 0x35, unsigned char[7])#define HCISETLOCALNAME _IOW(BT_IOC_MAGIC, 0x36, unsigned char[248])#define HCIREADSCANENABLE _IOR(BT_IOC_MAGIC, 0x37, int)#define HCIWRITESCANENABLE _IOW(BT_IOC_MAGIC, 0x38, int)#define HCIWRITEPAGESCANACTIVITY _IOW(BT_IOC_MAGIC, 0x39, unsigned int[2])#define HCIWRITECLASSOFDEVICE _IOW(BT_IOC_MAGIC, 0x3a, unsigned char[3])#define HCIREAD_AUTHENTICATION_ENABLE _IOR(BT_IOC_MAGIC, 0x3b, int)#define HCIWRITE_AUTHENTICATION_ENABLE _IOWR(BT_IOC_MAGIC, 0x3c, int)#define HCIREAD_ENCRYPTION_MODE _IOR(BT_IOC_MAGIC, 0x3d, int)#define HCIWRITE_ENCRYPTION_MODE _IOWR(BT_IOC_MAGIC, 0x3e, int)#define HCISET_EVENT_FILTER _IOW(BT_IOC_MAGIC, 0x3f, unsigned char[3])/* Informational Parameters */#define HCIREADCOUNTRYCODE _IOR(BT_IOC_MAGIC, 0x43, int)#define HCIREADLOCALBDADDR _IOR(BT_IOC_MAGIC, 0x45, unsigned char[6])/* Status Parameters *//* ============================================================== *//* Testing Commands */#define HCIENABLEDUT _IO(BT_IOC_MAGIC, 0x65)/* ============================================================== *//* Ioctls Vendor specific HCI commands */#define HCISETBAUDRATE _IOW(BT_IOC_MAGIC, 0x70, int)#define HCIWRITEBDADDR _IOW(BT_IOC_MAGIC, 0x71, unsigned char[6])/* | len 1 byte | 4 bytes hci header | data (max 256) | */#define HCISENDRAWDATA _IOW(BT_IOC_MAGIC, 0x72, unsigned char[261])/* | BD(6) | len(2) | data(max 256) |*/#define BTPING _IOW(BT_IOC_MAGIC, 0x73, ping_struct)/* | BD(6) | type (2) |*/#define BTGETINFO _IOW(BT_IOC_MAGIC, 0x74, unsigned char[8])/* ============================================================== *//* Used to calculate opcode for HCI commands using raw interface */#define OPCODE_LSB(ocf, ogf) ((ocf) & 0xff)#define OPCODE_MSB(ocf, ogf) (((ocf) >> 8) | (((ogf) & 0x3f) << 2))/* HCI packet types */#define CMD_PKT 0x01#define ACL_PKT 0x02#define SCO_PKT 0x03/* Define the different OpCode Group Field (OGF) values */#define HCI_LC 0x01 /* Link Control Command */#define HCI_LP 0x02 /* Link Policy Command */#define HCI_HC 0x03 /* Host Controller and Baseband Commands */#define HCI_IP 0x04 /* Informational Parameters */#define HCI_SP 0x05 /* StatusParameters */#define HCI_TC 0x06 /* Test Commands */#define MANUFACTURER_SPEC 0x3f/* ============================================================== *//* Ioctls used for general testing */#define BTSENDTESTDATA _IOW(BT_IOC_MAGIC, 0xf0, int[2])#define HCITESTCONNECTREQ _IOW(BT_IOC_MAGIC, 0xf1, unsigned char[6])/* | len (1) | test string | -- used for unplug tests */#define BTTESTCOMMAND _IOW(BT_IOC_MAGIC, 0xf2, unsigned char[261])#define BTSETMSSWITCH _IOW(BT_IOC_MAGIC, 0xf3, unsigned char)#define BTSETBCSPMODE _IOWR(BT_IOC_MAGIC, 0xf4, int)#define CSR_PSKEY_MSGHDR_SIZE 3#define CSR_PSKEY_MAXPARAMS 40/* * | ps_key (u16) | rw_mode (u16) | len (u16) | params (u16[])| */#define BT_CSR_PSKEY _IOWR(BT_IOC_MAGIC, 0xf5, unsigned short[CSR_PSKEY_MSGHDR_SIZE + CSR_PSKEY_MAXPARAMS])#define BTINITBCSP _IO(BT_IOC_MAGIC, 0xf6)#define BT_SET_DFU_MODE _IOWR(BT_IOC_MAGIC, 0xf7, int)#define BT_SEND_DFU_COMMAND _IOWR(BT_IOC_MAGIC, 0xf8, unsigned char[2048])#define BT_RETRIEVE_DFU_RESPONSE _IOWR(BT_IOC_MAGIC, 0xf9, unsigned char[2048])#define BTSETMAXCONNECTIONS _IOW(BT_IOC_MAGIC, 0xfa, unsigned char)/* ============================================================== *//* Structs */typedef struct bt_connection{ unsigned char bd[6]; unsigned int id; /* | psm(16 bits)爘 layer_specific (16 bits)爘
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -