IMbnDeviceService::WriteData method

Write data to a device service data session.


HRESULT WriteData(
  [in]  SAFEARRAY(BYTE) deviceServiceData,
  [out] ULONG           *requestID


deviceServiceData [in]

A byte array that is passed in to the device to write.

requestID [out]

A unique request ID assigned by the Mobile Broadband service to identify this request.

Return value

The method can return one of the following values.

Return codeDescription

The method completed successfully.


This device service command is not allowed for calling process privileges.


The length of the deviceServiceData is greater than the supported MaxDataSize.


The device service session is not open.


An error was encountered when executing this method.



WriteData passes a bulk data to a vendor-specific device service on the device. The Mobile Broadband service will forward this request to the device. deviceServiceData will be copied byte-by-byte into the data buffer passed in to the request. This data buffer must be less than MaxDataSize bytes.

The data session must be opened before the application can call WriteData. The operating system does not provide guarantees on the latency or performance of WriteData.

This is an asynchronous operation and WriteData will return immediately. On completion of the operation, the Mobile Broadband service will call the OnWriteDataComplete method of the IMbnDeviceServicesEvents interface.

See also