001package jmri.jmrix.powerline.cm11; 002 003/** 004 * Constants and functions specific to the CM11 interface. 005 * 006 * @author Bob Jacobsen Copyright (C) 2008 007 */ 008public class Constants { 009 010 private Constants() {} // class only supplies static methods 011 012 public static final int POLL_REQ = 0x5A; 013 public static final int TIME_REQ_CP11 = 0xA5; 014 public static final int TIME_REQ_CP10 = 0xA6; 015 public static final int MACRO_INITIATED = 0x5B; 016 public static final int MACRO_LOAD = 0xFB; 017 public static final int CHECKSUM_OK = 0x00; 018 public static final int READY_REQ = 0x55; 019 public static final int FILTER_FAIL = 0xF3; 020 public static final int EXT_CMD_HEADER = 0x07; 021 022 public static final int POLL_ACK = 0xC3; 023 public static final int TIMER_DOWNLOAD = 0x9B; 024 025 /** 026 * Pretty-print a header code. 027 * 028 * @param b header byte 029 * @return formatted as text of header byte 030 */ 031 public static String formatHeaderByte(int b) { 032 return "Dim: " + ((b >> 3) & 0x1F) 033 + ((b & 0x02) != 0 ? " function" : " address ") 034 + ((b & 0x01) != 0 ? " extended" : " "); 035 } 036 037}