##// END OF EJS Templates
Removed APBUartPlugin bug (when switching between debug and non debug link)....
Removed APBUartPlugin bug (when switching between debug and non debug link). Added APBUart Python wrapper.

File last commit:

r34:ccd56e93ef09 default
r34:ccd56e93ef09 default
Show More
APBUARTPLUGIN.cpp
177 lines | 5.4 KiB | text/x-c | CppLexer
Jeandet Alexis
updated plugin headers and win32/Apbuart fix tentative.
r4 /*------------------------------------------------------------------------------
-- This file is a part of the SocExplorer Software
Jeandet Alexis
Added disconnection auto-detection to the spacewire plugin.
r11 -- Copyright (C) 2013, Plasma Physics Laboratory - CNRS
First init /!\ outdated spwplugin!
r0 --
-- 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
Jeandet Alexis
updated plugin headers and win32/Apbuart fix tentative.
r4 -- the Free Software Foundation; either version 2 of the License, or
First init /!\ outdated spwplugin!
r0 -- (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
----------------------------------------------------------------------------*/
#include "APBUARTPLUGIN.h"
#include <socexplorerengine.h>
Removed APBUartPlugin bug (when switching between debug and non debug link)....
r34 #include <apbuartpywrapper.h>
First init /!\ outdated spwplugin!
r0
Removed APBUartPlugin bug (when switching between debug and non debug link)....
r34 ApbUartPlugin::ApbUartPlugin(QWidget *parent):socexplorerplugin(parent,false)
First init /!\ outdated spwplugin!
r0 {
APB UART PLUGIN rework in progress;
r28 this->setBaseAddress(-1);
Removed APBUartPlugin bug (when switching between debug and non debug link)....
r34 this->p_curentAPBUart = 0;
Added ui file for APB_UART_PLUGIN.
r26 this->UI = new APBUART_Plugin_ui();
First init /!\ outdated spwplugin!
r0 this->setWidget((QWidget*)this->UI);
APB UART PLUGIN rework in progress;
r28 this->uartConnected = false;
this->UartThread = new UARTPollingThread(this);
Removed APBUartPlugin bug (when switching between debug and non debug link)....
r34 this->pyObject = new APBUartPyWrapper(this);
connect(this->UI,SIGNAL(loopbackChkBxStateChanged(int)),this,SLOT(fifoDebugChangeState(int)));
APB UART PLUGIN rework in progress;
r28 connect(this->UartThread,SIGNAL(apbUartTextReceived(QString)),this->UI,SIGNAL(apbUartTextReceived(QString)));
connect(this->UI,SIGNAL(connectPort()),this,SLOT(toggleUartState()));
connect(this->UI,SIGNAL(sendChar(char)),this->UartThread,SLOT(sendChar(char)));
connect(this->UI,SIGNAL(PortNameChanged(QString)),this->UartThread,SLOT(setPortName(QString)));
connect(this->UI,SIGNAL(UartSpeedChanged(QString)),this->UartThread,SLOT(setPortSpeedStr(QString)));
Removed APBUartPlugin bug (when switching between debug and non debug link)....
r34 connect(this->UI,SIGNAL(updateAPBUartsList()),this,SLOT(updateAPBUartsList()));
connect(this->UI,SIGNAL(curentAPBUartChanged(int)),this,SLOT(setCurentAPBUart(int)));
connect(((APBUartPyWrapper*)this->pyObject),SIGNAL(openUart()),this,SLOT(openUart()));
connect(((APBUartPyWrapper*)this->pyObject),SIGNAL(closeUart()),this,SLOT(closeUart()));
connect(((APBUartPyWrapper*)this->pyObject),SIGNAL(setFifoDebugEnabled(bool)),this,SLOT(setFifoDebugEnabled(bool)));
connect(((APBUartPyWrapper*)this->pyObject),SIGNAL(setUARTPortNane(QString)),this,SLOT(setUARTPortNane(QString)));
connect(((APBUartPyWrapper*)this->pyObject),SIGNAL(setUARTPortSpeed(int)),this,SLOT(setUARTPortSpeed(int)));
connect(((APBUartPyWrapper*)this->pyObject),SIGNAL(updateAPBUartsList()),this,SLOT(updateAPBUartsList()));
APB UART PLUGIN rework in progress;
r28 this->UartThread->start();
First init /!\ outdated spwplugin!
r0 }
ApbUartPlugin::~ApbUartPlugin()
{
}
Removed APBUartPlugin bug (when switching between debug and non debug link)....
r34 int ApbUartPlugin::curentAPBUart()
{
return p_curentAPBUart;
}
First init /!\ outdated spwplugin!
r0 void ApbUartPlugin::closeMe()
{
emit this->closePlugin(this);
}
APB UART PLUGIN rework in progress;
r28 void ApbUartPlugin::toggleUartState()
First init /!\ outdated spwplugin!
r0 {
APB UART PLUGIN rework in progress;
r28 if(!uartConnected)
First init /!\ outdated spwplugin!
r0 {
Removed APBUartPlugin bug (when switching between debug and non debug link)....
r34 this->openUart();
First init /!\ outdated spwplugin!
r0 }
APB UART PLUGIN rework in progress;
r28 else
{
Removed APBUartPlugin bug (when switching between debug and non debug link)....
r34 this->closeUart();
APB UART PLUGIN rework in progress;
r28 }
Removed APBUartPlugin bug (when switching between debug and non debug link)....
r34 }
void ApbUartPlugin::activate(bool flag)
{
socexplorerplugin::activate(flag);
this->updateAPBUartsList();
}
void ApbUartPlugin::updateAPBUartsList()
{
QList<unsigned int> addresses;
int count = SocExplorerEngine::self()->getEnumDeviceCount(this,this->VID(),this->PID());
for(int i=0;i<count;i++)
{
addresses.append(SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,this->VID(),this->PID(),i));
}
this->UI->updateAPBUartList(addresses);
}
void ApbUartPlugin::setCurentAPBUart(int index)
{
this->p_curentAPBUart = index;
this->setBaseAddress(SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,this->VID(),this->PID(),index));
}
void ApbUartPlugin::openUart()
{
if(this->UartThread->fifoDebugEnabled())
setFifoDebugEnabled(false);
if(!uartConnected)
uartConnected = this->UartThread->openUart();
APB UART PLUGIN rework in progress;
r28 this->UI->setUartConnected(uartConnected);
First init /!\ outdated spwplugin!
r0 }
Removed APBUartPlugin bug (when switching between debug and non debug link)....
r34 void ApbUartPlugin::closeUart()
{
if(uartConnected)
this->UartThread->closeUart();
this->uartConnected = false;
this->UI->setUartConnected(uartConnected);
}
void ApbUartPlugin::setFifoDebugEnabled(bool enable)
{
if(uartConnected)
closeUart();
this->UI->setEnableForLoopBack(!enable);
this->UartThread->setFifoDebugEable(enable);
}
void ApbUartPlugin::setAPBUartIndex(int index)
{
this->UI->setAPBUartIndex(index);
}
void ApbUartPlugin::setUARTPortNane(QString name)
{
this->UI->setUartPortName(name);
}
void ApbUartPlugin::setUARTPortSpeed(int speed)
{
this->UI->setUartSpeed(speed);
}
void ApbUartPlugin::fifoDebugChangeState(int state)
First init /!\ outdated spwplugin!
r0 {
if(state==Qt::Checked)
{
Removed APBUartPlugin bug (when switching between debug and non debug link)....
r34 this->setFifoDebugEnabled(true);
First init /!\ outdated spwplugin!
r0 }
else
{
Removed APBUartPlugin bug (when switching between debug and non debug link)....
r34 this->setFifoDebugEnabled(false);
First init /!\ outdated spwplugin!
r0 }
}
unsigned int ApbUartPlugin::Read(unsigned int *Value,unsigned int count,unsigned int address)
{
if(parent!=NULL)
return parent->Read(Value,count,address);
return 0;
}
unsigned int ApbUartPlugin::Write(unsigned int *Value,unsigned int count, unsigned int address)
{
if(parent!=NULL)
return parent->Write(Value,count,address);
return 0;
}