@ -1,4 +1,4 @@
|
||||
*.o
|
||||
xlxd
|
||||
ambed
|
||||
ambedtest
|
||||
src/xlxd
|
||||
ambed/ambed
|
||||
ambedtest/ambedtest
|
||||
|
||||
@ -0,0 +1,94 @@
|
||||
//
|
||||
// cagc.cpp
|
||||
// ambed
|
||||
//
|
||||
// Created by Jean-Luc Deltombe (LX3JL) on 28/04/2017.
|
||||
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// This file is part of ambed.
|
||||
//
|
||||
// xlxd is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// xlxd is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Geoffrey Merck F4FXL / KC3FRA AGC code borrowed from Liquid DSP
|
||||
// Only took the parts we need qnd recoeded it to be close the XLX coding style
|
||||
// https://github.com/jgaeddert/liquid-dsp/blob/master/src/agc/src/agc.c
|
||||
|
||||
#include <math.h>
|
||||
#include "cagc.h"
|
||||
#include "main.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// constructor
|
||||
|
||||
CAGC::CAGC(float initialLeveldB)
|
||||
{
|
||||
// set internal gain appropriately
|
||||
m_Gain = pow(10.0f, initialLeveldB/20.0f);
|
||||
//+- 10dB Margin, TODO Move margin to constant
|
||||
m_GainMax = pow(10.0f, (initialLeveldB + AGC_CLAMPING)/20.0f);
|
||||
m_GainMin = pow(10.0f, (initialLeveldB - AGC_CLAMPING)/20.0f);
|
||||
|
||||
m_EnergyPrime = 1.0f;
|
||||
|
||||
// We do not target full scale to avoid stauration
|
||||
m_targetEnergy = 32767.0f * pow(10.0f, (initialLeveldB - 25.0)/20.0f);//25 dB below saturation as stated in docs
|
||||
//we also substract our target gain
|
||||
|
||||
//this is the time constant of our AGC...
|
||||
m_Bandwidth = 1e-2f;//TODO : Move to parameter ?
|
||||
m_Alpha = m_Bandwidth;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// get
|
||||
|
||||
float CAGC::GetGain()
|
||||
{
|
||||
return 20.0f*log10(m_Gain);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// process
|
||||
|
||||
inline void CAGC::ProcessSampleBlock(uint8* voice, int length)
|
||||
{
|
||||
for(int i = 0; i < length; i += 2)
|
||||
{
|
||||
float input = (float)(short)MAKEWORD(voice[i+1], voice[i]);
|
||||
//apply AGC
|
||||
// apply gain to input sample
|
||||
float output = input * m_Gain;
|
||||
|
||||
// compute output signal energy, scaled to 0 to 1
|
||||
float instantEnergy = abs(output) / m_targetEnergy;
|
||||
|
||||
// smooth energy estimate using single-pole low-pass filter
|
||||
m_EnergyPrime = (1.0f - m_Alpha) * m_EnergyPrime + m_Alpha * instantEnergy;
|
||||
|
||||
// update gain according to output energy
|
||||
if (m_EnergyPrime > 1e-6f)
|
||||
m_Gain *= exp( -0.5f * m_Alpha * log(m_EnergyPrime) );
|
||||
|
||||
// clamp gain
|
||||
if (m_Gain > m_GainMax)
|
||||
m_Gain = m_GainMax;
|
||||
else if(m_Gain < m_GainMin)
|
||||
m_Gain = m_GainMin;
|
||||
|
||||
//write processed sample back
|
||||
voice[i] = HIBYTE((short)output);
|
||||
voice[i+1] = LOBYTE((short)output);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,56 @@
|
||||
//
|
||||
// cagc.h
|
||||
// ambed
|
||||
//
|
||||
// Created by Jean-Luc Deltombe (LX3JL) on 26/04/2017.
|
||||
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// This file is part of ambed.
|
||||
//
|
||||
// xlxd is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// xlxd is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Geoffrey Merck F4FXL / KC3FRA AGC code largely inspired by Liquid DSP
|
||||
// Only took the parts we need qnd recoeded it to be close the XLX coding style
|
||||
// https://github.com/jgaeddert/liquid-dsp/blob/master/src/agc/src/agc.c
|
||||
|
||||
#ifndef cagc_h
|
||||
#define cagc_h
|
||||
|
||||
#include "csampleblockprocessor.h"
|
||||
|
||||
class CAGC : CSampleBlockProcessor
|
||||
{
|
||||
public:
|
||||
//Constructor
|
||||
CAGC(float initialLeveldB);
|
||||
|
||||
//methods
|
||||
void ProcessSampleBlock(uint8* voice, int length) ;
|
||||
float GetGain();//gets current gain
|
||||
|
||||
private:
|
||||
float m_Gain; // current gain value
|
||||
float m_GainMax, m_GainMin; //gain clamping
|
||||
float m_targetEnergy; // scale value for target energy
|
||||
|
||||
// gain control loop filter parameters
|
||||
float m_Bandwidth; // bandwidth-time constant
|
||||
float m_Alpha; // feed-back gain
|
||||
|
||||
// signal level estimate
|
||||
float m_EnergyPrime; // filtered output signal energy estimate
|
||||
};
|
||||
|
||||
#endif /* cgc_h */
|
||||
@ -0,0 +1,75 @@
|
||||
//
|
||||
// cfirfilter.cpp
|
||||
// ambed
|
||||
//
|
||||
// Created by Jean-Luc Deltombe (LX3JL) on 26/04/2017.
|
||||
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// This file is part of ambed.
|
||||
//
|
||||
// xlxd is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// xlxd is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
||||
// ----------------------------------------------------------------------------
|
||||
// FIRFilter by Geoffrey Merck F4FXL / KC3FRA
|
||||
|
||||
#include "cfirfilter.h"
|
||||
#include <string.h>
|
||||
|
||||
CFIRFilter::CFIRFilter(const float* taps, int tapsLength)
|
||||
{
|
||||
m_taps = new float[tapsLength];
|
||||
m_buffer = new float[tapsLength];
|
||||
m_tapsLength = tapsLength;
|
||||
|
||||
::memcpy(m_taps, taps, tapsLength * sizeof(float));
|
||||
::memset(m_buffer, 0, tapsLength * sizeof(float));
|
||||
m_currentBufferPosition = 0;
|
||||
}
|
||||
|
||||
CFIRFilter::~CFIRFilter()
|
||||
{
|
||||
delete[] m_taps;
|
||||
delete[] m_buffer;
|
||||
}
|
||||
|
||||
inline void CFIRFilter::ProcessSampleBlock(uint8* voice, int length)
|
||||
{
|
||||
for(int i = 0; i < length; i += 2)
|
||||
{
|
||||
float input = (float)(short)MAKEWORD(voice[i+1], voice[i]);
|
||||
float output = 0.0f;
|
||||
int iTaps = 0;
|
||||
|
||||
// Buffer latest sample into delay line
|
||||
m_buffer[m_currentBufferPosition] = input;
|
||||
|
||||
for(int i = m_currentBufferPosition; i >= 0; i--)
|
||||
{
|
||||
output += m_taps[iTaps++] * m_buffer[i];
|
||||
}
|
||||
|
||||
for(int i = m_tapsLength - 1; i > m_currentBufferPosition; i--)
|
||||
{
|
||||
output += m_taps[iTaps++] * m_buffer[i];
|
||||
}
|
||||
|
||||
m_currentBufferPosition = (m_currentBufferPosition + 1) % m_tapsLength;
|
||||
|
||||
//write processed sample back
|
||||
voice[i] = HIBYTE((short)output);
|
||||
voice[i+1] = LOBYTE((short)output);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,51 @@
|
||||
//
|
||||
// cfirfilter.h
|
||||
// ambed
|
||||
//
|
||||
// Created by Jean-Luc Deltombe (LX3JL) on 26/04/2017.
|
||||
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// This file is part of ambed.
|
||||
//
|
||||
// xlxd is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// xlxd is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
||||
// ----------------------------------------------------------------------------
|
||||
// FIRFilter by Geoffrey Merck F4FXL / KC3FRA
|
||||
|
||||
#ifndef cfirfilter_h
|
||||
#define cfirfilter_h
|
||||
|
||||
#include "csampleblockprocessor.h"
|
||||
|
||||
class CFIRFilter : CSampleBlockProcessor
|
||||
{
|
||||
public :
|
||||
//Constructor
|
||||
CFIRFilter(const float* taps, int tapsLength);
|
||||
|
||||
// Destructor
|
||||
~CFIRFilter();
|
||||
|
||||
// Processing
|
||||
void ProcessSampleBlock(uint8* voice, int length);
|
||||
|
||||
private:
|
||||
float* m_taps;
|
||||
int m_tapsLength;
|
||||
float* m_buffer;
|
||||
int m_currentBufferPosition;
|
||||
};
|
||||
|
||||
#endif //cfirfilter_h
|
||||
|
||||
@ -0,0 +1,53 @@
|
||||
//
|
||||
// cfixedgain.cpp
|
||||
// ambed
|
||||
//
|
||||
// Created by Jean-Luc Deltombe (LX3JL) on 28/04/2017.
|
||||
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// This file is part of ambed.
|
||||
//
|
||||
// xlxd is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// xlxd is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Geoffrey Merck F4FXL / KC3FRA AGC
|
||||
|
||||
#include "cfixedgain.h"
|
||||
#include <math.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// constructor
|
||||
|
||||
CFixedGain::CFixedGain(float gaindB)
|
||||
{
|
||||
m_gaindB = gaindB;
|
||||
m_gainLinear = pow(10.0f, m_gaindB/20.0f);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// processing
|
||||
|
||||
inline void CFixedGain::ProcessSampleBlock(uint8* voice, int length)
|
||||
{
|
||||
for(int i = 0; i < length; i += 2)
|
||||
{
|
||||
float input = (float)(short)MAKEWORD(voice[i+1], voice[i]);
|
||||
//apply gain
|
||||
float output = input * m_gainLinear;
|
||||
|
||||
//write processed sample back
|
||||
voice[i] = HIBYTE((short)output);
|
||||
voice[i+1] = LOBYTE((short)output);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,45 @@
|
||||
//
|
||||
// cfixedgain.h
|
||||
// ambed
|
||||
//
|
||||
// Created by Jean-Luc Deltombe (LX3JL) on 26/04/2017.
|
||||
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// This file is part of ambed.
|
||||
//
|
||||
// xlxd is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// xlxd is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Geoffrey Merck F4FXL / KC3FRA
|
||||
|
||||
#ifndef cfixedgain_h
|
||||
#define cfixedgain_h
|
||||
|
||||
#include "csampleblockprocessor.h"
|
||||
|
||||
class CFixedGain : CSampleBlockProcessor
|
||||
{
|
||||
public:
|
||||
//Constructor
|
||||
CFixedGain(float gaindB);
|
||||
|
||||
//processing
|
||||
void ProcessSampleBlock(uint8* voice, int length);
|
||||
|
||||
private:
|
||||
float m_gaindB; //gain in dB
|
||||
float m_gainLinear; //linearized gain
|
||||
};
|
||||
|
||||
#endif /* cfixedgain_h */
|
||||
@ -0,0 +1,38 @@
|
||||
//
|
||||
// csampleprocessor.h
|
||||
// ambed
|
||||
//
|
||||
// Created by Jean-Luc Deltombe (LX3JL) on 26/04/2017.
|
||||
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// This file is part of ambed.
|
||||
//
|
||||
// xlxd is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// xlxd is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Geoffrey Merck F4FXL / KC3FRA
|
||||
|
||||
#ifndef csamplebloclprocessor_h
|
||||
#define csamplebloclprocessor_h
|
||||
|
||||
#include "main.h"
|
||||
|
||||
class CSampleBlockProcessor
|
||||
{
|
||||
public:
|
||||
//processing
|
||||
virtual void ProcessSampleBlock(uint8* voice, int length) = 0;
|
||||
};
|
||||
|
||||
#endif /* csampleprocessor_h */
|
||||
@ -0,0 +1,94 @@
|
||||
//
|
||||
// cagc.cpp
|
||||
// ambed
|
||||
//
|
||||
// Created by Jean-Luc Deltombe (LX3JL) on 28/04/2017.
|
||||
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// This file is part of ambed.
|
||||
//
|
||||
// xlxd is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// xlxd is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Geoffrey Merck F4FXL / KC3FRA AGC
|
||||
|
||||
#include "main.h"
|
||||
#include "csignalprocessor.h"
|
||||
|
||||
#if USE_AGC == 1
|
||||
#include "cagc.h"
|
||||
#else
|
||||
#include "cfixedgain.h"
|
||||
#endif
|
||||
|
||||
#if USE_BANDPASSFILTER == 1
|
||||
#include "cfirfilter.h"
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// constructor
|
||||
|
||||
CSignalProcessor::CSignalProcessor(float gaindB)
|
||||
{
|
||||
#if USE_BANDPASSFILTER
|
||||
m_sampleProcessors.push_back((CSampleBlockProcessor*)new CFIRFilter(FILTER_TAPS, FILTER_TAPS_LENGTH));
|
||||
#endif
|
||||
#if USE_AGC == 1
|
||||
m_sampleProcessors.push_back((CSampleBlockProcessor*)new CAGC(gaindB));
|
||||
#else
|
||||
m_sampleProcessors.push_back((CSampleBlockProcessor*)new CFixedGain(gaindB));
|
||||
#endif
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// destructor
|
||||
|
||||
CSignalProcessor::~CSignalProcessor()
|
||||
{
|
||||
for(int i = 0; i < m_sampleProcessors.size(); i++)
|
||||
{
|
||||
delete m_sampleProcessors[i];
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// processing
|
||||
|
||||
void CSignalProcessor::Process(uint8* voice, int length)
|
||||
{
|
||||
/*float sample;
|
||||
int j;*/
|
||||
auto processorsSize = m_sampleProcessors.size();
|
||||
|
||||
for(int j = 0; j < processorsSize; j++)
|
||||
{
|
||||
m_sampleProcessors[j]->ProcessSampleBlock(voice, length);
|
||||
}
|
||||
|
||||
/*for(int i = 0; i < length; i += 2)
|
||||
{
|
||||
//Get the sample
|
||||
sample = (float)(short)MAKEWORD(voice[i+1], voice[i]);
|
||||
|
||||
for(j = 0; j < processorsSize; j++)
|
||||
{
|
||||
sample = m_sampleProcessors[j]->ProcessSample(sample);
|
||||
}
|
||||
|
||||
//write processed sample back
|
||||
voice[i] = HIBYTE((short)sample);
|
||||
voice[i+1] = LOBYTE((short)sample);
|
||||
}*/
|
||||
}
|
||||
@ -0,0 +1,48 @@
|
||||
//
|
||||
// csignalprocessor.h
|
||||
// ambed
|
||||
//
|
||||
// Created by Jean-Luc Deltombe (LX3JL) on 26/04/2017.
|
||||
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// This file is part of ambed.
|
||||
//
|
||||
// xlxd is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// xlxd is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Geoffrey Merck F4FXL / KC3FRA
|
||||
|
||||
#ifndef csignalprocessor_h
|
||||
#define csignalprocessor_h
|
||||
|
||||
#include <vector>
|
||||
#include "csampleblockprocessor.h"
|
||||
|
||||
class CSignalProcessor
|
||||
{
|
||||
public:
|
||||
//Constructor
|
||||
CSignalProcessor(float gaindB);
|
||||
|
||||
//Destructor
|
||||
~CSignalProcessor();
|
||||
|
||||
//Processing
|
||||
void Process(uint8* voice, int length);
|
||||
|
||||
private:
|
||||
std::vector<CSampleBlockProcessor *> m_sampleProcessors;
|
||||
};
|
||||
|
||||
#endif /* csignalprocessor_h */
|
||||
@ -0,0 +1,164 @@
|
||||
//
|
||||
// cusb3003df2etinterface.cpp
|
||||
// ambed
|
||||
//
|
||||
// Created by Jean-Luc Deltombe (LX3JL) and Florian Wolters (DF2ET) on 03/11/2017.
|
||||
// Copyright © 2017 Jean-Luc Deltombe (LX3JL) and Florian Wolters (DF2ET).
|
||||
// All rights reserved.
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// This file is part of ambed.
|
||||
//
|
||||
// xlxd is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// xlxd is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Created by Florian Wolters (DF2ET) on 03/11/2017.
|
||||
// Copyright © 2017 Florian Wolters (DF2ET). All rights reserved.
|
||||
|
||||
#include "main.h"
|
||||
#include "ctimepoint.h"
|
||||
#include "cambepacket.h"
|
||||
#include "cusb3003df2etinterface.h"
|
||||
#include "cvocodecs.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// constructor
|
||||
|
||||
CUsb3003DF2ETInterface::CUsb3003DF2ETInterface(uint32 uiVid, uint32 uiPid, const char *szDeviceName, const char *szDeviceSerial)
|
||||
: CUsb3003Interface(uiVid, uiPid, szDeviceName, szDeviceSerial)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// low level
|
||||
|
||||
bool CUsb3003DF2ETInterface::OpenDevice(void)
|
||||
{
|
||||
FT_STATUS ftStatus;
|
||||
int baudrate = 921600;
|
||||
|
||||
//sets serial VID/PID for a Standard Device NOTE: This is for legacy purposes only. This can be ommitted.
|
||||
ftStatus = FT_SetVIDPID(m_uiVid, m_uiPid);
|
||||
if (ftStatus != FT_OK) {FTDI_Error((char *)"FT_SetVIDPID", ftStatus ); return false; }
|
||||
|
||||
ftStatus = FT_OpenEx((PVOID)m_szDeviceSerial, FT_OPEN_BY_SERIAL_NUMBER, &m_FtdiHandle);
|
||||
if (ftStatus != FT_OK) { FTDI_Error((char *)"FT_OpenEx", ftStatus ); return false; }
|
||||
|
||||
CTimePoint::TaskSleepFor(50);
|
||||
FT_Purge(m_FtdiHandle, FT_PURGE_RX | FT_PURGE_TX );
|
||||
CTimePoint::TaskSleepFor(50);
|
||||
|
||||
ftStatus = FT_SetDataCharacteristics(m_FtdiHandle, FT_BITS_8, FT_STOP_BITS_1, FT_PARITY_NONE);
|
||||
if ( ftStatus != FT_OK ) { FTDI_Error((char *)"FT_SetDataCharacteristics", ftStatus ); return false; }
|
||||
|
||||
ftStatus = FT_SetFlowControl(m_FtdiHandle, FT_FLOW_RTS_CTS, 0x11, 0x13);
|
||||
if (ftStatus != FT_OK) { FTDI_Error((char *)"FT_SetFlowControl", ftStatus ); return false; }
|
||||
|
||||
ftStatus = FT_SetRts (m_FtdiHandle);
|
||||
if (ftStatus != FT_OK) { FTDI_Error((char *)"FT_SetRts", ftStatus ); return false; }
|
||||
|
||||
// for DF2ET-3003 interface pull DTR low to take AMBE3003 out of reset.
|
||||
ftStatus = FT_SetDtr( m_FtdiHandle );
|
||||
CTimePoint::TaskSleepFor(50);
|
||||
if (ftStatus != FT_OK) { FTDI_Error((char *)"FT_SetDtr", ftStatus); return false; }
|
||||
|
||||
ftStatus = FT_SetBaudRate(m_FtdiHandle, baudrate );
|
||||
if (ftStatus != FT_OK) { FTDI_Error((char *)"FT_SetBaudRate", ftStatus ); return false; }
|
||||
|
||||
ftStatus = FT_SetLatencyTimer(m_FtdiHandle, 4);
|
||||
if (ftStatus != FT_OK) { FTDI_Error((char *)"FT_SetLatencyTimer", ftStatus ); return false; }
|
||||
|
||||
ftStatus = FT_SetUSBParameters(m_FtdiHandle, USB3XXX_MAXPACKETSIZE, 0);
|
||||
if (ftStatus != FT_OK) { FTDI_Error((char *)"FT_SetUSBParameters", ftStatus ); return false; }
|
||||
|
||||
ftStatus = FT_SetTimeouts(m_FtdiHandle, 200, 200 );
|
||||
if (ftStatus != FT_OK) { FTDI_Error((char *)"FT_SetTimeouts", ftStatus ); return false; }
|
||||
|
||||
// done
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CUsb3003DF2ETInterface::ResetDevice(void)
|
||||
{
|
||||
bool ok = false;
|
||||
FT_STATUS ftStatus;
|
||||
int len, i;
|
||||
char rxpacket[100];
|
||||
|
||||
std::cout << "Trying DF2ET-3003 soft reset" << std::endl;
|
||||
|
||||
DWORD n, b;
|
||||
char txpacket[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
char reset_packet[7] = { PKT_HEADER, 0, 3, 0, PKT_RESET, PKT_PARITYBYTE, 3 ^ PKT_RESET ^ PKT_PARITYBYTE };
|
||||
char *p;
|
||||
|
||||
for (i = 0; i < 35; i++)
|
||||
{
|
||||
p = &txpacket[0];
|
||||
n = 10;
|
||||
do
|
||||
{
|
||||
ftStatus = FT_Write( m_FtdiHandle, p, n, &b);
|
||||
if (FT_OK != ftStatus)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
n -= b;
|
||||
p += b;
|
||||
} while (n > 0);
|
||||
}
|
||||
|
||||
p = &reset_packet[0];
|
||||
n = 7;
|
||||
do
|
||||
{
|
||||
ftStatus = FT_Write( m_FtdiHandle, p, n, &b);
|
||||
if (FT_OK != ftStatus)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
n -= b;
|
||||
p += b;
|
||||
} while (n > 0);
|
||||
|
||||
len = FTDI_read_packet( m_FtdiHandle, rxpacket, sizeof(rxpacket) );
|
||||
ok = ((len == 7) && (rxpacket[4] == PKT_READY));
|
||||
if ( ok )
|
||||
{
|
||||
std::cout << "DF2ET-3003 soft reset succeeded" << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "DF2ET-3003 soft reset failed" << std::endl;
|
||||
|
||||
std::cout << "Trying DF2ET-3003 hard reset" << std::endl;
|
||||
|
||||
ftStatus = FT_ClrDtr( m_FtdiHandle );
|
||||
CTimePoint::TaskSleepFor(10);
|
||||
ftStatus = FT_SetDtr( m_FtdiHandle );
|
||||
CTimePoint::TaskSleepFor(10);
|
||||
|
||||
len = FTDI_read_packet( m_FtdiHandle, rxpacket, sizeof(rxpacket) );
|
||||
ok = ((len == 7) && (rxpacket[4] == PKT_READY));
|
||||
if ( ok )
|
||||
{
|
||||
std::cout << "DF2ET-3003 hard reset succeeded" << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "DF2ET-3003 hard reset failed" << std::endl;
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
@ -0,0 +1,57 @@
|
||||
//
|
||||
// cusb3003df2etinterface.h
|
||||
// ambed
|
||||
//
|
||||
// Created by Jean-Luc Deltombe (LX3JL) and Florian Wolters (DF2ET) on 03/11/2017.
|
||||
// Copyright © 2017 Jean-Luc Deltombe (LX3JL) and Florian Wolters (DF2ET).
|
||||
// All rights reserved.
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// This file is part of ambed.
|
||||
//
|
||||
// xlxd is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// xlxd is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifndef cusb3003df2etinterface_h
|
||||
#define cusb3003df2etinterface_h
|
||||
|
||||
|
||||
#include "ftd2xx.h"
|
||||
#include "cbuffer.h"
|
||||
#include "cusb3003interface.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// define
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// class
|
||||
|
||||
class CUsb3003DF2ETInterface : public CUsb3003Interface
|
||||
{
|
||||
public:
|
||||
// constructors
|
||||
CUsb3003DF2ETInterface(uint32, uint32, const char *, const char *);
|
||||
|
||||
// destructor
|
||||
virtual ~CUsb3003DF2ETInterface() {}
|
||||
|
||||
protected:
|
||||
// low level
|
||||
bool OpenDevice(void);
|
||||
bool ResetDevice(void);
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
#endif /* cusb3003df2etinterface_h */
|
||||
@ -0,0 +1,66 @@
|
||||
//
|
||||
// cusb3003hrinterface.cpp
|
||||
// ambed
|
||||
//
|
||||
// Created by Jean-Luc Deltombe (LX3JL) on 30/10/2017.
|
||||
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// This file is part of ambed.
|
||||
//
|
||||
// xlxd is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// xlxd is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "main.h"
|
||||
#include "ctimepoint.h"
|
||||
#include "cambepacket.h"
|
||||
#include "cusb3003hrinterface.h"
|
||||
#include "cvocodecs.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// constructor
|
||||
|
||||
CUsb3003HRInterface::CUsb3003HRInterface(uint32 uiVid, uint32 uiPid, const char *szDeviceName, const char *szDeviceSerial)
|
||||
: CUsb3003Interface(uiVid, uiPid, szDeviceName, szDeviceSerial)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// low level
|
||||
|
||||
bool CUsb3003HRInterface::ResetDevice(void)
|
||||
{
|
||||
bool ok = false;
|
||||
FT_STATUS ftStatus;
|
||||
int len;
|
||||
char rxpacket[100];
|
||||
|
||||
//if the device is a USB-3003, it supports reset via UART break signal
|
||||
//printf("reset via uart break...\n");
|
||||
ftStatus = FT_SetBreakOn( m_FtdiHandle );
|
||||
CTimePoint::TaskSleepFor(10);
|
||||
ftStatus = FT_SetBreakOff( m_FtdiHandle );
|
||||
//CTimePoint::TaskSleepFor(10);
|
||||
|
||||
len = FTDI_read_packet( m_FtdiHandle, rxpacket, sizeof(rxpacket) );
|
||||
ok = ((len == 7) && (rxpacket[4] == PKT_READY));
|
||||
if ( !ok )
|
||||
{
|
||||
std::cout << "USB-3003 hard reset failed" << std::endl;
|
||||
}
|
||||
|
||||
// done
|
||||
return ok;
|
||||
}
|
||||
|
||||
@ -0,0 +1,55 @@
|
||||
//
|
||||
// cusb3003hrinterface.h
|
||||
// ambed
|
||||
//
|
||||
// Created by Jean-Luc Deltombe (LX3JL) on 30/10/2017.
|
||||
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// This file is part of ambed.
|
||||
//
|
||||
// xlxd is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// xlxd is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifndef cusb3003hrinterface_h
|
||||
#define cusb3003hrinterface_h
|
||||
|
||||
|
||||
#include "ftd2xx.h"
|
||||
#include "cbuffer.h"
|
||||
#include "cusb3003interface.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// define
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// class
|
||||
|
||||
class CUsb3003HRInterface : public CUsb3003Interface
|
||||
{
|
||||
public:
|
||||
// constructors
|
||||
CUsb3003HRInterface(uint32, uint32, const char *, const char *);
|
||||
|
||||
// destructor
|
||||
virtual ~CUsb3003HRInterface() {}
|
||||
|
||||
protected:
|
||||
// low level
|
||||
bool ResetDevice(void);
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
#endif /* cusb3003hrinterface_h */
|
||||
@ -0,0 +1,17 @@
|
||||
#########################################################################################
|
||||
# XLXD terminal option file
|
||||
#
|
||||
# one line per entry
|
||||
# each entry specifies a terminal option
|
||||
#
|
||||
# Valid option:
|
||||
# address <ip> - Ip address to be used by the terminal route responder
|
||||
# By default, the request destination address is used.
|
||||
# If the system is behind a router, set it to the public IP
|
||||
# If the system runs on the public IP, leave unset.
|
||||
# modules <modules> - a string with all modules to accept a terminal connection
|
||||
# Default value is "*", meaning accept all
|
||||
#
|
||||
#########################################################################################
|
||||
#address 193.1.2.3
|
||||
#modules BCD
|
||||
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 371 B |
@ -1 +0,0 @@
|
||||
fr.png
|
||||
|
Before Width: | Height: | Size: 1.2 KiB |
@ -1 +0,0 @@
|
||||
no.png
|
||||
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 788 B |
|
Before Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 233 B |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 566 B |
@ -1 +0,0 @@
|
||||
fr.png
|
||||
|
Before Width: | Height: | Size: 1022 B |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
@ -1 +0,0 @@
|
||||
fr.png
|
||||
|
Before Width: | Height: | Size: 1.7 KiB |
@ -1 +0,0 @@
|
||||
au.png
|
||||
|
Before Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 160 B After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
@ -1 +0,0 @@
|
||||
fr.png
|
||||
|
Before Width: | Height: | Size: 1.5 KiB |
@ -1 +0,0 @@
|
||||
fr.png
|
||||
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1023 B |
@ -1 +0,0 @@
|
||||
fr.png
|
||||
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 923 B |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
@ -1 +0,0 @@
|
||||
us.png
|
||||
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
@ -1 +0,0 @@
|
||||
fr.png
|
||||
|
Before Width: | Height: | Size: 1.3 KiB |
|
@ -0,0 +1,51 @@
|
||||
<table class="listingtable">
|
||||
<tr>
|
||||
<th width="80" rowspan="2">Module</th>
|
||||
<th width="130" rowspan="2">Name</th>
|
||||
<th width="65" rowspan="2">Users</th>
|
||||
<th colspan="2">DPlus</th>
|
||||
<th colspan="2">DExtra</th>
|
||||
<th colspan="2">DCS</th>
|
||||
<th width="65" rowspan="2">DMR</th>
|
||||
<th width="65" rowspan="2">YSF<br />DG-ID</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th width="100">URCALL</th>
|
||||
<th width="100">DTMF</th>
|
||||
<th width="100">URCALL</th>
|
||||
<th width="100">DTMF</th>
|
||||
<th width="100">URCALL</th>
|
||||
<th width="100">DTMF</th>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
$ReflectorNumber = substr($Reflector->GetReflectorName(), 3, 3);
|
||||
$NumberOfModules = isset($PageOptions['NumberOfModules']) ? min(max($PageOptions['NumberOfModules'],0),26) : 26;
|
||||
|
||||
$odd = "";
|
||||
|
||||
for ($i = 1; $i <= $NumberOfModules; $i++) {
|
||||
|
||||
$module = chr(ord('A')+($i-1));
|
||||
|
||||
if ($odd == "#FFFFFF") { $odd = "#F1FAFA"; } else { $odd = "#FFFFFF"; }
|
||||
|
||||
echo '
|
||||
<tr height="30" bgcolor="'.$odd.'" onMouseOver="this.bgColor=\'#FFFFCA\';" onMouseOut="this.bgColor=\''.$odd.'\';">
|
||||
<td align="center">'. $module .'</td>
|
||||
<td align="center">'. (empty($PageOptions['ModuleNames'][$module]) ? '-' : $PageOptions['ModuleNames'][$module]) .'</td>
|
||||
<td align="center">'. count($Reflector->GetNodesInModulesByID($module)) .'</td>
|
||||
<td align="center">'. 'REF' . $ReflectorNumber . $module . 'L' .'</td>
|
||||
<td align="center">'. (is_numeric($ReflectorNumber) ? '*' . sprintf('%01d',$ReflectorNumber) . (($i<=4)?$module:sprintf('%02d',$i)) : '-') .'</td>
|
||||
<td align="center">'. 'XRF' . $ReflectorNumber . $module . 'L' .'</td>
|
||||
<td align="center">'. (is_numeric($ReflectorNumber) ? 'B' . sprintf('%01d',$ReflectorNumber) . (($i<=4)?$module:sprintf('%02d',$i)) : '-') .'</td>
|
||||
<td align="center">'. 'DCS' . $ReflectorNumber . $module . 'L' .'</td>
|
||||
<td align="center">'. (is_numeric($ReflectorNumber) ? 'D' . sprintf('%01d',$ReflectorNumber) . (($i<=4)?$module:sprintf('%02d',$i)) : '-') .'</td>
|
||||
<td align="center">'. (4000+$i) .'</td>
|
||||
<td align="center">'. (9+$i) .'</td>
|
||||
</tr>';
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</table>
|
||||
@ -0,0 +1,102 @@
|
||||
<?php
|
||||
|
||||
if (!isset($_GET['iface'])) {
|
||||
if (isset($VNStat['Interfaces'][0]['Address'])) {
|
||||
$_GET['iface'] = $VNStat['Interfaces'][0]['Address'];
|
||||
}
|
||||
else {
|
||||
$_GET['iface'] = "";
|
||||
}
|
||||
}
|
||||
else {
|
||||
$f = false;
|
||||
$i = 0;
|
||||
while ($i < count($VNStat['Interfaces']) && (!$f)) {
|
||||
if ($_GET['iface'] == $VNStat['Interfaces'][$i]['Address']) {
|
||||
$f = true;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
if (!$f) {
|
||||
$_GET['iface'] = "";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<table class="listingtable">
|
||||
<tr>
|
||||
<th>Network interfaces</th>
|
||||
<th>Statistics</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td bgcolor="#F1FAFA" align="left" valign="top" style="padding-left:5px;"><?php
|
||||
|
||||
for ($i=0;$i<count($VNStat['Interfaces']);$i++) {
|
||||
echo '<a href="./index.php?show=traffic&iface='.$VNStat['Interfaces'][$i]['Address'].'" class="listinglink">'.$VNStat['Interfaces'][$i]['Name'].'</a>';
|
||||
if ($i < count($VNStat['Interfaces'])) {
|
||||
echo '<br />';
|
||||
}
|
||||
}
|
||||
|
||||
?></td>
|
||||
<td bgcolor="#FFFFFF"><?php
|
||||
|
||||
$Data = VNStatGetData($_GET['iface'], $VNStat['Binary']);
|
||||
|
||||
echo '
|
||||
<table style="margin:10px;">
|
||||
<tr>
|
||||
<td>Day</td>
|
||||
<td>RX</td>
|
||||
<td>TX</td>
|
||||
<td>Avg Rx</td>
|
||||
<td>Avg TX</td>
|
||||
</tr>';
|
||||
|
||||
for ($i=0;$i<count($Data[0]);$i++) {
|
||||
if ($Data[0][$i]['time'] > 0) {
|
||||
echo '
|
||||
<tr>
|
||||
<td width="100">'.date("d.m.Y", $Data[0][$i]['time']).'</td>
|
||||
<td width="100">'.kbytes_to_string($Data[0][$i]['rx']).'</td>
|
||||
<td width="100">'.kbytes_to_string($Data[0][$i]['tx']).'</td>
|
||||
<td width="100">'.kbytes_to_string($Data[0][$i]['rx2']).'</td>
|
||||
<td width="100">'.kbytes_to_string($Data[0][$i]['tx2']).'</td>
|
||||
</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
echo '</table>';
|
||||
|
||||
|
||||
|
||||
|
||||
echo '
|
||||
<table style="margin:10px;">
|
||||
<tr>
|
||||
<td>Month</td>
|
||||
<td>RX</td>
|
||||
<td>TX</td>
|
||||
<td>Avg Rx</td>
|
||||
<td>Avg TX</td>
|
||||
</tr>';
|
||||
|
||||
for ($i=0;$i<count($Data[1]);$i++) {
|
||||
if ($Data[1][$i]['time'] > 0) {
|
||||
echo '
|
||||
<tr>
|
||||
<td width="100">'.date("F", $Data[1][$i]['time']).'</td>
|
||||
<td width="100">'.kbytes_to_string($Data[1][$i]['rx']).'</td>
|
||||
<td width="100">'.kbytes_to_string($Data[1][$i]['tx']).'</td>
|
||||
<td width="100">'.kbytes_to_string($Data[1][$i]['rx2']).'</td>
|
||||
<td width="100">'.kbytes_to_string($Data[1][$i]['tx2']).'</td>
|
||||
</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
echo '</table>';
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 233 B |
|
After Width: | Height: | Size: 2.6 KiB |