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; }
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)); }
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); }
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; }
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; }
public bool Equals(RGS_Generic_ICON_Data data) { return this.x == data.x && this.y == data.y && this.icon_code_id == data.icon_code_id; }