2018-12-25 21:10:15 +01:00
|
|
|
/*******************************************************************************
|
|
|
|
* gui/TheWire/WireDialog.cpp *
|
|
|
|
* *
|
2020-02-29 11:47:00 +11:00
|
|
|
* Copyright (c) 2012-2020 Robert Fernie <retroshare.project@gmail.com> *
|
2018-12-25 21:10:15 +01:00
|
|
|
* *
|
|
|
|
* This program is free software: you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU Affero General Public License as *
|
|
|
|
* published by the Free Software Foundation, either version 3 of the *
|
|
|
|
* License, or (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU Affero General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU Affero General Public License *
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
|
|
|
* *
|
|
|
|
*******************************************************************************/
|
2012-02-13 18:43:15 +00:00
|
|
|
|
|
|
|
#include "WireDialog.h"
|
|
|
|
|
2020-02-29 11:47:00 +11:00
|
|
|
#include "WireGroupDialog.h"
|
|
|
|
#include "WireGroupItem.h"
|
|
|
|
|
2012-02-13 18:43:15 +00:00
|
|
|
#include <retroshare/rspeers.h>
|
2020-02-29 11:47:00 +11:00
|
|
|
#include <retroshare/rswire.h>
|
2012-02-13 18:43:15 +00:00
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include <sstream>
|
|
|
|
|
|
|
|
#include <QTimer>
|
2020-02-29 11:47:00 +11:00
|
|
|
#include <QMessageBox>
|
2012-02-13 18:43:15 +00:00
|
|
|
|
|
|
|
/****************************************************************
|
2020-02-29 11:47:00 +11:00
|
|
|
* TheWire Display Widget.
|
2012-02-13 18:43:15 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/** Constructor */
|
|
|
|
WireDialog::WireDialog(QWidget *parent)
|
|
|
|
: MainPage(parent)
|
|
|
|
{
|
|
|
|
ui.setupUi(this);
|
|
|
|
|
|
|
|
mAddDialog = NULL;
|
|
|
|
mPulseSelected = NULL;
|
|
|
|
|
2020-02-29 11:47:00 +11:00
|
|
|
connect( ui.toolButton_createAccount, SIGNAL(clicked()), this, SLOT(createGroup()));
|
|
|
|
connect( ui.toolButton_createPulse, SIGNAL(clicked()), this, SLOT(createPulse()));
|
|
|
|
connect( ui.pushButton_Post, SIGNAL(clicked()), this, SLOT(createPulse()));
|
|
|
|
connect( ui.toolButton_refresh, SIGNAL(clicked()), this, SLOT(refreshGroups()));
|
2012-02-13 18:43:15 +00:00
|
|
|
|
|
|
|
QTimer *timer = new QTimer(this);
|
|
|
|
timer->connect(timer, SIGNAL(timeout()), this, SLOT(checkUpdate()));
|
|
|
|
timer->start(1000);
|
|
|
|
|
2020-02-29 11:47:00 +11:00
|
|
|
/* setup TokenQueue */
|
|
|
|
mWireQueue = new TokenQueue(rsWire->getTokenService(), this);
|
2012-02-13 18:43:15 +00:00
|
|
|
|
2020-02-29 11:47:00 +11:00
|
|
|
requestGroupData();
|
2012-02-13 18:43:15 +00:00
|
|
|
}
|
|
|
|
|
2020-02-29 11:47:00 +11:00
|
|
|
void WireDialog::refreshGroups()
|
|
|
|
{
|
|
|
|
requestGroupData();
|
|
|
|
}
|
|
|
|
|
|
|
|
void WireDialog::addItem(QWidget *item)
|
|
|
|
{
|
|
|
|
QLayout *alayout = ui.scrollAreaWidgetContents->layout();
|
|
|
|
alayout->addWidget(item);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void WireDialog::addGroup(QWidget *item)
|
|
|
|
{
|
|
|
|
QLayout *alayout = ui.scrollAreaWidgetContents_groups->layout();
|
|
|
|
alayout->addWidget(item);
|
|
|
|
}
|
|
|
|
|
|
|
|
// PulseHolder interface.
|
|
|
|
void WireDialog::deletePulseItem(PulseItem *item, uint32_t type)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2012-02-13 18:43:15 +00:00
|
|
|
|
|
|
|
void WireDialog::notifySelection(PulseItem *item, int ptype)
|
|
|
|
{
|
2020-02-29 11:47:00 +11:00
|
|
|
std::cerr << "WireDialog::notifySelection() from : " << ptype << " " << item;
|
|
|
|
std::cerr << std::endl;
|
2012-02-13 18:43:15 +00:00
|
|
|
|
|
|
|
notifyPulseSelection(item);
|
2020-02-29 11:47:00 +11:00
|
|
|
}
|
2012-02-13 18:43:15 +00:00
|
|
|
|
2020-02-29 11:47:00 +11:00
|
|
|
|
|
|
|
// Actions from PulseHolder.
|
|
|
|
void WireDialog::follow(RsGxsGroupId &groupId)
|
|
|
|
{
|
|
|
|
std::cerr << "WireDialog::follow(";
|
|
|
|
std::cerr << groupId.toStdString();
|
|
|
|
std::cerr << ")";
|
|
|
|
std::cerr << std::endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
void WireDialog::rate(RsGxsId &authorId)
|
|
|
|
{
|
|
|
|
std::cerr << "WireDialog::rate(";
|
|
|
|
std::cerr << authorId.toStdString();
|
|
|
|
std::cerr << ")";
|
|
|
|
std::cerr << std::endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
void WireDialog::reply(RsWirePulse &pulse, std::string &groupName)
|
|
|
|
{
|
|
|
|
std::cerr << "WireDialog::reply(";
|
|
|
|
std::cerr << pulse.mMeta.mGroupId.toStdString();
|
|
|
|
std::cerr << ",";
|
|
|
|
std::cerr << pulse.mMeta.mOrigMsgId.toStdString();
|
|
|
|
std::cerr << ")";
|
|
|
|
std::cerr << std::endl;
|
|
|
|
|
|
|
|
if (!mAddDialog)
|
2012-02-13 18:43:15 +00:00
|
|
|
{
|
2020-02-29 11:47:00 +11:00
|
|
|
mAddDialog = new PulseAddDialog(NULL);
|
|
|
|
mAddDialog->hide();
|
2012-02-13 18:43:15 +00:00
|
|
|
}
|
2020-02-29 11:47:00 +11:00
|
|
|
|
|
|
|
int idx = ui.groupChooser->currentIndex();
|
|
|
|
if (idx < 0) {
|
|
|
|
std::cerr << "WireDialog::reply() ERROR GETTING AuthorId!";
|
|
|
|
std::cerr << std::endl;
|
|
|
|
|
|
|
|
QMessageBox::warning(this, tr("RetroShare"),tr("Please create or choose Wire Groupd first"), QMessageBox::Ok, QMessageBox::Ok);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// publishing group.
|
|
|
|
RsWireGroup group = mOwnGroups[idx];
|
|
|
|
mAddDialog->setGroup(group);
|
|
|
|
|
|
|
|
// establish replyTo.
|
|
|
|
mAddDialog->setReplyTo(pulse, groupName);
|
|
|
|
|
|
|
|
mAddDialog->show();
|
2012-02-13 18:43:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void WireDialog::notifyPulseSelection(PulseItem *item)
|
|
|
|
{
|
|
|
|
std::cerr << "WireDialog::notifyPulseSelection() from : " << item;
|
|
|
|
std::cerr << std::endl;
|
|
|
|
|
|
|
|
if (mPulseSelected)
|
|
|
|
{
|
|
|
|
std::cerr << "WireDialog::notifyPulseSelection() unselecting old one : " << mPulseSelected;
|
|
|
|
std::cerr << std::endl;
|
|
|
|
|
|
|
|
mPulseSelected->setSelected(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
mPulseSelected = item;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void WireDialog::checkUpdate()
|
|
|
|
{
|
|
|
|
#if 0
|
|
|
|
/* update */
|
|
|
|
if (!rsWire)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (rsWire->updated())
|
|
|
|
{
|
|
|
|
insertAlbums();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-02-29 11:47:00 +11:00
|
|
|
void WireDialog::createGroup()
|
|
|
|
{
|
|
|
|
WireGroupDialog wireCreate(mWireQueue, this);
|
|
|
|
wireCreate.exec();
|
|
|
|
}
|
2012-02-13 18:43:15 +00:00
|
|
|
|
2020-02-29 11:47:00 +11:00
|
|
|
void WireDialog::createPulse()
|
2012-02-13 18:43:15 +00:00
|
|
|
{
|
2020-02-29 11:47:00 +11:00
|
|
|
if (!mAddDialog)
|
2012-02-13 18:43:15 +00:00
|
|
|
{
|
|
|
|
mAddDialog = new PulseAddDialog(NULL);
|
2020-02-29 11:47:00 +11:00
|
|
|
mAddDialog->hide();
|
2012-02-13 18:43:15 +00:00
|
|
|
}
|
|
|
|
|
2020-02-29 11:47:00 +11:00
|
|
|
int idx = ui.groupChooser->currentIndex();
|
|
|
|
if (idx < 0) {
|
|
|
|
std::cerr << "WireDialog::createPulse() ERROR GETTING AuthorId!";
|
|
|
|
std::cerr << std::endl;
|
2012-02-13 18:43:15 +00:00
|
|
|
|
2020-02-29 11:47:00 +11:00
|
|
|
QMessageBox::warning(this, tr("RetroShare"),tr("Please create or choose Wire Groupd first"), QMessageBox::Ok, QMessageBox::Ok);
|
|
|
|
return;
|
|
|
|
}
|
2012-02-13 18:43:15 +00:00
|
|
|
|
2020-02-29 11:47:00 +11:00
|
|
|
RsWireGroup group = mOwnGroups[idx];
|
2012-02-13 18:43:15 +00:00
|
|
|
|
2020-02-29 11:47:00 +11:00
|
|
|
mAddDialog->setGroup(group);
|
|
|
|
mAddDialog->show();
|
2012-02-13 18:43:15 +00:00
|
|
|
}
|
|
|
|
|
2020-02-29 11:47:00 +11:00
|
|
|
void WireDialog::addPulse(RsWirePulse &pulse, RsWireGroup &group)
|
2012-02-13 18:43:15 +00:00
|
|
|
{
|
2020-02-29 11:47:00 +11:00
|
|
|
std::cerr << "WireDialog::addPulse() GroupId : " << pulse.mMeta.mGroupId;
|
|
|
|
std::cerr << " MsgId : " << pulse.mMeta.mGroupId;
|
|
|
|
std::cerr << std::endl;
|
2012-02-13 18:43:15 +00:00
|
|
|
|
2020-02-29 11:47:00 +11:00
|
|
|
QWidget *item = new PulseItem(this, pulse, group);
|
|
|
|
addItem(item);
|
2012-02-13 18:43:15 +00:00
|
|
|
}
|
|
|
|
|
2020-02-29 11:47:00 +11:00
|
|
|
void WireDialog::addGroup(RsWireGroup &group)
|
2012-02-13 18:43:15 +00:00
|
|
|
{
|
2020-02-29 11:47:00 +11:00
|
|
|
std::cerr << "WireDialog::addGroup() GroupId : " << group.mMeta.mGroupId;
|
|
|
|
std::cerr << std::endl;
|
2012-02-13 18:43:15 +00:00
|
|
|
|
2020-02-29 11:47:00 +11:00
|
|
|
addGroup(new WireGroupItem(group));
|
|
|
|
}
|
2012-02-13 18:43:15 +00:00
|
|
|
|
2020-02-29 11:47:00 +11:00
|
|
|
void WireDialog::deletePulses()
|
2012-02-13 18:43:15 +00:00
|
|
|
{
|
2020-02-29 11:47:00 +11:00
|
|
|
std::cerr << "WireDialog::deletePulses()";
|
|
|
|
std::cerr << std::endl;
|
2012-02-13 18:43:15 +00:00
|
|
|
|
2020-02-29 11:47:00 +11:00
|
|
|
QLayout *alayout = ui.scrollAreaWidgetContents->layout();
|
|
|
|
QLayoutItem *item;
|
|
|
|
int i = 0;
|
|
|
|
while (i < alayout->count())
|
|
|
|
{
|
|
|
|
item = alayout->itemAt(i);
|
|
|
|
QWidget *widget = item->widget();
|
|
|
|
if (NULL != dynamic_cast<PulseItem *>(widget))
|
2012-02-13 18:43:15 +00:00
|
|
|
{
|
2020-02-29 11:47:00 +11:00
|
|
|
std::cerr << "WireDialog::deletePulses() Removing Item at: " << i;
|
|
|
|
std::cerr << std::endl;
|
2012-02-13 18:43:15 +00:00
|
|
|
|
2020-02-29 11:47:00 +11:00
|
|
|
item = alayout->takeAt(i);
|
|
|
|
delete item->widget();
|
|
|
|
delete item;
|
2012-02-13 18:43:15 +00:00
|
|
|
}
|
2020-02-29 11:47:00 +11:00
|
|
|
else
|
|
|
|
{
|
|
|
|
std::cerr << "WireDialog::deletePulses() Leaving Item at: " << i;
|
|
|
|
std::cerr << std::endl;
|
2012-02-13 18:43:15 +00:00
|
|
|
|
2020-02-29 11:47:00 +11:00
|
|
|
i++;
|
|
|
|
}
|
2012-02-13 18:43:15 +00:00
|
|
|
}
|
|
|
|
}
|
2020-02-29 11:47:00 +11:00
|
|
|
|
|
|
|
void WireDialog::deleteGroups()
|
|
|
|
{
|
|
|
|
std::cerr << "WireDialog::deleteGroups()";
|
|
|
|
std::cerr << std::endl;
|
2012-02-13 18:43:15 +00:00
|
|
|
|
2020-02-29 11:47:00 +11:00
|
|
|
mAllGroups.clear();
|
|
|
|
mOwnGroups.clear();
|
|
|
|
ui.groupChooser->clear();
|
2012-02-13 18:43:15 +00:00
|
|
|
|
|
|
|
|
2020-02-29 11:47:00 +11:00
|
|
|
QLayout *alayout = ui.scrollAreaWidgetContents_groups->layout();
|
|
|
|
QLayoutItem *item;
|
2012-02-13 18:43:15 +00:00
|
|
|
int i = 0;
|
2020-02-29 11:47:00 +11:00
|
|
|
while (i < alayout->count())
|
2012-02-13 18:43:15 +00:00
|
|
|
{
|
2020-02-29 11:47:00 +11:00
|
|
|
item = alayout->itemAt(i);
|
|
|
|
QWidget *widget = item->widget();
|
|
|
|
if (NULL != dynamic_cast<WireGroupItem *>(widget))
|
2012-02-13 18:43:15 +00:00
|
|
|
{
|
2020-02-29 11:47:00 +11:00
|
|
|
std::cerr << "WireDialog::deleteGroups() Removing Item at: " << i;
|
|
|
|
std::cerr << std::endl;
|
|
|
|
|
|
|
|
item = alayout->takeAt(i);
|
|
|
|
delete item->widget();
|
|
|
|
delete item;
|
2012-02-13 18:43:15 +00:00
|
|
|
}
|
2020-02-29 11:47:00 +11:00
|
|
|
else
|
|
|
|
{
|
|
|
|
std::cerr << "WireDialog::deleteGroups() Leaving Item at: " << i;
|
|
|
|
std::cerr << std::endl;
|
2012-02-13 18:43:15 +00:00
|
|
|
|
2020-02-29 11:47:00 +11:00
|
|
|
i++;
|
|
|
|
}
|
2012-02-13 18:43:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-29 11:47:00 +11:00
|
|
|
void WireDialog::updateGroups(std::vector<RsWireGroup>& groups)
|
2012-02-13 18:43:15 +00:00
|
|
|
{
|
2020-02-29 11:47:00 +11:00
|
|
|
std::vector<RsWireGroup>::const_iterator it;
|
|
|
|
for(it = groups.begin(); it != groups.end(); it++) {
|
|
|
|
// save list of all groups.
|
|
|
|
mAllGroups[it->mMeta.mGroupId] = *it;
|
2012-02-13 18:43:15 +00:00
|
|
|
|
2020-02-29 11:47:00 +11:00
|
|
|
if (it->mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN)
|
|
|
|
{
|
|
|
|
// grab own groups.
|
|
|
|
// setup Chooser too.
|
|
|
|
mOwnGroups.push_back(*it);
|
|
|
|
ui.groupChooser->addItem(QString::fromStdString(it->mMeta.mGroupName));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-02-13 18:43:15 +00:00
|
|
|
|
|
|
|
|
2020-02-29 11:47:00 +11:00
|
|
|
// LOAD DATA...............................................
|
2012-02-13 18:43:15 +00:00
|
|
|
|
|
|
|
|
2020-02-29 11:47:00 +11:00
|
|
|
void WireDialog::requestGroupData()
|
|
|
|
{
|
|
|
|
std::cerr << "WireDialog::requestGroupData()";
|
|
|
|
std::cerr << std::endl;
|
2012-02-13 18:43:15 +00:00
|
|
|
|
2020-02-29 11:47:00 +11:00
|
|
|
RsTokReqOptions opts;
|
|
|
|
uint32_t token;
|
|
|
|
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
|
|
|
|
mWireQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, 0);
|
2012-02-13 18:43:15 +00:00
|
|
|
}
|
|
|
|
|
2020-02-29 11:47:00 +11:00
|
|
|
bool WireDialog::loadGroupData(const uint32_t &token)
|
2012-02-13 18:43:15 +00:00
|
|
|
{
|
2020-02-29 11:47:00 +11:00
|
|
|
std::cerr << "WireDialog::loadGroupData()";
|
2012-02-13 18:43:15 +00:00
|
|
|
std::cerr << std::endl;
|
|
|
|
|
2020-02-29 11:47:00 +11:00
|
|
|
deleteGroups();
|
|
|
|
deletePulses();
|
2012-02-13 18:43:15 +00:00
|
|
|
|
2020-02-29 11:47:00 +11:00
|
|
|
std::vector<RsWireGroup> groups;
|
|
|
|
rsWire->getGroupData(token, groups);
|
2012-02-13 18:43:15 +00:00
|
|
|
|
2020-02-29 11:47:00 +11:00
|
|
|
std::vector<RsWireGroup>::iterator vit = groups.begin();
|
2012-02-13 18:43:15 +00:00
|
|
|
|
2020-02-29 11:47:00 +11:00
|
|
|
for(; vit != groups.end(); ++vit)
|
|
|
|
{
|
|
|
|
RsWireGroup& group = *vit;
|
2012-02-13 18:43:15 +00:00
|
|
|
|
2020-02-29 11:47:00 +11:00
|
|
|
std::cerr << " WireDialog::addGroup() GroupId: " << group.mMeta.mGroupId << std::endl;
|
2012-02-13 18:43:15 +00:00
|
|
|
|
2020-02-29 11:47:00 +11:00
|
|
|
addGroup(group);
|
2012-02-13 18:43:15 +00:00
|
|
|
|
2020-02-29 11:47:00 +11:00
|
|
|
std::list<RsGxsGroupId> grpIds;
|
|
|
|
grpIds.push_back(group.mMeta.mGroupId);
|
|
|
|
requestPulseData(grpIds);
|
|
|
|
}
|
2012-02-13 18:43:15 +00:00
|
|
|
|
2020-02-29 11:47:00 +11:00
|
|
|
// save list of groups.
|
|
|
|
updateGroups(groups);
|
|
|
|
return true;
|
2012-02-13 18:43:15 +00:00
|
|
|
}
|
|
|
|
|
2020-02-29 11:47:00 +11:00
|
|
|
void WireDialog::requestPulseData(const std::list<RsGxsGroupId>& grpIds)
|
2012-02-13 18:43:15 +00:00
|
|
|
{
|
2020-02-29 11:47:00 +11:00
|
|
|
std::cerr << "WireDialog::requestPulseData()";
|
|
|
|
std::cerr << std::endl;
|
2012-02-13 18:43:15 +00:00
|
|
|
|
2020-02-29 11:47:00 +11:00
|
|
|
RsTokReqOptions opts;
|
|
|
|
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
|
|
|
opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
|
|
|
|
uint32_t token;
|
|
|
|
mWireQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, grpIds, 0);
|
2012-02-13 18:43:15 +00:00
|
|
|
}
|
|
|
|
|
2020-02-29 11:47:00 +11:00
|
|
|
bool WireDialog::loadPulseData(const uint32_t &token)
|
2012-02-13 18:43:15 +00:00
|
|
|
{
|
2020-02-29 11:47:00 +11:00
|
|
|
std::cerr << "WireDialog::loadPulseData()";
|
|
|
|
std::cerr << std::endl;
|
2012-02-13 18:43:15 +00:00
|
|
|
|
2020-02-29 11:47:00 +11:00
|
|
|
// clearPulses();
|
|
|
|
|
|
|
|
std::vector<RsWirePulse> pulses;
|
|
|
|
rsWire->getPulseData(token, pulses);
|
|
|
|
|
|
|
|
std::vector<RsWirePulse>::iterator vit = pulses.begin();
|
|
|
|
for(; vit != pulses.end(); vit++)
|
2012-02-13 18:43:15 +00:00
|
|
|
{
|
2020-02-29 11:47:00 +11:00
|
|
|
RsWirePulse& pulse = *vit;
|
|
|
|
|
|
|
|
RsGxsGroupId &gid = pulse.mMeta.mGroupId;
|
|
|
|
std::map<RsGxsGroupId, RsWireGroup>::iterator mit = mAllGroups.find(gid);
|
|
|
|
if (mit != mAllGroups.end())
|
2012-02-13 18:43:15 +00:00
|
|
|
{
|
2020-02-29 11:47:00 +11:00
|
|
|
RsWireGroup &group = mit->second;
|
|
|
|
addPulse(pulse, group);
|
|
|
|
std::cerr << "WireDialog::loadPulseData() GroupId: " << pulse.mMeta.mGroupId;
|
|
|
|
std::cerr << " PulseId: " << pulse.mMeta.mMsgId;
|
2012-02-13 18:43:15 +00:00
|
|
|
std::cerr << std::endl;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-02-29 11:47:00 +11:00
|
|
|
std::cerr << "WireDialog::loadPulseData() ERROR Missing GroupId: " << pulse.mMeta.mGroupId;
|
|
|
|
std::cerr << " PulseId: " << pulse.mMeta.mMsgId;
|
2012-02-13 18:43:15 +00:00
|
|
|
std::cerr << std::endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-29 11:47:00 +11:00
|
|
|
// updatePulses();
|
|
|
|
return true;
|
|
|
|
}
|
2012-02-13 18:43:15 +00:00
|
|
|
|
|
|
|
|
2020-02-29 11:47:00 +11:00
|
|
|
/**************************** Request / Response Filling of Data ************************/
|
2012-02-13 18:43:15 +00:00
|
|
|
|
2020-02-29 11:47:00 +11:00
|
|
|
void WireDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
|
|
|
{
|
|
|
|
std::cerr << "WireDialog::loadRequest()";
|
|
|
|
std::cerr << std::endl;
|
2012-02-13 18:43:15 +00:00
|
|
|
|
2020-02-29 11:47:00 +11:00
|
|
|
if (queue == mWireQueue)
|
2012-02-13 18:43:15 +00:00
|
|
|
{
|
2020-02-29 11:47:00 +11:00
|
|
|
/* now switch on req */
|
|
|
|
switch(req.mType)
|
|
|
|
{
|
|
|
|
case TOKENREQ_GROUPINFO:
|
|
|
|
switch(req.mAnsType)
|
|
|
|
{
|
|
|
|
// case RS_TOKREQ_ANSTYPE_LIST:
|
|
|
|
// loadGroupList(req.mToken);
|
|
|
|
// break;
|
|
|
|
case RS_TOKREQ_ANSTYPE_DATA:
|
|
|
|
loadGroupData(req.mToken);
|
|
|
|
break;
|
|
|
|
// case RS_TOKREQ_ANSTYPE_ACK:
|
|
|
|
// acknowledgeGroup(req.mToken);
|
|
|
|
// break;
|
|
|
|
default:
|
|
|
|
std::cerr << "WireDialog::loadRequest() ERROR: GROUP: INVALID ANS TYPE";
|
|
|
|
std::cerr << std::endl;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TOKENREQ_MSGINFO:
|
|
|
|
switch(req.mAnsType)
|
|
|
|
{
|
|
|
|
#if 0
|
|
|
|
case RS_TOKREQ_ANSTYPE_LIST:
|
|
|
|
loadPhotoList(req.mToken);
|
|
|
|
break;
|
|
|
|
case RS_TOKREQ_ANSTYPE_ACK:
|
|
|
|
acknowledgeMessage(req.mToken);
|
|
|
|
break;
|
2012-02-13 18:43:15 +00:00
|
|
|
#endif
|
2020-02-29 11:47:00 +11:00
|
|
|
case RS_TOKREQ_ANSTYPE_DATA:
|
|
|
|
loadPulseData(req.mToken);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
std::cerr << "WireDialog::loadRequest() ERROR: MSG: INVALID ANS TYPE";
|
|
|
|
std::cerr << std::endl;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2012-02-13 18:43:15 +00:00
|
|
|
#if 0
|
2020-02-29 11:47:00 +11:00
|
|
|
case TOKENREQ_MSGRELATEDINFO:
|
|
|
|
switch(req.mAnsType)
|
|
|
|
{
|
|
|
|
case RS_TOKREQ_ANSTYPE_DATA:
|
|
|
|
loadPhotoData(req.mToken);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
std::cerr << "WireDialog::loadRequest() ERROR: MSG: INVALID ANS TYPE";
|
|
|
|
std::cerr << std::endl;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2012-02-13 18:43:15 +00:00
|
|
|
#endif
|
2020-02-29 11:47:00 +11:00
|
|
|
default:
|
|
|
|
std::cerr << "WireDialog::loadRequest() ERROR: INVALID TYPE";
|
|
|
|
std::cerr << std::endl;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2012-02-13 18:43:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-02-29 11:47:00 +11:00
|
|
|
/**************************** Request / Response Filling of Data ************************/
|
2012-02-13 18:43:15 +00:00
|
|
|
|