Skip to content

We have prepare function

If you have good function add here.

Split

Input variable

Name Type
inputText CdString
split char

Return type

CdStringArray

Split function

//Create empty string array 
CdStringArray OutputStringArray;

//Create temporary String variable
CdString temp;

temp.Empty();

//Add split char at the end of splited string to separate last position
inputText << split;

//Go throught each position in string and compare with split char.
//temp variable is used to store text between two split char.
for (int i = 0; i < inputText.GetLength(); i++) {
    if( ( inputText[i] == split) && ( !temp.IsEmpty() ) ) {
        OutputStringArray.Append(temp);
        temp.Empty();
    } else {
        temp << inputText[i];
    }
}

return OutputStringArray;

Component Rising

nput variables

Name Type
ComponentDI CpDiSpec::Base*
bArmNotif bool
nTimeMs long

return type

void

code

nothing rewrite

ComponentDI->aDisarmNotif().send();

CdDiNotifs oNotifs;
oNotifs.m_bOnRising = bArmNotif;
oNotifs.m_bOnFalling = !bArmNotif;

//if 0 is disable time out
if( nTimeMs > 0 ){
    oNotifs.m_fTimeoutInMs = nTimeMs;
}

ComponentDI->ArmSingleNotif(oNotifs).send();

Compare Array CdString with CdString(dmc scanned)

Code

You must rewrite large whole words

CdStringArray BarcodeDataSplitted = Split( M_XSBARCODEBOXOUTPUTS, '|' );

for (int i = 0; i < BarcodeDataSplitted.GetNoOfElems() ; i++) { 
    po_DLOG("SPLITFUNC") << "BarcodeDataSplitted[i] '" << BarcodeDataSplitted[i] << "' == '" << M_XSBARCODEOUTPUTBOX.Get() << "'" << CLOSELOG;
    if ( BarcodeDataSplitted[i] == M_XSBARCODEOUTPUTBOX.Get() ) {
        return true;
    }
}
M_XSBARCODEOUTPUTBOX = "";
return false;