#include "DeviceBase.h"
#include <QDateTime>

DeviceBase::DeviceBase(QObject *parent) : QObject(parent)
{

}

void DeviceBase::setComName(QString comName)
{
    this->comName = comName;
}
void DeviceBase::setBaudRate(int baudRate)
{
    this->baudRate = baudRate;
}
QString DeviceBase::getDevCode()
{
    return this->devCode;
}
void DeviceBase::setDevCode(QString devCode)
{
    this->devCode = devCode;
}
void DeviceBase::setDeviceId(QString deviceId)
{
    this->deviceId = deviceId;
}

bool DeviceBase::isSerialOpen()
{
    return this->serialUtil.isOpen();
}

void DeviceBase::initSerialPort()
{
    this->serialUtil.openSerialPort(this->comName, this->baudRate);
}

void DeviceBase::sendDataToSerial(QByteArray data)
{
    data.append(FRAME_TAIL);
    this->serialUtil.sendData(data);
}
