CAResult_t CAGetNetworkInfo(CALocalConnectivity_t **info, uint32_t *size)
{
- CAResult_t res = CA_STATUS_FAILED;
-
CALocalConnectivity_t *tempInfo[CA_CONNECTIVITY_TYPE_NUM];
uint32_t tempSize[CA_CONNECTIVITY_TYPE_NUM];
// #1. get information each adapter
uint8_t index = 0;
+ CAResult_t res = CA_STATUS_FAILED;
for (index = 0; index < CA_CONNECTIVITY_TYPE_NUM; index++)
{
if (g_adapterHandler[index].GetnetInfo != NULL)
if (resSize <= 0)
{
- res = CA_STATUS_FAILED;
- return res;
+ if (res == CA_ADAPTER_NOT_ENABLED || res == CA_NOT_SUPPORTED)
+ {
+ return res;
+ }
+ return CA_STATUS_FAILED;
}
// #3. add data into result
// memory allocation
- CALocalConnectivity_t *resInfo = (CALocalConnectivity_t *) OICCalloc(resSize, sizeof(CALocalConnectivity_t));
+ CALocalConnectivity_t *resInfo = (CALocalConnectivity_t *) OICCalloc(
+ resSize, sizeof(CALocalConnectivity_t));
CA_MEMORY_ALLOC_CHECK(resInfo);
uint8_t pos = 0;
*size = resSize;
}
- res = CA_STATUS_OK;
-
OIC_LOG(DEBUG, TAG, "each network info save success!");
-
- return res;
+ return CA_STATUS_OK;
// memory error label.
memory_error_exit:
VERIFY_NON_NULL(info, TAG, "info");
VERIFY_NON_NULL(size, TAG, "size");
- CAResult_t res = CA_STATUS_FAILED;
-
CALocalConnectivity_t *tempInfo[CA_CONNECTIVITY_TYPE_NUM] = { 0 };
uint32_t tempSize[CA_CONNECTIVITY_TYPE_NUM] = { 0 };
- uint8_t index = 0;
+ uint8_t index = 0;
+ CAResult_t res = CA_STATUS_FAILED;
// #1. get information each adapter
for (index = 0; index < CA_CONNECTIVITY_TYPE_NUM; index++)
{
if (resSize <= 0)
{
- return res;
+ if (CA_ADAPTER_NOT_ENABLED == res || CA_NOT_SUPPORTED == res)
+ {
+ return res;
+ }
+ return CA_STATUS_FAILED;
}
// #3. add data into result
if (CA_STATUS_OK == res)
{
- std::cout << "ok";
g_selectNetworkResult = res;
return CA_STATUS_OK;
}
else if (CA_NOT_SUPPORTED == res)
{
- std::cout << "not supported";
g_selectNetworkResult = res;
return CA_STATUS_OK;
}
CAResult_t res = CAGetNetworkInformation(&tempInfo, &tempSize);
if (CA_STATUS_OK == res || CA_ADAPTER_NOT_ENABLED == res ||
- CA_ADAPTER_NOT_ENABLED == res)
+ CA_NOT_SUPPORTED == res)
{
return CA_STATUS_OK;
}