SmartCard

JAKAJAKA Member Posts: 18
Hello!

I need to add to my application verifying id from smartcard.
Unfortunately I am new to both NAV and SmartCard and I can't get this working at all! :(

This is what I have tried to get at least some sign of life from my card:
OBJECT Codeunit 90050 SmartCard
{
  OBJECT-PROPERTIES
  {
    Date=04.03.09;
    Time=13:47:17;
    Modified=Yes;
    Version List=;
  }
  PROPERTIES
  {
    OnRun=BEGIN
            ReadData();
          END;

  }
  CODE
  {
    VAR
      SmartCard@1000000000 : Automation "{82C38704-19F1-11D3-A11F-00C04F79F800} 1.0:{1461AAC7-6810-11D0-918F-00AA00C18068}:'scardssp 1.0 Type Library'.CSCard";
      CardHandle@1000000001 : Integer;
      result@1000000002 : Integer;

    PROCEDURE ReadData@1000000000();
    BEGIN

      CREATE(SmartCard);
      SmartCard.AttachByHandle(CardHandle);
      MESSAGE(FORMAT(CardHandle));
    END;

    BEGIN
    END.
  }
}
Unfortunately this doesn't do much, the message shows '0' and nothing else happens. If I try to do anything more complicated, I get error messages.
Can you give me anything to start with? :D

Comments

  • matttraxmatttrax Member Posts: 2,309
    I'm not sure displaying the automation variable will automatically call the ToString method from the code (or whatever similar thing it is trying to do).

    Are you using pre-built automations, or are you building your own / creating wrappers for them?
  • JAKAJAKA Member Posts: 18
    At the moment I'm trying to get any signal from the card reader. I haven't got any progress today. :(

    I'm using 'scardssp 1.0 Type Library'.CSCard", which was available in the automation server list.
  • JAKAJAKA Member Posts: 18
    Here is another test that fails:

    // VAR CardTest Automation 'scardssp 1.0 Type Library'.CSCardISO7816
    // VAR W_byte1 Text
    // VAR W_byte2 Text
    // VAR W_long Integer
    // VAR W_text Text

    CREATE(CardTest);
    W_byte1 := ' ';
    W_byte2 := ' ';
    W_long := 8;
    CardTest.GetData(W_byte1,W_byte2,W_long,W_text);
    { ERROR MESSAGE:
    This message is for C/AL programmers:
    Could not invoke the member GetData. The OLE control or Automation server returner the following message:
    One or more of the arguments could not be coerced.
    }

    As you can see, I really haven't made any progress. Can you help me to get started?
Sign In or Register to comment.