# DeviceJson
declaration: package: swervelib.parser.json, class: DeviceJson

Package swervelib.parser.json

# Class DeviceJson

java.lang.Object
swervelib.parser.json.DeviceJson

public class DeviceJson extends Object
Device JSON parsed class. Used to access the JSON data.

## Field Summary

Fields
Modifier and Type
Field
Description
`String`
`canbus`
The CAN bus name which the device resides on if using CAN.
`private final Alert`
`canIdWarning`
An `Alert` for if the CAN ID is greater than 40.
`private final Alert`
`i2cLockupWarning`
An `Alert` for if there is an I2C lockup issue on the roboRIO.
`int`
`id`
The CAN ID or pin ID of the device.
`private final Alert`
`serialCommsIssueWarning`
NavX serial comm issue.
`String`
`type`
The device type, e.g.

## Constructor Summary

Constructors
Constructor
Description
`DeviceJson()`

## Method Summary

Modifier and Type
Method
Description
`SwerveAbsoluteEncoder`
`createEncoder(SwerveMotor motor)`
Create a `SwerveAbsoluteEncoder` from the current configuration.
`SwerveIMU`
`createIMU()`
Create a `SwerveIMU` from the given configuration.
`SwerveMotor`
`createMotor(boolean isDriveMotor)`
Create a `SwerveMotor` from the given configuration.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### canIdWarning

private final Alert canIdWarning
An `Alert` for if the CAN ID is greater than 40.

### i2cLockupWarning

private final Alert i2cLockupWarning
An `Alert` for if there is an I2C lockup issue on the roboRIO.

### serialCommsIssueWarning

private final Alert serialCommsIssueWarning
NavX serial comm issue.

### type

public String type
The device type, e.g. pigeon/pigeon2/sparkmax/talonfx/navx

### id

public int id
The CAN ID or pin ID of the device.

### canbus

public String canbus
The CAN bus name which the device resides on if using CAN.

## Constructor Details

### DeviceJson

public DeviceJson()

## Method Details

### createEncoder

public SwerveAbsoluteEncoder createEncoder(SwerveMotor motor)
Create a `SwerveAbsoluteEncoder` from the current configuration.

Parameters:
  `motor` - `SwerveMotor` of which attached encoders will be created from, only used when the type is "attached" or "canandencoder".
Returns:
  `SwerveAbsoluteEncoder` given.

### createIMU

public SwerveIMU createIMU()
Create a `SwerveIMU` from the given configuration.

Returns:
  `SwerveIMU` given.

### createMotor

public SwerveMotor createMotor(boolean isDriveMotor)
Create a `SwerveMotor` from the given configuration.

Parameters:
  `isDriveMotor` - If the motor being generated is a drive motor.
Returns:
  `SwerveMotor` given.