/** \file
 *
 *  Specifies the interface details for the BPC1 component in the
 *  SensorModule.
 *
 *  BPC1.h should only be included by BPC1.cpp
 *  Other classes should include BPC1IF.h
 *
 *  Copyright (c) 2014 MBARI
 *  MBARI Proprietary Information.  All Rights Reserved
 */

#ifndef BPC1IF_H_
#define BPC1IF_H_

#include "data/ElementURI.h"

/**
 *  Specifies the interface details for the BPC1 component in the
 *  SensorModule.
 *
 *  BPC1.h should only be included by BPC1.cpp
 *  Other classes should include BPC1IF.h
 *
 *  \ingroup modules_sensor
 */
namespace BPC1IF
{
/// Static const for component name
/// (Can be used by other components)
static const Str NAME( "BPC1" );

// Include common ConfigURIs -- must be in namespace and follow definition of NAME
#include "component/HasLoadAtStartupIF.h"
#include "component/HasHardwareIF.h"
#include "component/HasLoadControlIF.h"
#include "component/HasPowerIF.h"
#include "component/HasUartIF.h"

static const int NUMBANKS = 2;
static const int NUMRESERVE = 6;
static const int RESERVEBATTSID[ NUMRESERVE ] = { 8, 16, 24, 39, 47, 55 }; // Reserve battery sticks

// accuracies below moved from call to Slate::NewUniversalWriter in BPC1.cpp
static const float PLATFORM_BATTERY_CHARGE_ACCURACY = 0.25;
static const float PLATFORM_BATTERY_VOLTAGE_ACCURACY = 0.25;
static const float PLATFORM_BATTERY_DISCHARGING_ACCURACY = 1;

/// Static consts for outputs
/// (Supplied so inputSettings can be directed to these outputs)
/// Probably only inputs should define names...
/// but we have no inputs to consume these values yet!
static const Str BATT_STATUS_BASENAME( "BattStatus_" );
static const Str BATT_VOLTAGE_BASENAME( "BattVoltage_" );
static const Str BATT_CURRENT_BASENAME( "BattCurrent_" );
static const Str BATT_TEMP_BASENAME( "BattTemp_" );
static const Str BATT_CAPACITY_BASENAME( "BattCapacity_" );
static const Str BATT_SERIAL_BASENAME( "BattSerial_" );

static const DataURI RESERVE_BATTERY_CHARGE( NAME, "reserve_battery_charge", Units::AMPERE_HOUR );
static const DataURI RESERVE_BATTERY_VOLTAGE( NAME, "reserve_battery_voltage", Units::VOLT );
static const DataURI BATTERY_CHARGING_STICK_COUNT( NAME, "battery_charging_sticks", Units::COUNT );

static const ConfigURI BATTERY_STICK_COMMS_TIMEOUT( NAME, "batteryStickCommsTimeout", Units::HOUR ); // Time allowed since last stick check-in before a stick is considered missing
static const ConfigURI BATTERY_MUX_CYCLE_TIME( NAME, "batteryMuxCycleTime", Units::MINUTE ); // Time it takes OceanServer to cycle over all battry banks
static const ConfigURI BATTERY_SAMPLING_INTERVAL( NAME, "batterySamplingInterval", Units::HOUR ); // Time between battery status checks
static const ConfigURI BATTERY_MISSING_STICK_THRESHOLD( NAME, "batteryMissingStickThreshold", Units::COUNT ); // Number of missing sticks allowed before we return to the surface
}

namespace BPC1AIF
{
static const Str NAME( "BPC1A" );
static const int NUMBATTS = 31;
static const int NUMRESERVE = 3;
static const int STICKOFFSET = 1;
#include "component/HasUartIF.h"
}

namespace BPC1BIF
{
static const Str NAME( "BPC1B" );
static const int NUMBATTS = 31;
static const int NUMRESERVE = 3;
static const int STICKOFFSET = 32;
#include "component/HasUartIF.h"
}

#endif /*BPC1IF_H_*/
