001package jmri.jmrix.ieee802154.xbee; 002 003import java.util.ResourceBundle; 004import jmri.InstanceManager; 005import jmri.LightManager; 006import jmri.SensorManager; 007import jmri.TurnoutManager; 008import org.slf4j.Logger; 009import org.slf4j.LoggerFactory; 010 011/** 012 * Lightweight class to denote that a system is active, and provide general 013 * information. 014 * <p> 015 * Objects of specific subtypes are registered in the instance manager to 016 * activate their particular system. 017 * 018 * @author Bob Jacobsen Copyright (C) 2010 copied from NCE into powerline for 019 * multiple connections by 020 * @author Ken Cameron Copyright (C) 2011 copied from powerline into IEEE802154 021 * for multiple connections by 022 * @author Paul Bender Copyright (C) 2013 023 */ 024public class XBeeConnectionMemo extends jmri.jmrix.ieee802154.IEEE802154SystemConnectionMemo { 025 026 jmri.jmrix.swing.ComponentFactory componentFactory = null; 027 028 public XBeeConnectionMemo() { 029 super("Z", "XBee"); 030 InstanceManager.store(this, XBeeConnectionMemo.class); // also register as specific type 031 } 032 033 @Override 034 protected void init() { 035 // create and register the XBeeComponentFactory 036 InstanceManager.store(componentFactory = new jmri.jmrix.ieee802154.xbee.swing.XBeeComponentFactory(this), 037 jmri.jmrix.swing.ComponentFactory.class); 038 } 039 040 /** 041 * Configure the common managers for XBee connections. This puts the common 042 * manager config in one place. 043 */ 044 @Override 045 public void configureManagers() { 046 log.debug("Configuring Managers for XBee Connection"); 047 048 XBeeTrafficController cont = (XBeeTrafficController) getTrafficController(); 049 // the start the managers. 050 setXBeeNodeManager(new XBeeNodeManager(cont)); 051 052 setSensorManager(new XBeeSensorManager(this)); 053 jmri.InstanceManager.setSensorManager(getSensorManager()); 054 setLightManager(new XBeeLightManager(this)); 055 jmri.InstanceManager.setLightManager(getLightManager()); 056 setTurnoutManager(new XBeeTurnoutManager(this)); 057 jmri.InstanceManager.setTurnoutManager(getTurnoutManager()); 058 register(); 059 } 060 061 /* 062 * get the Node Manager 063 */ 064 public XBeeNodeManager getXBeeNodeManager() { 065 return get(XBeeNodeManager.class); 066 } 067 /* 068 * set the Node Manager 069 */ 070 071 public void setXBeeNodeManager(XBeeNodeManager manager) { 072 store(manager,XBeeNodeManager.class); 073 } 074 075 /* 076 * Provides access to the SensorManager for this particular connection. 077 * NOTE: SensorManager defaults to NULL 078 */ 079 public SensorManager getSensorManager() { 080 return get(SensorManager.class); 081 082 } 083 084 public void setSensorManager(SensorManager s) { 085 store(s,SensorManager.class); 086 } 087 088 /* 089 * Provides access to the LightManager for this particular connection. 090 * NOTE: LightManager defaults to NULL 091 */ 092 public LightManager getLightManager() { 093 return get(LightManager.class); 094 095 } 096 097 public void setLightManager(LightManager s) { 098 store(s,LightManager.class); 099 } 100 101 /* 102 * Provides access to the TurnoutManager for this particular connection. 103 * NOTE: TurnoutManager defaults to NULL 104 */ 105 public TurnoutManager getTurnoutManager() { 106 return get(TurnoutManager.class); 107 108 } 109 110 public void setTurnoutManager(TurnoutManager s) { 111 store(s,TurnoutManager.class); 112 } 113 114 @Override 115 protected ResourceBundle getActionModelResourceBundle() { 116 return ResourceBundle.getBundle("jmri.jmrix.ieee802154.IEEE802154ActionListBundle"); 117 } 118 119 @Override 120 public void dispose() { 121 InstanceManager.deregister(this, XBeeConnectionMemo.class); 122 super.dispose(); 123 } 124 125 private final static Logger log = LoggerFactory.getLogger(XBeeConnectionMemo.class); 126 127} 128 129 130