Example #1
0
struct Declarator * SpecDeclFromString(char * string, struct __ecereNameSpace__ecere__sys__OldList * specs, struct Declarator * baseDecl)
{
struct Location oldLocation = yylloc;
struct Declarator * decl = (((void *)0));
struct __ecereNameSpace__ecere__com__Instance * backFileInput = fileInput;

if(!string)
string = "void()";
fileInput = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
((int (*)(struct __ecereNameSpace__ecere__com__Instance *, void *  buffer, unsigned int size, unsigned int count))fileInput->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Write])(fileInput, string, 1, strlen(string));
((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))fileInput->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(fileInput, 0, 0);
echoOn = 0x0;
parseTypeError = 0x0;
parsedType = (((void *)0));
declMode = (int)0;
resetScanner();
{
unsigned int oldParsingType = parsingType;

parsingType = 0x1;
type_yyparse();
parsingType = oldParsingType;
}
declMode = 2;
type_yydebug = 0x0;
(__ecereNameSpace__ecere__com__eInstance_DecRef(fileInput), fileInput = 0);
if(parsedType)
{
if(parsedType->qualifiers)
{
struct Specifier * spec;

for(; (spec = (*parsedType->qualifiers).first); )
{
__ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*parsedType->qualifiers), spec);
__ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*specs), spec);
}
}
if(parsedType->bitCount)
{
parsedType->declarator = MkStructDeclarator(parsedType->declarator, parsedType->bitCount);
parsedType->bitCount = (((void *)0));
}
decl = PlugDeclarator(parsedType->declarator, baseDecl);
FreeTypeName(parsedType);
parsedType = (((void *)0));
if(parseTypeError)
{
Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "parsing type %s\n", (((void *)0))), string);
}
}
else
{
Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "parsing type %s\n", (((void *)0))), string);
decl = baseDecl;
}
yylloc = oldLocation;
fileInput = backFileInput;
return decl;
}
Example #2
0
//--------------------------------------------------------------------------------------
// Mwars::Mwars()
// the Constructor
//--------------------------------------------------------------------------------------
Mwars::Mwars(QWidget *parent) : QMainWindow(parent), ui(new Ui::mwarsForm)  {

    ui->setupUi(this);  // Ui:mwarsForm ui

    //*********** two timers
    QTimer *keepServerAliveTimer = new QTimer(this);  // instantiate timer
    QTimer *testTimer = new QTimer(this);


    // a. TCP stream to scanner server
    // clientSocket: client socket sends stream to scanner. clientSocket already exists
    // Q_SIGNALS signals emitted by socket  unimplemented: void hostFound() void connected()
    connect( &clientSocket, SIGNAL(error(QAbstractSocket::SocketError)),
            this, SLOT(clientSocketError(QAbstractSocket::SocketError)) );
    connect( &clientSocket, SIGNAL(stateChanged(QAbstractSocket::SocketState)),
            this, SLOT(clientSocketState(QAbstractSocket::SocketState)) );

    connect( &clientSocket, SIGNAL(readyRead()),this, SLOT(OnReadyRead()) );
    connect( &clientSocket, SIGNAL(disconnected()), this, SLOT(disconnectedz()) );

    // b. UDP stream from opencv / camera
    listenSocket = new QUdpSocket ( this );
    listenSocket->bind(9988 );
    connect( listenSocket, SIGNAL(readyRead()),this, SLOT(OnReadyRead()) );

    //signals from within code
    connect( this, SIGNAL(connectScanner()), this, SLOT(connectToScanner()));  // Constructor
    connect( keepServerAliveTimer, SIGNAL(timeout()), this, SLOT(keepServerAlive()));

//    connect( testTimer, SIGNAL(timeout()), this, SLOT(testSignal()));

    // signals from ui
    connect( ui->xSlider, SIGNAL(valueChanged(int)), this, SLOT(sendScanCmd()));
    connect( ui->ySlider, SIGNAL(valueChanged(int)), this, SLOT(sendScanCmd()));
    connect( ui->spinboxXCamTrim, SIGNAL(valueChanged(int)), this, SLOT(sendScanCmd()));
    connect( ui->spinboxYCamTrim, SIGNAL(valueChanged(int)), this, SLOT(sendScanCmd()));

    //connect( ui->pbLaserToggle, SIGNAL(clicked()), this, SLOT(laserToggle()));
    connect( ui->pushButtonLaserDisableToggle, SIGNAL(clicked()), this, SLOT(laserDisableToggle()));
    connect( ui->pushButtonScannerToggle, SIGNAL(clicked()), this, SLOT(scannerToggle()));
    connect( ui->pushButtonConnect, SIGNAL(clicked()), this, SLOT(connectToScanner()));
    connect( ui->radioButtonVerboseOn, SIGNAL(clicked()), this, SLOT(verboseOn()));
    connect( ui->radioButtonVerboseOff, SIGNAL(clicked()), this, SLOT(verboseOff()));
    connect( ui->pushButtonResetScanner, SIGNAL(clicked()), this, SLOT(resetScanner()));
    connect( ui->pushButtonCameraDataToggle, SIGNAL(clicked()), this, SLOT(cameraDataToggle()));
    connect( ui->pushButtonTestDataToggle, SIGNAL(clicked()), this, SLOT(testDataToggle()));
    //connect( ui->pbAlignBS, SIGNAL(clicked()), this, SLOT(alignBoresight()));

    connect( ui->pbCalibrateToggle, SIGNAL(clicked()), this, SLOT(calibrateToggle()));
    connect( ui->pbCalSetULHC, SIGNAL(clicked()), this, SLOT(calSetULHC()));
    connect( ui->pbCalSetLRHC, SIGNAL(clicked()), this, SLOT(calSetLRHC()));
    connect( ui->pbCalFullFrame, SIGNAL(clicked()), this, SLOT(calFullFrame()));
    connect( ui->pbCalHalfFrame, SIGNAL(clicked()), this, SLOT(calHalfFrame()));

    connect( ui->spinboxXCamTrim, SIGNAL(valueChanged(int)), this, SLOT(xCamTrim()));
    connect( ui->spinboxYCamTrim, SIGNAL(valueChanged(int)), this, SLOT(yCamTrim()));
    connect( ui->pbCamTrimOffset, SIGNAL(clicked()), this, SLOT(camTrimOffset()));

    connect( ui->sbXCamOffset, SIGNAL(valueChanged(int)), this, SLOT(xCamOffset()));
    connect( ui->sbYCamOffset, SIGNAL(valueChanged(int)), this, SLOT(yCamOffset()));
    connect( ui->pbCamOffset, SIGNAL(clicked()), this, SLOT(camScanOffset()));

    connect( ui->pbCalLaserBsight, SIGNAL(clicked()), this, SLOT(alignBoresight()));
    //connect( this, SIGNAL (testSignal()), this, SLOT (testSignal()));


    // temporary stuff to test parallax offset
    g_xLenWallFOV_mm = (1310 * 2);  // measured width, x axis, of FOV at target distance = range (mm)
    g_yLenWallFOV_mm = (975 * 2);
    g_xSF_pixelTomm =  (float)g_xLenWallFOV_mm / CAMERA_X_PIXELS;
    g_ySF_pixelTomm =  (float)g_yLenWallFOV_mm / CAMERA_Y_PIXELS;
    range_mm         = 2750;          // measured range cam to target (mm)


    //overwritten when cam file is read
    g_xScanFOVOrigin_su = DAC_X_MIN;		// scanner origin corresponding to x_camFOVOrigin (scan units)
    g_xScanFOVMax_su    = DAC_X_MAX;		// scanner max x corresponding to x_camFOVMax (scan units)

    // read camera to scanner calibration file. This reads the calibration parameters
    // and sets main slider and spin box values
    readXMLFile();

    ui->spinboxXCamTrim->setRange(-5000, +5000);
    ui->spinboxYCamTrim->setRange(-5000, +5000);
    ui->radioButtonVerboseOff->setChecked(true);

    clearStateWidets();				// clear Server State widget text

#ifdef FORCE_ENABLE_WIDGETS
    enableWidgets();
#else
     disableWidgets();				// control widgets get enabled when connected
#endif

    verbose = false;                // verbose OFF
    laserOnFlag = false;
    testDataEnableFlag = false;     // set by TestData button to turn on test data stream
    cameraDataEnableFlag = false;   // set by Camera Data button to turn on OpenCVcamera data stream
    laserDisableFlag = false;       // set by Laser On/Off button
    scannerOnFlag = false;          // set by Scanner On/Off button
    tcpConnected = false;           // tcp connected
    serverReady = false;
    calibrateFlag = false;

    setWindowTitle(tr("MWARS SCANNER CONSOLE"));



    // =================== start scannerserver comms ===============================
    //  a) UDP stream of co-ords and laser command from OpenCV Project mwars
    //  b) TCP connection to server in the scanner unit

    // 1. connect to the TCP server in the laser scanner unit
    emit connectScanner();              //runs connectToScanner


    // ==================== timers ==================================
    // start the keep alivetimer. Used to get response to update Console
    keepServerAliveTimer->start(1000);  //1000 = 1 sec

    //start the test signal timer for testSignal()
    // 1000 = 1 sec, 1 = 1mS
    //testTimer->start(100);             // 5 Hz
    //testTimer->start(10);              // 50 Hz
    //testTimer->start(20);              // 25 Hz
    // testTimer->start(60);              //  8 Hz
    // testTimer->start(50);              //  10 Hz

    sendScanCmd();     // init scanner, slew to slider values

    rectangleIsRunning = false;
}