Hi Ram,

On ke, 2015-03-18 at 13:12 +0000, Kallumari Nagaraja Rao, RammohanX
wrote:
> Hello Jukka,
> 
> Is the Agent request input happens via a dictionary ?

Yes, the passphrase is sent as a dictionary element. See
doc/agent-api.txt document for details (there are some examples at the
end of the document).

> 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 sure you can search the web for examples how to send a dictionary
in dbus from C-program.

> 
> I am able to print the service properly.
> 
> Please help me on this. Thanks.
> 
> Regards,
> <Ram>
> 


Jukka


_______________________________________________
connman mailing list
[email protected]
https://lists.connman.net/mailman/listinfo/connman

Reply via email to