All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.bidib.wizard.api.model.NodeInterface Maven / Gradle / Ivy

The newest version!
package org.bidib.wizard.api.model;

import java.beans.PropertyChangeListener;
import java.util.Collection;
import java.util.List;
import java.util.Map;

import org.bidib.jbidibc.core.node.ConfigurationVariable;
import org.bidib.jbidibc.exchange.vendorcv.VendorCvData;
import org.bidib.jbidibc.messages.FeedbackAddressData;
import org.bidib.jbidibc.messages.FeedbackDynStateData;
import org.bidib.jbidibc.messages.Node;
import org.bidib.jbidibc.messages.enums.DetachedState;
import org.bidib.jbidibc.messages.enums.IdentifyState;
import org.bidib.jbidibc.messages.enums.LcOutputType;
import org.bidib.jbidibc.messages.enums.PositionLocationEnum;
import org.bidib.jbidibc.messages.enums.SysErrorEnum;
import org.bidib.jbidibc.messages.port.PortConfigValue;
import org.bidib.wizard.api.model.event.NodeStatusEvent.StatusIdentifier;
import org.bidib.wizard.api.model.firmware.FirmwareVersion;
import org.bidib.wizard.api.model.listener.AccessoryListListener;
import org.bidib.wizard.api.model.listener.CvDefinitionListener;
import org.bidib.wizard.api.model.listener.FlagListListener;
import org.bidib.wizard.api.model.listener.MacroListListener;
import org.bidib.wizard.api.model.listener.NodeListener;
import org.bidib.wizard.api.model.listener.PortListListener;
import org.bidib.wizard.api.model.listener.PortListener;
import org.bidib.wizard.api.model.listener.PortValueListener;
import org.bidib.wizard.model.ports.AnalogPort;
import org.bidib.wizard.model.ports.BacklightPort;
import org.bidib.wizard.model.ports.FeedbackPort;
import org.bidib.wizard.model.ports.GenericPort;
import org.bidib.wizard.model.ports.InputPort;
import org.bidib.wizard.model.ports.LightPort;
import org.bidib.wizard.model.ports.MotorPort;
import org.bidib.wizard.model.ports.Port;
import org.bidib.wizard.model.ports.ServoPort;
import org.bidib.wizard.model.ports.SoundPort;
import org.bidib.wizard.model.ports.SwitchPairPort;
import org.bidib.wizard.model.ports.SwitchPort;
import org.bidib.wizard.model.status.BidibStatus;
import org.bidib.wizard.model.status.FeedbackConfidenceStatus;
import org.bidib.wizard.model.status.FeedbackPortStatus;
import org.bidib.wizard.model.stringdata.StoredStrings;

public interface NodeInterface extends PortsProvider {

    static final String PROPERTY_REASON_DATA = "reasonData";

    static final String PROPERTY_FEEDBACKPORTS = "feedbackPorts";

    static final String PROPERTY_GLOBAL_DETECTOR_FEEDBACKPORT = "globalDetectorFeedbackPort";

    static final String PROPERTY_FEEDBACKPOSITIONS = "feedbackPositions";

    static final String PROPERTY_FEEDBACKPORT_STATUS = "feedbackPortStatus";

    static final String PROPERTY_FEEDBACKPORT_ADDRESSES = "feedbackPortAddresses";

    static final String PROPERTY_FEEDBACKPORT_CONFIDENCE = "feedbackPortConfidence";

    static final String PROPERTY_FEEDBACKPORT_GROUP_CONFIDENCE = "feedbackPortGroupConfidence";

    static final String PROPERTY_FEEDBACKPORT_DYNSTATES = "feedbackPortDynStates";

    static final String PROPERTY_LABEL = "label";

    static final String PROPERTY_ACCESSORIES = "accessories";

    static final String PROPERTY_NODE_LOAD_STATUS = "nodeLoadStatus";

    static final String PROPERTY_IDENTIFY_STATE = "identifyState";

    static final String PROPERTY_DETACHED = "detached";

    static final String PROPERTY_ERROR_STATE = "errorState";

    static final String PROPERTY_NODE_HAS_ERROR = "nodeHasError";

    static final String PROPERTY_ADDRESSMESSAGESENABLED = "addressMessagesEnabled";

    static final String PROPERTY_BASENUMBER = "baseNumber";

    static final String PROPERTY_ENABLED = "enabled";

    static final String PROPERTY_NODE_PREFIX = "node.";

    static final String PROPERTY_UDPATE_FIRMWARE_VERSION = "updateFirmwareVersion";

    static final String PROPERTY_STOREDSTRINGS_NS2 = "storedStringsNs2";

    /**
     * Perform some processing after the node data is loaded from the bus.
     */
    void postLoadNodeDataProcessing();

    /**
     * Refresh the node.
     */
    void refreshNode();

    /**
     * @return the core node
     */
    Node getNode();

    /**
     * @return the unique id
     */
    long getUniqueId();

    /**
     * @return the global detector feedback port
     */
    FeedbackPort getGlobalDetectorFeedbackPort();

    /**
     * @param feedbackPorts
     *            the feedback ports to set
     */
    void setFeedbackPorts(List feedbackPorts);

    /**
     * @return the node address
     */
    byte[] getAddr();

    /**
     * @param genericPorts
     *            the genericPorts to set
     */
    void setGenericPorts(List genericPorts);

    /**
     * @return the flag returns {@code true} after the generic ports are set, {@code false} otherwise
     */
    boolean isGenericPortsSet();

    /**
     * Set the analog ports
     * 
     * @param analogPorts
     *            the new analog ports.
     */
    void setAnalogPorts(List analogPorts);

    /**
     * @return the accessories
     */
    @Override
    List getAccessories();

    /**
     * @return the vendorCV data
     */
    VendorCvData getVendorCV();

    /**
     * @param vendorCV
     *            the vendorCV to set
     */
    void setVendorCV(VendorCvData vendorCV);

    /**
     * @param accessory
     *            the new accessory
     * @return the accessory
     */
    Accessory replaceAccessory(Accessory accessory, boolean silent);

    /**
     * @param macro
     *            the new macro
     * @return the macro
     */
    Macro replaceMacro(Macro macro, boolean silent);

    /**
     * @param configVars
     *            the new configuration variables
     */
    void updateConfigVariableValues(List configVars, final boolean read);

    /**
     * @param cvList
     *            the configuration variables
     */
    void setConfigVariables(List cvList);

    /**
     * Returns a map with the cvName as key and the CV as value.
     * 
     * @return the configuration variables in a map with the cvName as key and the CV as value
     */
    Map getConfigVariables();

    /**
     * @param nodeHasError
     *            the error flag to set
     */
    void setNodeHasError(boolean nodeHasError);

    /**
     * @return node has servo ports
     */
    boolean hasServoPorts();

    /**
     * @return node has sound ports
     */
    boolean hasSoundPorts();

    /**
     * @return node has accessories
     */
    boolean hasAccessories();

    /**
     * @return the number of aspects per accessory
     */
    int getMaxAspects();

    /**
     * @param maxAspectsCount
     *            the number of aspects per accessory on the node
     */
    void setMaxAspects(int maxAspectsCount);

    /**
     * Set the accessories of the node.
     * 
     * @param accessories
     *            the accessories
     */
    void setAccessories(List accessories);

    /**
     * Check if the node has macros loaded.
     * 
     * @return node has macros
     */
    boolean hasMacros();

    /**
     * Check if all macros were loaded from the node.
     * 
     * @return unloaded macro detected
     */
    boolean hasUnloadedMacros();

    /**
     * Set the macros of the node.
     * 
     * @param macros
     *            the macros to set
     */
    void setMacros(List macros);

    /**
     * @return the identify state
     */
    IdentifyState getIdentifyState();

    /**
     * @param identifyState
     *            the identify state
     */
    void setIdentifyState(IdentifyState identifyState);

    /**
     * @return the detached state
     */
    DetachedState getDetachedState();

    /**
     * @param detachedState
     *            the detached state
     */
    void setDetachedState(DetachedState detachedState);

    /**
     * @return the error state
     */
    SysErrorEnum getErrorState();

    /**
     * @return address messages enabled
     */
    Boolean isAddressMessagesEnabled();

    /**
     * @return DCC start is enabled
     */
    Boolean isDccStartEnabled();

    /**
     * @return external start is enabled
     */
    Boolean isExternalStartEnabled();

    /**
     * @return feedback messages are enabled
     */
    Boolean isFeedbackMessagesEnabled();

    /**
     * @return feedback mirror messages are disabled
     */
    Boolean isFeedbackMirrorDisabled();

    /**
     * @return key messages are enabled
     */
    Boolean isKeyMessagesEnabled();

    /**
     * @return node has an error
     */
    boolean isNodeHasError();

    /**
     * @param ignoreSysError
     *            flag to allow ignore sys errors
     * @return node has error flag set
     */
    boolean isNodeHasError(boolean ignoreSysError);

    /**
     * @param sysError
     *            sys error
     * @param reason
     *            the reason
     */
    void setErrorState(final SysErrorEnum sysError, final String reason);

    /**
     * @param userName
     *            the label
     */
    void setLabel(String userName);

    /**
     * @return the label
     */
    String getLabel();

    /**
     * @return the node has a global detector
     */
    boolean isGlobalDetectorAvailable();

    /**
     * @param globalDetectorAvailable
     *            the node has a global detector flag
     */
    void setGlobalDetectorAvailable(boolean globalDetectorAvailable);

    /**
     * @return the baseNumber
     */
    int getBaseNumber();

    /**
     * @param baseNumber
     *            the baseNumber to set
     */
    void setBaseNumber(int baseNumber);

    /**
     * @return node supports firmware update
     */
    boolean isUpdatable();

    /**
     * @param updatable
     *            set the node supports firmware update flag
     */
    void setUpdatable(boolean updatable);

    /**
     * @return the update firmware version
     */
    FirmwareVersion getUpdateFirmwareVersion();

    /**
     * @param updateFirmwareVerion
     *            the update firmware version
     */
    void setUpdateFirmwareVersion(FirmwareVersion updateFirmwareVerion);

    /**
     * @return node is a bootloader node
     */
    boolean isBootloaderNode();

    /**
     * @param bootloaderNode
     *            the bootloaderNode to set
     */
    void setBootloaderNode(boolean bootloaderNode);

    /**
     * Set the input ports
     * 
     * @param inputPorts
     *            the new input ports.
     */
    void setInputPorts(List inputPorts);

    /**
     * @param keyNumber
     *            the input number
     * @param keyState
     *            the input state
     */
    void setInputPortStatus(int keyNumber, int keyState);

    /**
     * @return node has analog ports
     */
    boolean hasAnalogPorts();

    /**
     * @return node has switch ports
     */
    boolean hasSwitchPorts();

    /**
     * @return node has switchPair ports
     */
    boolean hasSwitchPairPorts();

    /**
     * @return node has motor ports
     */
    boolean hasMotorPorts();

    /**
     * Confidence for port group is signaled from the node.
     * 
     * @param feedbackConfidenceStatus
     *            the confidence status of the detectors
     */
    void setFeedbackPortGroupConfidence(final FeedbackConfidenceStatus feedbackConfidenceStatus);

    /**
     * @return the FeedbackPortGroupConfidence of the node
     */
    FeedbackConfidenceStatus getFeedbackPortGroupConfidence();

    /**
     * Confidence is signaled from the node.
     * 
     * @param portNumber
     *            the port number (not the detector number)
     * @param freeze
     *            the freeze flag of the detector
     * @param noSignal
     *            the noSignal flag of the detector
     * @param invalid
     *            {@code false} the occupancy detection is detected from the track signal of the detector, {@code true}
     *            detection of occupancy is not possible
     */
    void setFeedbackPortConfidence(int portNumber, boolean invalid, boolean freeze, boolean noSignal);

    /**
     * Set the feedback port status.
     * 
     * @param detectorNumber
     *            the detector number
     * @param status
     *            the new port status
     * @param timestamp
     *            the sync timestamp
     */
    void setFeedbackPortStatus(int detectorNumber, final FeedbackPortStatus status, final Integer timestamp);

    /**
     * Set the configuration of the port.
     * 
     * @param portType
     *            the port type
     * @param portNumber
     *            the port number
     * @param portConfig
     *            the new port configuration
     */
    void setPortConfig(
        LcOutputType portType, int portNumber, Map> portConfig,
        final PropertyChangeListener pcl);

    /**
     * Clear the port cache.
     */
    void clearPortCache();

    /**
     * Set the backlight ports
     * 
     * @param backlightPorts
     *            the new backlight ports.
     */
    void setBacklightPorts(List backlightPorts);

    /**
     * Set the value of a backlight port.
     * 
     * @param portNumber
     *            the port number
     * @param portValue
     *            the new port value
     */
    void setBacklightPortValue(int portNumber, int portValue);

    /**
     * Set the light ports
     * 
     * @param lightPorts
     *            the new light ports.
     */
    void setLightPorts(List lightPorts);

    /**
     * Set the new switch port status.
     * 
     * @param portNumber
     *            the port number
     * @param portState
     *            the port state
     */
    void setLightPortStatus(final int portNumber, int portState);

    /**
     * Set the motor ports.
     * 
     * @param motorPorts
     *            the new motor ports.
     */
    void setMotorPorts(List motorPorts);

    /**
     * Set the value of a motor port.
     * 
     * @param portNumber
     *            the port number
     * @param portStatus
     *            the new port status
     */
    void setMotorPortValue(int portNumber, int portStatus);

    /**
     * Set the servo ports
     * 
     * @param servoPorts
     *            the new servo ports.
     */
    void setServoPorts(List servoPorts);

    /**
     * Set the value of a servo port.
     * 
     * @param portNumber
     *            the port number
     * @param portValue
     *            the new port value
     */
    void setServoPortValue(int portNumber, int portValue);

    /**
     * Set the sound ports.
     * 
     * @param soundPorts
     *            the new sound ports.
     */
    void setSoundPorts(List soundPorts);

    /**
     * Set the new sound port status.
     * 
     * @param portNumber
     *            the port number
     * @param portState
     *            the port state
     */
    void setSoundPortStatus(final int portNumber, int portState);

    /**
     * Set the switch ports
     * 
     * @param switchPorts
     *            the new switch ports.
     */
    void setSwitchPorts(List switchPorts);

    /**
     * Set the new switch port status.
     * 
     * @param portNumber
     *            the port number
     * @param portState
     *            the port state
     */
    void setSwitchPortStatus(final int portNumber, int portState);

    /**
     * Set the switchPair ports
     * 
     * @param switchPairPorts
     *            the new switchPair ports.
     */
    void setSwitchPairPorts(List switchPairPorts);

    /**
     * Set the new switchPair port status.
     * 
     * @param portNumber
     *            the port number
     * @param portState
     *            the port state
     */
    void setSwitchPairPortStatus(final int portNumber, int portState);

    /**
     * @return node has backlight ports
     */
    boolean hasBacklightPorts();

    /**
     * @return node has input ports
     */
    boolean hasInputPorts();

    /**
     * @return node has light ports
     */
    boolean hasLightPorts();

    /**
     * @return node has feedback ports
     */
    boolean hasFeedbackPorts();

    /**
     * @return number of feedback ports
     */
    int getFeedbackPortCount();

    /**
     * @param decoderAddress
     *            the decoder address
     * @param locationType
     *            the location type
     * @param locationAddress
     *            the location address
     * @param extendedData
     *            the extendedData
     */
    void setFeedbackPosition(
        int decoderAddress, PositionLocationEnum locationType, int locationAddress, byte[] extendedData);

    /**
     * Set the detected addresses for the feedback port.
     * 
     * @param detectorNumber
     *            the detector number
     * @param addresses
     *            the detected addresses
     */
    void setFeedbackPortAddresses(int detectorNumber, List addresses);

    /**
     * Set the speed on the current detector if the address matches.
     * 
     * @param detectorNumber
     *            the detector number
     * @param address
     *            the address to search
     * @param speed
     *            the speed value
     */
    void setFeedbackPortSpeed(int detectorNumber, int address, int speed);

    /**
     * @param detectorNumber
     *            the detector number
     * @param dynStates
     *            the dyn state values
     */
    void setFeedbackPortDynStates(int detectorNumber, List dynStates);

    /**
     * @param flags
     *            the flags
     */
    void setFlags(Collection flags);

    /**
     * Add listener for changes of the accessory list.
     * 
     * @param accessoryListListener
     *            the listener
     */
    void addAccessoryListListener(AccessoryListListener accessoryListListener);

    /**
     * Remove listener for changes of the accessory list.
     * 
     * @param listener
     *            the listener
     */
    void removeAccessoryListListener(AccessoryListListener listener);

    /**
     * Add the listener for flag list changes.
     * 
     * @param listener
     *            the flag list changes listener
     */
    void addFlagListListener(FlagListListener listener);

    /**
     * Remove the listener for flag list changes.
     * 
     * @param listener
     *            the flag list changes listener
     */
    void removeFlagListListener(FlagListListener listener);

    /**
     * Add listener for changes of the cv definitions.
     * 
     * @param listener
     *            the listener
     */
    void addCvDefinitionListener(CvDefinitionListener listener);

    /**
     * Remove listener for changes of the cv definitions.
     * 
     * @param listener
     *            the listener
     */
    void removeCvDefinitionListener(CvDefinitionListener listener);

    /**
     * @return CV definition for the node is available
     */
    boolean isCvDefinitionAvailable();

    /**
     * Add the listener for port list changes of the provided port class.
     * 
     * @param portClazz
     *            the port class
     * @param listener
     *            the port list changes listener
     */
    void addPortListListener(Class portClazz, PortListListener listener);

    /**
     * Remove the listener for port list changes of the provided port class.
     * 
     * @param portClazz
     *            the port class
     * @param listener
     *            the port list changes listener
     */
    void removePortListListener(Class portClazz, PortListListener listener);

    /**
     * Add the listener for port value changes of the provided port class.
     * 
     * @param portClazz
     *            the port class
     * @param listener
     *            the port value changes listener
     */
    void addPortValueListener(Class portClazz, PortValueListener listener);

    /**
     * Remove the listener for port value changes of the provided port class.
     * 
     * @param portClazz
     *            the port class
     * @param listener
     *            the port value changes listener
     */
    void removePortValueListener(Class portClazz, PortValueListener listener);

    /**
     * @return number of macros that can be stored on the node
     */
    int getStorableMacroCount();

    /**
     * @param storableMacroCount
     *            number of macros that can be stored on the node
     */
    void setStorableMacroCount(int storableMacroCount);

    /**
     * @return the maximum number of steps for macros
     */
    int getMaxMacroSteps();

    /**
     * @return returns the booster node instance or {@code null} if the node does not support booster functions
     */
    BoosterNodeInterface getBoosterNode();

    /**
     * @return returns the command station node instance or {@code null} if the node does not support command station
     *         functions
     */
    CommandStationNodeInterface getCommandStationNode();

    /**
     * @return returns the interface node instance or {@code null} if the node does not support interface functions
     */
    InterfaceNodeInterface getInterfaceNode();

    /**
     * @return returns the switching node instance or {@code null} if the node does not support switching functions
     */
    SwitchingNodeInterface getSwitchingNode();

    /**
     * @return returns the occupancy node instance or {@code null} if the node does not support occupancy functions
     */
    OccupancyNodeInterface getOccupancyNode();

    /**
     * Signal that the initial load of the node in in progress and it has been registered int he node registry.
     */
    void signalInitialLoadRegistered();

    /**
     * Signal that the initial load of configuration and status of the node has finished.
     */
    void signalInitialLoadFinished();

    /**
     * Signal that the initial load of configuration and status of the node has partially finished.
     */
    void signalInitialLoadPartiallyFinished();

    /**
     * Signal the reset of the initial load of configuration and status of the node has finished.
     */
    void signalResetInitialLoadFinished();

    /**
     * This lock is signaled when load the configuration and status of the node initially has finished.
     * 
     * @return the initial load finished lock
     */
    Object getInitialLoadFinishedLock();

    /**
     * Add property change listener.
     * 
     * @param propertyChangeListener
     *            the property change listener
     */
    void addPropertyChangeListener(PropertyChangeListener propertyChangeListener);

    /**
     * Remove property change listener.
     * 
     * @param propertyChangeListener
     *            the property change listener
     */
    void removePropertyChangeListener(PropertyChangeListener propertyChangeListener);

    /**
     * Add property change listener.
     * 
     * @param propertyName
     *            the property name
     * @param listener
     *            the property change listener
     */
    void addPropertyChangeListener(String propertyName, PropertyChangeListener listener);

    /**
     * Remove property change listener.
     * 
     * @param propertyName
     *            the property name
     * @param listener
     *            the property change listener
     */
    void removePropertyChangeListener(String propertyName, PropertyChangeListener listener);

    /**
     * Returns the reason data of an error on this node.
     * 
     * @return the reason data
     */
    String getReasonData();

    /**
     * Set the reason data.
     * 
     * @param reasonData
     *            the reason data
     */
    void setReasonData(String reasonData);

    /**
     * Add node listener.
     * 
     * @param nodeListener
     *            the node listener
     */
    void addNodeListener(final NodeListener nodeListener);

    /**
     * Remove node listener.
     * 
     * @param nodeListener
     *            the node listener
     */
    void removeNodeListener(final NodeListener nodeListener);

    /**
     * @return the node has the restart required flag set
     */
    boolean isNodeHasRestartPendingError();

    /**
     * Enable or disable the spontaneous address messages from the node.
     * 
     * @param enable
     *            {@code true}: events enabled, {@code false}: events disabled
     */
    void setAddressMessagesEnabled(Boolean enable);

    /**
     * Enable or disable the start of macros by DCC on the node.
     * 
     * @param enable
     *            {@code true}: events enabled, {@code false}: events disabled
     */
    void setDccStartEnabled(Boolean enable);

    /**
     * Enable or disable the start of macros by local input keys on the node.
     * 
     * @param enable
     *            {@code true}: events enabled, {@code false}: events disabled
     */
    void setExternalStartEnabled(Boolean enable);

    /**
     * Enable or disable the spontaneous occupany/feedback messages from the node.
     * 
     * @param enable
     *            {@code true}: events enabled, {@code false}: events disabled
     */
    void setFeedbackMessagesEnabled(Boolean enable);

    void setFeedbackMirrorDisabled(Boolean disable);

    /**
     * Enable or disable the spontaneous input changes from the node.
     * 
     * @param enable
     *            {@code true}: events enabled, {@code false}: events disabled
     */
    void setInputMessagesEnabled(Boolean enable);

    /**
     * Add a port listener.
     * 
     * @param portClazz
     *            the port class
     * @param listener
     *            the listener to add
     */
    void addPortListener(Class portClazz, PortListener> listener);

    /**
     * Remove a port listener.
     * 
     * @param portClazz
     *            the port class
     * @param listener
     *            the listener to remove
     */
    void removePortListener(Class portClazz, PortListener> listener);

    void addMacroListListener(MacroListListener macroListListener);

    void removeMacroListListener(MacroListListener macroListListener);

    void setAnalogPortConfig(int portNum, Map> portConfig);

    void setBacklightPortConfig(int portNum, Map> portConfig);

    void setLightPortConfig(int portNum, Map> portConfig);

    void setServoPortConfig(int portNum, Map> portConfig);

    void setSwitchPortConfig(int portNum, Map> portConfig);

    void setSwitchPairPortConfig(int portNum, Map> portConfig);

    void setSoundPortConfig(int portNum, Map> portConfig);

    /**
     * @return the node load finished status identifier
     */
    StatusIdentifier getNodeLoadStatusIdentifier();

    /**
     * @return the formatted node address and uniqueId and label if available
     */
    String toNodeAddressAndUniqueString();

    /**
     * @return the storedStringsNs2
     */
    StoredStrings getStoredStringsNs2();

    /**
     * Set the stored strings of the node in namespace 2.
     * 
     * @param storedStringsNs2
     *            the strings
     */
    void setStoredStringsNs2(final StoredStrings storedStringsNs2);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy