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

#ifndef MICROMODEMIF_H_
#define MICROMODEMIF_H_

#include "data/ElementURI.h"

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

// 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/HasLoadControl2IF.h"
#include "component/HasUartIF.h"

/// Maximum number of Transponders (below)
static const int NUM_TRANS = 4;

// Other config URIs
static const ConfigURI VERBOSITY_CFG( NAME, "verbosity", "Log verbosity: 0-none, 6-most", Units::ENUM );
static const ConfigURI LOCAL_ADDRESS_CFG( NAME, "localAddress", Units::ENUM );
static const ConfigURI DESTINATION_ADDRESS_CFG( NAME, "destinationAddress", "Destination for data packets, -1 for no data comms", Units::ENUM );
static const ConfigURI DATA_RATE_CFG( NAME, "dataRate", "Data rate, 0 to 5. Currently only 1 works.", Units::ENUM );
static const ConfigURI SEND_EXPRESS_CFG( NAME, "sendExpress", "Set to true to send Express-level data.", Units::BOOL );
static const ConfigURI ACOUSTIC_RESPONSE_TIMEOUT_CFG( NAME, "acousticResponseTimeout", "How long to wait for external responses.", Units::SECOND );
static const ConfigURI RESEND_PERIOD_CFG( NAME, "resendPeriod", "How long to wait between resend pings.", Units::SECOND );
static const ConfigURI SURFACE_THRESHOLD_CFG( NAME, "surfaceThreshold", "Use the modem for communications below this depth", Units::METER );
static const ConfigURI PWRAMP_TXLEVEL( NAME, "pwrampTXLevel", "TX Power Level, -1=don't set, 0=highest, 3=lowest", Units::ENUM );
static const ConfigURI CENTER_FREQUENCY( NAME, "centerFrequency", "Center frequency", Units::HERTZ );
static const ConfigURI BANDWIDTH( NAME, "bandwidth", "Bandwidth at center frequency", Units::HERTZ );
static const ConfigURI DUSBL_PING_CODE_CFG( NAME, "dusblPingCode", "Code to send in DUSBL pings", Units::NONE, STRVALUE );
static const ConfigURI RANGE_TX_SEQ_CODE_CFG( NAME, "rangeTxSeqCode", "Code to send in generic Range pings", Units::NONE, STRVALUE );
static const ConfigURI RANGE_TX_FREQ_CFG( NAME, "rangeTxFreq", "Frequency of outgoing narrowband/generic Range pings", Units::HERTZ );
static const ConfigURI RANGE_TX_TIME_CFG( NAME, "rangeTxTime", "Duration of outgoing narrowband Range pings", Units::MILLISECOND );
static const ConfigURI RANGE_RX_TIME_CFG( NAME, "rangeRxTime", "Duration of incoming narrowband Range pings", Units::MILLISECOND );
static const RestartConfigURI RANGE_TAT_CFG( NAME, "rangeTAT", "Turn-around time for a Range pings", Units::MILLISECOND );

static const ConfigURI TRANS1_CHANNEL_CFG( NAME, "trans1Channel", "Acoustic channel id, freq (Hz), or hex resp code of transponder #1", Units::ENUM );
static const ConfigURI TRANS2_CHANNEL_CFG( NAME, "trans2Channel", "Acoustic channel id, freq (Hz), or hex resp code of transponder #2", Units::ENUM );
static const ConfigURI TRANS3_CHANNEL_CFG( NAME, "trans3Channel", "Acoustic channel id, freq (Hz), or hex resp code of transponder #3", Units::ENUM );
static const ConfigURI TRANS4_CHANNEL_CFG( NAME, "trans4Channel", "Acoustic channel id, freq (Hz), or hex resp code of transponder #4", Units::ENUM );
static const ConfigURI* TRANS_CHANNEL_CFGS[MicromodemIF::NUM_TRANS] =
{
    &MicromodemIF::TRANS1_CHANNEL_CFG,
    &MicromodemIF::TRANS2_CHANNEL_CFG,
    &MicromodemIF::TRANS3_CHANNEL_CFG,
    &MicromodemIF::TRANS4_CHANNEL_CFG
};

// inputs from other components
static const DataURI QUERY_ADDRESS_REQUESTED( NAME, "queryAddressRequested", Units::ENUM );
static const DataURI PINGS_REQUESTED( NAME, "pingsRequested", "BitField of requested pings", Units::ENUM );
static const DataURI DUSBL_PING_CODE_REQUESTED( NAME, "dusblPingCodeRequested", "Transponder code: 2 for DR1-A, 3 for DR1-B, etc", Units::ENUM );

// slate outputs direct from instrument
static const DataURI ACOUSTIC_WAKEUP( NAME, "acoustic_wakeup", Units::COUNT );
//static const DataURI RX_TIME( NAME, "modem_receive_time", Units::EPOCH_SECOND );
//static const DataURI TX_TIME( NAME, "modem_transmit_time", Units::EPOCH_SECOND );
static const DataURI RANGE_REQUEST( NAME, "range_request", Units::COUNT );
static const DataURI REMOTE_ADDRESS_READING( NAME, "remote_address", Units::COUNT );
static const DataURI LOCAL_ADDRESS_READING( NAME, "local_address", Units::COUNT );
static const DataURI RANGE_READING( NAME, "range", Units::METER );
static const DataURI QUERY_PING_SENT( NAME, "query_pings", Units::COUNT );

}

#endif /*MICROMODEMIF_H_*/
