git-svn-id: svn://db.shs.com.ru/pip@540 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
#include "pip.h"
|
||||
#include "pifiletransfer.h"
|
||||
#include "pidatatransfer.h"
|
||||
#include "piscreen.h"
|
||||
#include "piscreentiles.h"
|
||||
|
||||
|
||||
TileSimple pmt;
|
||||
|
||||
|
||||
using namespace PICoutManipulators;
|
||||
@@ -20,7 +25,7 @@ public:
|
||||
//testt.setTimeout(0.1);
|
||||
CONNECTU(&testt, sendRequest, this, ftsend);
|
||||
} else {
|
||||
ft.setPacketSize(12800);
|
||||
ft.setPacketSize(65000);
|
||||
ft.setName("PIFT");
|
||||
CONNECTU(&ft, sendRequest, this, ftsend);
|
||||
CONNECTU(&ft, sendFilesStarted, this, ftevent);
|
||||
@@ -41,7 +46,7 @@ public:
|
||||
}
|
||||
|
||||
void startTest() {
|
||||
PIByteArray ba(1024*1024*256);
|
||||
PIByteArray ba(1024*1024*8);
|
||||
testt.send(ba);
|
||||
}
|
||||
|
||||
@@ -56,13 +61,17 @@ private:
|
||||
void tick(void *, int) {
|
||||
if (ft.isStarted()) {
|
||||
ftevent();
|
||||
updatePMT();
|
||||
if (PIKbdListener::exiting) {
|
||||
ft.stopSend();
|
||||
ft.stopReceive();
|
||||
}
|
||||
// piCout << (int)ft.diagnostic().quality();
|
||||
}
|
||||
if (testt.isSending() || testt.isReceiving()) ftevent();
|
||||
if (testt.isSending() || testt.isReceiving()) {
|
||||
ftevent();
|
||||
updatePMT();
|
||||
}
|
||||
}
|
||||
|
||||
EVENT_HANDLER(void, ftevent) {
|
||||
@@ -119,6 +128,18 @@ private:
|
||||
}
|
||||
ft.received(ba);
|
||||
}
|
||||
|
||||
|
||||
void updatePMT() {
|
||||
PIString pm;
|
||||
if (test_) pm = testt.packetMap();
|
||||
else pm = ft.packetMap();
|
||||
int wd = 110;
|
||||
pmt.content.resize(pm.size() / wd + 1);
|
||||
for (int i=0; i<pmt.content.size_s(); i++) {
|
||||
pmt.content[i].first = pm.mid(wd*i, piMini(pm.size() - i*wd, wd));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -166,9 +187,14 @@ int main (int argc, char * argv[]) {
|
||||
src = cli.argumentValue("receive");
|
||||
dst = cli.argumentValue("send");
|
||||
}
|
||||
PIScreen screen(false);
|
||||
screen.enableExitCapture();
|
||||
screen.rootTile()->addTile(new TilePICout());
|
||||
screen.rootTile()->addTile(&pmt);
|
||||
UDPFileTransfer tuf(src, dst, true);
|
||||
screen.start();
|
||||
if (send_) tuf.startTest();
|
||||
WAIT_FOREVER;
|
||||
screen.waitForFinish();
|
||||
return 0;
|
||||
}
|
||||
if ((!cli.hasArgument("send") || !cli.hasArgument("receive")) || cli.hasArgument("help")) {
|
||||
@@ -184,8 +210,13 @@ int main (int argc, char * argv[]) {
|
||||
src += ":"+PIString::fromNumber(port);
|
||||
dst += ":"+PIString::fromNumber(port);
|
||||
}
|
||||
PIKbdListener kbd;
|
||||
kbd.enableExitCapture();
|
||||
// PIKbdListener kbd;
|
||||
// kbd.enableExitCapture();
|
||||
PIScreen screen(false);
|
||||
screen.enableExitCapture();
|
||||
screen.rootTile()->addTile(new TilePICout());
|
||||
screen.rootTile()->addTile(&pmt);
|
||||
screen.start();
|
||||
UDPFileTransfer f(src, dst);
|
||||
if (cli.hasArgument("dir")) f.ft.setDirectory(cli.argumentValue("dir"));
|
||||
if (cli.hasArgument("quet")) f.setQuet(true);
|
||||
@@ -199,9 +230,8 @@ int main (int argc, char * argv[]) {
|
||||
} else {
|
||||
piCout << "wait for receiving";
|
||||
}
|
||||
kbd.start();
|
||||
WAIT_FOR_EXIT
|
||||
PICout(0) << "\n";
|
||||
screen.waitForFinish();
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user