Exemplo n.º 1
0
 public RGS_GenericDisplay_Data(byte mode, byte graph_code_id, RGS_Generic_ICON_Data[] icons, RGS_Generic_Message_Data[] msgs, RGS_Generic_Section_Data[] sections)
 {
     this.mode = mode;
     this.icons = icons;
     this.msgs = msgs;
     this.sections = sections;
     this.graph_code_id = graph_code_id;
 }
Exemplo n.º 2
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;
        }
Exemplo n.º 3
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;
        }
Exemplo n.º 4
0
 public bool Equals(RGS_Generic_Section_Data data)
 {
     //  Console.WriteLine(section_id + "," + data.section_id + "," + status + "," + data.status);
     return this.section_id == data.section_id && this.status == data.status;
 }