Hi,
first and foremost: Thanks for all the good work.
I'm trying to use dbussy/ravel to interface ConnMan.
Since I'm new to all of them: ConnMan, D-Bus and Your code, there's little surprise in me having problems, sorry.
I am trying to do things stepwise and I have the following test code:
#!/usr/bin/python3
import asyncio
import ravel
import pprint
from logging import getLogger
log = getLogger('networks')
pp = pprint.PrettyPrinter(indent=4)
bus_name = "net.connman"
path_name = "/"
iface_name = "net.connman.Manager"
chime_signal_name = "chime"
loop = asyncio.get_event_loop()
bus = ravel.system_bus()
bus.attach_asyncio(loop)
server = loop.run_until_complete(bus.get_proxy_interface_async(destination=bus_name,
path="/",
interface=iface_name))
server = server(connection=bus.connection, dest=bus_name)
async def main():
print('===================================')
tl = await server['/'].GetTechnologies()
for p in tl[0]:
# pp.pprint(p)
print('-----------------------------------')
print(f'-- {p[1]["Name"][1]}: {p[0]} --')
print('===================================')
sl = await server['/'].GetServices()
for p in sl[0]:
# pp.pprint(p)
print('-----------------------------------')
print(f'-- {p[1]["Name"][1]}: {p[0]} --')
print('===================================')
for p in tl[0]:
pp.pprint(p)
if p[1]['Type'][1] == 'wifi':
print('-----------------------------------')
t = p[1]
print(f'-- {t["Name"][1]}: {p[0]} --')
s = bus.get_proxy_interface(bus_name, p[0], 'net.connman.Technology')
s(connection=bus.connection, dest='net.connman.Technology').Scan()
await asyncio.sleep(10)
print('===================================')
sl = await server['/'].GetServices()
for p in sl[0]:
# pp.pprint(p)
print('-----------------------------------')
print(f'-- {p[1]["Name"][1]}: {p[0]} --')
print('===================================')
loop.run_until_complete(main())
This code, mostly stealed from useless_managed_object_server_ravelled, results in an exception:
===================================
-----------------------------------
-- Wired: /net/connman/technology/ethernet --
-----------------------------------
-- WiFi: /net/connman/technology/wifi --
-----------------------------------
-- Bluetooth: /net/connman/technology/bluetooth --
===================================
-----------------------------------
-- NETGEAR_11AC: /net/connman/service/wifi_001500d77076_4e4554474541525f31314143_managed_psk --
-----------------------------------
-- Wired: /net/connman/service/ethernet_02693694c027_cable --
-----------------------------------
-- Wired: /net/connman/service/ethernet_723575276940_cable --
-----------------------------------
-- Wired: /net/connman/service/ethernet_ae8d48867953_cable --
-----------------------------------
-- Wired: /net/connman/service/ethernet_ba6926867953_cable --
-----------------------------------
-- Wired: /net/connman/service/ethernet_366cdd276940_cable --
===================================
[ ObjectPath('/net/connman/technology/ethernet'),
{ 'Connected': (Signature('b'), True),
'Name': (Signature('s'), 'Wired'),
'Powered': (Signature('b'), True),
'Tethering': (Signature('b'), False),
'Type': (Signature('s'), 'ethernet')}]
[ ObjectPath('/net/connman/technology/wifi'),
{ 'Connected': (Signature('b'), True),
'Name': (Signature('s'), 'WiFi'),
'Powered': (Signature('b'), True),
'Tethering': (Signature('b'), False),
'Type': (Signature('s'), 'wifi')}]
-----------------------------------
-- WiFi: /net/connman/technology/wifi --
Traceback (most recent call last):
File "/home/mcon/projects/dbussy/networks.py", line 78, in <module>
loop.run_until_complete(main())
File "/usr/lib/python3.7/asyncio/base_events.py", line 583, in run_until_complete
return future.result()
File "/home/mcon/projects/dbussy/networks.py", line 67, in main
s(connection=bus.connection, dest='net.connman.Technology').Scan()
AttributeError: 'net.connman.Technology_factory' object has no attribute 'Scan'
Process finished with exit code 1
Reference code I'm trying to convert to ravel is:
technology = dbus.Interface(bus.get_object("net.connman",
"/net/connman/technology/wifi"),
"net.connman.Technology")
technology.Scan()
What am I doing so wrong?
Thanks in Advance
Mauro
Hi,
first and foremost: Thanks for all the good work.
I'm trying to use dbussy/ravel to interface ConnMan.
Since I'm new to all of them: ConnMan, D-Bus and Your code, there's little surprise in me having problems, sorry.
I am trying to do things stepwise and I have the following test code:
This code, mostly stealed from
useless_managed_object_server_ravelled, results in an exception:Reference code I'm trying to convert to ravel is:
What am I doing so wrong?
Thanks in Advance
Mauro