Bewerken

Delen via


EVT_MBB_DEVICE_SEND_MBIM_FRAGMENT callback function (mbbcx.h)

A client driver's EvtMbbDeviceSendMbimFragment event callback function instructs its device to perform the task specified by the MBIM control message. This callback function is the equivalent of the SendEncapsulatedCommand request defined in the MBIM specification.

Syntax

EVT_MBB_DEVICE_SEND_MBIM_FRAGMENT EvtMbbDeviceSendMbimFragment;

void EvtMbbDeviceSendMbimFragment(
  WDFDEVICE Device,
  MBBREQUEST SendRequest
)
{...}

Parameters

Device

A handle to a framework device object the client driver obtained from a previous call to WdfDeviceCreate.

SendRequest

A handle to the framework object that represents the request to send a fragmented MBIM message to the device.

Return value

None

Remarks

An MBBCx client driver must register an EvtMbbDeviceSendMbimFragment callback function by calling MbbDeviceInitialize.

The MBBCx framework calls this callback function when it wants to issue a command in the format of an MBIM control message to the client driver. If the size of the MBIM control message is larger than the maximum fragment size set by the client driver in the MBB_DEVICE_MBIM_PARAMETERS structure, the MBBCx framework splits the MBIM control message into multiple fragmented messages and calls this callback function once per fragmented message.

To get the actual MBIM message fragment being sent, the client driver should call MbbRequestGetBuffer to get the buffer where the MBIM message fragment is stored. Once its device has successfully accepted the control request, or any failure condition has occurred, the client driver must acknowledge this to MBBCx by calling MbbRequestComplete either asynchronously or synchronously.

For more information, see Handling MBIM control messages.

Example

Error handling code has been left out of this example for brevity and clarity.

VOID
EvtMbbDeviceSendMbimFragment(
    WDFDEVICE  Device,
    MBBREQUEST SendRequest
)
{
    // The client driver-specified framework object context
    PMY_DEVICE_CONTEXT myContext = GetMyDeviceContext(Device);

    size_t bufferSize = 0;
    PVOID buffer = MbbRequestGetBuffer(SendRequest, &bufferSize);

    // This client driver example uses asynchronous completion
    auto myDeviceSendCompletionRoutine = [](MBBREQUEST SendRequest, NTSTATUS NtStatus)
    {
        //Acknowledge back to MBBCx
        MbbRequestComplete(SendRequest, NtStatus);
    };

    // The client driver-specified function call into its device
    NTSTATUS sendStatus = MyDeviceAsyncSend(

        // The client driver-specific handle
        myContext->MyDeviceHandle,

        // The context for completion
        SendRequest,

        // MBIM message               
        buffer,

        // MBIM message size
        bufferSize,   

        // Can be used for logging purpose, for example              
        MbbRequestGetActivityId(SendRequest), 

        // The client driver-specific completion routine
        myDeviceSendCompletionRoutine);

    if (sendStatus != STATUS_PENDING)
    {
        // Acknowledge back to MBBCx
        myDeviceSendCompletionRoutine(
            SendRequest,
            sendStatus);
    }
}

Requirements

Requirement Value
Minimum supported client Windows 10, version 1809
Target Platform Universal
Minimum KMDF version 1.27
Header mbbcx.h
IRQL <= DISPATCH_LEVEL