//----------------------------- FUNCTION -------------------------------------*
BOOL
    DecodeCfgData(CByteArray const* pCfg,
                  CStringArray& aTexts, CUIntArray& aOffsets, CUIntArray& aLengths,
                  int& iTotalInputs, int& iTotalOutputs, int& iTotalInAndOuts, int& iSeq)
/*>>>> 
decode slave config data bytes to string

I   pCfg:       cfg data structure
O   aTexts:     array of texts to decoded config byte(s)
O   aOffsets:   array with start offsets of config sequence above
O   iTotalInputs    total bytes of inputs and outputs (incl. <iTotalInAndOuts> !)
O   iTotalOutputs
O   iTotalInAndOuts total bytes which allow input and output
0   iSeq        number of config sequences = number of entries in arrays
Result
    TRUE if ok 
<<<<*/
{
    int lenCfgData = pCfg->GetSize();
    BYTE*   pCfgData = (BYTE*) (pCfg->GetData());
    CString sCfgText;
    int     cntDecodedBytes;
    int     iOffset = 0;
    int     lenRead, lenWrite, lenReadAndWrite;
    BOOL    bConfigOK = TRUE;
    iTotalInputs    = 0;
    iTotalOutputs   = 0;
    iTotalInAndOuts = 0;
    iSeq            = 0;
    while (lenCfgData > 0)
    {
        cntDecodedBytes = 0;
        lenRead  = 0;
        lenWrite = 0;
        lenReadAndWrite = 0;
        if (::DecodeCfgBytes(pCfgData, sCfgText,
                             cntDecodedBytes, lenRead, lenWrite, lenReadAndWrite))
        {
            aTexts.SetAtGrow(iSeq, sCfgText);
            aOffsets.SetAtGrow(iSeq, iOffset);
            aLengths.SetAtGrow(iSeq, cntDecodedBytes);
            iOffset         += cntDecodedBytes;
            lenCfgData      -= cntDecodedBytes;
            iTotalInputs    += lenRead;
            iTotalOutputs   += lenWrite;
            iTotalInAndOuts += lenReadAndWrite;
            iSeq++;
        }
        else 
        {
            TRACE0("DecodeCfgData: Bad config data bytes\n");
            bConfigOK = FALSE;
            break;
        }
    };
    if (lenCfgData != 0)
    {
        ASSERT(FALSE);
        bConfigOK = FALSE;
    }

    return bConfigOK;
}