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

📄 bthsco.h

📁 Windows CE操作系统中适用的蓝牙驱动程序
💻 H
字号:
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to use
// this source code. For a copy of the EULA, please see the LICENSE.RTF on your
// install media.
//
/**
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED 
WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.


Abstract:
    Windows CE Bluetooth SCO layer 

**/
#if ! defined (__BTHSCO_HXX__)
#define __BTHSCO_HXX__      1

#include <svsutil.hxx>

#include <bt_debug.h>
#include <bt_tdbg.h>
#include <bt_api.h>
#include <bt_buffer.h>
#include <bt_ddi.h>



#define BT_LINK_TYPE_SCO    0
#define BT_LINK_TYPE_ACL    1

//
// SCO-specific user events
//

#define SCO_LINK_DISCONNECT      1000


//
// voice setting definitions (hci_ReadVoiceSetting_In and hci_WriteVoiceSetting_In)
//

#define VS_INPUT_CODING_LINEAR     0
#define VS_INPUT_CODING_ULAW       1
#define VS_INPUT_CODING_ALAW       2
#define VS_INPUT_CODING_RESERVED   3
#define VS_INPUT_FORMAT_1COMP      0
#define VS_INPUT_FORMAT_2COMP      1
#define VS_INPUT_FORMAT_SIGNMAG    2
#define VS_INPUT_FORMAT_RESERVED   3
#define VS_INPUT_SAMPLE_SIZE_8BIT  0
#define VS_INPUT_SAMPLE_SIZE_16BIT 1
#define VS_AIR_CODING_CVSD         0
#define VS_AIR_CODING_ULAW         1
#define VS_AIR_CODING_ALAW         2
#define VS_AIR_CODING_RESERVED     3

typedef union _VOICE_SETTING
{
    struct {
        unsigned short fAirCoding        : 2;
        unsigned short fLinearPCMBitPos  : 3;
        unsigned short fInputSampleSize  : 1;
        unsigned short fInputFormat      : 2;
        unsigned short fInputCoding      : 2;
    } Parameters;
    unsigned short usSetting;
} VOICE_SETTING;

//
// Callbacks given to SCO layer during binding
//

typedef int (*SCO_CALLBACK_DataPacketUp)        (void *pUserData, USHORT hConnection, PUCHAR pBuffer, DWORD dwBufferLen);
typedef int (*SCO_CALLBACK_DataPacketDown)      (void *pUserData, void *pPacketUserContext, USHORT hConnection, DWORD dwError);
typedef int (*SCO_CALLBACK_PacketsCompleted)    (void *pUserData, USHORT hConnection, USHORT nCompletedPackets);
typedef int (*SCO_CALLBACK_StackEvent)          (void *pUserData, int iEvent);

typedef struct _SCO_CALLBACKS
{
    SCO_CALLBACK_DataPacketUp       DataPacketUp;
    SCO_CALLBACK_DataPacketDown     DataPacketDown;
    SCO_CALLBACK_PacketsCompleted   PacketsCompleted;
    SCO_CALLBACK_StackEvent         StackEvent;
} SCO_CALLBACKS, *PSCO_CALLBACKS;


//
// Interface received from SCO layer during binding
//

// values for dwUserCallType

#define UCT_CONNECT                         0x00000001
#define UCT_DISCONNECT                      0x00000002
#define UCT_READ_VOICE_SETTING              0x00000003
#define UCT_WRITE_VOICE_SETTING             0x00000004
#define UCT_RECV_CONNECTION                 0x00000005
#define UCT_WRITE_PACKET                    0x00000006

#define SCO_IOCTL_MASK                      0x40000000
#define UCT_IOCTL_GET_BASEBAND_CONNECTIONS  0x40000001
#define UCT_IOCTL_GET_SCO_PARAMETERS        0x40000002

typedef struct _SCO_USER_CALL
{
    DWORD   dwUserCallType;
    HANDLE  hEvent;
    int     iResult;

    union {
        struct {
            IN      USHORT hAclConnection;
            OUT     USHORT hScoConnection;
        } Connect;

        struct {
            IN      USHORT hScoConnection;
        } Disconnect;

        struct {
            OUT     VOICE_SETTING   VoiceSetting;
        } ReadVoiceSetting;

        struct {
            IN      VOICE_SETTING   VoiceSetting;
        } WriteVoiceSetting;

        struct {
            IN      BOOL    bAllAddresses;
            IN OUT  BD_ADDR Address;
            OUT     USHORT  hScoConnection;
        } RecvConnection;

        struct {
            IN      USHORT  hScoConnection;
            IN      PUCHAR  pDataBuffer;
            IN      DWORD   dwDataBufferLen;
        } WritePacket;

        //
        // ioctls
        //

        struct {
            IN OUT  DWORD                       dwCount;
            OUT     BASEBAND_CONNECTION_DATA    *pConnections;
        } IoctlGetBasebandConnections;

        struct {
            OUT     BOOL    bScoSupported;
            OUT     DWORD   dwScoPacketMaxDataSize;
            OUT     DWORD   dwNumConcurrentScoPackets;
        } IoctlGetScoParameters;

    } uParameters;

} SCO_USER_CALL, *PSCO_USER_CALL;

//
// SCO interface
//

typedef int (*SCO_INTERFACE_Call)           (SCO_USER_CALL* pUserCall);
typedef int (*SCO_INTERFACE_AbortCall)      (SCO_USER_CALL* pUserCall);
typedef int (*SCO_INTERFACE_DataPacketDown) (void* pPacketUserContext, USHORT hConnection, PUCHAR pBuffer, DWORD dwBufferLen);

typedef struct _SCO_INTERFACE
{
    SCO_INTERFACE_Call              Call;
    SCO_INTERFACE_AbortCall         AbortCall;
    SCO_INTERFACE_DataPacketDown    DataPacketDown;
} SCO_INTERFACE, *PSCO_INTERFACE;


int sco_InitializeOnce(void);
int sco_UninitializeOnce(void);

int sco_CreateDriverInstance(void);
int sco_CloseDriverInstance(void);

int sco_Bind(void *pUserData, SCO_CALLBACKS *pCallbacks, SCO_INTERFACE *pInterface);
int sco_Unbind();

#endif      // __BTHSCO_HXX__

⌨️ 快捷键说明

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