#include <glib.h>
#include <gio/gio.h>
#include "g_lib_to_work.h"

//call SERVICE OBJECT INTERFACE METHOD [SIGNATURE [ARGUMENT...]]

static
void Get_Call_Args(gchar **obj_name, gchar **obj_path, gchar **i_name, gchar** method_name, gchar** signature, char **argv){   
        *obj_name = argv[1];
        *obj_path = argv[2];
        *i_name = argv[3];
	*method_name = argv[4];
	*signature = argv[5];
        return 0;
}

int bus_call(int argc, char** argv){  

    

    GDBusProxy *proxy;
    GVariant *result;
    GError *error = NULL;

    
    gchar *obj_name;
    gchar *obj_path; 
    gchar *i_name; 
    gchar *method_name;
    gchar *signature;

    Get_Call_Args(&obj_name, &obj_path, &i_name, &method_name, &signature, argv);
    gchar** vals = argv + 6;

    

    proxy = g_dbus_proxy_new_for_bus_sync(G_BUS_TYPE_SESSION, 0, NULL, obj_name, 
                                                obj_path, i_name, 
                                                NULL, &error);
	
    GVariantType* type = g_variant_type_new(signature);
    GVariant* params = g_variant_new_va(type, (const gchar**)strings, sizeof(strings)/sizeof(gchar*), NULL);


    result = g_dbus_proxy_call_sync(proxy, method_name, 
                                    params , G_DBUS_CALL_FLAGS_NONE, 
                                    -1, NULL, &error);
    
    if(IsError(error)){
        g_object_unref(proxy);
        g_object_unref(result);
        FreeError(error);
        g_print("Error message %s \n", error->message);
        return 0;
    }

    GVariantIter *interfaces = g_variant_iter_new(result);
    const gchar *interface_name;

    g_variant_iter_next(interfaces, "s", &interface_name, NULL);
    printf(interface_name);

    g_object_unref(proxy);
    g_variant_unref(result);
    
    return 0;
}
опиши функцию