Discussion:
net.connman.Service setProperty
(too old to reply)
Francesco Bruno
2015-10-12 13:30:31 UTC
Permalink
Dear All, 

I'm trying to set the Ipv4 configuration using the setProperty in the intefarce net.connman.Service.

The documentation says that the the data passed to the interface must be a dict with same values as IPv4 property.
So I've created a GVariant of type a{sv}  i.e. an array of dict entries made of a string and a variance.

Calling setProperty on  services ( not connected  ) do not change the configuration as expected.

What am I doing wrong? I suspect wrong data definition for the configuration.  

Thanks in advance

Below some code


GVariant * iResVar = NULL;
GVariant * iVarArr[4];
iVarArr[0] = g_variant_new_dict_entry( g_variant_new_string( "Method" ), g_variant_new_variant( g_variant_new_string( "manual" ) ) );
iVarArr[1] = g_variant_new_dict_entry( g_variant_new_string( "Address ), g_variant_new_variant( g_variant_new_string( "127.0.0.1" ) ) );
iVarArr[2] = g_variant_new_dict_entry( g_variant_new_string( "Netmask" ), g_variant_new_variant( g_variant_new_string( "255.255.255.0" ) ) );
iVarArr[3] = g_variant_new_dict_entry( g_variant_new_string( "Gateway" ), g_variant_new_variant( g_variant_new_string( "1.2.3.4" ) ) );
iResVar = g_variant_new_variant( g_variant_new_array ( ((const GVariantType *) "{sv}"), iVarArr, 4 ) );


    net_connman_service_call_set_property_sync(
NET_CONNMAN_SERVICE ( pServiceProxy ),
"IPv4.Configuration", iResVal, NULL, &iError );
Adam Moore
2015-10-12 19:28:22 UTC
Permalink
I¹m not sure if this will do it, but in my agent¹s RequestInput method
implementation, which expects a dictionary, I had to wrap it in a tuple.
This might be worth a quick try:

GVariant *set_property_with_me = g_variant_new_tuple(&iResVar, 1); //
Now returning ({sv})


On 10/12/15, 6:30 AM, "connman on behalf of Francesco Bruno"
<connman-***@connman.net on behalf of ***@hotmail.com> wrote:

>Dear All,
>
>I'm trying to set the Ipv4 configuration using the setProperty in the
>intefarce net.connman.Service.
>
>The documentation says that the the data passed to the interface must be
>a dict with same values as IPv4 property.
>So I've created a GVariant of type a{sv} i.e. an array of dict entries
>made of a string and a variance.
>
>Calling setProperty on services ( not connected ) do not change the
>configuration as expected.
>
>What am I doing wrong? I suspect wrong data definition for the
>configuration.
>
>Thanks in advance
>
>Below some code
>
>
> GVariant * iResVar = NULL;
> GVariant * iVarArr[4];
> iVarArr[0] = g_variant_new_dict_entry( g_variant_new_string( "Method"
>), g_variant_new_variant( g_variant_new_string( "manual" ) ) );
> iVarArr[1] = g_variant_new_dict_entry( g_variant_new_string( "Address ),
>g_variant_new_variant( g_variant_new_string( "127.0.0.1" ) ) );
> iVarArr[2] = g_variant_new_dict_entry( g_variant_new_string( "Netmask"
>), g_variant_new_variant( g_variant_new_string( "255.255.255.0" ) ) );
> iVarArr[3] = g_variant_new_dict_entry( g_variant_new_string( "Gateway"
>), g_variant_new_variant( g_variant_new_string( "1.2.3.4" ) ) );
> iResVar = g_variant_new_variant( g_variant_new_array ( ((const
>GVariantType *) "{sv}"), iVarArr, 4 ) );
>
>
> net_connman_service_call_set_property_sync(
> NET_CONNMAN_SERVICE ( pServiceProxy ),
> "IPv4.Configuration", iResVal, NULL, &iError );
>_______________________________________________
>connman mailing list
>***@connman.net
>https://lists.connman.net/mailman/listinfo/connman


Statement of Confidentiality

The contents of this e-mail message and any attachments are confidential and are intended solely for the addressee. The information may also be legally privileged. This transmission is sent in trust, and the sole purpose of delivery to the intended recipient. If you have received this transmission in error, any use, reproduction or dissemination of this transmission is strictly prohibited. If you are not the intended recipient, please immediately notify the sender by reply e-mail or at 508.683.2500 and delete this message and its attachments, if any.
f***@hotmail.com
2015-10-13 04:22:09 UTC
Permalink
Thanks.

Are you able to change IPv4 configuration? I'm getting not supported error.

It doesn't work even with python test application. The service stucks in configuraton state and the method cannot be changed in anything but off.


Any idea?


Thanks.


Francesco Bruno





On Mon, Oct 12, 2015 at 12:28 PM -0700, "Adam Moore" <***@savantsystems.com> wrote:
I¹m not sure if this will do it, but in my agent¹s RequestInput method
implementation, which expects a dictionary, I had to wrap it in a tuple.
This might be worth a quick try:

GVariant *set_property_with_me = g_variant_new_tuple(&iResVar, 1); //
Now returning ({sv})


On 10/12/15, 6:30 AM, "connman on behalf of Francesco Bruno"
<connman-***@connman.net on behalf of ***@hotmail.com> wrote:

>Dear All,
>
>I'm trying to set the Ipv4 configuration using the setProperty in the
>intefarce net.connman.Service.
>
>The documentation says that the the data passed to the interface must be
>a dict with same values as IPv4 property.
>So I've created a GVariant of type a{sv} i.e. an array of dict entries
>made of a string and a variance.
>
>Calling setProperty on services ( not connected ) do not change the
>configuration as expected.
>
>What am I doing wrong? I suspect wrong data definition for the
>configuration.
>
>Thanks in advance
>
>Below some code
>
>
> GVariant * iResVar = NULL;
> GVariant * iVarArr[4];
> iVarArr[0] = g_variant_new_dict_entry( g_variant_new_string( "Method"
>), g_variant_new_variant( g_variant_new_string( "manual" ) ) );
> iVarArr[1] = g_variant_new_dict_entry( g_variant_new_string( "Address ),
>g_variant_new_variant( g_variant_new_string( "127.0.0.1" ) ) );
> iVarArr[2] = g_variant_new_dict_entry( g_variant_new_string( "Netmask"
>), g_variant_new_variant( g_variant_new_string( "255.255.255.0" ) ) );
> iVarArr[3] = g_variant_new_dict_entry( g_variant_new_string( "Gateway"
>), g_variant_new_variant( g_variant_new_string( "1.2.3.4" ) ) );
> iResVar = g_variant_new_variant( g_variant_new_array ( ((const
>GVariantType *) "{sv}"), iVarArr, 4 ) );
>
>
> net_connman_service_call_set_property_sync(
> NET_CONNMAN_SERVICE ( pServiceProxy ),
> "IPv4.Configuration", iResVal, NULL, &iError );
>_______________________________________________
>connman mailing list
>***@connman.net
>https://lists.connman.net/mailman/listinfo/connman


Statement of Confidentiality

The contents of this e-mail message and any attachments are confidential and are intended solely for the addressee. The information may also be legally privileged. This transmission is sent in trust, and the sole purpose of delivery to the intended recipient. If you have received this transmission in error, any use, reproduction or dissemination of this transmission is strictly prohibited. If you are not the intended recipient, please immediately notify the sender by reply e-mail or at 508.683.2500 and delete this message and its attachments, if any.

_______________________________________________
connman mailing list
***@connman.net
https://lists.connman.net/mailman/listinfo/connman
Patrik Flykt
2015-10-13 08:30:19 UTC
Permalink
On Tue, 2015-10-13 at 04:22 +0000, ***@hotmail.com wrote:
> Thanks.
>
> Are you able to change IPv4 configuration? I'm getting not supported error.

'IPv4.Configuration' is the property to change. On low-level the
attribute is an 'sv' with the variant 'v' containing a dict which is of
the form 'a{sv}'. Look at the python example code in
test/set-ipv4-method and perhaps connmanctl C code in client/commands.c.

> It doesn't work even with python test application. The service stucks
> in configuraton state and the method cannot be changed in anything but
> off.

If a service looks like it is stuck in configuration state, start by
checking that a DHCP server is running in the network as the default
IPv4 configuration mechanism tries to use DHCP and will timeout in a bit
over a minute if none is found. If a service looks like it is stuck when
changing IPv4 configuration on a connected service, it sounds like a
bug.

HTH,

Patrik
Francesco Bruno
2015-10-13 10:44:55 UTC
Permalink
Thanks Patrik,

I've seen that the Connman version I'm working with is the 1.29 and that in 1.30 some fixs have been done on ipv4 configuration.
Maybe it is worth to update my version first.

Thanks & Regards

Francesco

----------------------------------------
> Subject: Re: net.connman.Service setProperty
> From: ***@linux.intel.com
> To: ***@connman.net
> Date: Tue, 13 Oct 2015 11:30:19 +0300
>
> On Tue, 2015-10-13 at 04:22 +0000, ***@hotmail.com wrote:
>> Thanks.
>>
>> Are you able to change IPv4 configuration? I'm getting not supported error.
>
> 'IPv4.Configuration' is the property to change. On low-level the
> attribute is an 'sv' with the variant 'v' containing a dict which is of
> the form 'a{sv}'. Look at the python example code in
> test/set-ipv4-method and perhaps connmanctl C code in client/commands.c.
>
>> It doesn't work even with python test application. The service stucks
>> in configuraton state and the method cannot be changed in anything but
>> off.
>
> If a service looks like it is stuck in configuration state, start by
> checking that a DHCP server is running in the network as the default
> IPv4 configuration mechanism tries to use DHCP and will timeout in a bit
> over a minute if none is found. If a service looks like it is stuck when
> changing IPv4 configuration on a connected service, it sounds like a
> bug.
>
> HTH,
>
> Patrik
>
> _______________________________________________
> connman mailing list
> ***@connman.net
> https://lists.connman.net/mailman/listinfo/connman
Loading...