void Interpreter::ProcessInstance(int argc, char *argv[]) { otError error = OT_ERROR_NONE; long value; if (argc == 0) { if (mInstance == NULL) { mServer->OutputFormat("No Instance Set\r\n"); } else { GUID aDeviceGuid = otGetDeviceGuid(mInstance); uint32_t aCompartment = otGetCompartmentId(mInstance); mServer->OutputFormat("[%d] " GUID_FORMAT " (Compartment %u)\r\n", mInstanceIndex, GUID_ARG(aDeviceGuid), aCompartment); } } else { SuccessOrExit(error = ParseLong(argv[0], value)); VerifyOrExit(value >= 0 && value < mInstancesLength, error = OT_ERROR_INVALID_ARGS); mInstanceIndex = (uint8_t)value; mInstance = mInstances[mInstanceIndex].mInstance; } exit: AppendResult(error); }
void Interpreter::ProcessInstanceList(int argc, char *argv[]) { mServer->OutputFormat("%d instances found:\r\n", mInstancesLength); for (uint8_t i = 0; i < mInstancesLength; i++) { GUID aDeviceGuid = otGetDeviceGuid(mInstances[i].mInstance); uint32_t aCompartment = otGetCompartmentId(mInstances[i].mInstance); mServer->OutputFormat("[%d] " GUID_FORMAT " (Compartment %u)\r\n", i, GUID_ARG(aDeviceGuid), aCompartment); } }