using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Epost.Common { public class ModBusLightInfoHelper { private byte[] on1 = new byte[] { 0xFE, 0x05, 0x00, 0x00, 0xFF, 0x00, 0x98, 0x35 }; private byte[] off1 = new byte[] { 0xFE, 0x05, 0x00, 0x00, 0x00, 0x00, 0xD9, 0xC5 }; private byte[] on2 = new byte[] { 0xFE, 0x05, 0x00, 0x01, 0xFF, 0x00, 0xC9, 0xF5 }; private byte[] off2 = new byte[] { 0xFE, 0x05, 0x00, 0x01, 0x00, 0x00, 0x88, 0x05 }; private byte[] on3 = new byte[] { 0xFE, 0x05, 0x00, 0x02, 0xFF, 0x00, 0x39, 0xF5 }; private byte[] off3 = new byte[] { 0xFE, 0x05, 0x00, 0x02, 0x00, 0x00, 0x78, 0x05 }; private byte[] on4 = new byte[] { 0xFE, 0x05, 0x00, 0x03, 0xFF, 0x00, 0x68, 0x35 }; private byte[] off4 = new byte[] { 0xFE, 0x05, 0x00, 0x03, 0x00, 0x00, 0x29, 0xC5 }; private byte[] on5 = new byte[] { 0xFE, 0x05, 0x00, 0x04, 0xFF, 0x00, 0xD9, 0xF4 }; private byte[] off5 = new byte[] { 0xFE, 0x05, 0x00, 0x04, 0x00, 0x00, 0x98, 0x04 }; private byte[] on6 = new byte[] { 0xFE, 0x05, 0x00, 0x05, 0xFF, 0x00, 0x88, 0x34 }; private byte[] off6 = new byte[] { 0xFE, 0x05, 0x00, 0x05, 0x00, 0x00, 0xC9, 0xC4 }; private byte[] on7 = new byte[] { 0xFE, 0x05, 0x00, 0x06, 0xFF, 0x00, 0x78, 0x34 }; private byte[] off7 = new byte[] { 0xFE, 0x05, 0x00, 0x06, 0x00, 0x00, 0x39, 0xC4 }; private byte[] on8 = new byte[] { 0xFE, 0x05, 0x00, 0x07, 0xFF, 0x00, 0x29, 0xF4 }; private byte[] off8 = new byte[] { 0xFE, 0x05, 0x00, 0x07, 0x00, 0x00, 0x68, 0x04 }; private byte[] on9 = new byte[] { 0xFE, 0x05, 0x00, 0x08, 0xFF, 0x00, 0x19, 0xF7 }; private byte[] off9 = new byte[] { 0xFE, 0x05, 0x00, 0x08, 0x00, 0x00, 0x58, 0x07 }; private byte[] on10 = new byte[] { 0xFE, 0x05, 0x00, 0x09, 0xFF, 0x00, 0x48, 0x37 }; private byte[] off10 = new byte[] { 0xFE, 0x05, 0x00, 0x09, 0x00, 0x00, 0x09, 0xC7 }; private byte[] on11 = new byte[] { 0xFE, 0x05, 0x00, 0x0A, 0xFF, 0x00, 0xB8, 0x37 }; private byte[] off11 = new byte[] { 0xFE, 0x05, 0x00, 0x0A, 0x00, 0x00, 0xF9, 0xC7 }; private byte[] on12 = new byte[] { 0xFE, 0x05, 0x00, 0x0B, 0xFF, 0x00, 0xE9, 0xF7 }; private byte[] off12 = new byte[] { 0xFE, 0x05, 0x00, 0x0B, 0x00, 0x00, 0xA8, 0x07 }; private byte[] on13 = new byte[] { 0xFE, 0x05, 0x00, 0x0C, 0xFF, 0x00, 0x58, 0x36 }; private byte[] off13 = new byte[] { 0xFE, 0x05, 0x00, 0x0C, 0x00, 0x00, 0x19, 0xC6 }; private byte[] on14 = new byte[] { 0xFE, 0x05, 0x00, 0x0D, 0xFF, 0x00, 0x09, 0xF6 }; private byte[] off14 = new byte[] { 0xFE, 0x05, 0x00, 0x0D, 0x00, 0x00, 0x48, 0x06 }; private byte[] on15 = new byte[] { 0xFE, 0x05, 0x00, 0x0E, 0xFF, 0x00, 0xF9, 0xF6 }; private byte[] off15 = new byte[] { 0xFE, 0x05, 0x00, 0x0E, 0x00, 0x00, 0xB8, 0x06 }; private byte[] on16 = new byte[] { 0xFE, 0x05, 0x00, 0x0F, 0xFF, 0x00, 0xA8, 0x36 }; private byte[] off16 = new byte[] { 0xFE, 0x05, 0x00, 0x0F, 0x00, 0x00, 0xE9, 0xC6 }; private byte[] on17 = new byte[] { 0xFE, 0x05, 0x00, 0x10, 0xFF, 0x00, 0x99, 0xF0 }; private byte[] off17 = new byte[] { 0xFE, 0x05, 0x00, 0x10, 0x00, 0x00, 0xD8, 0x00 }; private byte[] on18 = new byte[] { 0xFE, 0x05, 0x00, 0x11, 0xFF, 0x00, 0xC8, 0x30 }; private byte[] off18 = new byte[] { 0xFE, 0x05, 0x00, 0x11, 0x00, 0x00, 0x89, 0xC0 }; private byte[] on19 = new byte[] { 0xFE, 0x05, 0x00, 0x12, 0xFF, 0x00, 0x38, 0x30 }; private byte[] off19 = new byte[] { 0xFE, 0x05, 0x00, 0x12, 0x00, 0x00, 0x79, 0xC0 }; private byte[] on20 = new byte[] { 0xFE, 0x05, 0x00, 0x13, 0xFF, 0x00, 0x69, 0xF0 }; private byte[] off20 = new byte[] { 0xFE, 0x05, 0x00, 0x13, 0x00, 0x00, 0x28, 0x00 }; private byte[] on21 = new byte[] { 0xFE, 0x05, 0x00, 0x14, 0xFF, 0x00, 0xD8, 0x31 }; private byte[] off21 = new byte[] { 0xFE, 0x05, 0x00, 0x14, 0x00, 0x00, 0x99, 0xC1 }; private byte[] on22 = new byte[] { 0xFE, 0x05, 0x00, 0x15, 0xFF, 0x00, 0x89, 0xF1 }; private byte[] off22 = new byte[] { 0xFE, 0x05, 0x00, 0x15, 0x00, 0x00, 0xC8, 0x01 }; private byte[] on23 = new byte[] { 0xFE, 0x05, 0x00, 0x16, 0xFF, 0x00, 0x79, 0xF1 }; private byte[] off23 = new byte[] { 0xFE, 0x05, 0x00, 0x16, 0x00, 0x00, 0x38, 0x01 }; private byte[] on24 = new byte[] { 0xFE, 0x05, 0x00, 0x17, 0xFF, 0x00, 0x28, 0x31 }; private byte[] off24 = new byte[] { 0xFE, 0x05, 0x00, 0x17, 0x00, 0x00, 0x69, 0xC1 }; private byte[] on25 = new byte[] { 0xFE, 0x05, 0x00, 0x18, 0xFF, 0x00, 0x18, 0x32 }; private byte[] off25 = new byte[] { 0xFE, 0x05, 0x00, 0x18, 0x00, 0x00, 0x59, 0xC2 }; private byte[] on26 = new byte[] { 0xFE, 0x05, 0x00, 0x19, 0xFF, 0x00, 0x49, 0xF2 }; private byte[] off26 = new byte[] { 0xFE, 0x05, 0x00, 0x19, 0x00, 0x00, 0x08, 0x02 }; private byte[] on27 = new byte[] { 0xFE, 0x05, 0x00, 0x1A, 0xFF, 0x00, 0xB9, 0xF2 }; private byte[] off27 = new byte[] { 0xFE, 0x05, 0x00, 0x1A, 0x00, 0x00, 0xF8, 0x02 }; private byte[] on28 = new byte[] { 0xFE, 0x05, 0x00, 0x1B, 0xFF, 0x00, 0xE8, 0x32 }; private byte[] off28 = new byte[] { 0xFE, 0x05, 0x00, 0x1B, 0x00, 0x00, 0xA9, 0xC2 }; private byte[] on29 = new byte[] { 0xFE, 0x05, 0x00, 0x1C, 0xFF, 0x00, 0x59, 0xF3 }; private byte[] off29 = new byte[] { 0xFE, 0x05, 0x00, 0x1C, 0x00, 0x00, 0x18, 0x03 }; private byte[] on30 = new byte[] { 0xFE, 0x05, 0x00, 0x1D, 0xFF, 0x00, 0x08, 0x33 }; private byte[] off30 = new byte[] { 0xFE, 0x05, 0x00, 0x1D, 0x00, 0x00, 0x49, 0xC3 }; private byte[] on31 = new byte[] { 0xFE, 0x05, 0x00, 0x1E, 0xFF, 0x00, 0xF8, 0x33 }; private byte[] off31 = new byte[] { 0xFE, 0x05, 0x00, 0x1E, 0x00, 0x00, 0xB9, 0xC3 }; public byte[] returninfo(string address, string offon) { byte[] result; if (offon != "off") { switch (address) { case "01": result = on1; break; case "02": result = on2; break; case "03": result = on3; break; case "04": result = on4; break; case "05": result = on5; break; case "06": result = on6; break; case "07": result = on7; break; case "08": result = on8; break; case "09": result = on9; break; case "10": result = on10; break; case "11": result = on11; break; case "12": result = on12; break; case "13": result = on13; break; case "14": result = on14; break; case "15": result = on15; break; case "16": result = on16; break; case "17": result = on17; break; case "18": result = on18; break; case "19": result = on19; break; case "20": result = on20; break; case "21": result = on21; break; case "22": result = on22; break; case "23": result = on23; break; case "24": result = on24; break; case "25": result = on25; break; case "26": result = on26; break; case "27": result = on27; break; case "28": result = on28; break; case "29": result = on29; break; case "30": result = on30; break; case "31": result = on31; break; default: result = null; break; } return result; } else { switch (address) { case "01": result = off1; break; case "02": result = off2; break; case "03": result = off3; break; case "04": result = off4; break; case "05": result = off5; break; case "06": result = off6; break; case "07": result = off7; break; case "08": result = off8; break; case "09": result = off9; break; case "10": result = off10; break; case "11": result = off11; break; case "12": result = off12; break; case "13": result = off13; break; case "14": result = off14; break; case "15": result = off15; break; case "16": result = off16; break; case "17": result = off17; break; case "18": result = off18; break; case "19": result = off19; break; case "20": result = off20; break; case "21": result = off21; break; case "22": result = off22; break; case "23": result = off23; break; case "24": result = off24; break; case "25": result = off25; break; case "26": result = off26; break; case "27": result = off27; break; case "28": result = off28; break; case "29": result = off29; break; case "30": result = off30; break; case "31": result = off31; break; default: result = null; break; } return result; } } } }