private DCCCommand(DCCCommandPriority priority, DCCCommandType type, ArrayList dataBytes) : this(dataBytes) { this.priority = priority; this.type = type; switch (type) { case DCCCommandType.None: repeats = 1; break; case DCCCommandType.Stop: repeats = StopRepeats; break; case DCCCommandType.Speed: repeats = SpeedRepeat; break; case DCCCommandType.Function: repeats = FuncRepeat; break; case DCCCommandType.Accessory: repeats = AccRepeat; break; case DCCCommandType.POM: repeats = PomRepeat; break; case DCCCommandType.Service: repeats = ServiceRepeat; break; default: repeats = 1; break; } }
/* Byte 1 (bin) Byte 1 (dec) | Byte 2 (bin) Byte 2 (dec) ќписание 00000000 0 | x x Ўирокое вещание 00000001Е01111111 1Е127 | x x ћультифункциональные декодеры с 7-битными адресами 10000000Е10111111 128Е191 | x x Ѕазовые аксессуарные декодеры с 9-битными адресами; | –асширенные аксессуарные декодеры с 11-битными адресами 11000000Е11100111 192Е231 | 00000000...11111111 0...255 ћультифункциональные декодеры с 14-битными адресами (0...10239) 11101000Е11111110 232Е254 | 00000000...11111111 0...255 «арезервировано дл¤ использовани¤ в будущем (10240...16127) 11111111 255 | x x јдрес дл¤ пакета просто¤ */ private static DCCCommand LocoBroadcast(DCCCommandPriority priority, DCCCommandType type, byte[] instruction) { ArrayList list = new ArrayList(); list.Add(DCC.LocoBroadcastAddress); foreach (byte b in instruction) list.Add(b); return new DCCCommand(priority, type, list); }
private static DCCCommand LocoBroadcast(DCCCommandPriority priority, DCCCommandType type, byte[] instruction) { List<byte> list = new List<byte>(); list.Add(DCC.LocoBroadcastAddress); list.AddRange(instruction); return new DCCCommand(list) { Priority = priority, Type = type }; }