The first function, BMCSSearchVariable(), searches for an exact match of the variable
name that you pass in. The second and third both perform partial matches. Notice that
BMCSSearchVal3() takes a VALMANSTRUCT reference as a parameter. In this case,
it is important that you know and understand the structure of a variable in MCS before
trying to use the function.
The following is an example that uses all three search functions as well as both the copy
and move function:
UCHAR attr, temp;
OBCD dat;
Cal_setn_OBC(5,&dat);
// Create x=5 in folder main
BMCSCreateVariable((CP_CHAR*)"main", (CP_CHAR*)"x", IMU_MCS_TypeReal,
// Create folder test
BMCSCreateFolder((CP_CHAR*)"test", &temp);
// Copy x to test
BMCSCopyVariable((CP_CHAR*)"main", (CP_CHAR*)"x", (CP_CHAR*)"test",
// Move x to test
BMCSMoveVariable((CP_CHAR*)"main", (CP_CHAR*)"x", (CP_CHAR*)"test",
// Search using the first search function.
// address of the variable if found.
UCHAR *ucDataTopAddress;
DWORD dwDataSize;
UCHAR *pucManTopAdr;
UCHAR ucValType;
if(BMCSSearchVariable((CP_CHAR*)"test",(CP_CHAR*)"moved x",
&ucValType,&pucManTopAdr, (UCHAR **)&ucDataTopAddress, &dwDataSize)!=0)
{
// not found!
}
else
{
// Create a variable using the address from the search function
BMCSCreateVariable((CP_CHAR*)"test",(CP_CHAR*)"found x1",
}
// The second search function returns the name of the found variable
// in a CP_CHAR buffer
CP_CHAR buffer[100];
if(BMCSSearchVal2((CP_CHAR*)"test",(CP_CHAR*)"moved ", buffer, 5) != 0)
{
// not found!
}
IMU_MCS_TypeReal,dwDataSize, (UCHAR *)&pucManTopAdr);
sizeof(OBCD), (UCHAR*)&dat);
(CP_CHAR*)"copied x");
(CP_CHAR*)"moved x");
This function returns the
115