public void registerModule(PModule module) { if (module.getLightCount() <= 0) return; int moduleIndex = module.getComponentIndex(); int vaIndex = ((VoiceArea) module.getParentComponent()).isPolyVoiceArea() ? 0 : 1; PLight light = module.getLight(0); switch (light.getType()) { case PLightDescriptor.TYPE_LED: registerLED(moduleIndex, vaIndex, light); break; case PLightDescriptor.TYPE_LED_ARRAY: case PLightDescriptor.TYPE_METER: { PLight a = light; PLight b = module.getLightCount() > 1 ? module.getLight(1) : null; if (b != null && a.getIntAttribute("index", -1) == 1) { PLight tmp = b; b = a; a = tmp; } registerMeter(moduleIndex, vaIndex, b, a); } break; } }
public void unregisterModule(PModule module) { if (module.getLightCount() <= 0) return; int moduleIndex = module.getComponentIndex(); int vaIndex = ((VoiceArea) module.getParentComponent()).isPolyVoiceArea() ? 0 : 1; PLight light = module.getLight(0); switch (light.getType()) { case PLightDescriptor.TYPE_LED: unregisterLED(moduleIndex, vaIndex, light); break; case PLightDescriptor.TYPE_METER: case PLightDescriptor.TYPE_LED_ARRAY: unregisterMeter(moduleIndex, vaIndex, light); break; } }
public void processMeterMessage(MeterMessage message) { int startIndex = message.get(KEY_START_INDEX); for (int i = 0; i <= 4; i++) { int index = startIndex + (i * 2); if (index >= 0 && index < METERCount * 2) { PLight b = METERs[index]; PLight a = METERs[index + 1]; // System.out.print("("+at(b)+":"+message.get(meterValueKeysB[i])+","+at(a)+":"+message.get(meterValueKeysA[i])+"),"); if (b == null) { a.setValue(message.get(meterValueKeysB[i])); } else { if (a != null) { a.setValue(message.get(meterValueKeysA[i])); b.setValue(message.get(meterValueKeysB[i])); } else { b.setValue(message.get(meterValueKeysB[i])); } } } } // System.out.println(); }
private int moduleIndex(PLight l) { return l.getParentComponent().getComponentIndex(); }