EVT_MBB_DEVICE_SEND_DEVICE_SERVICE_SESSION_DATA回调函数 (mbbcx.h)

客户端驱动程序的 EvtMbbDeviceSendServiceSessionData 事件回调函数将设备服务会话数据向下发送到其调制解调器设备。

语法

EVT_MBB_DEVICE_SEND_DEVICE_SERVICE_SESSION_DATA EvtMbbDeviceSendDeviceServiceSessionData;

void EvtMbbDeviceSendDeviceServiceSessionData(
  WDFDEVICE Device,
  DSS_SESSION_ID SessionId,
  WDFMEMORY Data
)
{...}

参数

Device

从上一次调用 WdfDeviceCreate获取的客户端驱动程序的框架设备对象的句柄。

SessionId

从上一次调用 MbbAdapterGetSessionId获取的设备服务会话的 ID。

Data

包含要传递给设备的数据的 WDFMEMORY 对象。

返回值

没有

言论

当应用程序将 DSS 数据向下发送到调制解调器设备时,MBBCx 调用客户端驱动程序的 EvtMbbDeviceSendServiceSessionData 回调函数。 异步将数据发送到设备后,客户端驱动程序必须调用 MbbDeviceSendServiceSessionDataComplete,以便 MBBCx 可以释放为数据分配的内存。

以下示例演示客户端如何将 DSS 数据向下发送到其调制解调器设备。 为了简洁明了,错误处理已被排除在此示例中。

VOID
MyEvtMbbDeviceSendServiceSessionData(
    _In_ WDFDEVICE Device,
    _In_ DSS_SESSION_ID SessionId,
    _In_ WDFMEMORY Data
)
{
    // Get the device context and NETADAPTER context
    PMY_DEVICE_CONTEXT deviceContext = GetMyDeviceContext(Device);

    // Set up a driver-defined DSS packet structure
    PMY_DSS_PACKET packet = NULL;

    // Get the data to send from the WDFMEMORY object
    size_t bufferSize = 0;
    PVOID buffer = WdfMemoryGetBuffer(Data, 
                                      &bufferSize);

    // Populate the DSS packet
    packet = MyAllocateDssPacket(Data,
                                buffer,
                                bufferSize,
                                SessionId);

    // Send the data asynchronously, which returns STATUS_PENDING when successful
    status = MyModemBusWriteData(deviceContext->BusHandle,
                                 packet);

    // Increment count of sent packets
    deviceContext->DSSPacketsSentCount++;

    // Clean up the memory
    MbbDeviceSendServiceSessionDataComplete(Data,
                                            status);
    MyCleanupDssPacket(packet);
}

要求

要求 价值
最低支持的客户端 Windows 10 版本 1809
目标平台 普遍
最低 KMDF 版本 1.27
标头 mbbcx.h
IRQL PASSIVE_LEVEL