/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package structures;
import gnu.io.*;
/**
 *
 * @author baba
 */
public class Constants {
    
    

     /*NEW
     * Locations are based on the following diagrams
     *     _8_|_1__|_2_   <-- All front 9
     *     _7_|_ME_|_3_   <-- All in line 10
     *      6 | 5  | 4    <-- All back 11
     *      |        |
     *  All Left    All Right
     *      12        13
     * We are going to approx the GPS coordinates to one of these locations
     */

    public static final int FRONT_LEFT = 8;
    public static final int FRONT_CENTER = 1;
    public static final int FRONT_RIGHT = 2;
    public static final int FRONT_ALL = 9;
    public static final int LEFT = 7;
    public static final int RIGHT =3;
    public static final int ALL_INLINE = 10;
    public static final int BACK_LEFT = 6;
    public static final int BACK_CENTER = 5;
    public static final int BACK_RIGHT = 4;
    public static final int BACK_ALL = 11;
    public static final int LEFT_ALL = 12;
    public static final int RIGHT_ALL = 13;

    public static final String FRONT_LEFT_STRING = "8.0";
    public static final String FRONT_CENTER_STRING = "1.0";
    public static final String FRONT_RIGHT_STRING = "2.0";
    public static final String FRONT_ALL_STRING = "9.0";
    public static final String LEFT_STRING = "7.0";
    public static final String RIGHT_STRING ="3.0";
    public static final String ALL_INLINE_STRING = "10.0";
    public static final String BACK_LEFT_STRING = "6.0";
    public static final String BACK_CENTER_STRING = "5.0";
    public static final String BACK_RIGHT_STRING = "4.0";
    public static final String BACK_ALL_STRING = "11.0";
    public static final String LEFT_ALL_STRING = "12.0";
    public static final String RIGHT_ALL_STRING = "13.0";

    //Application Settings
    public static final String PROPERTIES_FILE = "ApplicationSettings.properties";
    public static final String HAS_RFID = "HAS_RFID";
    public static final String PROPERTIES_DEBUG = "DEBUG";
    public static final String PROPERTIES_TRUE = "TRUE";
    public static final String PROPERTIES_FALSE = "FALSE";
    public static final String PROPERTIES_RULES_FILES = "RULES";
    public static final String PROPERTIES_TICK = "TICK";
    public static final String PROPERTIES_COREHASH = "COREHASH";
    public static final String PROPERTIES_ME="ME";
    public static final String PROPERTIES_MY_PORT_RECEIVE = "MY_PORT_RECEIVE";
    public static final String PROPERTIES_MY_PORT_SEND = "MY_PORT_SEND";
    public static final String PROPERTIES_SEND_TICK = "SEND_TICK";
    public static final String PROPERTIES_PASSWORD = "PASSWORD";
    public static final String PROPERTIES_SUPERNODES = "SUPERNODES";
    public static final String PROPERTIES_RM_RECEIVE_PORT="RM_RECEIVE_PORT";
    public static final String PROPERTIES_RM_TICK= "RM_TICK";
    public static final String PROPERTIES_SUPERNODE_TICK= "SUPERNODE_TICK";
    public static final String PROPERTIES_ROADSIGN_FILE = "ROADSIGNS";
    public static final String PROPERTIES_SIGN_DISTANCE = "SIGN_DISTANCE";
    public static final String PROPERTIES_CARBON = "CARBON";
    public static final String PROPERTIES_WALLET = "WALLET";
    public static final String PROPERTIES_CHARGE_POINT = "CHARGE_POINT";
    public static final String PROPERTIES_SPHINX = "SPHINX";
    public static final String PROPERTIES_OBD_PORT = "OBD_PORT";
    public static final String PROPERTIES_OBD_BAUD = "OBD_BAUD";
    public static final String PROPERTIES_GPS_PORT = "GPS_PORT";
    public static final String PROPERTIES_TMC = "TMC";
    public static final String PROPERTIES_VOIP = "VOIP";
    public static final String PROPERTIES_VOIP_CONFIG = "VOIP_CONFIG";

    // for the entity type
    public static final int TYPE_VEHICLE = 0;
    public static final int TYPE_AMBULANCE = 1;
    public static final int TYPE_ROADSIDE = 2;
    public static final int TYPE_STOPSIGN = 3;
    public static final int TYPE_RESTAREA = 4;
    public static final int TYPE_PEDESTRIAN = 5;
    public static final int TYPE_SCHOOL = 6;
    public static final int TYPE_CONSTRUCTION = 7;

    public static final String TYPE_AMBULANCE_STRING = "1.0";
    public static final String TYPE_PEDESTRIAN_STRING = "5.0";
    public static final String TYPE_SCHOOL_STRING = "6.0";
    public static final String TYPE_CONSTRUCTION_STRING = "7.0";
    public static final String TYPE_POLICE_STRING = "8.0";
    public static final String TYPE_FIRE_STRING = "9.0";
    public static final String TYPE_TOW_STRING = "10.0";

    // for the variable type
    public static final String INTEGER = "INTEGER";
    public static final String STRING = "STRING";
    public static final String DOUBLE = "DOUBLE";
    public static final String LOCATION = "LOCATION";

    //for the xml file
    public static final String GLOBAL_VARIABLES = "GlobalVariables";
    public static final String VARIABLES = "Variable";
    public static final String VARIABLE_NAME = "name";
    public static final String VARIABLE_TYPE = "type";
    public static final String VARIABLE_VALUE = "value";
    public static final String RULE_SET = "RuleSet";
    public static final String RULES = "Rule";
    public static final String RULE_CONDITIONS = "Conditions";
    public static final String RULE_ID = "ID";
    public static final String CONDITION = "condition";
    public static final String CONDITION_FUNCTION = "conditionFunction";
    public static final String CONDITION_NOT = "not";
    public static final String CONDITION_LOGIGAL_OPERATOR = "logicalOperator";
    public static final String RULE_ACTIONS = "Actions";
    public static final String ACTION = "action";
    public static final String ACTION_FUNCTION = "actionFunction";

    //for the conditionfunctions
    public static final String SUBTRACT = "-";
    public static final String ADD = "+";
    public static final String DIVIDE = "/";
    public static final String MULTIPLY = "*";
    public static final String LOGICAL_AND = "AND";
    public static final String LOGICAL_NOT = "NOT";
    public static final String LOGICAL_OR = "OR";

    //For the hashtable keys
    public static final String HASH_SPEED = "speed";
    public static final String HASH_RPM = "rpm";
    public static final String HASH_MAF = "maf";
    public static final String HASH_FUEL_PRESSURE = "fuel_pressure";
    public static final String HASH_INTAKE_AIR_TMP = "intake_air_temp";
    public static final String HASH_THROTTLE_POSN = "throttle_posn";
    public static final String HASH_ENGINE_LOAD = "engine_load";
    public static final String HASH_ENGINE_STATE = "engine_state";
    public static final String HASH_ENGINE_COOLANT_TMP = "engine_coolant_temp";
    public static final String HASH_MPG = "mpg";
    public static final String HASH_FUEL_INPUT_LEVEL = "fuel_input_level";
    public static final String HASH_TYPE = "type";
    public static final String HASH_CONDITION = "condition";
    public static final String HASH_ACCELERATION = "acceleration";
    public static final String HASH_GPS_LOCATION = "gpsLocation";
    public static final String HASH_SPEED_LIMIT = "speedLimit";
    public static final String HASH_OVER_SPEED_LIMIT = "overSpeedLimit";
    public static final String HASH_RANGE = "range";
    public static final String HASH_ID = "name";
    public static final String HASH_LOCATION = "location";
    public static final String HASH_LOCATION1 = "location1";
    public static final String HASH_PRESENT = "present";
    public static final String HASH_VALUE_TRUE = "true";
    public static final String HASH_VALUE_FALSE = "false";
    public static final String HASH_HASHTAG = "hash";
    public static final String HASH_LATITUDE = "latitude";
    public static final String HASH_LONGITUDE = "longitude";
    public static final String HASH_HEADING = "heading";
    public static final String HASH_BEARING = "bearing";
    public static final String HASH_ROADSIGN_ENABLE = "roadsign";
    public static final String HASH_IMAGE1 = "image1";
    public static final String HASH_IMAGE2 = "image2";
    public static final String HASH_IMAGE3 = "image3";
    public static final String HASH_IMAGE4 = "image4";
    public static final String HASH_IMAGE_TAKEN = "YES";
    public static final String HASH_IMAGE_NOT_TAKEN = "NO";
    public static final String HASH_SPHINX = "sphinx";
    public static final String HASH_SPHINX_ACTIVE_SCENE = "sphinx_active_scene";
    public static final String HASH_TRACKING = "tracking";
    public static final String HASH_MOVING = "moving";
    public static final String QOR_VARIANCE = "qor_variance";


    //NEW!!
    public static final String HASH_COREHASHTAG = "hash_core";

    public static final int HASH_INITAL_VALUE = 23;

    public static final int CONDITION_NORMAL = 0;
    public static final int CONDITION_ABNORMAL = 1;


    ///for delimiter
    public static final String DELIMITER = ",";
    public static final String DELIMITER_CORE = ";";

    //for serialization
    public static final String SCALAR = "s";
    public static final String VECTOR = "v";
    public static final String TYPE_DOUBLE = "d";
    public static final String TYPE_STRING = "s";
    public static int MAX_BUFFER = 2048;

    //for de-serialization
    public static final String DELIMITER_ENTRY = "::";
    public static final String DELIMITER_SINGLE_ENTRY = ";";
    public static final String DELIMITER_FOR_VIN = "&";
    public static final String DELIMITER_FOR_ENCRYPTION = ":::";
    public static final String DELIMITER_FOR_HASHCODE = "@@";

    // for the supernodes file
    public static final String XML_SUPERNODES = "supernodes";
    public static final String XML_SUPERNODES_SUPERNODE = "superNode";
    public static final String XML_SUPERNODES_SUPERNODE_ID = "ID";
    public static final String XML_SUPERNODES_SUPERNODE_IP = "IP";
    public static final String XML_SUPERNODES_SUPERNODE_RM_TCP_PORT = "RM_TCP_PORT";
    public static final String XML_SUPERNODES_SUPERNODE_NODE_TCP_PORT = "NODE_TCP_PORT";
    public static final String XML_SUPERNODES_SUPERNODE_TCP_PORT = "SUPERNODE_TCP_PORT";

    // for carbonemissions file
    public static final String  XML_CARBON = "trips";
    public static final String  XML_CARBON_TRIP = "trip";
    public static final String  XML_CARBON_DATE = "date";
    public static final String  XML_CARBON_FUEL = "fuel";
    public static final String  XML_CARBON_MILES = "miles";
    public static final String  XML_CARBON_CARBON = "carbon";

    //for the roadsign file
    public static final String XML_ROADSIGNS = "RoadSigns";
    public static final String XML_ROADSIGNS_SIGN = "sign";
    public static final String XML_ROADSIGNS_SIGN_TYPE = "type";
    public static final String XML_ROADSIGNS_SIGN_LAT = "lat";
    public static final String XML_ROADSIGNS_SIGN_LON = "lon";
    public static final String XML_ROADSIGNS_SIGN_HEADING = "heading";
    public static final String XML_ROADSIGNS_SIGN_BEARING = "bearing";
    public static final String XML_ROADSIGNS_SIGN_PRIORITY = "priority";
    public static final String XML_ROADSIGNS_SIGN_SPEEDLIMIT = "speedlimit";

    //for the chargepoint file
    public static final String XML_CHARGEPOINTS = "ChargePoints";
    public static final String XML_CHARGEPOINTS_CHARGEPOINT = "chargepoint";
    public static final String XML_CHARGEPOINTS_CHARGEPOINT_ID = "id";
    public static final String XML_CHARGEPOINTS_CHARGEPOINT_TYPE = "type";
    public static final String XML_CHARGEPOINTS_CHARGEPOINT_LAT = "lat";
    public static final String XML_CHARGEPOINTS_CHARGEPOINT_LON = "lon";
    public static final String XML_CHARGEPOINTS_CHARGEPOINT_PRICE = "price";
    public static final String XML_CHARGEPOINTS_CHARGEPOINT_SEQUENCE = "sequence";
    public static final String XML_CHARGEPOINTS_CHARGEPOINT_DATE = "date";
    public static final String XML_CHARGEPOINTS_CHARGE = "charge";


    public static final String NOT_NUMBER = "NaN";
    public static final String GPS_ORIENTATION_NORTH = "N";
    public static final String GPS_ORIENTATION_SOUTH = "S";
    public static final String GPS_ORIENTATION_WEST="W";
    public static final String GPS_ORIENTATION_EAST = "E";
    public static final String GPS_ORIENTATION_NORTHEAST = "NE";
    public static final String GPS_ORIENTATION_NORTHWEST = "NW";
    public static final String GPS_ORIENTATION_SOUTHEAST = "SE";
    public static final String GPS_ORIENTATION_SOUTHWEST = "SW";
    public static final int GPS_DEGREE_RANGE = 45;

       //for OBD connection
    public static final String COM_PORT = "COM4";
    public static final int BAUD_RATE = 38400;
    public static final int DATA_BITS_8 = SerialPort.DATABITS_8;
    public static final int STOP_BITS_1 = SerialPort.STOPBITS_1;
    public static final int FLOW_CONTROL_NONE = SerialPort.FLOWCONTROL_NONE;
    public static final int PARITY_NONE =  SerialPort.PARITY_NONE;

    public static final String DELIM_SPACE = " ";
    public static final String DELIM_PROMPT = ">";

    public static final byte[] PROMPT = DELIM_PROMPT.getBytes();
    public static final int THREAD_SLEEP = 1000;

    ///for the roadsign
    public static final String ROADSIGN_TYPE_STOP = "stop";
    public static final String ROADSIGN_TYPE_SPEED_LIMIT = "Speed Limit";
    public static final String ROADSIGN_TYPE_PEDESTRIAN = "pedestrian";
    public static final String ROADSIGN_TYPE_PEDESTRIAN_CROSSING = "Pedestrian Crossing";
    public static final String ROADSIGN_TYPE_ONE_WAY ="One Way";
    public static final String ROADSIGN_TYPE_SCHOOL_STOP ="schoolstop";
    public static final String ROADSIGN_TYPE_CONSTRUCTION ="construction";
    public static final String ROADSIGN_TYPE_AMBULANCE ="ambulance";
    public static final String ROADSIGN_TYPE_POLICE ="police";
    public static final String ROADSIGN_TYPE_FIRE ="fire";
    public static final String ROADSIGN_TYPE_TOW ="tow";
    //public static final String ROADSIGN_TYPE = "TYPE";

    //for OBD sensors
    public static final String SENSOR_ENGINE_RPM = "Engine RPM";
    public static final String SENSOR_VEHICLE_SPEED = "Vehicle Speed";
    public static final String SENSOR_MAF = "MAF Air Flow Rate";
    public static final String SENSOR_FUEL_LEVEL = "Fuel Level Input";
    public static final String SENSOR_FUEL_PRESSURE = "Fuel Pressure";
    public static final String SENSOR_INTAKE_AIR_TEMP = "Intake Air Temperature";
    public static final String SENSOR_THROTTLE_POSN = "Throttle Position";
    public static final String SENSOR_ENGINE_LOAD = "Calculated Engine Load Value";
    public static final String SENSOR_ENGINE_COOLANT_TMP = "Engine Coolant Temperature";

    public static final int UDP_PORT = 4445;
    
    public static final String COLOR_BLUE = "#0000FF";
    public static final String COLOR_RED = "#FF0000";
    public static final String COLOR_GREEN = "#00FF00";



}
