/* A dialog for getting/setting general info about a Make Controller */ Inspector::Inspector(MainWindow *mainWindow) : QDialog( 0 ) { this->mainWindow = mainWindow; setupUi(this); connect(this, SIGNAL(finished(int)), this, SLOT(onFinished())); connect(&infoTimer, SIGNAL(timeout()), this, SLOT(getBoardInfo())); connect(applyButton, SIGNAL(clicked()), this, SLOT(onApply())); connect(revertButton, SIGNAL(clicked()), this, SLOT(onRevert())); connect(nameEdit, SIGNAL(textEdited(QString)), this, SLOT(onAnyValueEdited())); connect(serialEdit, SIGNAL(textEdited(QString)), this, SLOT(onAnyValueEdited())); connect(versionEdit, SIGNAL(textEdited(QString)), this, SLOT(onAnyValueEdited())); connect(freememEdit, SIGNAL(textEdited(QString)), this, SLOT(onAnyValueEdited())); connect(ipEdit, SIGNAL(textEdited(QString)), this, SLOT(onAnyValueEdited())); connect(netmaskEdit, SIGNAL(textEdited(QString)), this, SLOT(onAnyValueEdited())); connect(gatewayEdit, SIGNAL(textEdited(QString)), this, SLOT(onAnyValueEdited())); connect(listenPortEdit, SIGNAL(textEdited(QString)), this, SLOT(onAnyValueEdited())); connect(sendPortEdit, SIGNAL(textEdited(QString)), this, SLOT(onAnyValueEdited())); connect(dhcpBox, SIGNAL(clicked(bool)), this, SLOT(onAnyValueEdited())); QSettings settings("MakingThings", "mchelper"); QPoint inspectorPos = settings.value("inspector_pos").toPoint(); if(!inspectorPos.isNull()) move(inspectorPos); resize(gridLayout->sizeHint()); }
static int getBoardType() { clearLastError(); int ret = -1; char info[2][32]; int boardType = getBoardInfo(2, info); if (boardType < 1) { return ret; } if (strncasecmp(info[0], "MINI6410", 8)==0) { ret = BOARD_MINI6410; } else if (strncasecmp(info[0], "MINI210", 7)==0) { ret = BOARD_MINI210; } else if (strncasecmp(info[0], "TINY4412", 8)==0) { ret = BOARD_TINY4412; } else if (strncasecmp(info[0], "sun8i", 5)==0) { ret = BOARD_NANOPI_M1; } else if (strncasecmp(info[0], "NANOPI2", 7)==0) { if (strncasecmp(info[1], "0000", 4)==0) { ret = BOARD_NANOPI_2; } else if (strncasecmp(info[1], "0004", 4)==0) { ret = BOARD_NANOPI_2_FIRE; } else if (strncasecmp(info[1], "0005", 4)==0) { ret = BOARD_NANOPI_M2; } else if (strncasecmp(info[1], "0001", 4)==0) { ret = BOARD_NANOPC_T2; } } else if(strncasecmp(info[0], "NANOPI3", 7)==0) { if (strncasecmp(info[1], "0007", 4)==0) { ret = BOARD_NANOPI_M3; } else if (strncasecmp(info[1], "0001", 4)==0) { ret = BOARD_NANOPC_T3; } } return ret; }
void Inspector::loadAndShow( ) { getBoardInfo(); infoTimer.start(1000); show(); }
// 初始化采集卡与摄像机 // 设置参数初始化 // 返回Status; int MicroDisplayInit::InitParameter(MicroDisplayInit& mdi) { #ifdef OUTPUT_DEBUG_INFO if (OUTPUT_DEBUG_INFO) { getBoardInfo(); } #endif int status = 0; char debugInfo[256]; // Initialization of the microEnable frame grabber if (mdi.colorType == GRAY) { if ((mdi.fg = Fg_Init(mdi.dllNameGRAY, mdi.nBoard)) == NULL) { return status; } //设置传输模式,设置后才为4k int _FG_CAMERA_LINK_CAMTYP = FG_CL_DUALTAP_8_BIT; if (Fg_setParameter(mdi.fg, FG_CAMERA_LINK_CAMTYP, &_FG_CAMERA_LINK_CAMTYP, mdi.nCamPort) < 0) { return status; } } else { if ((mdi.fg = Fg_Init(mdi.dllNameRGB, mdi.nBoard)) == NULL) { return status; } //TODO:添加传输模式的调整 //int _FG_CAMERA_LINK_CAMTYP = FG_CL_DUALTAP_8_BIT; //if (Fg_setParameter(mdi.fg, FG_CAMERA_LINK_CAMTYP, &_FG_CAMERA_LINK_CAMTYP, mdi.nCamPort) < 0) { // return status; //} } OutPutDebugInfo("Init Grabber ok"); //设置参数 int _FG_CAMERA_LINK_CAMTYP = FG_CL_DUALTAP_8_BIT; if (Fg_setParameter(mdi.fg, FG_CAMERA_LINK_CAMTYP, &_FG_CAMERA_LINK_CAMTYP, mdi.nCamPort) < 0) { return status; } if (Fg_setParameter(mdi.fg, FG_WIDTH, &mdi.width, mdi.nCamPort) < 0) { return status; } if (Fg_setParameter(mdi.fg, FG_HEIGHT, &mdi.height, mdi.nCamPort) < 0) { return status; } int bitAlignment = FG_LEFT_ALIGNED; if (Fg_setParameter(mdi.fg, FG_BITALIGNMENT, &bitAlignment, mdi.nCamPort) < 0) { return status; } sprintf(debugInfo, "Set Image Size on port %d (w: %d,h: %d) ok", mdi.nCamPort, mdi.width, mdi.height); OutPutDebugInfo(debugInfo); // Memory allocation int format = 0; Fg_getParameter(mdi.fg, FG_FORMAT, &format, mdi.nCamPort); size_t bytesPerPixel = 1; switch (format){ case FG_GRAY: bytesPerPixel = 1; break; case FG_GRAY16: bytesPerPixel = 2; break; case FG_COL24: bytesPerPixel = 3; break; case FG_COL32: bytesPerPixel = 4; break; case FG_COL30: bytesPerPixel = 5; break; case FG_COL48: bytesPerPixel = 6; break; } size_t totalBufSize = mdi.width*mdi.height*mdi.nr_of_buffer*bytesPerPixel; if ((mdi.pMem0 = Fg_AllocMemEx(mdi.fg, totalBufSize, mdi.nr_of_buffer)) == NULL){ return status; } else { sprintf(debugInfo, "%d framebuffer allocated for port %d ok", mdi.nr_of_buffer, mdi.nCamPort); OutPutDebugInfo(debugInfo); } return status; }