001package jmri.jmrix;
002
003/**
004 * Enables basic setup of a network interface for a jmrix implementation. Based
005 * upon work by Bob Jacobsen from SerialPortAdapter
006 *
007 * @author Kevin Dickerson Copyright (C) 2010
008 * @author Bob Jacobsen Copyright (C) 2010
009 * @see jmri.jmrix.NetworkConfigException
010 */
011public interface NetworkPortAdapter extends PortAdapter {
012
013    /**
014     * Connects to the end device using a hostname/ip address and port
015     * @param host hostname / ip address.
016     * @param port network port.
017     * @throws java.io.IOException on connection error.
018     */
019    void connect(String host, int port) throws java.io.IOException;
020
021    /**
022     * Configure all of the other jmrix widgets needed to work with this adapter
023     */
024    @Override
025    void configure();
026
027    /**
028     * Query the status of this connection.
029     *
030     * @return true if all is OK, at least as far as known.
031     */
032    @Override
033    boolean status();
034
035    /**
036     * Remember the associated port name.
037     *
038     * @param s port name.
039     */
040    void setPort(String s);
041
042    void setPort(int s);
043
044    int getPort();
045
046    @Override
047    String getCurrentPortName();
048
049    void setHostName(String hostname);
050
051    String getHostName();
052
053    /*
054     * Set whether or not this adapter should be
055     * configured automatically via MDNS.
056     */
057    void setMdnsConfigure(boolean autoconfig);
058
059    /*
060     * Get whether or not this adapter is configured
061     * to use autoconfiguration via MDNS
062     */
063    boolean getMdnsConfigure();
064
065    /*
066     * Perform the automatic configuration.
067     */
068    void autoConfigure();
069
070    /*
071     * Get and set the ZeroConf/mDNS advertisement name.
072     */
073    void setAdvertisementName(String AdName);
074
075    String getAdvertisementName();
076
077    /*
078     * Get and set the ZeroConf/mDNS service type.
079     */
080    void setServiceType(String ServiceType);
081
082    String getServiceType();
083
084}