<commit_before>#include "RadioConnectionService.h"

RadioConnectionService::RadioConnectionService(QSerialPort& serialPort)
: serialPort_(serialPort)
{
}

RadioConnectionService::~RadioConnectionService()
{
   disconnectFromDataSource();
}

void RadioConnectionService::setSerialParameters(QString serialPortName, int baudRate)
{
   serialPort_.setPortName(serialPortName);
   serialPort_.setBaudRate(baudRate);
}

bool RadioConnectionService::connectToDataSource()
{
   if (serialPort_.open(QIODevice::ReadWrite))
   {
      emit connectionSucceeded();
      return true;
   }
   else
   {
      emit connectionFailed(serialPort_.errorString());
      return false;
   }
}

void RadioConnectionService::disconnectFromDataSource()<commit_msg>connection service automatically connects to the port upon construction<commit_after>#include "RadioConnectionService.h"
#include <QDebug>

namespace
{
   // const QString DEFAULT_PORT_NAME = "/dev/ttyUSB0";
   const QString DEFAULT_PORT_NAME = "COM5";
   const int DEFAULT_BAUDRATE = 9600;
}

RadioConnectionService::RadioConnectionService(QSerialPort& serialPort)
: serialPort_(serialPort)
{
   setSerialParameters(DEFAULT_PORT_NAME, DEFAULT_BAUDRATE);
   connectToDataSource();
}

RadioConnectionService::~RadioConnectionService()
{
   disconnectFromDataSource();
}

void RadioConnectionService::setSerialParameters(QString serialPortName, int baudRate)
{
   serialPort_.setPortName(serialPortName);
   serialPort_.setBaudRate(baudRate);
}

bool RadioConnectionService::connectToDataSource()
{
   if (serialPort_.open(QIODevice::ReadWrite))
   {
      emit connectionSucceeded();
      return true;
   }
   else
   {
      emit connectionFailed(serialPort_.errorString());
      return false;
   }
}

void RadioConnectionService::disconnectFromDataSource()
{'fraction_non_alphanumeric': 0.0966129927817879, 'fraction_numerical': 0.003331482509716824, 'mean_word_length': 6.011673151750973, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3749533', 'n_tokens_mistral': 520, 'n_tokens_neox': 513, 'n_words': 83}