public void displayLcd(LcdDisplayParameter param) { byte[] msg = ASCIIEncoding.ASCII.GetBytes(param.message); if (msg.Length > 16) { Array.Resize(ref msg, 16); } Apdu apdu = new Apdu(); apdu.lengthExpected = 2; apdu.data = new byte[5 + msg.Length]; apdu.data[0] = 0xFF; apdu.data[1] = 0x00; apdu.data[2] = 0x68; apdu.data[3] = param.positionAbsolute; apdu.data[4] = (byte)msg.Length; Array.Copy(msg, 0, apdu.data, 5, msg.Length); if (param.boldFont) { apdu.data[1] |= 0x01; } apdu.data[1] |= (byte)param.fontSet; apduCommand = apdu; sendCardControl(); //if (apduCommand.statusWord[0] != 0x90) // throw new ContactlessException("Operation failed", Contactless_ErrorCodes.OPERATION_FAILED); }
/* * private void timerCb(object state) * { * Dispatcher.Invoke(() => * { * label1.Content = "Foo!"; * }); * } */ private void acr1222lreader(Boolean Backlight, string firstlinemessage, string secondlinemessage, string led) { try { string Reader = myListOfReaders[0]; acr1222SmartCardReader.readerName = Reader; acr1222SmartCardReader.connectDirect(); if (Backlight) { acr1222SmartCardReader.backlight(true); } else { acr1222SmartCardReader.backlight(false); } //MessageBox.Show( acr1222SmartCardReader.getTagUID()); //text on screen acr1222SmartCardReader.clearLcd(); LedStatus myled = new LedStatus(); LcdDisplayParameter parameter = new LcdDisplayParameter(); if (led == "none") { acr1222SmartCardReader.ledControl(LedStateSwitch.On, LedStateSwitch.Off, LedStateSwitch.Off, LedStateSwitch.Off); } if (led == "blue") { acr1222SmartCardReader.ledControl(LedStateSwitch.On, LedStateSwitch.On, LedStateSwitch.Off, LedStateSwitch.Off); acr1222SmartCardReader.ledControl(LedStateSwitch.On, LedStateSwitch.On, LedStateSwitch.Off, LedStateSwitch.Off); acr1222SmartCardReader.ledControl(LedStateSwitch.On, LedStateSwitch.On, LedStateSwitch.Off, LedStateSwitch.Off); acr1222SmartCardReader.ledControl(LedStateSwitch.On, LedStateSwitch.Off, LedStateSwitch.Off, LedStateSwitch.Off); acr1222SmartCardReader.ledControl(LedStateSwitch.On, LedStateSwitch.Off, LedStateSwitch.Off, LedStateSwitch.Off); acr1222SmartCardReader.ledControl(LedStateSwitch.On, LedStateSwitch.Off, LedStateSwitch.Off, LedStateSwitch.Off); acr1222SmartCardReader.ledControl(LedStateSwitch.On, LedStateSwitch.On, LedStateSwitch.Off, LedStateSwitch.Off); acr1222SmartCardReader.ledControl(LedStateSwitch.On, LedStateSwitch.On, LedStateSwitch.Off, LedStateSwitch.Off); acr1222SmartCardReader.ledControl(LedStateSwitch.On, LedStateSwitch.On, LedStateSwitch.Off, LedStateSwitch.Off); acr1222SmartCardReader.ledControl(LedStateSwitch.On, LedStateSwitch.Off, LedStateSwitch.Off, LedStateSwitch.Off); acr1222SmartCardReader.ledControl(LedStateSwitch.On, LedStateSwitch.Off, LedStateSwitch.Off, LedStateSwitch.Off); acr1222SmartCardReader.ledControl(LedStateSwitch.On, LedStateSwitch.Off, LedStateSwitch.Off, LedStateSwitch.Off); acr1222SmartCardReader.ledControl(LedStateSwitch.On, LedStateSwitch.On, LedStateSwitch.Off, LedStateSwitch.Off); acr1222SmartCardReader.ledControl(LedStateSwitch.On, LedStateSwitch.On, LedStateSwitch.Off, LedStateSwitch.Off); acr1222SmartCardReader.ledControl(LedStateSwitch.On, LedStateSwitch.On, LedStateSwitch.Off, LedStateSwitch.Off); acr1222SmartCardReader.ledControl(LedStateSwitch.On, LedStateSwitch.On, LedStateSwitch.Off, LedStateSwitch.Off); acr1222SmartCardReader.ledControl(LedStateSwitch.On, LedStateSwitch.Off, LedStateSwitch.Off, LedStateSwitch.Off); acr1222SmartCardReader.ledControl(LedStateSwitch.On, LedStateSwitch.Off, LedStateSwitch.Off, LedStateSwitch.Off); acr1222SmartCardReader.ledControl(LedStateSwitch.On, LedStateSwitch.On, LedStateSwitch.Off, LedStateSwitch.Off); } if (led == "orange") { acr1222SmartCardReader.ledControl(LedStateSwitch.On, LedStateSwitch.Off, LedStateSwitch.On, LedStateSwitch.Off); } if (led == "red") { acr1222SmartCardReader.ledControl(LedStateSwitch.On, LedStateSwitch.Off, LedStateSwitch.Off, LedStateSwitch.On); } parameter.message = firstlinemessage; //parameter.boldFont = CheckBoxBoldFont.Checked; parameter.positionLineNumber = (byte)(0 + 1); parameter.positionOffset = (byte)(0); parameter.fontSet = FontSet.SetA; acr1222SmartCardReader.displayLcd(parameter); parameter.message = secondlinemessage; //parameter.boldFont = CheckBoxBoldFont.Checked; parameter.positionLineNumber = (byte)(0 + 2); parameter.positionOffset = (byte)(0); parameter.fontSet = FontSet.SetA; acr1222SmartCardReader.displayLcd(parameter); acr1222SmartCardReader.disconnect(); } catch (PcscException acr1222Ex) { //showPcscException(acr1222Ex.Message); } catch (Exception ex) { //showSystemException(ex.Message); } }