// Slot to be triggered from the updater thread void Downloader::startDl() { if (reply==nullptr) { //Prep appdata file if (!QDir(config->APPDATA).exists()) { QDir().mkpath(config->APPDATA); } file = new QFile(config->APPDATA+"\\patch.zip"); file->open(QFile::WriteOnly | QFile::Truncate); //nam.setNetworkAccessible(QNetworkAccessManager::Accessible); reply = nam.get(QNetworkRequest(url)); emit sendInfo("Starting download"); emit sendInfo(""); //empty line which will be removed for the progress text QObject::connect(reply, SIGNAL(finished()), this, SLOT(finishedSlot())); QObject::connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(errorSlot(QNetworkReply::NetworkError))); QObject::connect(reply, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(progressSlot(qint64, qint64))); QObject::connect(reply, SIGNAL(readyRead()), this, SLOT(writeToFileSlot())); } else { emit sendInfo("You can't start the same download several times!!!"); } }
int Sample::Diagnose(ias &grids, ias &data, unstruct_grid::vecFlag typeFlag, bool isStrGrid) { if (typeFlag != unstruct_grid::SCALAR && typeFlag != unstruct_grid::VECTOR && typeFlag != unstruct_grid::POINT) { sendInfo("Could not decide between vector and scalar"); return -1; } if (typeFlag == unstruct_grid::POINT || isStrGrid) { return 0; } if (grids.size() != data.size()) { return -1; } for (int time = 0; time < grids.size(); ++time) { for (int block = 0; block < grids[time].size();) { int num_el = 0, num_conn = 0, num_coor_grid = 0, num_coor_data = 0; coDoUnstructuredGrid *p_grid = (coDoUnstructuredGrid *)(grids[time][block]); p_grid->getGridSize(&num_el, &num_conn, &num_coor_grid); if (typeFlag == unstruct_grid::SCALAR) { coDoFloat *p_sdata = (coDoFloat *)(data[time][block]); num_coor_data = p_sdata->getNumPoints(); } else if (typeFlag == unstruct_grid::VECTOR) { coDoVec3 *p_vdata = (coDoVec3 *)(data[time][block]); num_coor_data = p_vdata->getNumPoints(); } if (num_coor_data == 0 && grids[time].size() > 1) { // we have to "forget" that the corresponding grid exists... compress(grids[time], block); compress(data[time], block); continue; } if (num_coor_grid != num_coor_data) { sendInfo("Detected grid and data object with incompatible size: data has to be node-based"); return -1; } ++block; } } return 0; }
void ReadN3s::createCoviseUnsgrd() { unsgridObject = new coDoUnstructuredGrid(unsgridPort->getObjName(), num_elements, num_elements * (dim + 1), num_nodes, 1); unsgridObject->getTypeList(&tl); unsgridObject->getAddresses(&el, &vl, &x, &y, &z); unsgridPort->setCurrentObject(unsgridObject); if (dim == 3) sendInfo("found %d coordinates, %d tetrahedra", num_nodes, num_elements); else sendInfo("found %d coordinates, %d triangles", num_nodes, num_elements); }
bool UFuncBin::handleCommand(UServerInMsg * msg, void * extra) { bool ask4help; const int MVL = 1000; char val[MVL]; bool replySend = false; bool gotOpenLog; bool gotOpenLogValue = false; bool gotVerbose; bool gotVerboseValue = false; UTime t; // check for parameters - one parameter is tested for - 'help' // the help value is ignored, e.g. if help="bark", then // the value "bark" will be in the 'helpValue' string. ask4help = msg->tag.getAttValue("help", val, MVL); // get all other parameters gotOpenLog = msg->tag.getAttValueBool("log", &gotOpenLogValue, true); gotVerbose = msg->tag.getAttValueBool("verbose", &gotVerboseValue, true); // if (ask4help) { // create the reply in XML-like (html - like) format sendHelpStart("BIN"); sendText("--- available BIN options (mission poly lines and points)\n"); sendText("verbose[=false] Posibly more messages to server console\n"); sendText("log[=false] Open [or close] logfile\n"); sendText("help This message\n"); sendText("--------\n"); sendHelpDone(); replySend = true; } else { // resource is available, so make a reply if (gotVerbose) { bin->verbose = gotVerboseValue; sendInfo("done"); replySend = true; } if (gotOpenLog) { bin->openLog(gotOpenLogValue); sendInfo("done"); replySend = true; } } if (not replySend) sendInfo(msg, "no poly action performed (no command option?)"); // return true if the function is handled with a positive result return true; }
void dequeue(void) { unsigned int i=0; for(i=0; i<qQueue.size(); i++) { sendInfo(qQueue[i]); } qQueue.clear(); }
int ReadN3s::openFiles() { strcpy(infobuf, "Opening file "); strcat(infobuf, geofilename); strcpy(infobuf, "Opening file "); strcat(infobuf, resfilename); sendInfo(infobuf); // open the obj file if ((fpgeo = fopen((char *)geofilename, "r")) == NULL) { strcpy(infobuf, "ERROR: Can't open file >> "); strcat(infobuf, geofilename); sendError(infobuf); return (FALSE); } if ((fpres = fopen((char *)resfilename, "r")) == NULL) { strcpy(infobuf, "ERROR: Can't open file >> "); strcat(infobuf, resfilename); sendError(infobuf); return (FALSE); } else { return (TRUE); } }
Foam::labelPairList Foam::globalPoints::addSendTransform ( const label patchI, const labelPairList& info ) const { labelPairList sendInfo(info.size()); forAll(info, i) { //Pout<< " adding send transform to" << nl // << " proc:" << globalIndexAndTransform::processor(info[i]) // << nl // << " index:" << globalIndexAndTransform::index(info[i]) << nl // << " trafo:" // << globalTransforms_.decodeTransformIndex // (globalIndexAndTransform::transformIndex(info[i])) // << endl; sendInfo[i] = globalIndexAndTransform::encode ( globalIndexAndTransform::processor(info[i]), globalIndexAndTransform::index(info[i]), globalTransforms_.addToTransformIndex ( globalIndexAndTransform::transformIndex(info[i]), patchI, true // patchI is sending side ) ); }
void myModule::postInst() { sendInfo("please use Control Panel for parametrization"); // show/hide parameters handleParamWidgets(); }
void Downloader::errorSlot(QNetworkReply::NetworkError code) { if (!erroremitted) { emit sendInfo("Network error: "+QString::number(code)); erroremitted=true; emit finisheddl(); } }
void TcpSocket::readClient() { qDebug() << "readClientInServer"; QDataStream in(this); in.setVersion(QDataStream::Qt_4_6); if (nextBlockSize == 0) { if (bytesAvailable() < sizeof(quint64)) return; in >> nextBlockSize; } if ((quint64)bytesAvailable() < nextBlockSize) return; QString requestType; in >> requestType; if(requestType == "GET") sendInfo(); else if (requestType == "CLICK" || requestType == "RIGHT" || requestType == "DOUBLE") { int i,j; in >> i >> j; qDebug() << requestType << QString::number(i) << QString::number(j); emit updateSocks(requestType,i,j); emitter = peerAddress().toString(); }
//static void FSData::callbackReqInfo(const LLSD ¬ification, const LLSD &response) { S32 option = LLNotification::getSelectedOption(notification, response); std::string my_name; LLSD subs = LLNotification(notification).getSubstitutions(); LLUUID uid = subs["FROMUUID"].asUUID(); LLUUID sessionid = subs["SESSIONID"].asUUID(); llinfos << "the uuid is " << uid.asString().c_str() << llendl; LLAgentUI::buildFullname(my_name); if ( option == 0 )//yes { sendInfo(uid,sessionid,my_name,IM_NOTHING_SPECIAL); } else { pack_instant_message( gMessageSystem, gAgent.getID(), FALSE, gAgent.getSessionID(), uid, my_name, "Request Denied.", IM_ONLINE, IM_NOTHING_SPECIAL, sessionid ); gAgent.sendReliableMessage(); gIMMgr->addMessage(sessionid,uid,my_name,"Request Denied"); } }
void reduceFunction::getInfo(int fd, rio_t client, int id){ char buf1[MAXLINE]; int numBytes; char * saveptr=NULL; while(true){ numBytes = Rio_readlineb(&client, buf1, MAXLINE); if(numBytes==0){ break; } printf("buf1 is %s\n", buf1); char* d1 = strtok_r(buf1, "*",&saveptr); char ip[20]; strcpy(ip,d1); char* d2 = strtok_r(NULL, "*",&saveptr); int port=atoi(d2); char* d3 = strtok_r(NULL, "* \r\n",&saveptr); int num=atoi(d3); mapNode mapWorker; strcpy(mapWorker.mapIp,ip); mapWorker.mapPort=port; mapAddress[num]=mapWorker; } getMapInfo(); sendInfo(); }
int ReadN3s::compute(const char *) { // get the file name geofilename = geoFileParam->getValue(); resfilename = resFileParam->getValue(); if (geofilename != NULL || resfilename != NULL) { // open the file if (openFiles()) { sendInfo(infobuf, "Files %s %s open", geofilename, resfilename); // read the file, create the lists and create a COVISE unstructured grid object readGeoFile(); fclose(fpgeo); readResultFile(); fclose(fpres); } else { sendError("Error opening files %s %s", geofilename, resfilename); return STOP_PIPELINE; } } else { sendError("ERROR: fileName for geo or result file is NULL"); } return CONTINUE_PIPELINE; }
void ServerProxy::queryInfo() { ClientInfo info; m_client->getShape(info.m_x, info.m_y, info.m_w, info.m_h); m_client->getCursorPos(info.m_mx, info.m_my); sendInfo(info); }
void VerticesList::resetMesh() { clear(); for (int i=0; i<mesh->getVSize(); i++) addItem(new VertexItem(mesh->getV(i))); if (count() > 0) { setCurrentRow(0); sendInfo(currentItem()); } }
bool RemoteLogger::trySendingLog(){ bool result = false; if (infoMailbox.isMail()) { sendInfo(infoMailbox.fetch()); result = true; } return result; }
void IMT_MRGui::createstartcalcthread() { emit sendInfo("Reading...",true); *future = QtConcurrent::run(this,&IMT_MRGui::readcalcwrite_thread); watcher->setFuture(*future); //watcher->waitForFinished(); }
status_t BnMcuService::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { ALOGI("BnMcuService::onTransact, code[%d]", code); switch (code) { case GET_TEST: { CHECK_INTERFACE(IMcuService, data, reply); int result = getTest(); reply->writeInt32(result); return NO_ERROR; } break; case obtain_info: { CHECK_INTERFACE(IMcuService, data, reply); int domain = data.readInt32(); int cmd = data.readInt32(); Parcel out; bool res = obtainInfo(domain, cmd, out); reply->appendFrom(&out, 0, out.dataSize()); reply->writeInt32(res?1:0); out.freeData(); return NO_ERROR; } break; case send_info: { CHECK_INTERFACE(IMcuService, data, reply); int domain = data.readInt32(); int cmd = data.readInt32(); Parcel in; if(data.dataAvail() >0) { in.appendFrom(&data, data.dataPosition(), data.dataSize()-data.dataPosition()); in.setDataPosition(0); } bool res = sendInfo(domain, cmd, in); reply->writeInt32(res?1:0); in.freeData(); return NO_ERROR; } break; case regist_data_changed_listener: { CHECK_INTERFACE(IMcuService, data, reply); int domain = data.readInt32(); sp<IDataChangedListener> client = interface_cast<IDataChangedListener>(data.readStrongBinder()); bool res = registDataChanagedListener(domain, client); reply->writeInt32((res?1:0)); return NO_ERROR; } break; case unregist_data_changed_listener: { CHECK_INTERFACE(IMcuService, data, reply); int domain = data.readInt32(); sp<IDataChangedListener> client = interface_cast<IDataChangedListener>(data.readStrongBinder()); bool res = unregistDataChanagedListener(domain, client); reply->writeInt32((res?1:0)); return NO_ERROR; } break; default: return BBinder::onTransact(code, data, reply, flags); } }
//reply finished void Downloader::finishedSlot(){ if (reply->error() == QNetworkReply::NoError){ QVariant possibleRedirectUrl = reply->attribute(QNetworkRequest::RedirectionTargetAttribute); if (!possibleRedirectUrl.toUrl().isEmpty()) { //there is redirect //make new request //emit sendInfo("Redirected to "+possibleRedirectUrl.toUrl().toString()); reply->deleteLater(); reply = nam.get(QNetworkRequest(possibleRedirectUrl.toUrl())); //when this reply is finished this slot will get re-triggered emit sendInfo("Redirecting..."); emit sendInfo(""); tmpBuffer.clear(); //CLEAR THE GODDAMN BUFFER!!!! file->resize(0); //reconnect since deleting reply disconnects all slots QObject::connect(reply, SIGNAL(finished()), this, SLOT(finishedSlot())); QObject::connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(errorSlot(QNetworkReply::NetworkError))); QObject::connect(reply, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(progressSlot(qint64, qint64))); } else { //all ok emit sendInfo("Downloader exiting with no errors"); //Read whatever is left tmpBuffer.append(reply->readAll()); file->write(tmpBuffer); file->close(); emit sendInfo("Handing off work to updater"); emit finisheddl(); } } else { if (!erroremitted) { emit sendInfo("Network err code: "+reply->errorString()); erroremitted=true; emit finisheddl(); } } }
int Lic::compute() { //int dimension = resolution->getValue(); int width = pixImgWidth->getValue(); int height = pixImgHeight->getValue(); int pix = pixelSize->getValue(); //float size = domainSize->getValue(); float sq = scaleQuad->getValue(); int num_triangles = 0; trivec triangles = trivec(); Patch *triPatch = new Patch(); coDoPolygons *polygons = 0; coDistributedObject *pInObj = 0; pInObj = polygonInPort->getCurrentObject(); if (pInObj != 0) { if (pInObj->isType("POLYGN")) { if (!(polygons = dynamic_cast<coDoPolygons *>(pInObj))) { // this should never occur cerr << "FATAL error: GetSubset::compute( ) dynamic cast failed in line " << __LINE__ << " of file " << __FILE__ << endl; } else ; } else { sendError("Did not receive a POLYGON object at port %s", polygonInPort->getName()); sendInfo("Did not receive a POLYGON object at port %s.", polygonInPort->getName()); return STOP_PIPELINE; } } doPolygons(&triPatch, triangles, &polygons, &num_triangles, sq); //coDoPixelImage* pixels = NULL; //doPixelImage(width, height, pix, &pixels); //coDoVec3* vectorData = NULL; //vectorData = vectorInPort->getCurrentObject(); //doConvolution(&triPatch, triangles, &polygons, vectorData, &pixels); //coDoTexture* texture = NULL; //doTexture(dimension, pix, &polygons, &pixels, &texture); delete triPatch; return SUCCESS; }
void ProjectBase::addResult(Result *result) { _results->addCase(result); emit sendInfo(Info(ListInfo::ADDEDPROBLEM,result->name())); //update GUI emit projectChanged(); emit addedResult(result); }
void ProjectBase::addProblem(Problem *problem) { HighTools::checkUniqueProblemName(this,problem,_problems); _problems->addCase(problem); //update GUI emit sendInfo(Info(ListInfo::ADDEDPROBLEM,problem->name())); emit projectChanged(); emit addedProblem(problem); }
void ReadN3s::param(const char *name, bool inMapLoading) { static char *resFileNameTmp = NULL; cerr << "\n ------- Parameter Callback for '" << name << "'" << endl; if (strcmp(name, resFileParam->getName()) == 0) { cerr << "begin scanning\n"; resfilename = resFileParam->getValue(); if (resfilename == NULL) return; if (resFileNameTmp == NULL) { resFileNameTmp = new char[strlen(resfilename) + 1]; strcpy(resFileNameTmp, resfilename); } else { if (strcmp(resFileNameTmp, resfilename) == 0) return; else { delete[] resFileNameTmp; resFileNameTmp = new char[strlen(resfilename) + 1]; strcpy(resFileNameTmp, resfilename); } } strcpy(infobuf, "Opening file "); strcat(infobuf, resfilename); sendInfo(infobuf); if ((fpres = fopen((char *)resfilename, "r")) == NULL) { strcpy(infobuf, "ERROR: Can't open file >> "); strcat(infobuf, resfilename); sendError(infobuf); return; } else { scanResultFile(); fclose(fpres); return; } } }
void ModifyAddPart::getNumOfVents() { int i; numVents = 0; for (i = 0; i < MAX_VENTS; i++) { if (exist[i] == 1) numVents++; } sprintf(buf, ":::::::::::::Detected %d attached vents\n", numVents); sendInfo(buf); }
void Camera::feedImages() { FlyCapture2::Error error; unsigned int pair_id = 0; while (ok) { unsigned char *img_frame = NULL; uint32_t bytes_used; // Retrieve an image error = cam.RetrieveBuffer( &rawImage ); if (error != FlyCapture2::PGRERROR_OK) { // PrintError( error ); continue; } ros::Time capture_time = ros::Time::now(); // Convert the raw image error = rawImage.Convert( FlyCapture2::PIXEL_FORMAT_RGB, &convertedImage ); if (error != FlyCapture2::PGRERROR_OK) { // PrintError( error ); continue; } ImagePtr image(new Image); image->height = convertedImage.GetRows(); image->width = convertedImage.GetCols(); image->step = convertedImage.GetStride(); image->encoding = image_encodings::RGB8; image->header.stamp = capture_time; image->header.seq = pair_id; image->header.frame_id = frame; int data_size = convertedImage.GetDataSize(); image->data.resize(data_size); memcpy(&image->data[0], convertedImage.GetData(), data_size); pub.publish(image); sendInfo(image, capture_time); } }
void ImProxy::readyRead(s8 *buf, u32 len) { for (s8 *end = buf + len; buf < end && MSG(buf)->len && MSG(buf)->len <= (end - buf); buf += MSG(buf)->len) { if (mMsgWaitState == WaitingMessage && mMsgWaitType == MSG(buf)->type) mMsgWaitState = GotMessage; if (!mConnected && MSG(buf)->type != Connect) continue; switch (MSG(buf)->type) { case Connect: mConnected = true; mRawInput = MSG(buf)->raw; sendInfo(); break; case PutText: if (MSG(buf)->len > OFFSET(Message, texts)) { mShell->imInput(MSG(buf)->texts, MSG(buf)->len - OFFSET(Message, texts)); } break; case SetWin: if (MSG(buf)->len == sizeof(Message)) { // keep compatibility with v1.5 setImWin(MSG(buf)->win.winid, MSG(buf)->win.rect); } sendAckWin(); break; case FillRect: if (addWinMsg(MSG(buf)) && FbShellManager::instance()->activeShell() == mShell) { doFillRect(MSG(buf)); } break; case DrawText: if (addWinMsg(MSG(buf)) && FbShellManager::instance()->activeShell() == mShell) { doDrawText(MSG(buf)); } break; case Ping: sendAckPing(); break; default: break; } } }
void Camera::feedImages() { unsigned int pair_id = 0; while (ok) { unsigned char *img_frame = NULL; uint32_t bytes_used; ros::Time capture_time = ros::Time::now(); int idx = cam->grab(&img_frame, bytes_used); /* Read in every frame the camera generates, but only send each * (skip_frames + 1)th frame. It's set up this way just because * this is based on Stereo... */ if (skip_frames == 0 || frames_to_skip == 0) { if (img_frame) { ImagePtr image(new Image); image->height = height; image->width = width; image->step = 3 * width; image->encoding = image_encodings::RGB8; image->header.stamp = capture_time; image->header.seq = pair_id; image->header.frame_id = frame; image->data.resize(image->step * image->height); memcpy(&image->data[0], img_frame, width*height * 3); pub.publish(image); sendInfo(image, capture_time); ++pair_id; } frames_to_skip = skip_frames; } else { frames_to_skip--; } if (img_frame) cam->release(idx); } }
void ReadN3s::createCoviseUnsgrd() { // get the COVISE output object name from the controller unsgridObjectName = (char *)unsgridPort->getObjName(); unsgridObject = new coDoUnstructuredGrid(unsgridObjectName, num_elements, num_elements * (dim + 1), num_nodes, 1); unsgridObject->getTypeList(&tl); unsgridObject->getAddresses(&el, &vl, &x, &y, &z); unsgridPort->setCurrentObject(unsgridObject); if (dim == 3) sprintf(infobuf, "found %d coordinates, %d tetrahedra", num_nodes, num_elements); else sprintf(infobuf, "found %d coordinates, %d triangles", num_nodes, num_elements); sendInfo(infobuf); }
/** * returns a container with results file data */ void ReadFamu::sendResultsToPorts(ResultsFileData *resultsFileData, MeshDataTrans * /*meshDataTrans*/) { int noOfTimeSteps = resultsFileData->getNoOfTimeSteps(); int noOfDataTypes = resultsFileData->getNoOfDataTypes(0); noOfDataTypes = noOfDataTypes > NUMRES ? NUMRES : noOfDataTypes; int n; for (n = 0; n < noOfDataTypes; n++) { // collect all timesteps of a DataType in a dataSet // and send the dataSet to _dataPort[dataTypeNo] std::string dtName = resultsFileData->getDataTypeName(0, n); const char *cName = dtName.c_str(); sendInfo("DataValue %d :%s", n, cName); coDistributedObject **dataObjs = new coDistributedObject *[noOfTimeSteps + 1]; int i; for (i = 0; i < noOfTimeSteps; i++) { dataObjs[i] = resultsFileData->getDataObject(n, i); } dataObjs[noOfTimeSteps] = NULL; // send the DataTypes to _dataPort[] coDoSet *dataSet = new coDoSet(_dataPort[n]->getObjName(), dataObjs); if (noOfTimeSteps > 1) { dataSet->addAttribute("TIMESTEP", "1 10"); if (_periodicAngle->getValue() > 0 && _periodicTimeSteps->getValue() == 0) { int num = (int)(360.0 / _periodicAngle->getValue()); char attrValue[200]; sprintf(attrValue, "%d %f", num - 1, _periodicAngle->getValue()); dataSet->addAttribute("MULTIROT", attrValue); } } delete[] dataObjs; // Assign sets to output ports: _dataPort[n]->setCurrentObject(dataSet); } }
bool UFunctionSeq::addCmdLine(UServerInMsg * msg, const char * line) { FILE * errLog; bool result = true; int m, i = 0; const int MRL = 300; char reply[MRL]; const char * logName = "errLog.log"; bool isOK; // make a file for syntax error etc errLog = fopen(logName, "w"); isOK = seq->add(line, errLog, &m); if (errLog != NULL) fclose(errLog); if (not isOK) { if (errLog != NULL) { // open for read of messages errLog = fopen(logName, "r"); while (fgets(reply, MRL, errLog) != NULL) { // send all warning lines sendWarning(msg, reply); i++; } fclose(errLog); } if ((errLog == NULL) or (i == 0)) { snprintf(reply, MRL, "Syntax error line %d, but no log - line will be ignored", m); sendWarning(msg, reply); } } else { snprintf(reply, MRL, "added as line %d", m); sendInfo(msg, reply); } // return result; }