using Edge.Core.Parser.BinaryParser.MessageEntity; using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace HengshanPaymentTerminal.MessageEntity.Outgoing { /// /// 发送二维码至油机数据对象 /// public class SendQrCode : CommonMessage { static NLog.Logger Logger = NLog.LogManager.GetCurrentClassLogger(); /// /// 云端油枪id /// public long CloundNozzleId { get; set; } /// /// 油枪号 /// public int NozzleNum { get; set; } /// /// 小程序链接 /// 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 list = new List(); 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; } } }