int _connection_libnet_get_profile_iterator(connection_iterator_type_e type, connection_profile_iterator_h* profile_iter_h)
{
int count = 0;
- int rv1, rv2, rv3, rv4;
+ int rv1, rv2, rv3, rv4, rv5;
net_profile_info_t *profiles = NULL;
struct _profile_list_s wifi_profiles = {0, 0, NULL};
struct _profile_list_s cellular_profiles = {0, 0, NULL};
struct _profile_list_s ethernet_profiles = {0, 0, NULL};
struct _profile_list_s bluetooth_profiles = {0, 0, NULL};
+ struct _profile_list_s mesh_profiles = {0, 0, NULL};
__libnet_clear_profile_list(&profile_iterator);
}
CONNECTION_LOG(CONNECTION_INFO, "Bluetooth profile count : %d", bluetooth_profiles.count);
+ rv5 = net_get_profile_list(NET_DEVICE_MESH, &mesh_profiles.profiles, &mesh_profiles.count);
+ if (rv5 == NET_ERR_ACCESS_DENIED) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
+ __libnet_clear_profile_list(&wifi_profiles);
+ return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
+ } else if (rv5 != NET_ERR_NO_SERVICE && rv5 != NET_ERR_NONE) {
+ __libnet_clear_profile_list(&wifi_profiles);
+ return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
+ }
+
+ CONNECTION_LOG(CONNECTION_INFO, "Mesh profile count: %d", mesh_profiles.count);
*profile_iter_h = &profile_iterator;
switch (type) {
case CONNECTION_ITERATOR_TYPE_REGISTERED:
- count = wifi_profiles.count + cellular_profiles.count + ethernet_profiles.count + bluetooth_profiles.count;
+ count = wifi_profiles.count + cellular_profiles.count + ethernet_profiles.count + bluetooth_profiles.count + mesh_profiles.count;
CONNECTION_LOG(CONNECTION_INFO, "Total profile count : %d", count);
if (count == 0)
return CONNECTION_ERROR_NONE;
__libnet_clear_profile_list(&cellular_profiles);
__libnet_clear_profile_list(ðernet_profiles);
__libnet_clear_profile_list(&bluetooth_profiles);
+ __libnet_clear_profile_list(&mesh_profiles);
return CONNECTION_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE
}
profiles += ethernet_profiles.count;
}
+ if (mesh_profiles.count > 0) {
+ memcpy(profiles, mesh_profiles.profiles,
+ sizeof(net_profile_info_t) * mesh_profiles.count);
+ profiles += mesh_profiles.count;
+ }
+
if (bluetooth_profiles.count > 0)
memcpy(profiles, bluetooth_profiles.profiles,
sizeof(net_profile_info_t) * bluetooth_profiles.count);
count += __libnet_get_connected_count(&cellular_profiles);
count += __libnet_get_connected_count(ðernet_profiles);
count += __libnet_get_connected_count(&bluetooth_profiles);
+ count += __libnet_get_connected_count(&mesh_profiles);
CONNECTION_LOG(CONNECTION_INFO, "Total connected profile count : %d", count);
if (count == 0)
return CONNECTION_ERROR_NONE;
__libnet_clear_profile_list(&cellular_profiles);
__libnet_clear_profile_list(ðernet_profiles);
__libnet_clear_profile_list(&bluetooth_profiles);
+ __libnet_clear_profile_list(&mesh_profiles);
return CONNECTION_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE
}
if (bluetooth_profiles.count > 0)
__libnet_copy_connected_profile(&profiles, &bluetooth_profiles);
+ if (mesh_profiles.count > 0)
+ __libnet_copy_connected_profile(&profiles, &mesh_profiles);
+
break;
case CONNECTION_ITERATOR_TYPE_DEFAULT:
count = __libnet_get_default_count(&cellular_profiles);
__libnet_clear_profile_list(&cellular_profiles);
__libnet_clear_profile_list(ðernet_profiles);
__libnet_clear_profile_list(&bluetooth_profiles);
+ __libnet_clear_profile_list(&mesh_profiles);
return CONNECTION_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE
}
__libnet_clear_profile_list(&cellular_profiles);
__libnet_clear_profile_list(ðernet_profiles);
__libnet_clear_profile_list(&bluetooth_profiles);
+ __libnet_clear_profile_list(&mesh_profiles);
profile_iterator.count = count;
net_profile_info_t *profile_info = profile;
- rv = net_open_connection_with_profile(profile_info->ProfileName);
+ if (profile_info->profile_type == NET_DEVICE_MESH)
+ rv = net_open_mesh_connection_with_profile(profile_info->ProfileName);
+ else
+ rv = net_open_connection_with_profile(profile_info->ProfileName);
+
if (rv == NET_ERR_ACCESS_DENIED) {
CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
net_profile_info_t *profile_info = profile;
- rv = net_close_connection(profile_info->ProfileName);
+ if (profile_info->profile_type == NET_DEVICE_MESH)
+ rv = net_close_mesh_connection(profile_info->ProfileName);
+ else
+ rv = net_close_connection(profile_info->ProfileName);
+
if (rv == NET_ERR_ACCESS_DENIED) {
CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE