Example #1
0
//-------------------------------------------------------------------------
bool DcBootControl::identify(QRtMidiDevIdent* id /*=0 */)
{
    bool rtval = false;
    QRtAutoTrigger autotc("F0 7E .. 06 02 00 01 55",_pMidiIn);

    _pMidiOut->dataOut("F0 7E 7F 06 01 F7");

    // Wait for the response data, or timeout after 300ms
    if(autotc.wait(3000))
    {
        if(id)
        {
            QRtMidiData md;
            if(autotc.dequeue(md))
            {
                id->fromIdentData(md);
                DCLOG() << id->toString() << "\n";
                rtval = true;
            }
        }
        else
        {
            rtval = true;
        }
    }
    else
    {
        _lastErrorMsg << "Timeout waiting for identity response";
    }

    return rtval;
}
Example #2
0
//-------------------------------------------------------------------------
bool DcBootControl::exitBoot( QRtMidiDevIdent* id /*= 0*/ )
{
    bool rtval = false;


    // Setup to wait for Strymon identity data
    QRtAutoTrigger autotc("F0 7E .. 06 02 00 01 55",_pMidiIn);

    _pMidiOut->dataOut("F0 00 01 55 42 01 F7");

    // Wait 4 seconds for the response data
    if(autotc.wait(4000))
    {
        rtval = true;

        if(id)
        {
            QRtMidiData md;
            if(autotc.dequeue(md))
            {
                id->fromIdentData(md);
            }
            else
            {
                rtval  = false;
            }
        }
    }

    return rtval;
}
Example #3
0
//-------------------------------------------------------------------------
bool DcBootControl::isBootcode()
{
    QRtAutoTrigger autotc(RESPONCE_BANK_INFO_ANY,_pMidiIn);
    _pMidiOut->dataOut(CMD_GET_BANK0_INFO);

    bool rtval = autotc.wait(400);

    return rtval;
}
Example #4
0
//-------------------------------------------------------------------------
bool DcBootControl::getBootCodeInfo(DcBootCodeInfo& bcInfo)
{
    DcCodeBankInfo codeInfo;

    if(!isBootcode())
    {
        return false;
    }
    else
    {

        QRtMidiDevIdent id;
        if(identify(&id))
        {
            bcInfo.setVersion(id.FwVersion);
        }

        QRtAutoTrigger autotc(RESPONCE_BANK_INFO_ANY,_pMidiIn);
        _pMidiOut->dataOut(CMD_GET_BANK0_INFO);

        if(!autotc.wait(500))
        {
            codeInfo.clear();
        }
        else
        {
            QRtMidiData md;
            autotc.dequeue(md);
            codeInfo.init(md);
        }

        bcInfo.setBank(0,codeInfo);
        _pMidiOut->dataOut(CMD_GET_BANK1_INFO);

        if(!autotc.wait(500))
        {
            codeInfo.clear();
        }
        else
        {
            QRtMidiData md;
            autotc.dequeue(md);
            codeInfo.init(md);
        }
        bcInfo.setBank(1,codeInfo);

    }

    return bcInfo.isOk();
}
Example #5
0
bool DcBootControl::identify(DcMidiDevIdent* id /*=0 */)
{
    bool rtval = false;
    DcAutoTrigger autotc(_blindMode ? "F0 7E .. 06" :  "F0 7E .. 06 02 00 01 55",_pMidiIn );
    _pMidiOut->dataOut( "F0 7E 7F 06 01 F7" );

    // Wait for the response data, or timeout after 300ms
    if( autotc.wait( 3000 ) )
    {
        if( id )
        {
            DcMidiData md;
            if( autotc.dequeue( md ) )
            {
                if( _blindMode && _pDevDetails && !_pDevDetails->isEmpty())
                {
                    
                    DcMidiDevIdent* dcid = static_cast<DcMidiDevIdent*>(_pDevDetails);
                    if( dcid )
                    {
                        *id = *dcid;
                        DCLOG() << "BootControl 'blind mode' Id Result: " << id->toString() << "\n";
                        rtval = true;
                    }
                    else
                    {
                        DCLOG() << "BootControl 'blind mode' FAIL\n";
                    }
                }
                else
                {
                    id->fromIdentData( md );
                    DCLOG() << "BootControl Id Result: " << id->toString() << "\n";
                    rtval = true;
                }
            }
        }
        else
        {
            rtval = true;
        }
    }
    else
    {
        _lastErrorMsg << "Timeout waiting for identity response in BootControl";
    }
    
    
    return rtval;
}
Example #6
0
bool DcBootControl::writeFirmwareUpdateMsg(QRtMidiData& msg,int timeOutMs /*= 2000*/)
{
    bool rtval = false;
    QRtAutoTrigger autotc(kFUResponcePattern,_pMidiIn);

    // Magic number 8 is the response control flags, a 3 will
    // deliver status.
    msg[8] = 0x03;

    _pMidiOut->dataOutSplit(msg,_maxDataOut,_delayBetweenDataOut);

    QRtMidiData md;


    // Wait for the response data, or timeout after 300ms
    if(autotc.wait(timeOutMs))
    {
        if(autotc.dequeue(md))
        {
            if(md == kFUGood)
            {
                rtval =  true;
            }
            else if(md == kFUBad)
            {
                DCLOG() << "kFUBad";
                _lastErrorMsg << "Device reject firmware command - BAD packet.";
            }
            else if(md == kFUFailed)
            {
                DCLOG() << "kFUFailed";
                _lastErrorMsg << "Device failed firmware command.";
            }
            else
            {
                DCLOG() << "Unknown response: " << md.toString(' ') << "\n";
                _lastErrorMsg << "Firmware write generated an unknown response from the device.";
            }
        }
    }
    else
    {
        DCLOG() << "Timeout waiting on " << msg.toString(' ') << "\n";
        _lastErrorMsg << "Firmware update failure - timeout after write command.\n" << msg.toString(' ').mid(15,38);
    }

    return rtval;
}
Example #7
0
bool DcBootControl::writeFirmwareUpdateMsg(DcMidiData& msg,int timeOutMs /*= 2000*/)
{
    bool rtval = false;

    DcAutoTrigger autotc( _blindMode ? "F0 00 01 55" : kFUResponcePattern ,_pMidiIn );

    
    // Magic number 8 is the response control flags, a 3 will deliver status.
    msg[8] = 0x03;
//     if(_blindMode )
//     {
//         DCLOG() << "SEND: " << msg.toString(' ');
//     }
     _pMidiOut->dataOut(msg);

    DcMidiData md;

    // Wait for the response data, or timeout after 300ms
    if(autotc.wait(timeOutMs))
    {
        if(autotc.dequeue(md))
        {

          if(_blindMode )
            {
                if(md.match("F0 00 01 55 42 00") )
                {
                    md = kFUGood;
                }
                else if(md.match("F0 00 01 55 42 01") )
                {
                    DCLOG() << "RECVD: " << md.toString(' ');
                    md = kFUBad;
                }
                else if(md.match("F0 00 01 55 42 02"))
                {
                    DCLOG() << "RECVD: " << md.toString(' ');
                    md = kFUFailed;
                }
            }

            if( md == kFUGood )
            {
                rtval = true;
            }
            else if( md == kFUBad )
            {
                DCLOG() << "kFUBad";
                _lastErrorMsg << "Device reject firmware command - BAD packet.";
            }
            else if( md == kFUFailed )
            {
                DCLOG() << "kFUFailed";
                _lastErrorMsg << "Device failed firmware command.";
            }
            else
            {
                DCLOG() << "Unknown response: " << md.toString( ' ' ) << "\n";
                _lastErrorMsg << "Firmware write generated an unknown response from the device.";
            }
        }
    }
    else
    {
        DCLOG() << "Timeout waiting on " << msg.toString(' ') << "\n";
        _lastErrorMsg << "Firmware update failure - timeout after write command.\n" << msg.toString(' ').mid(15,38);
    }

    return rtval;
}