当前位置: 首页>>代码示例>>C++>>正文


C++ QSerialPortInfo::productIdentifier方法代码示例

本文整理汇总了C++中QSerialPortInfo::productIdentifier方法的典型用法代码示例。如果您正苦于以下问题:C++ QSerialPortInfo::productIdentifier方法的具体用法?C++ QSerialPortInfo::productIdentifier怎么用?C++ QSerialPortInfo::productIdentifier使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QSerialPortInfo的用法示例。


在下文中一共展示了QSerialPortInfo::productIdentifier方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: foreach

 foreach (const QSerialPortInfo &info, BlinkyTape::findBlinkyTapeBootloaders()) {
     report.append("  " + info.portName() + "\r");
     report.append("    Manufacturer: " + info.manufacturer() + "\r");
     report.append("    Description: " + info.description() + "\r");
     report.append("    VID: 0x" + QString::number(info.vendorIdentifier(),16) + "\r");
     report.append("    PID: 0x" + QString::number(info.productIdentifier(),16) + "\r");
 }
开发者ID:invariant,项目名称:PatternPaint,代码行数:7,代码来源:systeminformation.cpp

示例2: foreach

 //  Found the available ports, associated vendor id and product id
 foreach(const QSerialPortInfo &serialPortInfo, QSerialPortInfo::availablePorts()){
     if(serialPortInfo.hasVendorIdentifier() && serialPortInfo.hasProductIdentifier()){
         if(serialPortInfo.vendorIdentifier() == found_vendorID){
             if(serialPortInfo.productIdentifier() == found_productID){
                 arm_portname = serialPortInfo.portName();
                 arm_port_is_available = true;
             }
         }
     }
 }
开发者ID:lamarts,项目名称:Tiva-TM4C-ARM-Coretex-M4-UART---Qt-C-GUI,代码行数:11,代码来源:mainwindowMac.cpp

示例3: setToolTip

void StatusBar::setToolTip(const QSerialPort *port)
{

    QSerialPortInfo info = QSerialPortInfo(*port);
    if (info.isValid()) {
        QString deviceInfo = QString("%1 %2\n%3:%4 "
#if QT_VERSION < QT_VERSION_CHECK(5, 3, 0)
                                     )
#else
                                     "# %5")
#endif
                                 .arg(info.manufacturer())
                                 .arg(info.description())
                                 .arg(info.vendorIdentifier())
                                 .arg(info.productIdentifier())
#if QT_VERSION < QT_VERSION_CHECK(5, 3, 0)
                ;
#else
                                 .arg(info.serialNumber());
开发者ID:Arento,项目名称:CuteCom,代码行数:19,代码来源:statusbar.cpp

示例4: main

int main(int argc, char *argv[])
{
    QCoreApplication app(argc, argv);

    // Get list of all serial ports
    QList<QSerialPortInfo> serialInfoList = QSerialPortInfo::availablePorts();
    qDebug();
    if (!serialInfoList.size() > 0)
    {
        qDebug() << "no serial ports found";
        return app.exec();
    }
    else
    {
        qDebug() << "List all serial ports";
        qDebug() << "---------------------";
        for (int i=0; i<serialInfoList.size(); i++)
        {
            QSerialPortInfo serialInfo = serialInfoList.at(i);
            qDebug() << "port: " << i;
            qDebug() << "  name:          " << serialInfo.portName();
            qDebug() << "  description:   " << serialInfo.description();
            qDebug() << "  manufacturer:  " << serialInfo.manufacturer();
            //qDebug() << "  serial Number: " << serialInfo.serialNumber();
            if (serialInfo.hasVendorIdentifier())
            {
                qDebug() << "  vendorId:     " << serialInfo.vendorIdentifier();
            }
            if (serialInfo.hasProductIdentifier())
            {
                qDebug() << "  producId:     " << serialInfo.productIdentifier();
            }
            qDebug();
        }
    }

    qDebug() << "opening panels controller";
    QSerialPortInfo serialInfo = serialInfoList.at(0);
    bias::PanelsController pcontrol(serialInfo);
    bool isOpen = pcontrol.open();
    if (!isOpen)
    {
        qDebug() << "  unable to open device";
        return app.exec();
    }
    qDebug() << "  device opened";

     if (true)
    {
        qDebug() << "  blink led";
        pcontrol.blinkLED();
        QThread::msleep(4000);
    }

    // Test allOn, allOff 
     if (true)
    {
        for (int i=0; i<5; i++)
        {
            qDebug() << "  all on";
            pcontrol.allOn();
            QThread::msleep(500);
            qDebug() << "  all off";
            pcontrol.allOff();
            QThread::msleep(500);
        }
    }

    // Test setToGrayLevel
     if (true)
    {
        for (int i=0; i<2; i++)
        {
            for (int j=1; j<bias::PanelsController::NUM_GRAY_LEVEL; j++)
            {
                qDebug() << "  set to gray level = " << j;
                pcontrol.setToGrayLevel(j);
                QThread::msleep(100);
            }
            for (int j=bias::PanelsController::NUM_GRAY_LEVEL-1; j>=0; j--) 
            {
                qDebug() << "  set to gray level = " << j;
                pcontrol.setToGrayLevel(j);
                QThread::msleep(100);
            }
        }
    }

    // Test setConfigID
     if (true)
    {
        int id = 1;
        qDebug() << "  set config id = " << id;
        pcontrol.setConfigID(id);
        QThread::msleep(1000);
    }


    // Test setPatternID 
    if (true)
//.........这里部分代码省略.........
开发者ID:janelia-idf,项目名称:bias,代码行数:101,代码来源:test_panels_controller.cpp

示例5: startUpload

bool BlinkyPendantUploader::startUpload(BlinkyController &controller,
                                        QList<PatternWriter> &patternWriters)
{
    // TODO: push the image conversions into here so they are less awkward.
    #define PIXEL_COUNT 10

    // Probe for the blinkypendant version
    // TODO: Update the firmware first!
    QSerialPortInfo portInfo;
    if (!controller.getPortInfo(portInfo)) {
        errorString = "Couln't get port information!";
        return false;
    }

    int version = getVersionForDevice(portInfo.vendorIdentifier(),
                                      portInfo.productIdentifier());

    QByteArray data;
    if (version == BLINKY_PENDANT_VERSION_1) {
        qDebug() << "Using version 1 upload mechanism, please update firmware!";

        // Make sure we have an image compatible with the BlinkyPendant
        if (patternWriters.front().getLedCount() != 10) {
            errorString = "Wrong pattern size- must be 10 pixels high!";
            return false;
        }
        if (patternWriters.front().getEncoding() != PatternWriter::RGB24) {
            errorString = "Wrong encoding type- must be RGB24!";
            return false;
        }

        if(patternWriters.front().getFrameCount() > 255) {
            errorString = "Pattern too long, must be < 256 frames";
            return false;
        }

        // Create the data structure to write to the device memory
        data.append((char)0x13);    // header
        data.append((char)0x37);
        data.append((char)patternWriters.front().getFrameCount());  // frame count
        data += patternWriters.front().getData();       // image data (RGB24, uncompressed)
    } else {
        // Create the data structure to write to the device memory
        // Animation table

        QByteArray patternData;

        data.append((char)0x31);    // header
        data.append((char)0x23);
        data.append((char)patternWriters.size()); // Number of patterns in the table
        data.append((char)PIXEL_COUNT);     // Number of LEDs in the pattern

        foreach (PatternWriter pattern, patternWriters) {
            // Make sure we have an image compatible with the BlinkyPendant
            if (pattern.getLedCount() != 10) {
                errorString = "Wrong pattern size- must be 10 pixels high!";
                return false;
            }
            if (pattern.getEncoding() != PatternWriter::RGB24) {
                errorString = "Wrong encoding type- must be RGB24!";
                return false;
            }

            if(pattern.getFrameCount() > 65535) {
                errorString = "Pattern too long, must be < 65535 frames";
                return false;
            }

            // Animation entry
            data.append((char)0);             // Encoding type (1 byte) (RGB24, uncompressed) (TODO)
            data += encodeInt(patternData.length());        // Data offset (4 bytes)
            data += encodeWord(pattern.getFrameCount());   // Frame count (2 bytes)
            data += encodeWord(0);                          // Frame delay (2 bytes) TODO

            // Make sure we have an image compatible with the BlinkyPendant
            patternData += pattern.getData();       // image data (RGB24, uncompressed)
        }

        data += patternData;
    }

    // TODO: Check if the data can fit in the device memory

    // Set up the commandQueue using the serial descriptor, and close the tape connection
    controller.close();
    commandQueue.open(portInfo);

    setProgress(0);

    // Queue the following commands:
    // 1. start write
    commandQueue.enqueue(BlinkyPendantCommands::startWrite());

    // 2-n. write data (aligned to 1024-byte sectors, 64 bytes at a time)
    commandQueue.enqueue(BlinkyPendantCommands::writeData(data));

    // n+1 stop write
    commandQueue.enqueue(BlinkyPendantCommands::stopWrite());

    return true;
//.........这里部分代码省略.........
开发者ID:dunk8888,项目名称:PatternPaint,代码行数:101,代码来源:blinkypendantuploader.cpp


注:本文中的QSerialPortInfo::productIdentifier方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。