public BordmonitorText(BordmonitorFields field, string text, byte index = 0, bool isChecked = false) { Field = field; Text = text; Index = index; IsChecked = isChecked; parsed = true; }
public BordmonitorText(BordmonitorFields field, byte[] data) { Field = field; Data = data; }
public static Message ShowText(string s, TextAlign align, BordmonitorFields field, byte index = 0, bool isChecked = false, bool send = true) { int len; byte[] data; if (Translit) { s = s.Translit(); } switch (field) { case BordmonitorFields.Title: len = 11; data = DataShowTitle; break; case BordmonitorFields.Status: len = 11; data = DataShowStatus; break; case BordmonitorFields.Item: if (isChecked) { len = 15; } else { switch (NaviVersion) { case Tools.NaviVersion.MK4: len = System.Math.Min(23, s.Length); break; default: len = 15; break; } } index += 0x40; /*if (index == 0x47) { index = 0x7; }*/ if (NaviVersion == Tools.NaviVersion.MK2) { data = new byte[] { 0xA5, 0x62, 0x00, (byte)index }; } else { data = new byte[] { 0x21, 0x60, 0x00, (byte)index }; } break; default: throw new Exception("TODO"); } var offset = data.Length; data = data.PadRight(0x20, len); data.PasteASCII(Translit ? s : s.UTF8ToASCII(), offset, len); if (isChecked) { data[data.Length - 2] = 0x2A; } if (field == BordmonitorFields.Item && NaviVersion < Tools.NaviVersion.MK4) { data[data.Length - 1] = 0x06; } var m = new Message(iBus.DeviceAddress.Radio, iBus.DeviceAddress.GraphicsNavigationDriver, "Show message on BM (" + index.ToHex() + "): " + s, data); if (send) { Manager.EnqueueMessage(m); } return m; }
public static Message ShowText(string s, BordmonitorFields field, byte index = 0, bool isChecked = false, bool send = true) { return ShowText(s, TextAlign.Left, field, index, isChecked, send); }
public static Message ShowText(string s, TextAlign align, BordmonitorFields field, byte index = 0, bool isChecked = false, bool send = true) { int len; byte[] data; if (Translit) { s = s.Translit(); } string receiverDescription = "Show message on BM (" + index.ToHex() + "): "; switch (field) { case BordmonitorFields.Title: len = 11; data = DataShowTitle; break; case BordmonitorFields.T1: len = 4; data = DataShowT1; break; case BordmonitorFields.T2: len = 3; data = DataShowT2; break; case BordmonitorFields.T3: len = 5; data = DataShowT3; break; case BordmonitorFields.T4: len = 3; data = DataShowT4; break; case BordmonitorFields.T5: len = 5; data = DataShowT5; break; case BordmonitorFields.Status: len = 11; data = DataShowStatus; break; case BordmonitorFields.Item: if (isChecked) { len = 15; } else { switch (NaviVersion) { case Tools.NaviVersion.MK4: len = System.Math.Min(23, s.Length); break; default: len = 15; break; } } index += 0x40; /*if (index == 0x47) * { * index = 0x7; * }*/ //Format of the message for index fields I-0 to I-5 ( MK2 navigation system) //<68 Length 3B> A5 62 00 <Index of the text field> <Text in ASCII Hex> <XOR> if (NaviVersion == Tools.NaviVersion.MK2) { data = DataDrawIndexMk2.Combine(index); } //Format of the message for index fields I-0 to I-5 ( MK3 and MK4 navigation system with split screen software) //<68 Length 3B> 21 60 00 <Index of the text field> <Text in ASCII Hex> <XOR> else { data = DataDrawIndexMk34.Combine(index); } break; default: throw new Exception("TODO"); } var offset = data.Length; data = data.PadRight(0x20, len); data.PasteASCII(Translit ? s : s.UTF8ToASCII(), offset, len); if (isChecked) { data[data.Length - 2] = 0x2A; } if (field == BordmonitorFields.Item && NaviVersion < NaviVersion.MK4) { data[data.Length - 1] = 0x06; } var m = new Message(DeviceAddress.Radio, DeviceAddress.GraphicsNavigationDriver, data); m.ReceiverDescription += s; if (send) { Manager.Instance.EnqueueMessage(m); } return(m); }
public static Message ShowText(string s, BordmonitorFields field, byte index = 0, bool isChecked = false, bool send = true) { return(ShowText(s, TextAlign.Left, field, index, isChecked, send)); }
public static Message ShowText(string s, TextAlign align, BordmonitorFields field, byte index = 0, bool isChecked = false, bool send = true) { int len; byte[] data; if (Translit) { s = s.Translit(); } switch (field) { case BordmonitorFields.Title: len = 11; data = DataShowTitle; break; case BordmonitorFields.Status: len = 11; data = DataShowStatus; break; case BordmonitorFields.Item: if (isChecked) { len = 15; } else { switch (NaviVersion) { case Tools.NaviVersion.MK4: len = System.Math.Min(23, s.Length); break; default: len = 15; break; } } index += 0x40; /*if (index == 0x47) * { * index = 0x7; * }*/ if (NaviVersion == Tools.NaviVersion.MK2) { data = new byte[] { 0xA5, 0x62, 0x00, (byte)index }; } else { data = new byte[] { 0x21, 0x60, 0x00, (byte)index }; } break; default: throw new Exception("TODO"); } var offset = data.Length; data = data.PadRight(0x20, len); data.PasteASCII(Translit ? s : s.UTF8ToASCII(), offset, len); if (isChecked) { data[data.Length - 2] = 0x2A; } if (field == BordmonitorFields.Item && NaviVersion < Tools.NaviVersion.MK4) { data[data.Length - 1] = 0x06; } var m = new Message(iBus.DeviceAddress.Radio, iBus.DeviceAddress.GraphicsNavigationDriver, "Show message on BM (" + index.ToHex() + "): " + s, data); if (send) { Manager.EnqueueMessage(m); } return(m); }
public static Message ShowText(string s, TextAlign align, BordmonitorFields field, byte index = 0, bool isChecked = false, bool send = true) { int len; byte[] data; switch (field) { case BordmonitorFields.Title: len = 11; data = DataShowTitle; break; case BordmonitorFields.Status: len = 11; data = new byte[] { 0xA5, 0x62, 0x01, 0x06 }; break; case BordmonitorFields.Item: if (isChecked || MK2Mode) { len = 14; } else { len = 23; } if (!isChecked) { len = System.Math.Min(len, s.Length); } index += 0x40; /*if (index == 0x47) * { * index = 0x7; * }*/ if (MK2Mode) { data = new byte[] { 0xA5, 0x62, 0x00, (byte)index }; } else { data = new byte[] { 0x21, 0x60, 0x00, (byte)index }; } break; default: throw new Exception("TODO"); } var offset = data.Length; data = data.PadRight(0x20, len); data.PasteASCII(s.UTF8ToASCII(), offset, len); if (isChecked) { data[data.Length - 1] = 0x2A; } var m = new Message(iBus.DeviceAddress.Radio, iBus.DeviceAddress.GraphicsNavigationDriver, "Show message on BM (" + index.ToHex() + "): " + s, data); if (send) { Manager.EnqueueMessage(m); } return(m); }