首页 > 解决方案 > wdf windows 示例中的首选 PSM 是什么?

问题描述

我一直在研究 WDF Windows 的回声位样本。

server.c 中有一个注册 PSM 的函数BthEchoSrvRegisterPSM

它看起来像这样:

_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
BthEchoSrvRegisterPSM(
    _In_ PBTHECHOSAMPLE_SERVER_CONTEXT DevCtx
    )
/*++

Description:

    Registers server PSM.

Arguments:

    DevCtx - Device context of the server

Return Value:

    NTSTATUS Status code.

--*/
{
    NTSTATUS status;
    struct _BRB_PSM * brb;

    DevCtx->Header.ProfileDrvInterface.BthReuseBrb(
        &(DevCtx->RegisterUnregisterBrb), 
        BRB_REGISTER_PSM
        );

    brb = (struct _BRB_PSM *)
            &(DevCtx->RegisterUnregisterBrb);
    
    //
    // Send in our preferred PSM
    //
    brb->Psm = DevCtx->Psm;

    status = BthEchoSharedSendBrbSynchronously(
        DevCtx->Header.IoTarget,
        DevCtx->Header.Request,
        (PBRB) brb,
        sizeof(*brb)
        );
    
    if (!NT_SUCCESS(status))
    {
        TraceEvents(TRACE_LEVEL_ERROR, DBG_PNP, 
            "BRB_REGISTER_PSM failed, Status code %!STATUS!\n", status);
        goto exit;        
    }

    //
    // Store PSM obtained
    //
    DevCtx->Psm = brb->Psm;

exit:
    return status;
}

我的问题是什么是“我们首选的 PSM”?PSM 不是定义为特定服务吗?如何为远程设备设置它?它从何而来?

标签: c++windowsbluetoothwdfl2cap

解决方案


推荐阅读