다음을 통해 공유


SmartcardT1Request (Windows Embedded CE 6.0)

1/6/2010

The SmartcardT1Request function copies data from the user buffer to a send buffer and checks the T=1 protocol status.

Syntax

NTSTATUS SmartcardT1Request(
  PSMARTCARD_EXTENSION SmartcardExtension
);

Parameters

  • SmartcardExtension
    [in] Points to the smart card extension of the device.

Return Value

SmartcardT1Request returns an NTSTATUS value; STATUS_SUCCESS indicates that the buffer was successfully set up.

Remarks

Do not change any members of the T1_DATA structure. They will be initialized automatically. The only member that can be safely modified is the NAD value. Changing of any member might lead to protocol errors.

SmartcardT1Request copies the data, embedded in a T=1 protocol frame, from the user buffer to the Buffer member of the SmartcardRequest member of the SMARTCARD_EXTENSION structure pointed to by SmartcardExtension and it also adjusts the value in BufferLength member of the SmartcardRequest member of this structure. The driver must send this buffer to the smart card and read the answer of the card into the Buffer member of the SmartcardReply member of this structure. The driver must then call SmartcardT1Reply, which checks the incoming protocol frame.

You can copy your header data to the buffer either before or after a call to SmartcardT1Request, depending on which is easier to do in your driver. If your driver needs to send header data to the reader before the actual T=1 data, you should set the value of BufferLength in the SmartcardRequest member of this structure to the number of bytes that you need for your header before you call this function. The packet consists of your header data followed by the T= 1 data.

A usual T=1 transmission can be done in the following way.

// Run this loop as long as the protocol requires to send data
do {
    // Copy data to SmartcardExtension->SmartcardRequest.Buffer
    // embedded in a T=1 frame
    status = SmartcardT1Request(SmartcardExtension);
    if (status != STATUS_SUCCESS)
        return status;
    // Send T=1 frame to smart card
    status = DriverSendDataToSmartcard(...);
    if (status != STATUS_SUCCESS)
        return status;
// Now set appropiate timeout (This example calculates. the time-out in ms)
// Timeout = SmartcardExtension->CardCapabilities.T1.BWT *
//    (SmartcardExtension->T1.Wtx ? SmartcardExtension->T1.Wtx : 1);
    // receive T=1 frame from smart card
    status = DriverReceiveDataFromSmartcard(...);
    if (status != STATUS_SUCCESS)
        return status;
    // Check T=1 protocol status and copy any data back to user buffer
    status = SmartcardT1Reply(SmartcardExtension);
} while (status == STATUS_MORE_PROCESSING_REQUIRED);
return status;

Requirements

Header smclib.h
Windows Embedded CE Windows CE 3.0 and later

See Also

Reference

Smart Card Driver Functions
T1_DATA
SmartcardT1Reply