guint32 mode;
};
+static void test_handle_test_mode_on_thread_func(gpointer user_data);
+
+static void test_handle_test_mode_off_thread_func(gpointer user_data);
+
static void test_handle_sim_test_thread_func(gpointer user_data);
static void test_handle_prbs_test_thread_func(gpointer user_data);
static void test_handle_set_ee_data_thread_func(gpointer user_data);
+static gboolean test_handle_test_mode_on(NetNfcGDbusTest * test, GDBusMethodInvocation * invocation, GVariant * smack_privilege, gpointer user_data);
+
+static gboolean test_handle_test_mode_off(NetNfcGDbusTest * test, GDBusMethodInvocation * invocation, GVariant * smack_privilege, gpointer user_data);
+
static gboolean test_handle_sim_test(NetNfcGDbusTest * test, GDBusMethodInvocation * invocation, GVariant * smack_privilege, gpointer user_data);
static gboolean test_handle_prbs_test(NetNfcGDbusTest * test, GDBusMethodInvocation * invocation, guint32 arg_tech, guint32 arg_rate, GVariant * smack_privilege, gpointer user_data);
static NetNfcGDbusTest *test_skeleton = NULL;
/* LCOV_EXCL_START */
+static void test_handle_test_mode_on_thread_func(gpointer user_data)
+{
+ TestData *data = (TestData *) user_data;
+ net_nfc_error_e result = NET_NFC_OK;
+
+ g_assert(data != NULL);
+ g_assert(data->test != NULL);
+ g_assert(data->invocation != NULL);
+
+ net_nfc_controller_test_mode_on(&result);
+
+ net_nfc_gdbus_test_complete_test_mode_on(data->test, data->invocation, (gint) result);
+
+ g_object_unref(data->invocation);
+ g_object_unref(data->test);
+
+ g_free(data);
+}
+
+static void test_handle_test_mode_off_thread_func(gpointer user_data)
+{
+ TestData *data = (TestData *) user_data;
+ net_nfc_error_e result = NET_NFC_OK;
+
+ g_assert(data != NULL);
+ g_assert(data->test != NULL);
+ g_assert(data->invocation != NULL);
+
+ net_nfc_controller_test_mode_off(&result);
+
+ net_nfc_gdbus_test_complete_test_mode_off(data->test, data->invocation, (gint) result);
+
+ g_object_unref(data->invocation);
+ g_object_unref(data->test);
+
+ g_free(data);
+}
+
static void test_handle_sim_test_thread_func(gpointer user_data)
{
TestData *data = (TestData *) user_data;
g_free(data);
}
+static gboolean test_handle_test_mode_on(NetNfcGDbusTest * test, GDBusMethodInvocation * invocation, GVariant * smack_privilege, gpointer user_data)
+{
+ TestData *data = NULL;
+ gint result;
+
+ INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
+
+ /* check privilege and update client context */
+ if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC) == false) {
+ DEBUG_ERR_MSG("permission denied, and finished request");
+ result = NET_NFC_PERMISSION_DENIED;
+
+ goto ERROR;
+ }
+
+ DEBUG_SERVER_MSG("test_mode_on");
+
+ data = g_try_new0(TestData, 1);
+ if (data == NULL) {
+ DEBUG_ERR_MSG("Memory allocation failed");
+ result = NET_NFC_ALLOC_FAIL;
+
+ goto ERROR;
+ }
+
+ data->test = g_object_ref(test);
+ data->invocation = g_object_ref(invocation);
+
+ if (net_nfc_server_controller_async_queue_push(test_handle_test_mode_on_thread_func, data) == FALSE) {
+ /* return error if queue was blocked */
+ DEBUG_SERVER_MSG("controller is processing important message..");
+ result = NET_NFC_BUSY;
+
+ goto ERROR;
+ }
+
+ return TRUE;
+
+ ERROR:
+ if (data != NULL) {
+ g_object_unref(data->invocation);
+ g_object_unref(data->test);
+
+ g_free(data);
+ }
+
+ net_nfc_gdbus_test_complete_test_mode_on(test, invocation, result);
+
+ return TRUE;
+}
+
+static gboolean test_handle_test_mode_off(NetNfcGDbusTest * test, GDBusMethodInvocation * invocation, GVariant * smack_privilege, gpointer user_data)
+{
+ TestData *data = NULL;
+ gint result;
+
+ INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
+
+ /* check privilege and update client context */
+ if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC) == false) {
+ DEBUG_ERR_MSG("permission denied, and finished request");
+ result = NET_NFC_PERMISSION_DENIED;
+
+ goto ERROR;
+ }
+
+ DEBUG_SERVER_MSG("test_mode_off");
+
+ data = g_try_new0(TestData, 1);
+ if (data == NULL) {
+ DEBUG_ERR_MSG("Memory allocation failed");
+ result = NET_NFC_ALLOC_FAIL;
+
+ goto ERROR;
+ }
+
+ data->test = g_object_ref(test);
+ data->invocation = g_object_ref(invocation);
+
+ if (net_nfc_server_controller_async_queue_push(test_handle_test_mode_off_thread_func, data) == FALSE) {
+ /* return error if queue was blocked */
+ DEBUG_SERVER_MSG("controller is processing important message..");
+ result = NET_NFC_BUSY;
+
+ goto ERROR;
+ }
+
+ return TRUE;
+
+ ERROR:
+ if (data != NULL) {
+ g_object_unref(data->invocation);
+ g_object_unref(data->test);
+
+ g_free(data);
+ }
+
+ net_nfc_gdbus_test_complete_test_mode_off(test, invocation, result);
+
+ return TRUE;
+}
+
static gboolean test_handle_sim_test(NetNfcGDbusTest * test, GDBusMethodInvocation * invocation, GVariant * smack_privilege, gpointer user_data)
{
TestData *data = NULL;
test_skeleton = net_nfc_gdbus_test_skeleton_new();
+ g_signal_connect(test_skeleton, "handle-test-mode-on", G_CALLBACK(test_handle_test_mode_on), NULL);
+
+ g_signal_connect(test_skeleton, "handle-test-mode-off", G_CALLBACK(test_handle_test_mode_off), NULL);
+
g_signal_connect(test_skeleton, "handle-sim-test", G_CALLBACK(test_handle_sim_test), NULL);
g_signal_connect(test_skeleton, "handle-prbs-test", G_CALLBACK(test_handle_prbs_test), NULL);