001package jmri.jmrit.vsdecoder;
002
003import jmri.DccLocoAddress;
004import jmri.LocoAddress;
005import jmri.jmrit.roster.RosterEntry;
006import jmri.util.PhysicalLocation;
007
008/**
009 * Data capsule ("Model"?) for passing configuration between the GUI and the
010 * VSDecoder itself.
011 *
012 * <hr>
013 * This file is part of JMRI.
014 * <p>
015 * JMRI is free software; you can redistribute it and/or modify it under
016 * the terms of version 2 of the GNU General Public License as published
017 * by the Free Software Foundation. See the "COPYING" file for a copy
018 * of this license.
019 * <p>
020 * JMRI is distributed in the hope that it will be useful, but WITHOUT
021 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
022 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
023 * for more details.
024 *
025 * @author Mark Underwood Copyright (C) 2011
026 */
027public class VSDConfig {
028
029    public float DEFAULT_VOLUME = 0.8f;
030
031    private String my_id;
032    private String vsd_path;
033    private String profile_name;
034    private LocoAddress address;
035    private float volume;
036    private PhysicalLocation location;
037    private RosterEntry roster;
038
039    public VSDConfig() {
040        // umm... do... nothing? here...
041        my_id = "";
042        vsd_path = "";
043        profile_name = "";
044        address = null;
045        volume = DEFAULT_VOLUME;
046        location = null;
047        roster = null;
048    }
049
050    public String getId() {
051        return my_id;
052    }
053
054    public String getVSDPath() {
055        return vsd_path;
056    }
057
058    public String getProfileName() {
059        return profile_name;
060    }
061
062    public LocoAddress getLocoAddress() {
063        return address;
064    }
065
066    public DccLocoAddress getDccAddress() {
067        return new DccLocoAddress(address.getNumber(), address.getProtocol());
068    }
069
070    public float getVolume() {
071        return volume;
072    }
073
074    public PhysicalLocation getPhysicalLocation() {
075        return location;
076    }
077
078    public RosterEntry getRosterEntry() {
079        return roster;
080    }
081
082    public void setId(String id) {
083        my_id = id;
084    }
085
086    public void setVSDPath(String path) {
087        vsd_path = path;
088    }
089
090    public void setProfileName(String name) {
091        profile_name = name;
092    }
093
094    public void setLocoAddress(LocoAddress a) {
095        address = a;
096    }
097
098    public void setVolume(float v) {
099        volume = v;
100    }
101
102    public void setPhysicalLocation(PhysicalLocation p) {
103        location = p;
104    }
105
106    public void setRosterEntry(RosterEntry r) {
107        roster = r;
108    }
109
110    @Override
111    public String toString() {
112        return ("Config: ID:" + my_id
113                + " Path:" + vsd_path
114                + " Profile:" + profile_name
115                + " Addr:" + address
116                + " Vol:" + volume
117                + " Loc:" + location);
118    }
119
120}