001/*
002 * Copyright (C) Cross The Road Electronics.  All rights reserved.
003 * License information can be found in CTRE_LICENSE.txt
004 * For support and suggestions contact support@ctr-electronics.com or file
005 * an issue tracker at https://github.com/CrossTheRoadElec/Phoenix-Releases
006 */
007package com.ctre.phoenixpro.hardware;
008
009import com.ctre.phoenix6.hardware.jni.HardwareJNI;
010
011/**
012 * @deprecated Classes in the phoenixpro package will be removed in 2024.
013 *             Users should instead use classes from the phoenix6 package.
014 */
015@Deprecated(forRemoval = true)
016public class DeviceIdentifier {
017    String network;
018    String model;
019    String tostring = null;
020    int deviceID;
021    int deviceHash;
022
023    /**
024     * @deprecated Classes in the phoenixpro package will be removed in 2024.
025     *             Users should instead use classes from the phoenix6 package.
026     */
027    @Deprecated(forRemoval = true)
028    public DeviceIdentifier() {
029        this.network = "";
030        this.model = "";
031        this.deviceID = 0;
032        this.deviceHash = 0;
033    }
034
035    /**
036     * @deprecated Classes in the phoenixpro package will be removed in 2024.
037     *             Users should instead use classes from the phoenix6 package.
038     */
039    @Deprecated(forRemoval = true)
040    public DeviceIdentifier(int deviceID, String model, String canbus) {
041        this.network = canbus;
042        this.model = model;
043        this.deviceID = deviceID;
044        this.deviceHash = HardwareJNI.getDeviceHash(HardwareJNI.Context.ContextAPI.value, deviceID, model);
045    }
046
047    public String getNetwork() {
048        return network;
049    }
050
051    public String getModel() {
052        return model;
053    }
054
055    public int getDeviceId() {
056        return deviceID;
057    }
058
059    public int getDeviceHash() {
060        return deviceHash;
061    }
062
063    public String toString() {
064        if (tostring == null)
065        {
066            tostring = model + " " + deviceID + " (" + network + ")";
067        }
068        return tostring;
069    }
070}