/*! * * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. * \copyright * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * \file mloadcellreadings.cpp * \author (last) Behrouz NemaiPour * \date (last) 10-Jun-2020 * \author (original) Behrouz NemaiPour * \date (original) 10-Jun-2020 * */ #include "mloadcellreadings.h" using namespace Model; QString MLoadCellReadings::toString() const { return QString(stringPrefix + "(%1, %2, %3, %4)") .arg(_data.mReservoir1Prim .value) .arg(_data.mReservoir1Bkup .value) .arg(_data.mReservoir2Prim .value) .arg(_data.mReservoir2Bkup .value); } void MLoadCellReadings::toVariantList(QVariantList &vData) const { vData += _data.mReservoir1Prim .value; vData += _data.mReservoir1Bkup .value; vData += _data.mReservoir2Prim .value; vData += _data.mReservoir2Bkup .value; } bool MLoadCellReadings::fromByteArray(const QByteArray &vByteArray, int *vIndex) { int index = 0; // message data start position if (GetValue(vByteArray, index, _data.mReservoir1Prim )) if (GetValue(vByteArray, index, _data.mReservoir1Bkup )) if (GetValue(vByteArray, index, _data.mReservoir2Prim )) if (GetValue(vByteArray, index, _data.mReservoir2Bkup )) return true ; else { if(vIndex) *vIndex = index; return false; } else { if(vIndex) *vIndex = index; return false; } else { if(vIndex) *vIndex = index; return false; } else { if(vIndex) *vIndex = index; return false; } } MLoadCellReadings::Data MLoadCellReadings::data() const { Data data; data.mReservoir1Prim = _data.mReservoir1Prim .value; data.mReservoir1Bkup = _data.mReservoir1Bkup .value; data.mReservoir2Prim = _data.mReservoir2Prim .value; data.mReservoir2Bkup = _data.mReservoir2Bkup .value; return data; }