Esempio n. 1
0
        public bool Equals(RGS_GenericDisplay_Data data)
        {
            if (mode != data.mode)
            {
               // Console.WriteLine("mode different!");
                return false;
            }
            if (graph_code_id != data.graph_code_id)
            {
               // Console.WriteLine("g_code_id  different!");
                return false;
            }

            if (icons.Length != data.icons.Length)
            {
               // Console.WriteLine("icons.Length different!");
                return false;
            }
            for (int i = 0; i < icons.Length; i++)
                if (!icons[i].Equals(data.icons[i]))
                {
                 //  Console.WriteLine("icon data different!");
                    return false;
                }
            if (msgs.Length != data.msgs.Length)
            {
              //  Console.WriteLine("mesg.Length different!");
                return false;
            }
            for (int i = 0; i < msgs.Length; i++)
                if (!msgs[i].Equals(data.msgs[i]))
                    return false;
            if (sections.Length != data.sections.Length)
            {
               // Console.WriteLine("section.Length different!");
                return false;
            }
            for (int i = 0; i < sections.Length; i++)
                if (!sections[i].Equals(data.sections[i]))
                {
                  //  Console.WriteLine("section data different!");
                    return false;
                }

            return true;
        }
Esempio n. 2
0
        public void setGenericDisplay(string devName, RGS_GenericDisplay_Data data)
        {
            try
               {

               Comm.TC.RGSTC tc = (Comm.TC.RGSTC)this.getMFCC_base().getTcManager()[devName];
               this.checkAllowConnect(tc);
               if (data == null)
               {
                   tc.TC_SetDisplayOff();
                   ConsoleServer.WriteLine(devName + " 熄滅!");
               }
               else
               // return tc.TC_GetBackgroundPic(0xffff, (byte)mode, (byte)g_code_id, ref desc);
               {
                   tc.TC_SetGenericDisplay(data);
                   ConsoleServer.WriteLine(devName + data.ToString());
               }

               }
               catch (Exception ex)
               {
               throw new RemoteInterface.RemoteException(ex.Message+","+ex.StackTrace);
               }
        }
Esempio n. 3
0
        public void setGenericDisplay(string ip, int port, RGS_GenericDisplay_Data data)
        {
            try
               {
               Comm.TC.RGSTC tc = (Comm.TC.RGSTC)this.getMFCC_base().getTcManager()[ip,port];
               this.checkAllowConnect(tc);
              // return tc.setG
               if (data == null)
               {
                   tc.TC_SetDisplayOff();

               }
               else
                   tc.TC_SetGenericDisplay(data);

               }
               catch (Exception ex)
               {
               throw new RemoteInterface.RemoteException(ex.Message+","+ex.StackTrace);
               }
        }
Esempio n. 4
0
        private bool IsCmsModeOutput(int Displaypart,RGS_GenericDisplay_Data data)
        {
            bool ret = false;

             foreach (RGS_Generic_ICON_Data icon in data.icons)
             ret = ret || icon.y == (Displaypart - 1) * 128;
             if (ret)
             return ret;

             foreach (RGS_Generic_Message_Data msg in data.msgs)
             ret = ret ||( msg.y >= (Displaypart - 1) * 128  &&  msg.y < Displaypart*128);

             return ret;
        }
Esempio n. 5
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);
        }
Esempio n. 6
0
        public void SetTravelDisplay(byte[] iconids, string[] messages, Color[][] forecolors)
        {
            byte mode=2 ;//cms mode
               byte iconcnt=0;
               byte msgcnt = 0;

               for (int i = 0; i < iconids.Length; i++)
               if (iconids[i] != 0) iconcnt++;
               for (int i = 0; i < messages.Length; i++)
               {
               if (messages[i] != "") msgcnt++;

               }

               RGS_Generic_ICON_Data[] icons = new RGS_Generic_ICON_Data[iconcnt];
               byte inx=0;
               for(int i=0;i<iconids.Length;i++)
               {
               if (iconids[i] != 0)
                   icons[inx++] = new RGS_Generic_ICON_Data(iconids[i], 0, (ushort)(128 * i));
               }

               RGS_Generic_Message_Data[] msgs=new RGS_Generic_Message_Data[msgcnt];
               inx=0;
               for (int i = 0; i < messages.Length; i++)
               {
               if(messages[i]!="")
               {
                   Color[]backcolor=new Color[messages[i].Length];
                   for(int j=0;j<messages[i].Length;j++)
                       backcolor[j]=Color.Black;
                   int offset =-128;
                   for (int j = 0; j < icons.Length; j++)
                   {
                       if (icons[j].y / 128 == i / 2)
                       {
                           offset = 0;
                           break;
                       }
                   }
                   msgs[inx++] = new RGS_Generic_Message_Data(messages[i], forecolors[i], backcolor,(ushort) (128+4+offset),(ushort)( 64 * i));

               }

               }

               RGS_GenericDisplay_Data data = new RGS_GenericDisplay_Data(mode,0,icons,msgs,new RGS_Generic_Section_Data[0]);
               curr_display_data = data;
               TC_SetGenericDisplay(data);
        }
Esempio n. 7
0
        public void SetTravelDisplay(byte[] iconids, string[] messages, Color[][] forecolors)
        {
            byte mode = 2;//cms mode
             byte iconcnt = 0;
             byte msgcnt = 0;

             for (int i = 0; i < iconids.Length; i++)
             if (iconids[i] != 0) iconcnt++;
             for (int i = 0; i < messages.Length; i++)
             {
             if (messages[i] != "") msgcnt++;

             }

             RGS_Generic_ICON_Data[] icons = new RGS_Generic_ICON_Data[iconcnt];
             byte inx = 0;
             for (int i = 0; i < iconids.Length; i++)
             {
             if (iconids[i] != 0)
                 icons[inx++] = new RGS_Generic_ICON_Data(iconids[i], 0, (ushort)(128 * i));
             }

             RGS_Generic_Message_Data[] msgs = new RGS_Generic_Message_Data[msgcnt];
             inx = 0;
             for (int i = 0; i < messages.Length; i++)
             {
             if (messages[i] != "")
             {
                 Color[] backcolor = new Color[messages[i].Length];
                 for (int j = 0; j < messages[i].Length; j++)
                     backcolor[j] = Color.Black;
                 int offset = -128;
                 for (int j = 0; j < icons.Length; j++)
                 {
                     if (icons[j].y / 128 == i / 2)
                     {
                         offset = 0;
                         break;
                     }
                 }
                 msgs[inx++] = new RGS_Generic_Message_Data(messages[i], forecolors[i], backcolor, (ushort)(128 + 4 + offset), (ushort)(64 * i));

             }

             }

             RGS_GenericDisplay_Data data = new RGS_GenericDisplay_Data(mode, 0, icons, msgs, new RGS_Generic_Section_Data[0]);

             this.SetOutput(new OutputQueueData(this.deviceName,OutputModeEnum.TravelMode,OutputQueueData.TRAVEL_RULE_ID, OutputQueueData.TRAVEL_PRIORITY, data));
        }
Esempio n. 8
0
        public static RGS_GenericDisplay_Data GetGenericDisplayData(byte[] text)
        {
            RGS_GenericDisplay_Data data = null;
            byte mode, g_code_id;
            int inx = 1;
            inx += 7; //skip hw_status,opmode,commstat,opstatus
            mode = text[inx++];
            g_code_id = text[inx++];
            RGS_Generic_ICON_Data[] icons = new RGS_Generic_ICON_Data[text[inx++]];
             //   RGS_Generic_Message_Data[] msgs;

            for (int i = 0; i < icons.Length; i++)
            {
                icons[i] = new RGS_Generic_ICON_Data(0, 0, 0);

                icons[i].icon_code_id=text[inx++];
                icons[i].x = (ushort)(text[inx++] * 256);
                icons[i].x += text[inx++];
                icons[i].y = (ushort)(text[inx++] * 256);
                icons[i].y += text[inx++];
            }

            RGS_Generic_Message_Data[] msgs = new RGS_Generic_Message_Data[text[inx++]];
            for (int i = 0; i < msgs.Length; i++)
            {
                msgs[i]=new RGS_Generic_Message_Data("",new Color[0],new Color[0],0,0);
                byte[] code_big5 = new byte[text[inx++]];
                for (int j = 0; j < code_big5.Length; j++)
                    code_big5[j] = text[inx++];
                string message = RemoteInterface.Utils.Util.Big5BytesToString(code_big5);//System.Text.Encoding.Unicode.GetString(System.Text.Encoding.Convert(System.Text.Encoding.GetEncoding("big5"), System.Text.Encoding.Unicode, code_big5));
                Color[] forecolor = new Color[message.Length];
                Color[] backcolor = new Color[message.Length];
                for (int j = 0; j < message.Length; j++)
                {
                    int r,g,b;
                    r=text[inx++];
                    g=text[inx++];
                    b=text[inx++];
                    forecolor[j] = Color.FromArgb(r, g, b);
                    r=text[inx++];
                    g=text[inx++];
                    b=text[inx++];
                    backcolor[j] = Color.FromArgb(r, g, b);

                }

                msgs[i].messgae = message;
                msgs[i].forecolor = forecolor;
                msgs[i].backcolor = backcolor;
                msgs[i].x = (byte)(text[inx++] * 256);
                msgs[i].x += text[inx++];
                msgs[i].y = (byte)(text[inx++] * 256);
                msgs[i].y += text[inx++];

            }

            RGS_Generic_Section_Data[] sections = new RGS_Generic_Section_Data[text[inx++]];
            for (int i = 0; i < sections.Length; i++)
            {
                sections[i] = new RGS_Generic_Section_Data(0, 0);
                sections[i].section_id = text[inx++];
                sections[i].status = text[inx++];
            }
            data = new RGS_GenericDisplay_Data(mode, g_code_id, icons, msgs, sections);

            return data;
        }
Esempio n. 9
0
 private void TC_SetGenericDisplay(RGS_GenericDisplay_Data data)
 {
     checkConntected();
     ///   TC_SetDisplayOff();
        RGS30_Extend.SetGenericDisplay(m_device, (int)m_deviceid, data);
 }
Esempio n. 10
0
        public static RGS_GenericDisplay_Data GetGenericDisplayData(I_DLE device, int address)
        {
            RGS_GenericDisplay_Data data=null;
            SendPackage pkg = new SendPackage(CmdType.CmdQuery, CmdClass.A, address, new byte[] { 0x9d });
            device.Send(pkg);
            if (pkg.result != CmdResult.ACK)
                throw new Exception(pkg.result.ToString());
            byte[] text = pkg.ReturnTextPackage.Text;
            byte mode, g_code_id;
            int inx = 1;
            inx += 7; //skip hw_status,opmode,commstat,opstatus
            mode = text[inx++];
            g_code_id = text[inx++];
            RGS_Generic_ICON_Data[] icons = new RGS_Generic_ICON_Data[text[inx++]];
             //   RGS_Generic_Message_Data[] msgs;

            for (int i = 0; i < icons.Length; i++)
            {
                icons[i] = new RGS_Generic_ICON_Data(0, 0, 0);

                icons[i].icon_code_id=text[inx++];
                icons[i].x = (ushort)(text[inx++] * 256);
                icons[i].x += text[inx++];
                icons[i].y = (ushort)(text[inx++] * 256);
                icons[i].y += text[inx++];
            }

            RGS_Generic_Message_Data[] msgs = new RGS_Generic_Message_Data[text[inx++]];
            for (int i = 0; i < msgs.Length; i++)
            {
                msgs[i]=new RGS_Generic_Message_Data("",new Color[0],new Color[0],0,0);
                byte[] code_big5 = new byte[text[inx++]];
                for (int j = 0; j < code_big5.Length; j++)
                    code_big5[j] = text[inx++];
                string message = RemoteInterface.Utils.Util.Big5BytesToString(code_big5);//System.Text.Encoding.Unicode.GetString(System.Text.Encoding.Convert(System.Text.Encoding.GetEncoding("big5"), System.Text.Encoding.Unicode, code_big5));
                Color[] forecolor = new Color[message.Length];
                Color[] backcolor = new Color[message.Length];
                for (int j = 0; j < message.Length; j++)
                {
                    int r,g,b;
                    r=text[inx++];
                    g=text[inx++];
                    b=text[inx++];
                    forecolor[j] = Color.FromArgb(r, g, b);
                    r=text[inx++];
                    g=text[inx++];
                    b=text[inx++];
                    backcolor[j] = Color.FromArgb(r, g, b);

                }

                msgs[i].messgae = message;
                msgs[i].forecolor = forecolor;
                msgs[i].backcolor = backcolor;
                msgs[i].x = (byte)(text[inx++] * 256);
                msgs[i].x += text[inx++];
                msgs[i].y = (byte)(text[inx++] * 256);
                msgs[i].y += text[inx++];

            }

            RGS_Generic_Section_Data[] sections = new RGS_Generic_Section_Data[text[inx++]];
            for (int i = 0; i < sections.Length; i++)
            {
                sections[i] = new RGS_Generic_Section_Data(0, 0);
                sections[i].section_id = text[inx++];
                sections[i].status = text[inx++];
            }
            data = new RGS_GenericDisplay_Data(mode, g_code_id, icons, msgs, sections);

            return data;
        }
Esempio n. 11
0
        public static void SetGenericDisplay(I_DLE device, int address, RGS_GenericDisplay_Data data)
        {
            System.IO.MemoryStream ms=new System.IO.MemoryStream();
            ms.WriteByte(0x9c);
            ms.WriteByte(data.mode);
            ms.WriteByte(data.graph_code_id);
            ms.WriteByte((byte)data.icons.Length);
            for (int i = 0; i < data.icons.Length; i++)
            {
                ms.WriteByte(data.icons[i].icon_code_id);

                ms.WriteByte((byte)(data.icons[i].x / 256));
                ms.WriteByte((byte)(data.icons[i].x % 256));

                ms.WriteByte((byte)(data.icons[i].y/256));
                ms.WriteByte((byte)(data.icons[i].y%256));
            }
            ms.WriteByte((byte)data.msgs.Length);
            for (int i = 0; i < data.msgs.Length; i++)
            {
                byte[] code_big5 = RemoteInterface.Utils.Util.StringToBig5Bytes(data.msgs[i].messgae);// Comm.RGS30_Extend.ToBig5Bytes(data.msgs[i].messgae);

                ms.WriteByte((byte)code_big5.Length);
                ms.Write(code_big5, 0, code_big5.Length);
                for (int j = 0; j < data.msgs[i].messgae.Length; j++)
                {
                    ms.WriteByte(data.msgs[i].forecolor[j].R);
                    ms.WriteByte(data.msgs[i].forecolor[j].G);
                    ms.WriteByte(data.msgs[i].forecolor[j].B);
                    ms.WriteByte(data.msgs[i].backcolor[j].R);
                    ms.WriteByte(data.msgs[i].backcolor[j].G);
                    ms.WriteByte(data.msgs[i].backcolor[j].B);

                }
                ms.WriteByte((byte)(data.msgs[i].x / 256));
                ms.WriteByte((byte)(data.msgs[i].x % 256));
                ms.WriteByte((byte)(data.msgs[i].y / 256));
                ms.WriteByte((byte)(data.msgs[i].y % 256));

            }

            ms.WriteByte((byte)data.sections.Length);
            for (int i = 0; i < data.sections.Length; i++)
            {
                ms.WriteByte(data.sections[i].section_id);
                ms.WriteByte(data.sections[i].status);
            }
            byte[]text=new byte[ms.Position];
            System.Array.Copy(ms.GetBuffer(),text,text.Length);
            SendPackage pkg = new SendPackage(CmdType.CmdSet, CmdClass.A, address, text);
            device.Send(pkg);
            if (pkg.result != CmdResult.ACK)
                throw new Exception(pkg.result.ToString());
        }
Esempio n. 12
0
 void RGSTC_OnConnectStatusChanged(object tc)
 {
     try
     {
         if (!((RGSTC)tc).IsConnected)
         {
             this.curr_display_data = null;
             ConsoleServer.WriteLine("控制器斷線,curr_display_data=null");
         }
     }
     catch (Exception ex)
     {
         ConsoleServer.WriteLine(ex.Message + "," + ex.StackTrace);
     }
 }
Esempio n. 13
0
        public void TC_SetGenericDisplay(RGS_GenericDisplay_Data data)
        {
            checkConntected();
            ///   TC_SetDisplayOff();
            ///

               lock (currDispLockObj)
               {
               if (curr_display_data != null)
               {

                   if (!curr_display_data.Equals(data))
                   {
                       curr_display_data = data;

                       this.InvokeOutPutChangeEvent(this, data.ToString());
                       RGS30_Extend.SetGenericDisplay(m_device, (int)m_deviceid, data);
                   }

               }
               else
               {
                       curr_display_data = data;
                       RGS30_Extend.SetGenericDisplay(m_device, (int)m_deviceid, data);
                       this.InvokeOutPutChangeEvent(this, data.ToString());

                }

               }
        }
Esempio n. 14
0
        public override void TC_SetDisplayOff()
        {
            checkConntected();
            SendPackage pk = new SendPackage(CmdType.CmdSet, CmdClass.A, m_deviceid, new byte[] { 0x53});

            lock (currDispLockObj)
            {
                if (curr_display_data != null)
                    this.InvokeOutPutChangeEvent(this, "熄滅");
                this.curr_display_data = null;
                this.m_device.Send(pk);
                if (pk.result != CmdResult.ACK)
                    Console.WriteLine(m_deviceName + ":set display off" + pk.result);
            }
        }
Esempio n. 15
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--;
            }
        }
Esempio n. 16
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);
            }
        }