DisplayRequest.cs 1.5 KB

123456789101112131415161718192021222324252627282930
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using Parser.BinaryParser.Util;
  7. namespace WayneChina_IcCardReader_SinoChem.MessageEntity.Outgoing
  8. {
  9. public class DisplayRequest : IcCardReaderMessageBase
  10. {
  11. /// <summary>
  12. ///
  13. /// </summary>
  14. /// <param name="textWithFormat">max 64 bytes ASCII chars. less than 64 will auto padding right with space. the `format control chars` are device dependency, pls refer device spec.
  15. /// 西文ASCII / 中文GB码,中文码的第一字节必须是在奇数位上</param>
  16. /// <param name="howLongToStayOnScreen">the expecting time that the device will keep this text on screen for how long, by second
  17. /// 0 indicates display forever, and during this time, all keyboard event will be routed and need to be handled by FC as well</param>
  18. public DisplayRequest(byte[] textWithFormat, int howLongToStayOnScreen)
  19. {
  20. if (textWithFormat.Length > 64) throw new ArgumentOutOfRangeException("textWithFormat length must <=64");
  21. if (howLongToStayOnScreen > 65536) throw new ArgumentOutOfRangeException("howLongToStayOnScreen must <=65536");
  22. base.RawData = new List<byte>();
  23. base.RawData.Add(0x03);
  24. base.RawData.AddRange(howLongToStayOnScreen.GetBCDBytes(2));
  25. var displayData = textWithFormat;
  26. base.RawData.AddRange(displayData);
  27. }
  28. }
  29. }