CMD_PSK_ACTIVE,
CMD_PSK_PASSIVE2,
CMD_PSK_ACTIVE2,
+ CMD_OPEN_PASSIVE_RANGING,
+ CMD_OPEN_ACTIVE_RANGING,
CMD_INVALID,
};
= "PSK + Passive (Wrong password)",
[CMD_PSK_ACTIVE2]
= "PSK + Active (Wrong password)",
+ [CMD_OPEN_PASSIVE_RANGING]
+ = "Open + Passive + Ranging",
+ [CMD_OPEN_ACTIVE_RANGING]
+ = "Open + Active + Ranging",
[CMD_INVALID]
= NULL,
};
static GMainLoop *g_main_loop_p;
static bool g_initialized = false;
+static int g_min_distance = -1;
+static int g_max_distance = -1;
static wifi_aware_session_h g_wifi_aware_session = NULL;
static wifi_aware_subscribe_h g_subscribe_handle = NULL;
return false;
}
+ if (g_min_distance > 0) {
+ ret = wifi_aware_subscribe_set_min_distance(subscribe, g_min_distance);
+ if (ret == WIFI_AWARE_ERROR_NONE) {
+ printf("min distance: %d", g_min_distance);
+ }
+ else {
+ printf("Fail to set min distance\n");
+ return false;
+ }
+ }
+ if (g_max_distance > 0) {
+ ret = wifi_aware_subscribe_set_max_distance(subscribe, g_max_distance);
+ if (ret == WIFI_AWARE_ERROR_NONE) {
+ printf("max distance: %d", g_max_distance);
+ }
+ else {
+ printf("Fail to set max distance\n");
+ return false;
+ }
+ }
return true;
}
run_common();
}
+void test_open_passive_ranging()
+{
+ clear_resources();
+ g_sub_type = WIFI_AWARE_SUBSCRIBE_TYPE_PASSIVE;
+ g_security_type = WIFI_AWARE_SECURITY_TYPE_OPEN;
+ g_min_distance = 0;
+ g_max_distance = 10;
+ run_common();
+}
+
+void test_open_active_ranging()
+{
+ clear_resources();
+ g_sub_type = WIFI_AWARE_SUBSCRIBE_TYPE_ACTIVE;
+ g_security_type = WIFI_AWARE_SECURITY_TYPE_OPEN;
+ g_min_distance = 0;
+ g_max_distance = 10;
+ run_common();
+}
+
void test_init()
{
int ret = 0;
[CMD_PSK_ACTIVE] = test_psk_active,
[CMD_PSK_PASSIVE2] = test_psk_passive2,
[CMD_PSK_ACTIVE2] = test_psk_active2,
+ [CMD_OPEN_PASSIVE_RANGING] = test_open_passive_ranging,
+ [CMD_OPEN_ACTIVE_RANGING] = test_open_active_ranging,
[CMD_INVALID] = NULL,
};