Skip to content
Permalink
Browse files

apply candle settings (gui still not working)

  • Loading branch information...
HubertD committed May 16, 2016
1 parent 1e6b0f7 commit 6ac97f294876bee59cc4876f5eee0db9d9c96c2d
@@ -7,14 +7,15 @@ CandleApiInterface::CandleApiInterface(CandleApiDriver *driver, candle_handle ha
_deviceTicksLastSync(0),
_tLastSync_us(0),
_handle(handle),
_bitrate(500000),
_numRx(0),
_numTx(0),
_numTxErr(0)
{
LARGE_INTEGER tps;
QueryPerformanceFrequency(&tps);
_perfTicksPerSecond = tps.QuadPart;
_settings.setBitrate(500000);
_settings.setSamplePoint(0.875);
}

CandleApiInterface::~CandleApiInterface()
@@ -29,11 +30,12 @@ QString CandleApiInterface::getName() const

void CandleApiInterface::applyConfig(const MeasurementInterface &mi)
{
_settings = mi;
}

int CandleApiInterface::getBitrate()
{
return _bitrate;
return _settings.bitrate();
}

uint32_t CandleApiInterface::getCapabilities()
@@ -119,15 +121,25 @@ void CandleApiInterface::open()
return;
}

candle_channel_set_bitrate(_handle, 0, _settings.bitrate());

uint32_t flags = 0;
if (_settings.isListenOnlyMode()) {
flags |= CANDLE_MODE_LISTEN_ONLY;
}
if (_settings.isTripleSampling()) {
flags |= CANDLE_MODE_TRIPLE_SAMPLE;
}

LARGE_INTEGER pc;
candle_channel_set_bitrate(_handle, 0, _bitrate);
QueryPerformanceCounter(&pc);
_perfCountStart = pc.QuadPart;
syncTimestamp();
_numRx = 0;
_numTx = 0;
_numTxErr = 0;
candle_channel_start(_handle, 0, 0);

candle_channel_start(_handle, 0, flags);
}

void CandleApiInterface::close()
@@ -2,6 +2,7 @@
#define CANDLEAPIINTERFACE_H

#include <driver/CanInterface.h>
#include <core/MeasurementInterface.h>
#include "api/candle.h"
#include <windows.h>

@@ -49,7 +50,7 @@ class CandleApiInterface : public CanInterface
uint64_t _tLastSync_us;

candle_handle _handle;
uint32_t _bitrate;
MeasurementInterface _settings;

uint64_t _numRx;
uint64_t _numTx;

0 comments on commit 6ac97f2

Please sign in to comment.
You can’t perform that action at this time.