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

com.enterprisecoding.jraspbee.Config Maven / Gradle / Ivy

Go to download

jRaspBee; a Java library allowing developers to easily use the features offered by a RaspBee bridge.

The newest version!
/* jRaspBee - a Java library for RaspBee bridge
 *  Copyright (c) 2016 Fatih Boy (http://enterprisecoding.com)
 *  Licensed under the MIT (LICENSE).
 *  
 *  Forked from Jue (https://github.com/Q42/Jue) a java library
 *  for managing Philips HUE Bridge
 */
package com.enterprisecoding.jraspbee;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * Detailed bridge info available if authenticated.
 */
public class Config {
    private String name;
    private String ipaddress;
    private String mac;
    private boolean linkbutton;
    private Date UTC;
    private String swversion;

    // Full Config fields
    private boolean dhcp;
    private boolean portalservices;
    private String netmask;
    private String gateway;
    private String proxyaddress;
    private int proxyport;

    private Map whitelist;
    private SoftwareUpdate swupdate;

    Config() {
    }

    /**
     * Returns the name.
     *
     * @return name of the bridge
     */
    public String getName() {
        return name;
    }

    /**
     * Returns the version of the software.
     *
     * @return version of software on the bridge
     */
    public String getSoftwareVersion() {
        return swversion;
    }

    /**
     * Returns the MAC address.
     *
     * @return mac address of bridge
     */
    public String getMACAddress() {
        return mac;
    }

    /**
     * Returns if the current IP address was obtained with DHCP.
     *
     * @return true if the current IP address was obtained with DHCP, false otherwise.
     */
    public boolean isDHCPEnabled() {
        return dhcp;
    }

    public boolean isPortalServicesEnabled() {
        return portalservices;
    }

    /**
     * Returns the IP address.
     *
     * @return ip address of bridge
     */
    public String getIPAddress() {
        return ipaddress;
    }

    /**
     * Returns the network mask.
     *
     * @return network mask
     */
    public String getNetworkMask() {
        return netmask;
    }

    /**
     * Returns the IP address of the gateway.
     *
     * @return ip address of gateway
     */
    public String getGateway() {
        return gateway;
    }

    /**
     * Returns the IP address of the proxy or null if there is none.
     *
     * @return ip address of proxy or null
     */
    public String getProxyAddress() {
        return proxyaddress.equals("none") ? null : proxyaddress;
    }

    /**
     * Returns the port of the proxy or null if there is none.
     *
     * @return port of proxy or null
     */
    public Integer getProxyPort() {
        return proxyaddress.equals("none") ? null : proxyport;
    }

    /**
     * Returns the time on the bridge.
     *
     * @return time on the bridge
     */
    public Date getUTCTime() {
        return UTC;
    }

    /**
     * Returns if the link button has been pressed within the last 30 seconds.
     *
     * @return true if the link button has been pressed within the last 30 seconds, false otherwise
     */
    public boolean isLinkButtonPressed() {
        return linkbutton;
    }

    /**
     * Returns the list of whitelisted users.
     *
     * @return list of whitelisted users
     */
    public List getWhitelist() {
        ArrayList usersList = new ArrayList();

        usersList.addAll(whitelist.values());

        return usersList;
    }

    /**
     * Returns information about a bridge firmware update.
     *
     * @return bridge firmware update info
     */
    public SoftwareUpdate getSoftwareUpdate() {
        return swupdate;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy