public List<String> getDipNames() { List<String> d = new LinkedList<>(); for (DipSwitch dipSwitch : dipList) { d.add(dipSwitch.getName()); } return d; }
@Override protected String getSignal(Gateway gateway, String action) throws GatewayNotSupportedException, ActionNotSupportedException { boolean actionSupported = false; for (Button button : buttons) { if (button.getName().equals(action)) { actionSupported = true; break; } } if (!actionSupported) { throw new ActionNotSupportedException(); } String seq = ""; String lo = "1,"; String hi = "3,"; // segments of four String seqLo = lo + hi + lo + hi; // low @SuppressWarnings("unused") String seqHi = hi + lo + hi + lo; // high (never used) String seqFl = lo + hi + hi + lo; // floating String on = seqLo + seqFl; String off = seqFl + seqLo; for (DipSwitch dip : dipList) { if (dip.isChecked()) { seq += seqLo; } else { seq += seqFl; } } if (gateway.getClass() == ConnAir.class) { if (action.equals(context.getString(R.string.on))) { String ON = headConnAir + seq + on + tailConnAir; return ON; } else { String OFF = headConnAir + seq + off + tailConnAir; return OFF; } } else if (gateway.getClass() == BrematicGWY433.class) { if (action.equals(context.getString(R.string.on))) { String ON = headConnAir + seq + on + tailConnAir; return ON; } else { String OFF = headConnAir + seq + off + tailConnAir; return OFF; } } else if (gateway.getClass() == ITGW433.class) { if (action.equals(context.getString(R.string.on))) { String ON = headITGW + seq + on + tailITGW; return ON; } else { String OFF = headITGW + seq + off + tailITGW; return OFF; } } else { throw new GatewayNotSupportedException(); } }