⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 btifdefinitions.h

📁 基于widcomm的蓝牙传输功能程序
💻 H
📖 第 1 页 / 共 4 页
字号:
/////////////////////////////////////////////////////////////////////////////
//
//  Name        BtIfDefinitions.h
//  $Header:
//
//  Function    this file contains WIDCOMM BTW SDK type definitions
//
//  Date                 Modification
//  ----------------------------------
//  12/17/2000    JF   Create
//
//  Copyright (c) 2000-2006, Broadcom Corporation, All Rights Reserved.
//
//////////////////////////////////////////////////////////////////////////////

#ifndef _BTIFDEFINITIONS_H 
#define _BTIFDEFINITIONS_H


// Ensure alignment across all builds
//
#ifdef _WIN32_WCE
#pragma pack (8)
#else
#include <pshpack1.h>
#endif


//
// Define return codes from the SDP service functions
//
typedef enum
{
    SDP_OK,
    SDP_COULD_NOT_ADD_RECORD,
    SDP_INVALID_RECORD,
    SDP_INVALID_PARAMETERS

} SDP_RETURN_CODE;

//
// Define SPP connection states
//
typedef enum
{
    SPP_CONNECTED,          // port now connected
    SPP_DISCONNECTED,       // port now disconnected
    SPP_RFCOMM_CONNECTION_FAILED,    //rfcomm connction failed

    //for SPP Client only
    SPP_PORT_IN_USE,        // Port in use, for SPPClient only
    SPP_PORT_NOT_CONFIGURED, // no port configured
    SPP_SERVICE_NOT_FOUND,  // service not found

    //for SPP Server Only
    SPP_ALLOC_SCN_FAILED,
    SPP_SDP_FULL
} SPP_STATE_CODE;


// Maximum number of UUIDs in a service class ID list
//
#define MAX_UUIDS_PER_SEQUENCE   3

// Maximum service name length
//
#define BT_MAX_SERVICE_NAME_LEN  100

// Maximum protocol list elements in a record
//
#define MAX_PROTOCOL_LIST_ELEM   3

#define SDP_MAX_LIST_ELEMS      3
#define MAX_ELEM_IN_SEQ 10


//
// Define a structure to hold attribute values when
// read from the discovery database. Note that the
// attribute may be a sequence, in which case the
// number of elements will be greater than 1.
//
#define MAX_SEQ_ENTRIES     20
#define MAX_ATTR_LEN_OLD    256     // BTW stacks before 5.0.1.400 will truncate any longer attributes on create/receive 
#define MAX_ATTR_LEN        496     // Newer stacks accept up to this length.  Note: old length
                                    // still used in CSdpService::AddSupportedFormatsList()
                                     
typedef struct
{
    int     num_elem;

    struct
    {
        #define ATTR_TYPE_INT      0       // Attribute value is an integer
        #define ATTR_TYPE_TWO_COMP 1       // Attribute value is an 2's complement integer
        #define ATTR_TYPE_UUID     2       // Attribute value is a UUID
        #define ATTR_TYPE_BOOL     3       // Attribute value is a boolean
        #define ATTR_TYPE_ARRAY    4       // Attribute value is an array of bytes

        int     type;
        int     len;                        // Length of the attribute
        BOOL    start_of_seq;               // TRUE for each start of sequence
        union
        {
            unsigned char    u8;                      // 8-bit integer
            unsigned short   u16;                     // 16-bit integer
            unsigned long    u32;                     // 32-bit integer
            unsigned __int64 u64;                     // 64-bit integer
            struct
            {
                unsigned __int64 uLow64;
                unsigned __int64 uHigh64;
            } u128;                                   // 128-bit integer
            BOOL             b;                       // Boolean
            unsigned char    array[MAX_ATTR_LEN];     // Variable length array
        } val;

    } elem [MAX_SEQ_ENTRIES];

} SDP_DISC_ATTTR_VAL;

///////////////////////////////////////////////////////////////////////////////
///// definitions used in FTP client apps to present remote server directory listings
//
#define MAX_NAME_SIZE   255
#define MAX_ENTRY_SIZE  1000
#define DATE_TIME_SIZE  15

typedef struct
{
    WCHAR    name[MAX_NAME_SIZE + 1];
    BOOL    is_folder;
    WCHAR    date_created[DATE_TIME_SIZE + 1];
    WCHAR    date_modified[DATE_TIME_SIZE + 1];
    WCHAR    date_accessed[DATE_TIME_SIZE + 1];
    ULONG    file_size;

#define FTP_READ_PERM      (0x01)
#define FTP_WRITE_PERM     (0x02)
#define FTP_DELETE_PERM    (0x04)

    WCHAR    user_perm;
    WCHAR    group_perm;
    WCHAR    other_perm;
} tFTP_FILE_ENTRY;



#ifndef BT_CONN_STATS_DEFINED
#define BT_CONN_STATS_DEFINED
typedef struct
{
    UINT32   bIsConnected;
    INT32    Rssi;
    UINT32   BytesSent;
    UINT32   BytesRcvd;
    UINT32   Duration;
} tBT_CONN_STATS;
#endif  //BT_CONN_STATS_DEFINED

#define L2CAP_MIN_MTU                   (48)

/* Link types for connection complete event */
#define HCI_LINK_TYPE_SCO               0x00
#define HCI_LINK_TYPE_ACL               0x01
#define HCI_LINK_TYPE_ESCO              0x02


/////////////////////////////////////////////////////////////////////////////////////////
//  Definitions for applications only
//

#if !defined (WIDCOMMSDK_EXPORTS)

//
// Define some types used by the WIDCOMM BTW SDK
//
typedef unsigned char    UINT8;
typedef unsigned short   UINT16;
typedef unsigned int     UINT32;
typedef unsigned __int64 UINT64;

#ifndef SDP_UINT128_DEFINED
#define SDP_UINT128_DEFINED
typedef struct 
{
    UINT64 uLow64;
    UINT64 uHigh64;
} SDP_UINT128;
#endif

//
// Common Bluetooth field definitions
//
#define BD_ADDR_LEN     6                   /* Device address length */
typedef UINT8 BD_ADDR[BD_ADDR_LEN];         /* Device address */
typedef UINT8 *BD_ADDR_PTR;                 /* Pointer to Device Address */

#define LINK_KEY_LEN    16
typedef UINT8 LINK_KEY[LINK_KEY_LEN];       /* Link Key */

#define PIN_CODE_LEN    16
typedef UINT8 PIN_CODE[PIN_CODE_LEN];       /* Pin Code (upto 128 bits) MSB is 0 */
typedef UINT8 *PIN_CODE_PTR;                /* Pointer to Pin Code */

#define DEV_CLASS_LEN   3
typedef UINT8 DEV_CLASS[DEV_CLASS_LEN];     /* Device class */
typedef UINT8 *DEV_CLASS_PTR;               /* Pointer to Device class */

#define BTM_MAX_VENDOR_SPECIFIC_LEN 255     /*Vendor specific command len */
//
// Coding of the DEV_CLASS field. Refer to Bluetooth Assigned Numbers
// specification for further information on device class.
//
// First byte - Service class of the CoD, byte [0]
#define SERV_CLASS_NETWORKING               (1 << 1)
#define SERV_CLASS_RENDERING                (1 << 2)
#define SERV_CLASS_CAPTURING                (1 << 3)
#define SERV_CLASS_OBJECT_TRANSFER          (1 << 4)
#define SERV_CLASS_OBJECT_AUDIO             (1 << 5)
#define SERV_CLASS_OBJECT_TELEPHONY         (1 << 6)
#define SERV_CLASS_OBJECT_INFORMATION       (1 << 7)

// Second byte - high order 
#define SERV_CLASS_LIMITED_DISC_MODE        (0x20)

// Also 2nd byte - Major Device class - low 5 bits
#define MAJOR_DEV_CLASS_MASK                0x1F

#define MAJOR_DEV_CLASS_MISC                0x00
#define MAJOR_DEV_CLASS_COMPUTER            0x01
#define MAJOR_DEV_CLASS_PHONE               0x02
#define MAJOR_DEV_CLASS_LAN_ACCESS          0x03
#define MAJOR_DEV_CLASS_AUDIO               0x04
#define MAJOR_DEV_CLASS_PERIPHERAL          0x05
#define MAJOR_DEV_CLASS_IMAGING             0x06
#define MAJOR_DEV_CLASS_UNSPECIFIED         0x1F

// 3rd byte - Minor Device class, hi  6 bits
#define MINOR_DEV_CLASS_MASK                0xFC

// Minor device class if major is computer
#define MINOR_DEV_CLASS_COMP_UNCLASSIFIED   0x00
#define MINOR_DEV_CLASS_COMP_WORKSTATION    (0x01 << 2)
#define MINOR_DEV_CLASS_COMP_SERVER         (0x02 << 2)
#define MINOR_DEV_CLASS_COMP_LAPTOP         (0x03 << 2)
#define MINOR_DEV_CLASS_COMP_HANDHELD       (0x04 << 2)
#define MINOR_DEV_CLASS_COMP_PALM           (0x05 << 2)

// Minor device class if major is phone
#define MINOR_DEV_CLASS_PHONE_UNCLASSIFIED  0x00
#define MINOR_DEV_CLASS_PHONE_CELLULAR      (0x01 << 2)
#define MINOR_DEV_CLASS_PHONE_CORDLESS      (0x02 << 2)
#define MINOR_DEV_CLASS_PHONE_SMART         (0x03 << 2)
#define MINOR_DEV_CLASS_PHONE_MODEM         (0x04 << 2)

// Minor device class if major is imaging
#define MINOR_DEV_CLASS_IMAGING_UNCLASSIFIED  0x00
#define MINOR_DEV_CLASS_IMAGING_DISPLAY       (0x04 << 2)
#define MINOR_DEV_CLASS_IMAGING_CAMERA        (0x08 << 2)
#define MINOR_DEV_CLASS_IMAGING_SCANNER       (0x10 << 2)
#define MINOR_DEV_CLASS_IMAGING_PRINTER       (0x20 << 2)

#define MINOR_DEV_CLASS_AUDIO_UNCLASSIFIED  0x00

// Minor device class if major is audio
#define MINOR_DEV_CLASS_AUDIO_UNCLASSIFIED  0x00
#define MINOR_DEV_CLASS_AUDIO_HEADSET       (0x01 << 2)


#define BD_NAME_LEN     248
typedef UINT8 BD_NAME[BD_NAME_LEN];         /* Device name */
typedef UINT8 *BD_NAME_PTR;                 /* Pointer to Device name */


// L2CAP Configuration QOS structure
//
#ifndef BT_TYPES_H
typedef struct
{
    UINT8               qos_flags;          /* TBD */

// Values for service_type
//
#define NO_TRAFFIC      0
#define BEST_EFFORT     1
#define GUARANTEED      2

    UINT8               service_type;       /* see below */
    UINT32              token_rate;         /* bytes/second */
    UINT32              token_bucket_size;  /* bytes */
    UINT32              peak_bandwidth;     /* bytes/second */
    UINT32              latency;            /* microseconds */
    UINT32              delay_variation;    /* microseconds */          

} FLOW_SPEC;
#endif



//Zong, need to talk to ask to see if we can make them the same
#ifdef _WIN32_WCE
    #define L2CAP_MAX_MTU               1400
    #define L2CAP_DEFAULT_MTU           672
#else
//    Note:  The following is not defined because: a) it is not
//           used in the SDK source code, and b) to avoid a redefinition
//           warning when used with the Windows Bluetooth SDK. (CR 14046)
//    #define L2CAP_MAX_MTU               1696      // 
    #define L2CAP_DEFAULT_MTU           (672)
    #define BNEP_MIN_MTU_SIZE           1691
#endif

#define L2CAP_DEFAULT_FLUSH_TO          0xFFFF


// This structure is used to add protocol lists and find protocol elements
//
#ifndef SDP_MAX_PROTOCOL_PARAMS
#define SDP_MAX_PROTOCOL_PARAMS     1
#endif

typedef struct 
{
    UINT16      protocol_uuid;
    UINT16      num_params;
    UINT16      params[SDP_MAX_PROTOCOL_PARAMS];
} tSDP_PROTOCOL_ELEM;

typedef struct 
{
    UINT16              num_elems;
    tSDP_PROTOCOL_ELEM  list_elem[SDP_MAX_LIST_ELEMS];
} tSDP_PROTO_LIST_ELEM;

// Maximum UUID size - 16 bytes, and structure to hold any type of UUID.
//
#define MAX_UUID_SIZE              16

#ifndef BT_TYPES_H
typedef struct
{
#define LEN_UUID_16     2
#define LEN_UUID_32     4
#define LEN_UUID_128    16

    UINT16          len;
    UINT8           pad[14];

    union
    {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -