Ejemplo n.º 1
0
 public void setWIS_Dispaly(string devicename,OutputModeEnum mode, int ruleid, int priority, int icon_id, int g_code_id, int hor_space, string mesg, byte[] colors)
 {
     CMSOutputData WISdata = new CMSOutputData(icon_id, g_code_id, hor_space, mesg, colors);
        OutputQueueData data = new OutputQueueData(devicename, mode, ruleid, priority, WISdata);
        this.SetOutput(data);
        //output();
 }
Ejemplo n.º 2
0
        public virtual OutputQueueData[] getAllOutputQueueData()
        {
            System.Collections.ArrayList ary = new System.Collections.ArrayList();

            if (outputQueue.Count == 0)
                return null;
            else
            {

                System.Collections.IEnumerator ie = outputQueue.GetEnumerator();
                while (ie.MoveNext())
                {
                    OutputQueueData quedata = (OutputQueueData)((System.Collections.DictionaryEntry)ie.Current).Value;

                    ary.Add(quedata);

                }
            }

            ary.Sort();
            object[] data = ary.ToArray();

            OutputQueueData[] retobjs = new OutputQueueData[data.Length];

            for (int i = 0; i < data.Length; i++)
                retobjs[i] =(OutputQueueData)data[i];

            return retobjs;
        }
Ejemplo n.º 3
0
 public void InvokeOutputDataStatusChange(OutputQueueData qdata)
 {
     return;
      if (qdata.mode != OutputModeEnum.ResponsePlanMode)
             return;
     string sql = "update tblrspexecutionoutputdata set status={0} ,Success='{1}' where eventid={2} and devicename='{3}'";
     Program.matrix.dbServer.SendSqlCmd(string.Format(sql, qdata.status, qdata.IsSuccess ? "Y" : "N", qdata.ruleid, this.deviceName));
 }
Ejemplo n.º 4
0
 public void SetDisplay(OutputModeEnum mode, int ruleid, int priority,LCSOutputData lcstata)
 {
     OutputQueueData data = new OutputQueueData(this.deviceName,mode, ruleid, priority, lcstata);
        this.SetOutput(data);
       // output();
 }
Ejemplo n.º 5
0
 public void SetOutput(string devName,object  OutputData,bool bForce)
 {
     try
     {
         OutputQueueData data = new OutputQueueData(devName,(bForce) ? OutputModeEnum.ForceManualMode : OutputModeEnum.ManualMode,(bForce) ? OutputQueueData.MANUAL_RULE_ID : OutputQueueData.NORMAL_MANUAL_RULE_ID, (bForce) ? OutputQueueData.MANUAL_PRIORITY : OutputQueueData.NORMAL_MANUAL_PRIORITY, OutputData);
         ((OutPutDeviceBase)Program.matrix.getDeviceWrapper(devName)).SetOutput(data);
     }
     catch (Exception ex)
     {
         throw new RemoteException(ex.Message + ex.StackTrace);
     }
 }
Ejemplo n.º 6
0
        protected override void EnOutputQueue(OutputQueueData data)
        {
            if (data.data != null)
             {
             RGS_GenericDisplay_Data rgsgendata = data.data as RGS_GenericDisplay_Data;
             if (data.mode == OutputModeEnum.ResponsePlanMode && rgsgendata.mode == 2)
             {
                 if (data.HappenLineID == this.lineid && data.HappenDir == this.direction)
                 {
                     if (rgsgendata.icons.Length > 0)

                         rgsgendata.icons[0].y = 0;

                     for (int i = 0; i < rgsgendata.msgs.Length; i++)
                     {
                         rgsgendata.msgs[i].y = (ushort)(i * 64);
                     }

                 }
                 else
                 {

                     if (rgsgendata.icons.Length > 0)

                         rgsgendata.icons[0].y = 128;

                     for (int i = 0; i < rgsgendata.msgs.Length; i++)
                     {
                         rgsgendata.msgs[i].y = (ushort)(i * 64+128);
                     }
                 }
             }

             }

             base.EnOutputQueue(data);
        }
Ejemplo n.º 7
0
        public override OutputQueueData getOutputdata()
        {
            System.Collections.ArrayList ary = new System.Collections.ArrayList();
            byte[] boardid = new byte[]{1,2,3};
            string[] traveltime = new string[] { " ", " ", " " };
            byte[] colors = new byte[] { 255, 255, 255 };
            OutputQueueData ret;

            if (outputQueue.Count == 0)
                return null;
            else
            {

                System.Collections.IEnumerator ie = outputQueue.GetEnumerator();
                while (ie.MoveNext())
                {
                    OutputQueueData quedata = (OutputQueueData)((System.Collections.DictionaryEntry)ie.Current).Value;

                    ary.Add(quedata);

                }
            }

            ary.Sort();
            if (ary.Count == 0)
                return null;
            else if (ary.Count == 1)
            {
             RemoteInterface.HC.TTSOutputData data   = (TTSOutputData)((OutputQueueData)ary[ary.Count - 1]).data;

                for (int i = 0; i < data.boardid.Length; i++)
                {
                    boardid[data.boardid[i] - 1] = data.boardid[i];
                    traveltime[data.boardid[i] - 1] = data.traveltime[i];
                    colors[data.boardid[i] - 1] = data.color[i];
                }

            }
            else
            {

                for (int qinx = ary.Count - 1; qinx >= 0; qinx--)
                {
                    RemoteInterface.HC.TTSOutputData data = (TTSOutputData)((OutputQueueData)ary[qinx]).data;
                    for (int i = 0; i < data.boardid.Length; i++)
                    {

                        if (colors[data.boardid[i] - 1] == 255 && data.color[i]!=255)
                        {
                            boardid[data.boardid[i] - 1] = data.boardid[i];
                            traveltime[data.boardid[i] - 1] = data.traveltime[i];
                            colors[data.boardid[i] - 1] = data.color[i];
                        }
                    }

                }
                //for (int i = 0; i < data.boardid.Length; i++)
                //{
                //    boardid[data.boardid[i] - 1] = data.boardid[i];
                //    traveltime[data.boardid[i] - 1] = data.traveltime[i];
                //    colors[data.boardid[i] - 1] = data.color[i];
                //}
                //data = (TTSOutputData)((OutputQueueData)ary[ary.Count - 1]).data;
                //for (int i = 0; i < data.boardid.Length; i++)
                //{
                //    boardid[data.boardid[i] - 1] = data.boardid[i];
                //    traveltime[data.boardid[i] - 1] = data.traveltime[i];
                //    colors[data.boardid[i] - 1] = data.color[i];
                //}
            }

            ret = new OutputQueueData(this.deviceName,((OutputQueueData)ary[ary.Count - 1]).mode, ((OutputQueueData)ary[ary.Count - 1]).ruleid, ((OutputQueueData)ary[ary.Count - 1]).priority
                , new TTSOutputData(boardid, traveltime, colors));
            return ret;
               // object[] data = ary.ToArray();
            //if (this.deviceName == "CMS-T78-W-41.6")
            //    Console.WriteLine("stop here");

              //  return (OutputQueueData)data[data.Length - 1];
        }
Ejemplo n.º 8
0
        protected OutputQueueData[] GetPriorityQueueData(System.Collections.IComparer I_compare)
        {
            System.Collections.ArrayList ary = new System.Collections.ArrayList();
            if (outputQueue.Count == 0)
                return new OutputQueueData[0];
            else
            {

                System.Collections.IEnumerator ie = outputQueue.GetEnumerator();
                while (ie.MoveNext())
                {
                    OutputQueueData quedata = (OutputQueueData)((System.Collections.DictionaryEntry)ie.Current).Value;

                    ary.Add(quedata);
                }

            }

            ary.Sort(I_compare);
            OutputQueueData[] data = new OutputQueueData[ary.Count];
            for (int i = 0; i < ary.Count; i++)
                data[i] = ary[i] as OutputQueueData;

            return data;
        }
Ejemplo n.º 9
0
 public CMSRSTTurnData(int turnid, OutputQueueData data)
 {
     this.TurnId = turnid;
     this.Qdata = data;
 }
Ejemplo n.º 10
0
        void LoadTurnData()
        {
            System.Data.Odbc.OdbcConnection cn = new OdbcConnection(Global.Db2ConnectionString);
               System.Data.Odbc.OdbcCommand cmd = new OdbcCommand("select turnid,outputdata from tblCmsTurn where devicename='" + this.deviceName + "'");
               System.Data.Odbc.OdbcDataReader rd;
               try
               {
               cn.Open();
               cmd.Connection = cn;
               rd = cmd.ExecuteReader();
               while (rd.Read())
               {
                   int turnid = System.Convert.ToInt32(rd[0]);
                   string ouputdata = rd[1].ToString();
                   CMSOutputData cmsoutdata=null;
                   if (ouputdata.Trim() != "")
                   {
                       cmsoutdata = Util.getObjectByHexString(ouputdata) as CMSOutputData;

                       OutputQueueData qdata = new OutputQueueData(this.deviceName, OutputModeEnum.ManualMode, OutputQueueData.NORMAL_MANUAL_RULE_ID, OutputQueueData.MANUAL_PRIORITY, cmsoutdata);
                       ManualTurnData[turnid] = qdata;
                   }

               }
               rd.Close();
               }
               catch (Exception ex)
               {

               }
               finally
               {
               cn.Close();
               }
        }
Ejemplo n.º 11
0
        protected override void EnOutputQueue(OutputQueueData data)
        {
            for (int i = 0; i < RespTurnDatas.Length; i++)
               {
               if (RespTurnDatas[i] == null)
               {
                   RespTurnDatas[i] = data;
                   SetDisplayByInx(i);

               }

               }

               //base.EnOutputQueue(data);
        }
Ejemplo n.º 12
0
 public void setCMS_Dispaly(string devicename, OutputModeEnum mode, int ruleid, int priority, int icon_id, int g_code_id, int hor_space, string mesg, byte[] colors,byte[]vspaces)
 {
     CMSOutputData cmsdata = new CMSOutputData(icon_id, g_code_id, hor_space, mesg, colors,vspaces);
        OutputQueueData data = new OutputQueueData(this.deviceName,mode, ruleid, priority, cmsdata);
        this.SetOutput(data);
 }
Ejemplo n.º 13
0
        private void doModeControl(EventStatus newStatus)
        {
            try
            {

                if (this.EventMode == EventMode.DontCare)
                    return;
                if (!IsAllowStatus(this.EventMode, EventStatus, newStatus))
                    return;

                if (this.m_class == 60)  //火警事件
                #region
                {
                    string[] cmsDevNames=new string[0];
                    string[] cmsMessages=new string[0];
                    string[] lcsDevNames=new string[0];
                    RemoteInterface.TEM.FireAlarmData fdata = ((TEM.TemRangeData)this).eventData as RemoteInterface.TEM.FireAlarmData;
                    if (Global.IsTunnelGearing(fdata.tunnel, fdata.place,ref cmsDevNames,ref cmsMessages,ref lcsDevNames))
                    {  //處理連動
                        for (int i = 0; i < cmsDevNames.Length; i++)
                        {
                           byte[]colors=new byte[cmsMessages[i].Length];
                            for(int j=0;j<colors.Length;j++)
                                colors[j]=0x20;
                            OutputQueueData outdata=new OutputQueueData(cmsDevNames[i],OutputModeEnum.ManualMode,OutputQueueData.MANUAL_RULE_ID,OutputQueueData.NORMAL_MANUAL_RULE_ID,
                                new CMSOutputData(0,0,0,cmsMessages[i],colors) );

                            lock(this.lstOutputQueueData) // 2013-4-27
                                 this.lstOutputQueueData.Add(outdata);
                            try
                            {
                                (Program.matrix.getDeviceWrapper(outdata.DeviceName) as TC.CMSDeviceWrapper).SetOutput(outdata);
                            }
                            catch (Exception ex)
                            {
                                Util.SysLog("evterr.log",ex.Message+","+ex.StackTrace);
                            }

                            System.Data.DataSet ds = Program.ScriptMgr["LCS"].GetSendDataSet("set_ctl_sign");
                            System.Data.DataRow r = ds.Tables[0].Rows[0];
                            r["sign_cnt"] = 2;

                            for(int j=0;j<2;j++)
                            {
                             r = ds.Tables[1].NewRow();
                             r["sign_no"] = j;
                             r["sign_status"] = 5;  //1:green 2:red 5: flah green
                             ds.Tables[1].Rows.Add(r);
                            }

                            ds.AcceptChanges();
                            outdata = new OutputQueueData(lcsDevNames[i], OutputModeEnum.ManualMode, OutputQueueData.MANUAL_RULE_ID, OutputQueueData.NORMAL_MANUAL_RULE_ID,
                                new LCSOutputData(ds));
                            lock (this.lstOutputQueueData)     //2013-4-27
                                     this.lstOutputQueueData.Add(outdata);
                            try
                            {
                                (Program.matrix.getDeviceWrapper(outdata.DeviceName) as TC.LCSDeviceWrapper).SetOutput(outdata);
                            }
                            catch (Exception ex)
                            {
                                Util.SysLog("evterr.log", ex.Message + "," + ex.StackTrace);
                            }

                        }

                    }
                }
                #endregion
                switch (this.EventMode)
                {

                    case EventMode.Manual:
                        this.executePlan();
                        break;
                    case EventMode.AutoAuto:

            //#if DEBUG
                        Util.SysLog("sys.log", DateTime.Now+"prepare to execute:" + this.EventId);
            //#endif

                        Execution.Execution.getBuilder().InputIIP_Event(this.EventId);

            //#if DEBUG
                        Util.SysLog("sys.log", DateTime.Now+" generate  plan:" + this.EventId);
            //#endif
                            Execution.Execution.getBuilder().GenerateExecutionTable(this.EventId);

                        this.EventStatus = EventStatus.Executing;
            //#if DEBUG
                        Util.SysLog("sys.log", DateTime.Now + " begin execute:" + this.EventId);
            //#endif
                        this.executePlan();
            //#if DEBUG
                        Util.SysLog("sys.log", DateTime.Now + " execute  completed:" + this.EventId);
            //#endif
                        break;
                    case EventMode.DontCare:
                        this.EventStatus = EventStatus.Alarm;
                        break;
                    case EventMode.HalfAuto:

                        if (newStatus == EventStatus.Confirm)
                        {
                          //  Execution.Execution.getBuilder().InputIIP_Event(this.EventId);

                                Execution.Execution.getBuilder().GenerateExecutionTable(this.EventId);

                            this.EventStatus = EventStatus.Executing;
                            this.executePlan();

                        }
                        else if (newStatus == EventStatus.Alarm)
                            this.EventStatus = EventStatus.Alarm;

                        break;

                    case EventMode.HalfHalf:
                        if (newStatus == EventStatus.Confirm)
                        {
                           // Execution.Execution.getBuilder().InputIIP_Event(this.EventId);

                                Execution.Execution.getBuilder().GenerateExecutionTable(this.EventId);

                            EventStatus = EventStatus.Confirm;
                        }
                        else if (newStatus == EventStatus.PlanCheck)
                        {

                            this.EventStatus = EventStatus.Executing;
                            this.executePlan();

                        }
                        else if (newStatus == EventStatus.Alarm)
                            this.EventStatus = EventStatus.Alarm;

                        break;

                    case EventMode.AutoHalf:
                        if (newStatus == EventStatus.Alarm)
                        {

                                Execution.Execution.getBuilder().InputIIP_Event(this.EventId);
                                Execution.Execution.getBuilder().GenerateExecutionTable(this.EventId);

                            this.EventStatus = EventStatus.Confirm;
                        }
                        else if (newStatus == EventStatus.PlanCheck)
                        {

                            this.EventStatus = EventStatus.Executing;
                            this.executePlan();

                        }

                        break;

                    case Host.Event.EventMode.AutoStop:
                        if (newStatus == EventStatus.Alarm)
                        {

                                Execution.Execution.getBuilder().InputIIP_Event(this.EventId);
                                Execution.Execution.getBuilder().GenerateExecutionTable(this.EventId);

                            this.EventStatus = EventStatus.Ignore;
                        }
                        else if (newStatus == EventStatus.PlanCheck)
                        {

                          //  this.EventStatus = EventStatus.Executing;
                          //  this.executePlan();

                        }

                        break;

                    case Host.Event.EventMode.HalfStop:
                        if (newStatus == EventStatus.Confirm)
                        {
                            // Execution.Execution.getBuilder().InputIIP_Event(this.EventId);
                          //  Execution.Execution.getBuilder().GenerateExecutionTable(this.EventId);
                            EventStatus = EventStatus.Ignore;
                        }
                        else if (newStatus == EventStatus.PlanCheck)
                        {

                          //  this.EventStatus = EventStatus.Executing;
                          //  this.executePlan();

                        }
                        else if (newStatus == EventStatus.Alarm)
                            this.EventStatus = EventStatus.Alarm;
                        break;

                }
            }
            catch (Exception ex)
            {
                Util.SysLog("evterr.log", ex.Message + "," + ex.StackTrace);
                throw new Exception(ex.Message + "," + ex.StackTrace);
            }
        }
Ejemplo n.º 14
0
        public void executePlan()
        {
            OdbcConnection cn = new OdbcConnection(Global.Db2ConnectionString);
            OdbcCommand cmd = new OdbcCommand("select devicename,device_type,priority,outputdata1,outputdata2 from tblrspExecutionOutputData where delmark='N' and  eventid=" + this.EventId);
            OdbcDataReader rd;
            cmd.Connection = cn;

            try
            {
                clearLstOutputQueueData();
                cn.Open();
                rd = cmd.ExecuteReader();

                bool isIn = false;
                while (rd.Read())
                {
                    try
                    {
                        isIn = true;
                        RemoteInterface.HC.OutputQueueData qdata;
                        int priority = System.Convert.ToInt32(rd[2]);
                        string devName = rd[0].ToString();
                        object OutObj = null;

                        if (!rd.IsDBNull(4))
                        {
                            OutObj = RemoteInterface.Util.getObjectByHexString(rd[4].ToString());
                        }
                        else if (!rd.IsDBNull(3))
                        {
                            OutObj = RemoteInterface.Util.getObjectByHexString(rd[3].ToString());
                        }
                        else
                        {
                            RemoteInterface.Util.SysLog("evterr.log",this.EventId+","+"no outputdata and outputdata1");
                            continue;
                        }

                        Host.TC.OutPutDeviceBase dev = Program.matrix.getDeviceWrapper(devName) as Host.TC.OutPutDeviceBase;
                        qdata = new RemoteInterface.HC.OutputQueueData(devName, RemoteInterface.HC.OutputModeEnum.ResponsePlanMode, this.EventId, priority, OutObj);
                        qdata.HappenDir = this.getDir();
                        qdata.HappenLineID = this.getLineId();
                        qdata.HappenMileage = this.getStartMileM();
                        qdata.DevDir= dev.direction ;
                        qdata.DevLineId = dev.getLineID();
                        qdata.DevMileage = dev.getMileage();
                      //  qdata.AlarmClass = this.m_class;

                        (Program.matrix.getDeviceWrapper(devName) as Host.TC.OutPutDeviceBase).SetOutput(qdata);
                    //    RemoteInterface.Util.SysLog( DateTime.Now + "," +  "evterr.log", "output " + devName + ",");

                        lock (this.lstOutputQueueData)   //2013-04-27
                        this.lstOutputQueueData.Add(qdata);
                    }
                    catch (Exception ex)
                    {
                        RemoteInterface.Util.SysLog("evterr.log", ex.Message + "," + ex.StackTrace);
                    }
                }
                if (!isIn)
                {
                    RemoteInterface.Util.SysLog("evterr.log", this.EventId + "," + "executeing table not found!");
                }
                rd.Close();
            }
            catch (Exception ex)
            {
                RemoteInterface.ConsoleServer.WriteLine(ex.Message + "," + ex.StackTrace);
                RemoteInterface.Util.SysLog("evterr.log", ex.Message + "," + ex.StackTrace);
            }
            finally
            {
                cn.Close();
            }
            //2011/4/13 for delay remove output
            lock (this.lstOutputQueueData)
            {
                System.Threading.Monitor.PulseAll(this.lstOutputQueueData);
            }
        }
Ejemplo n.º 15
0
        public void SetOutput(OutputQueueData data)
        {
            data.OnStatusChange += (sender, arg) =>
            {

                OutputQueueData qdata = sender as OutputQueueData;
                if (qdata.mode != OutputModeEnum.ResponsePlanMode)
                    return;

                string sql = "update tblrspexecutionoutputdata set status={0} ,Success='{1}' where eventid={2} and devicename='{3}'";
                Program.matrix.dbServer.SendSqlCmd(string.Format(sql, qdata.status, qdata.IsSuccess ? "Y" : "N", qdata.ruleid, this.deviceName));
            };
            data.status = 0;
            EnOutputQueue( data);

            if (this.IsRemoteObjectConnect())
                output();
        }
Ejemplo n.º 16
0
 protected virtual void EnOutputQueue(OutputQueueData data)
 {
     if (outputQueue.Contains(data.ruleid))
         outputQueue.Remove(data.ruleid);
     outputQueue.Add(data.ruleid,data);
     //候對中
     if (data.mode == OutputModeEnum.ManualMode || data.mode == OutputModeEnum.ForceManualMode)
         SaveManualData(data);
 }
Ejemplo n.º 17
0
        public void loadManualTurnData(int inx)
        {
            if(inx < 0 || inx >15)
               throw new Exception("invalid inx range!");

               System.Data.Odbc.OdbcConnection cn = new OdbcConnection(Global.Db2ConnectionString);
               System.Data.Odbc.OdbcCommand cmd = new OdbcCommand("select turnid,outputdata from tblCmsTurn where devicename='" + this.deviceName + "' and turnid="+inx);
               System.Data.Odbc.OdbcDataReader rd;

               try
               {
               cn.Open();
               cmd.Connection = cn;
               rd = cmd.ExecuteReader();
               if (rd.Read())
               {
                   int turnid = System.Convert.ToInt32(rd[0]);
                   string ouputdata = rd[1].ToString();
                   CMSOutputData cmsoutdata = null;
                   if (ouputdata.Trim() != "")
                   {
                       cmsoutdata = Util.getObjectByHexString(ouputdata) as CMSOutputData;

                       OutputQueueData qdata = new OutputQueueData(this.deviceName, OutputModeEnum.ManualMode, OutputQueueData.NORMAL_MANUAL_RULE_ID, OutputQueueData.MANUAL_PRIORITY, cmsoutdata);
                       ManualTurnData[inx] = qdata;
                   }
                   else
                       ManualTurnData[inx] = null;

                   SetDisplayByInx(inx);
               }
               rd.Close();
               }
               catch (Exception ex)
               {
               throw new Exception(ex.Message + "," + ex.StackTrace);
               }
               finally
               {
             //  output(true);
               cn.Close();
               }
        }
Ejemplo n.º 18
0
        private void SaveManualData(OutputQueueData data)
        {
            string sql = "";

            if (data.mode == OutputModeEnum.ManualMode)

                sql = "update tblDeviceManualOutputData set Manualdata='" + RemoteInterface.Util.getObjectHexString(data) + "' where devicename='" + this.deviceName + "'";

            else
                sql = "update tblDeviceManualOutputData set ForceManualdata='" + RemoteInterface.Util.getObjectHexString(data) + "' where devicename='" + this.deviceName + "'";

            #if !DEBUG

            Program.matrix.dbServer.SendSqlCmd(sql);
            #endif
        }
Ejemplo n.º 19
0
        public void RGS_setManualGenericDisplay(string devicename, RGS_GenericDisplay_Data data,bool bForce)
        {
            try
            {
                if (dictPerformance.ContainsKey("RGS_setManualGenericDisplay"))
                {
                    dictPerformance["RGS_setManualGenericDisplay"].CallCount++;
                    dictPerformance["RGS_setManualGenericDisplay"].InCount++;
                }

                OutputQueueData odata = new OutputQueueData(devicename, (bForce) ? OutputModeEnum.ForceManualMode : OutputModeEnum.ManualMode, (bForce) ? OutputQueueData.MANUAL_RULE_ID : OutputQueueData.NORMAL_MANUAL_RULE_ID, (bForce) ? OutputQueueData.MANUAL_PRIORITY : OutputQueueData.NORMAL_MANUAL_PRIORITY, data);
                ((RGSDeviceWrapper)Program.matrix.getDeviceWrapper(devicename)).SetOutput(odata);

            }
            catch (Exception ex)
            {
                throw new RemoteException(ex.Message + ex.StackTrace);
            }
            finally
            {
                if (dictPerformance.ContainsKey("RGS_setManualGenericDisplay"))
                    dictPerformance["RGS_setManualGenericDisplay"].InCount--;
            }
        }
Ejemplo n.º 20
0
        public override OutputQueueData getOutputdata()
        {
            System.Collections.ArrayList ary = new System.Collections.ArrayList();
               byte[] laneids = new byte[] { 1, 2, 3 };
               object[] displays = new object[3];
               //    byte  [] speedllimits = new byte[] { -1,-1,-1,-1,-1,-1};
               OutputQueueData ret;

               if (outputQueue.Count == 0)
               return null;
               else
               {

               System.Collections.IEnumerator ie = outputQueue.GetEnumerator();
               while (ie.MoveNext())
               {
                   OutputQueueData quedata = (OutputQueueData)((System.Collections.DictionaryEntry)ie.Current).Value;

                   ary.Add(quedata);

               }
               }

               ary.Sort();
               if (ary.Count == 0)
               return null;
               else if (ary.Count == 1)
               {
               RemoteInterface.HC.MASOutputData data = (MASOutputData)((OutputQueueData)ary[ary.Count - 1]).data;

               for (int i = 0; i < data.laneids.Length; i++)
               {
                   laneids[data.laneids[i] - 1] = data.laneids[i];
                   displays[data.laneids[i] - 1] = data.displays[i];
                 //  colors[data.boardid[i] - 1] = data.color[i];
               }

               }
               else
               {
               RemoteInterface.HC.MASOutputData data = (MASOutputData)((OutputQueueData)ary[ary.Count - 2]).data;

               for (int i = 0; i < data.laneids.Length; i++)
               {
                   laneids[data.laneids[i] - 1] = data.laneids[i];
                   displays[data.laneids[i] - 1] = data.laneids[i];
                   //colors[data.boardid[i] - 1] = data.color[i];
               }
               data = (MASOutputData)((OutputQueueData)ary[ary.Count - 1]).data;
               for (int i = 0; i < data.laneids.Length; i++)
               {
                   laneids[data.laneids[i] - 1] = data.laneids[i];
                   displays[data.laneids[i] - 1] = data.displays[i];
                  // colors[data.boardid[i] - 1] = data.color[i];
               }
               }

               ret = new OutputQueueData(this.deviceName,((OutputQueueData)ary[ary.Count - 1]).mode, ((OutputQueueData)ary[ary.Count - 1]).ruleid, ((OutputQueueData)ary[ary.Count - 1]).priority
               , new MASOutputData(laneids, displays));
               return ret;
        }
Ejemplo n.º 21
0
 public void SetOutput(string devName,object  OutputData,bool bForce)
 {
     try
     {
         if (dictPerformance.ContainsKey("SetOutput"))
         {
             dictPerformance["SetOutput"].CallCount++;
             dictPerformance["SetOutput"].InCount++;
         }
         OutputQueueData data = new OutputQueueData(devName, (bForce) ? OutputModeEnum.ForceManualMode : OutputModeEnum.ManualMode, (bForce) ? OutputQueueData.MANUAL_RULE_ID : OutputQueueData.NORMAL_MANUAL_RULE_ID, (bForce) ? OutputQueueData.MANUAL_PRIORITY : OutputQueueData.NORMAL_MANUAL_PRIORITY, OutputData);
         ((OutPutDeviceBase)Program.matrix.getDeviceWrapper(devName)).SetOutput(data);
     }
     catch (Exception ex)
     {
         throw new RemoteException(ex.Message + ex.StackTrace);
     }
     finally
     {
         if (dictPerformance.ContainsKey("SetOutput"))
         {
            // dictPerformance["SetOutput"].CallCount++;
             dictPerformance["SetOutput"].InCount--;
         }
     }
 }
Ejemplo n.º 22
0
        //合併RGS data
        private OutputQueueData mergeOutputQueueData(OutputQueueData higher, OutputQueueData lower)
        {
            if (higher.data == null)
             return higher;
            // OutputQueueData retData = new OutputQueueData(higher.ruleid, higher.priority, higher.data);
             RGS_GenericDisplay_Data data1 = (RGS_GenericDisplay_Data)higher.data;
             RGS_GenericDisplay_Data data2 = (RGS_GenericDisplay_Data)lower.data;
             RGS_GenericDisplay_Data mergeData = new RGS_GenericDisplay_Data(data1.mode, data1.graph_code_id, data1.icons, data1.msgs, data1.sections);
             if (data1.mode != 2 || data2.mode!=2)  //cms mode
             return new OutputQueueData(this.deviceName,higher.mode,higher.ruleid, higher.priority,mergeData);

             System.Collections.ArrayList ary = new System.Collections.ArrayList();

             ary.Clear();

             for (int i = 0; i < data1.icons.Length; i++)
             ary.Add(data1.icons[i]);

             bool bfind = false;

             for (int i = 0; i < data2.icons.Length; i++)
             {

             bfind = false;
             foreach (RGS_Generic_ICON_Data icon in ary)
             {
                 if (icon.y == data2.icons[i].y)
                 {
                     bfind = true;
                     break;
                 }

             }
             if (!bfind  && !IsCmsModeOutput(data2.icons[i].y/128+1,data1))
                 ary.Add(data2.icons[i]);

             }

             mergeData.icons = new RGS_Generic_ICON_Data[ary.Count];
             int inx = 0;
             foreach (RGS_Generic_ICON_Data icon in ary)
             mergeData.icons[inx++] = icon;

             ary.Clear();

             for (int i = 0; i < data1.msgs.Length; i++)
             ary.Add(data1.msgs[i]);

             for (int i = 0; i < data2.msgs.Length; i++)
             {
             bfind = false;
             foreach (RGS_Generic_Message_Data msg in ary)
             {
                 if (msg.y == data2.msgs[i].y)
                 {
                     bfind = true;
                     break;
                 }
             }

             if (!bfind && !IsCmsModeOutput(data2.msgs[i].y/128+1,data1))
                 ary.Add(data2.msgs[i]);

             }

             inx = 0;

             mergeData.msgs = new RGS_Generic_Message_Data[ary.Count];

             foreach (RGS_Generic_Message_Data msg in ary)
             mergeData.msgs[inx++] = msg;

             return new OutputQueueData(this.deviceName,higher.mode,higher.ruleid, higher.priority,mergeData);
        }
Ejemplo n.º 23
0
 public virtual void SetOutput(OutputQueueData data)
 {
     EnOutputQueue( data);
     if (this.IsRemoteObjectConnect())
         output();
 }
Ejemplo n.º 24
0
        public void executePlan()
        {
            OdbcConnection cn = new OdbcConnection(Global.Db2ConnectionString);
            OdbcCommand cmd = new OdbcCommand("select devicename,device_type,priority,outputdata1,outputdata2 from tblrspExecutionOutputData where eventid=" + this.EventId);
            OdbcDataReader rd;
            cmd.Connection = cn;

            try
            {
                cn.Open();
                rd = cmd.ExecuteReader();
                clearLstOutputQueueData();
                while (rd.Read())
                {
                    RemoteInterface.HC.OutputQueueData qdata;
                    int priority= System.Convert.ToInt32(rd[2]);
                    string devName=rd[0].ToString();
                    object OutObj = null;

                    if (!rd.IsDBNull(4))
                    {
                       OutObj=RemoteInterface.Util.getObjectByHexString(rd[4].ToString());
                    }
                    else if (!rd.IsDBNull(3))
                    {
                        OutObj = RemoteInterface.Util.getObjectByHexString(rd[3].ToString());
                    }
                    else
                        return;

                    qdata = new RemoteInterface.HC.OutputQueueData(devName,RemoteInterface.HC.OutputModeEnum.ResponsePlanMode, this.EventId, priority,OutObj );

                    (Program.matrix.getDeviceWrapper(devName) as Host.TC.OutPutDeviceBase).SetOutput(qdata);
                    this.lstOutputQueueData.Add(qdata);
                }
                rd.Close();
            }
            catch (Exception ex)
            {
                RemoteInterface.ConsoleServer.WriteLine(ex.Message + "," + ex.StackTrace);
            }
            finally
            {
                cn.Close();
            }
        }
Ejemplo n.º 25
0
        public void RGS_setManualGenericDisplay(string devicename, RGS_GenericDisplay_Data data,bool bForce)
        {
            try
            {
                OutputQueueData odata = new OutputQueueData(devicename,(bForce) ?OutputModeEnum.ForceManualMode:OutputModeEnum.ManualMode,        (bForce) ? OutputQueueData.MANUAL_RULE_ID : OutputQueueData.NORMAL_MANUAL_RULE_ID, (bForce) ? OutputQueueData.MANUAL_PRIORITY : OutputQueueData.NORMAL_MANUAL_PRIORITY, data);
                ((RGSDeviceWrapper)Program.matrix.getDeviceWrapper(devicename)).SetOutput(odata);

            }
            catch (Exception ex)
            {
                throw new RemoteException(ex.Message + ex.StackTrace);
            }
        }