Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server (Not)   Client   Old   Guides   Examples
New in version: 6.2   6.3   6.4   6.5   7.0   7.1   7.2   7.3   7.4   7.5    Statistic  

SmartCard.Init

Initializes a smartcard context.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
SmartCard 6.3 Yes Yes Yes No No

MBS( "SmartCard.Init" )

Parameters

none

Result

Returns SmartCard Context ID or error.

Description

Initializes a smartcard context.
Returns the ID for other SmartCard functions.
Please call SmartCard.Release later.

Examples

List readers:

Set Variable [$c; Value:MBS( "SmartCard.Init" )]
Set Variable [$readers; Value:MBS( "SmartCard.ListReaders"; $c )]
Set Variable [$r; Value:MBS( "SmartCard.Release"; $c )]
Show Custom Dialog ["Readers"; $readers]

Connect and query value:

If [MBS( "SmartCard.Available" ) = 1]
    #Start a new session
    Set Variable [$SCContext; Value:MBS( "SmartCard.Init" )]
    If [MBS( "SmartCard.Valid"; $SCContext )]
        #Query list of readers and pick first
        Set Variable [$SCReader; Value:GetValue ( MBS( "SmartCard.ListReaders"; $SCContext) ; 1 )]
        If [MBS("IsError") = 0]
            # Connect to card
            Set Variable [$SCConnect; Value:MBS( "SmartCard.Connect"; $SCContext ; $SCReader ; "Shared"; "any")]
            Set Variable [$PRotocol; Value:MBS( "SmartCard.GetActiveProtocol"; $SCContext)]
            If [$SCConnect = "OK"]
                #Run a query
                Set Variable [$Result; Value:MBS( "SmartCard.Transmit"; $SCContext; "0200000008000000"; "00ca018202"; 512 )]
                #Result is 4 bytes. Starts with C901 for Version 5.0 or C903 for Version 5.3
                Show Custom Dialog ["Version"; $result]
                #Disconnect
                Set Variable [$SCDisconnect; Value:MBS( "SmartCard.Disconnect"; $SCContext; "Leave" )]
            Else
                Show Custom Dialog ["Error"; "No card available."]
            End If
        End If
        #End Card Session
        Set Variable [$SCRelease; Value:MBS( "SmartCard.Release" ; $SCContext )]
    Else
        Show Custom Dialog ["Error"; "Failed to initalize"]
    End If
Else
    Show Custom Dialog ["Error"; "No SmartCard API on this OS."]
End If

See also

Example Databases


SmartCard.HeaderTemplate   -   SmartCard.ListReaderGroups

Feedback: Report problem or ask question.




Links
MBS Xojo PDF Plugins