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.wpiutils;
008
009import edu.wpi.first.hal.HALValue;
010
011public class CallbackHelper {
012    public static double getRawValue(HALValue value) {
013        switch(value.getType()) {
014        case HALValue.kDouble:
015            return value.getDouble();
016        case HALValue.kBoolean:
017            return value.getBoolean() ? 1 : 0;
018        case HALValue.kInt:
019            return value.getLong();
020        case HALValue.kLong:
021            return value.getLong();
022        case HALValue.kEnum:
023            return value.getLong();
024        default:
025            return 0;
026        }
027    }
028}