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.phoenixpro.hardware.jni.HardwareJNI; 010 011public class DeviceIdentifier { 012 String network; 013 String model; 014 String tostring = null; 015 int deviceID; 016 int deviceHash; 017 018 public DeviceIdentifier() { 019 this.network = ""; 020 this.model = ""; 021 this.deviceID = 0; 022 this.deviceHash = 0; 023 } 024 025 public DeviceIdentifier(int deviceID, String model, String canbus) { 026 this.network = canbus; 027 this.model = model; 028 this.deviceID = deviceID; 029 this.deviceHash = HardwareJNI.getDeviceHash(HardwareJNI.Context.ContextAPI.value, deviceID, model); 030 } 031 032 public String getNetwork() { 033 return network; 034 } 035 036 public String getModel() { 037 return model; 038 } 039 040 public int getDeviceId() { 041 return deviceID; 042 } 043 044 public int getDeviceHash() { 045 return deviceHash; 046 } 047 048 public String toString() { 049 if (tostring == null) 050 { 051 tostring = model + " " + deviceID + " (" + network + ")"; 052 } 053 return tostring; 054 } 055}