/* Sanity Check: Validate the arguments */
if (ptrCLICfg == NULL)
return -1;
/* Cycle through and determine the number of supported CLI commands: */
for (index = 0; index < CLI_MAX_CMD; index++)
{
/* Do we have a valid entry? */
if (ptrCLICfg->tableEntry[index].cmd == NULL)
{
/* NO: This is the last entry */
break;
}
else
{
/* YES: Increment the number of CLI commands */
numCLICommands = numCLICommands + 1;
}
}
/* Execute All Radar Commands */
for (idx = 0; idx < MAX_RADAR_CMD; idx++)
{
/* Reset all the tokenized arguments: */
memset ((void *)&tokenizedArgs, 0, sizeof(tokenizedArgs));
argIndex = 0;
ptrCLICommand = (char*)radarCmdString[idx];
/* Set the CLI status: */
cliStatus = -1;
/* The command has been entered we now tokenize the command message */
while (1)
{
/* Tokenize the arguments: */
tokenizedArgs[argIndex] = strtok(ptrCLICommand, delimitter);
if (tokenizedArgs[argIndex] == NULL)
break;
/* Increment the argument index: */
argIndex++;
if (argIndex >= CLI_MAX_ARGS)
break;
/* Reset the command string */
ptrCLICommand = NULL;
}
/* Were we able to tokenize the CLI command? */
if (argIndex == 0)
continue;
/* Cycle through all the registered CLI commands: */
for (index = 0; index < numCLICommands; index++)
{
ptrCLICommandEntry = &ptrCLICfg->tableEntry[index];
/* Do we have a match? */
if (strcmp(ptrCLICommandEntry->cmd, tokenizedArgs[0]) == 0)
{
/* YES: Pass this to the CLI registered function */
cliStatus = ptrCLICommandEntry->cmdHandlerFxn (argIndex, tokenizedArgs);
if (cliStatus == 0)
{
CLI_write ("Done\n");
}
else
{
CLI_write ("Error %d\n", cliStatus);
}
break;
}
}
/* Did we get a matching CLI command? */
if (index == numCLICommands)
{
/* NO matching command found. Is the mmWave extension enabled? */
if (ptrCLICfg->enableMMWaveExtension == 1U)
{
/* Yes: Pass this to the mmWave extension handler */
cliStatus = CLI_MMWaveExtensionHandler (argIndex, tokenizedArgs);
}
/* Was the CLI command found? */
if (cliStatus == -1)
{
/* No: The command was still not found */
CLI_write ("'%s' is not recognized as a CLI command\n", tokenizedArgs[0]);
}
}
}
return 0;
}
void MmwDemo_Bypass_CLI (void)
{
if (CLI_ByPassApi(&gCLI.cfg) != 0)
{
System_printf ("Error: Unable to CLI_ByPassApi\n");
return;
}
return;