Beispiel #1
0
        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);
        }
Beispiel #2
0
        private TollOptionSetting GetTollOptionFromInput()
        {
            TollOptionSetting tos = new TollOptionSetting();

            //tos.FreeTimeAfterPay = this.txtFreeTimeAfterPay.IntergerValue;
            //tos.PointCount = (byte)(rdYuan.Checked ? 0 : 1);
            return(tos);
        }
Beispiel #3
0
 private Packet FormatTariff(TariffBase tariff, int index, TollOptionSetting tos)
 {
     if (tariff is TariffPerDay)
     {
         return(FormatTariffPerDay(tariff as TariffPerDay, index, tos));
     }
     else if (tariff is TariffPerTime)
     {
         return(FormatTariffPerTime(tariff as TariffPerTime, index, tos));
     }
     else if (tariff is TariffOfLimitation)
     {
         return(FormatTariffOfLimitation(tariff as TariffOfLimitation, index, tos));
     }
     return(null);
 }
Beispiel #4
0
        //参数长度为161字节
        private Packet FormatTariffOptions(TollOptionSetting tollOption)
        {
            Packet packet = new Packet();

            packet.Order   = OrderCode.Comm_WriteParameterTable;
            packet.Address = CanAddress.HostEntrance;

            packet.AddByte(18);                    //下载表号18
            packet.AddByte(0);                     //不可更改
            packet.AddByte(tollOption.PointCount); //小数点位数
            packet.AddByte(2);                     //临时卡可以切换的车型数量
            packet.AddByte(0);                     //为1表示收费需要等待车型确认
            packet.AddByte(0);                     //为1表示免费仍要等待车型确认
            packet.AddByte(2);                     //不可更改!
            packet.AddBytes(new byte[161 - 7]);
            return(packet);
        }
Beispiel #5
0
        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);
        }
Beispiel #6
0
        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);
        }