Hello Jukka,

Is the Agent request input happens via a dictionary ?
I was able to register a agent handler & getting RequestInput from the ConnMan.
However I am unable to send out the passphrase out.

static DBusHandlerResult request_passkey_message(DBusConnection *conn, 
DBusMessage *msg)
{
        DBusMessage *reply;
        DBusError derr, error;
        const char *device;
        char passkey[17] = "micromax";
        const char *psk = "micromax";

        reply = dbus_message_new_method_return(msg);
        if (!reply)
                return DBUS_HANDLER_RESULT_NEED_MEMORY;

        dbus_error_init(&derr);
        if (!dbus_message_get_args(msg, &derr, DBUS_TYPE_OBJECT_PATH, &device,
                                                           DBUS_TYPE_INVALID)) {
                fprintf(stderr, "%s", derr.message);
                dbus_error_free(&derr);
                return  error_message(conn, msg, "net.connman.Error.Rejected",
                                        "Wrong signature");
        }

        if (device)
                printf("Device: %s\n", device);

        //memset(passkey, 0, sizeof(passkey));
        printf("Passkey sent over: %s\n", psk);

        dbus_message_append_args(reply, DBUS_TYPE_STRING, &psk, 
DBUS_TYPE_INVALID);

        dbus_connection_send(conn, reply, NULL);

        printf("reply success\n");

        dbus_message_unref(reply);

        return DBUS_HANDLER_RESULT_HANDLED;
}

I guess the passkey is currently sent out as a string & the ConnMan may not be 
able to accept it.
Not sure how to convert the input into a dictionary & append my passphrase into 
it.

I am able to print the service properly.

Please help me on this. Thanks.

Regards,
<Ram>

-----Original Message-----
From: connman [mailto:connman-boun...@connman.net] On Behalf Of Jukka Rissanen
Sent: Tuesday, March 17, 2015 7:53 PM
To: connman@connman.net
Subject: Re: connman connection policy

On ti, 2015-03-17 at 10:25 +0000, Kallumari Nagaraja Rao, RammohanX
wrote:
> This is what I tried doing it, I am very new to these stuffs :(
> 
> DBusMessage * agent_update_passphrase(DBusConnection *connection, char 
> * serv_str, char * pass) {
>       DBusMessage *message, *reply;
>       DBusError error;
>       DBusMessageIter iter;
>       DBusMessageIter args;
>       static char *path = NULL;
>       char *property = "Passphrase";
>       int type = DBUS_TYPE_STRING;
>       char *param = AGENT_PATH;
>       
>       path = g_strdup_printf("/net/connman/service/%s", serv_str);
>       message = dbus_message_new_method_call( CONNMAN_SERVICE,
>                                                                               
>         path,
>                                                                               
>         CONNMAN_AGENT_INTERFACE,
>                                                                               
>         "RequestInput" );

This is wrong. ConnMan will call RequestInput method so you will need to create 
a listener in your application for that. You are not suppose to call 
RequestInput in ConnMan as there will not be such method there.


Jukka


_______________________________________________
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman
_______________________________________________
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman

Reply via email to