#include "assictscalet2000.h"
#include <QList>
#include "globalinfo.h"

AssicTScaleT2000::AssicTScaleT2000()
{

}

AssicTScaleT2000::~AssicTScaleT2000()
{

}

bool AssicTScaleT2000::needSend()
{
    return false;
}

QByteArray AssicTScaleT2000::sendData()
{
    return QByteArray();
}


void AssicTScaleT2000::handle(QByteArray &data)
{
    readed(data);

}

void AssicTScaleT2000::doHandle(const QByteArray & data)
{
    QList<QByteArray> list = data.split(',');
    auto buff = list.last();
//    QDInfo << data ;
    // Token is a sequence of numbers.
    QByteArray dt;
    for (int i = 0; i < buff.size(); ++i){
        auto ch = buff.at(i);
        if (ch == '.' || ch == '-' || (ch >= '0' && ch <= '9'))
            dt.append(ch);
    }
    if (!dt.isEmpty()) {
        double token = dt.toDouble();
        GlobalInfo::this_()->currentWidght = token;// (_scaledata);
    }
}
