diff --git a/.hgsubstate b/.hgsubstate --- a/.hgsubstate +++ b/.hgsubstate @@ -1,1 +1,1 @@ -023b503dbdc52f4214390519c35385722cd31f84 src/lppserial +9fddeb704663451094926b8e3b10d18025c8fefb src/lppserial diff --git a/main.cpp b/main.cpp --- a/main.cpp +++ b/main.cpp @@ -1,11 +1,38 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the Uprobe Software +-- Copyright (C) 2014, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 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 General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +-- Author : Kaveh Mohamadabadi +-- Mail : kaveh.mohamadabadi@lpp.polytechnique.fr +--------------------------------------------------------------------------------*/ #include "mainwindow.h" #include +#include int main(int argc, char *argv[]) { QApplication a(argc, argv); - MainWindow w; - w.show(); + UProbeProtocol proto; + proto.setPortName("/dev/ttyUSB0"); + proto.setSpeed(38400); + proto.open(); + proto.start(); return a.exec(); } diff --git a/mainwindow.cpp b/mainwindow.cpp --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1,3 +1,26 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the Uprobe Software +-- Copyright (C) 2014, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 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 General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +-- Author : Kaveh Mohamadabadi +-- Mail : kaveh.mohamadabadi@lpp.polytechnique.fr +--------------------------------------------------------------------------------*/ #include "mainwindow.h" #include "ui_mainwindow.h" diff --git a/mainwindow.h b/mainwindow.h --- a/mainwindow.h +++ b/mainwindow.h @@ -1,3 +1,26 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the Uprobe Software +-- Copyright (C) 2014, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 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 General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +-- Author : Kaveh Mohamadabadi +-- Mail : kaveh.mohamadabadi@lpp.polytechnique.fr +--------------------------------------------------------------------------------*/ #ifndef MAINWINDOW_H #define MAINWINDOW_H diff --git a/src/ucomport.cpp b/src/ucomport.cpp --- a/src/ucomport.cpp +++ b/src/ucomport.cpp @@ -1,3 +1,26 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the Uprobe Software +-- Copyright (C) 2014, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 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 General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +-- Author : Kaveh Mohamadabadi +-- Mail : kaveh.mohamadabadi@lpp.polytechnique.fr +--------------------------------------------------------------------------------*/ #include "ucomport.h" UComPort::UComPort() diff --git a/src/ucomport.h b/src/ucomport.h --- a/src/ucomport.h +++ b/src/ucomport.h @@ -1,3 +1,27 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the Uprobe Software +-- Copyright (C) 2014, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 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 General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +-- Author : Kaveh Mohamadabadi +-- Mail : kaveh.mohamadabadi@lpp.polytechnique.fr +--------------------------------------------------------------------------------*/ + #ifndef UCOMPORT_H #define UCOMPORT_H diff --git a/src/uprobe.cpp b/src/uprobe.cpp --- a/src/uprobe.cpp +++ b/src/uprobe.cpp @@ -1,3 +1,26 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the Uprobe Software +-- Copyright (C) 2014, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 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 General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +-- Author : Kaveh Mohamadabadi +-- Mail : kaveh.mohamadabadi@lpp.polytechnique.fr +--------------------------------------------------------------------------------*/ #include "uprobe.h" UProbe::UProbe(QObject *parent) : diff --git a/src/uprobe.h b/src/uprobe.h --- a/src/uprobe.h +++ b/src/uprobe.h @@ -1,3 +1,26 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the Uprobe Software +-- Copyright (C) 2014, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 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 General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +-- Author : Kaveh Mohamadabadi +-- Mail : kaveh.mohamadabadi@lpp.polytechnique.fr +--------------------------------------------------------------------------------*/ #ifndef UPROBE_H #define UPROBE_H diff --git a/src/uprobeprotocol.cpp b/src/uprobeprotocol.cpp --- a/src/uprobeprotocol.cpp +++ b/src/uprobeprotocol.cpp @@ -1,7 +1,30 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the Uprobe Software +-- Copyright (C) 2014, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 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 General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +-- Author : Kaveh Mohamadabadi +-- Mail : kaveh.mohamadabadi@lpp.polytechnique.fr +--------------------------------------------------------------------------------*/ #include "uprobeprotocol.h" UProbeProtocol::UProbeProtocol(QObject *parent) : - QThread(parent),UComPort() + QThread(parent),UComPort(),p_datacount(0),p_index(0) { moveToThread((QThread*)this); } @@ -32,7 +55,7 @@ void UProbeProtocol::run() { p_index+=currentPacket->packetSize + 6; //forward DATA - + emit packetReady(currentPacket); } } p_index++; @@ -110,7 +133,7 @@ bool UProbeProtocol::FSM_ExtractHeaderSt currentPacket = new UProbeProtocolPacket(); currentPacket->packetNumber = p_buffer[p_index+2]; currentPacket->packetSize = ((unsigned int)p_buffer[p_index+3] + 1)*2; - currentPacket->channelCount = 0xF & (int)(p_buffer[p_index+4]>>4); + currentPacket->channelCount = 0xF & ((int)(p_buffer[p_index+4]>>4) +1); currentPacket->coding = (UProbeProtocol::UProbeProtocolPacket::PacketCoding)(0x3 & (int)(p_buffer[p_index+4]>>2)); currentPacket->resolution = (UProbeProtocol::UProbeProtocolPacket::PacketResolution)(0x3 & (int)(p_buffer[p_index+4])); currentPacket->ID = (unsigned int)p_buffer[p_index+5]; diff --git a/src/uprobeprotocol.h b/src/uprobeprotocol.h --- a/src/uprobeprotocol.h +++ b/src/uprobeprotocol.h @@ -1,3 +1,26 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the Uprobe Software +-- Copyright (C) 2014, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 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 General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +-- Author : Kaveh Mohamadabadi +-- Mail : kaveh.mohamadabadi@lpp.polytechnique.fr +--------------------------------------------------------------------------------*/ #ifndef UPROBEPROTOCOL_H #define UPROBEPROTOCOL_H @@ -21,7 +44,7 @@ ------------------------------------------------------------------------------------------- || Sync (2Bytes) || Header(4 Bytes) || Payload Data (2 to 512 Bytes) || CRC(1 Byte) || - || 0xA5 0xF0 || PCPT | (PSZ-1)*2 | SHAPE | ID || [...] || Uses SpaceWire CRC || + || 0xA5 0xF0 || PCPT | (PSZ/2)-1 | SHAPE | ID || [...] || Uses SpaceWire CRC || Shape: @@ -124,6 +147,7 @@ public: void run(); signals: + void packetReady(UProbeProtocolPacket* currentPacket); public slots: void setPortName(const QString& name);