void DDSWidget::receiveValue(double pValue) { double m_nVoltRangeArray[5]={0.6,1.5,3.5,7.0,13.0}; qDebug() << m_nLineEditIndex << "pValue:" << pValue; if (m_nLineEditIndex == 4) { m_nOutputFrequency = validateFrequency(pValue); qDebug() << "validated frequency:" << m_nOutputFrequency << m_strFreqUnit; m_objLE_OPFreq->setText(QString::number(m_nOutputFrequency, 'f', 3)); ui->FoUnit->setText(m_strFreqUnit); m_nOutputFrequency = pValue; ui->leOutputTime->setText(QString::number((validateTime((1 / pValue))), 'f', 3)); ui->opUnit->setText(m_strTimeUnit); //update on value change--------------------------------------- double l_nFTWOutputFrequency, l_nOutputTime; l_nFTWOutputFrequency = (m_nOutputFrequency / 50000000); l_nFTWOutputFrequency = l_nFTWOutputFrequency * pow(2, 32); l_nOutputTime = 1 / l_nFTWOutputFrequency; qDebug() << "FTW Output Frequency:" << l_nFTWOutputFrequency; qDebug() << "FTW Output Time:" << l_nOutputTime; m_nFTW_LSW = ((unsigned int) l_nFTWOutputFrequency << 16) >> 16; m_nFTW_MSW = (unsigned int) l_nFTWOutputFrequency >> 16; qDebug() << "FTW_LSW" << hex << m_nFTW_LSW; qDebug() << "FTW_MSW" << hex << m_nFTW_MSW; IAppCard->setDDSFTW_LSW(m_nFTW_LSW); IAppCard->setDDSFTW_MSW(m_nFTW_MSW); //--------------------------------------------------------------- } else if (m_nLineEditIndex == 9) {
int main(int argc, const char *argv[]) { if(argc < 4){ fprintf(stderr, "Usage: %s <frequency (ns)> <duration (ms)> <script> [<args>...]\n", argv[0]); return -1; } long frequency = atol(argv[1]); if (validateFrequency(frequency) > 0) { Shakespeare::log(Shakespeare::ERROR,processName,"Invalid frequency, must be greater than zero"); } // TODO - more validation long duration = atol(argv[2]); if (validateDuration (duration) > 0) { Shakespeare::log(Shakespeare::ERROR,processName,"Invalid duration, must be greater than zero"); } // TODO - more validation // Set up arguments for exec: the path is always the 3th argument const char * path = argv[3]; // All of the rest of the arguments are arguments for the job. The path of // the job should also be passed to the job as argument zero. // TODO replace with new char ** args = (char **) malloc(sizeof(char*) * (argc-2)); // Copy the remaining args into an array of strings. Doing it this way because // they're const and need to be non-const. Maybe there's a better way though... // TODO do this without malloc for(int i = 0; i < (argc-3); ++i){ args[i] = strcpy( (char*) malloc( sizeof(char) * (strlen (argv[i + 3]) + 1) ), argv[i + 3]); } // arg list must be null-terminated for execvp args[argc-3] = NULL; // Start a timer to track the total duration, as it's the most accurate way to do so I think timer_t timer = timer_get(); timer_start(&timer, duration/1000, duration%1000); // just keep forkin while(!timer_complete(&timer)){ fork_and_manage_child(path, args, frequency); } for(int i = 0; i < (argc-3); ++i) { free (args[i]); } free (args); return CS1_SUCCESS; }