private Packet FormatTariffPerDay(TariffPerDay tariff, int index, TollOptionSetting tos) { Packet packet = new Packet(); packet.Order = OrderCode.Comm_WriteParameterTable; packet.Address = CanAddress.HostEntrance; packet.AddByte((byte)index); //下载而号 //16字节 单字节选项 packet.AddByte(0x0); packet.AddByte(GetVoice(tariff.CarType)); packet.AddByte(GetVoice(tariff.CarType)); packet.AddBytes(new byte[13]); //以下为公共收费参数 16字节 packet.AddByte(0x0); //为1表示无入场记录按次收费 packet.AddShort(0x0); //无入场记录按上次出场时间计算免费时间(分钟) packet.AddShort(0x0); //无入场记录按次收费金额 packet.AddByte(0x0); //备用 packet.AddShort(tariff.FreeMinutes); //入场免费时间 packet.AddShort(0x0); //免费零头时间 packet.AddShort(0x0); //中央收费后免费时间 packet.AddShort((short)(24 * 60)); //公用的周期限额计费时间(小时)(24小时) packet.AddShort((short)(tos.FromYuan(tariff.FeePerDay))); //不分时段普通收费参数16byte packet.AddByte(0x02); //计费模式 2按天 packet.AddBytes(new byte[15]); //下面为空 packet.AddBytes(new byte[240 - 49]); //参数总共240字节, return(packet); }
private Packet FormatTariffOfLimitation(TariffOfLimitation tariff, int index, TollOptionSetting tos) { Packet packet = new Packet(); packet.Order = OrderCode.Comm_WriteParameterTable; packet.Address = CanAddress.HostEntrance; packet.AddByte((byte)index); //下载而号 //16字节 单字节选项 packet.AddByte(0x0); packet.AddByte(GetVoice(tariff.CarType)); packet.AddByte(GetVoice(tariff.CarType)); packet.AddBytes(new byte[13]); //以下为公共收费参数 16字节 packet.AddByte(0x0); //为1表示无入场记录按次收费 packet.AddShort(0x0); //无入场记录按上次出场时间计算免费时间(分钟) packet.AddShort(0x0); //无入场记录按次收费金额 packet.AddByte(0x0); //备用 packet.AddShort(tariff.FreeMinutes); //入场免费时间 packet.AddShort(0x0); //免费零头时间 packet.AddShort(0x0); //中央收费后免费时间 if (tariff.FeeOf12Hour > 0) { packet.AddShort(12 * 60); //公用的周期限额计费时间(小时)(12小时) packet.AddShort((short)(tos.FromYuan(tariff.FeeOf12Hour))); } else { packet.AddShort(24 * 60); //公用的周期限额计费时间(小时)(24小时) packet.AddShort((short)(tos.FromYuan(tariff.FeeOf24Hour))); } //不分时段普通收费参数16byte packet.AddByte(0x03); //计费模式 3=仅一次入场收费 packet.AddBytes(new byte[3]); packet.AddShort((short)(tariff.FirstCharge == null ? 0 : tariff.FirstCharge.Minutes)); //入场计费时间 packet.AddShort((short)tos.FromYuan(tariff.FirstCharge == null ? 0 : tariff.FirstCharge.Fee)); //入场收费金额 packet.AddShort(tariff.RegularCharge.Minutes); //单位时间收费:计费时间(分钟) packet.AddShort((short)(tos.FromYuan(tariff.RegularCharge.Fee))); //单位时间收费:计费金额 packet.AddShort(0x0); //备用1 packet.AddShort(0x0); //备用2 ////下面为空 packet.AddBytes(new byte[240 - 49]); //参数总共240字节, return(packet); }
private Packet FormatTariffOfMidNight(TariffOfMidNight tariff, int index, TollOptionSetting tos) { Packet packet = new Packet(); packet.Order = OrderCode.Comm_WriteParameterTable; packet.Address = CanAddress.HostEntrance; packet.AddByte((byte)index); //下载而号 //16字节 单字节选项 packet.AddByte(0x0); packet.AddByte(GetVoice(tariff.CarType)); packet.AddByte(GetVoice(tariff.CarType)); packet.AddBytes(new byte[13]); //以下为公共收费参数 16字节 packet.AddByte(0x0); //为1表示无入场记录按次收费 packet.AddShort(0x0); //无入场记录按上次出场时间计算免费时间(分钟) packet.AddShort(0x0); //无入场记录按次收费金额 packet.AddByte(0x0); //备用 packet.AddShort(tariff.FreeMinutes); //入场免费时间 packet.AddShort(0x0); //免费零头时间 packet.AddShort(0x0); //中央收费后免费时间 packet.AddShort(24 * 60); //公用的周期限额计费时间(小时)(24小时) packet.AddShort((short)(tos.FromYuan(tariff.FeeOf24Hour))); //不分时段普通收费参数16byte packet.AddByte(0x00); //计费模式 packet.AddBytes(new byte[3]); packet.AddShort(0x0); //入场计费时间 packet.AddShort((short)tos.FromYuan(tariff.FirstFee)); //入场收费金额 packet.AddShort(0x0); //单位时间收费:计费时间(分钟) packet.AddShort(0x0); //单位时间收费:计费金额 packet.AddShort(0x0); //备用1 packet.AddShort(0x0); //备用2 //不规则收费参数 16字节 packet.AddByte(0x2); //1=过点后改为限额收费 packet.AddShort(0); //过零点 packet.AddBytes(new byte[13]); ////下面为空 packet.AddBytes(new byte[240 - 65]); //参数总共240字节, return(packet); }