12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- using Edge.Core.Parser.BinaryParser.MessageEntity;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace HengshanPaymentTerminal.MessageEntity.Outgoing
- {
- /// <summary>
- /// 发送二维码至油机数据对象
- /// </summary>
- public class SendQrCode : CommonMessage
- {
- /// <summary>
- /// 云端油枪id
- /// </summary>
- public long CloundNozzleId { get; set; }
- /// <summary>
- /// 油枪号
- /// </summary>
- public int NozzleNum { get; set; }
- /// <summary>
- /// 小程序链接
- /// </summary>
- private string SmallProgram { get; set; }
- public SendQrCode(long cloundNozzleId,int nozzle,string samllProgram,byte frame)
- {
- this.Handle = (byte)Command.SEND_QR_CODE;
- this.NozzleNum = nozzle;
- this.CloundNozzleId = cloundNozzleId;
- this.SmallProgram = samllProgram;
- this.FrameNum = frame;
- }
- public override byte[] ToCommonByteArray()
- {
- List<Byte> list = new List<Byte>();
- byte[] commandAndNozzle = { this.Handle, (byte)this.NozzleNum };
- string qrCode = this.SmallProgram + "?id=" + this.CloundNozzleId;
- byte[] qrCodeBytes = Encoding.ASCII.GetBytes(qrCode);
- list.AddRange(commandAndNozzle);
- list.Add((byte)qrCodeBytes.Length);
- list.AddRange(qrCodeBytes);
- byte[] sendBytes = content2data(list.ToArray());
- return sendBytes;
- }
- public override CommonMessage ToObject(byte[] datas)
- {
- return this;
- }
- }
- }
|