Added main.py

This file at the moment contains debugging code.
Changed HACKING.md
This commit is contained in:
Pranav Jerry 2021-07-18 14:07:16 +05:30
parent b1d970a0f6
commit 91be0b0189
No known key found for this signature in database
GPG Key ID: F1DCDC4FED0A0C5B
3 changed files with 25 additions and 4 deletions

View File

@ -1,6 +1,6 @@
# Hacking # Hacking
Everyone is welcome to [hack][] naxalnet. Antinationals and urban naxals are welcome to [hack][] naxalnet.
See below for how to hack. See below for how to hack.
## Reporting issues and suggesting ideas ## Reporting issues and suggesting ideas
@ -14,10 +14,9 @@ relevant label.
To push to this repo, you need your username to be in the To push to this repo, you need your username to be in the
contributors list. contributors list.
To add you as a contributor, email any of the authors with To add you as a contributor, email any of the authors with
your username to: your username:
- libreinator plus nxlnet at disroot dot org (change plus, at, - `echo yvoervangbe cyhf akyarg ng qvfebbg qbg bet | tr 'A-Za-z' 'N-ZA-Mn-za-m' | sed 's/plus/+/' | sed 's/ at /@/' | sed 's/dot/./' | tr -d ' '`
dot to symbols)
## Packaging ## Packaging

View File

@ -132,6 +132,9 @@ class Device:
adapter_path = self._proxy.Adapter adapter_path = self._proxy.Adapter
self.adapter = self._iwd.get_name_from_path(adapter_path) self.adapter = self._iwd.get_name_from_path(adapter_path)
def __str__(self):
return self.name
def is_powered_on(self) -> bool: def is_powered_on(self) -> bool:
"""returns True if devie is powered on""" """returns True if devie is powered on"""
return self._proxy.Powered return self._proxy.Powered
@ -192,3 +195,6 @@ class Device:
self.power_on() self.power_on()
self._proxy.StartOpen(name) self._proxy.StartOpen(name)
# TODO: make a class Adapter with power_on() and power_off()

16
naxalnet/main.py Normal file
View File

@ -0,0 +1,16 @@
#!/usr/bin/env python3
# This file should import libraries and do
# what /usr/bin/naxalnet used to do
# TODO: change to naxalnet.iwd
from iwd import IWD, Device
iwd = IWD()
devices = iwd.get_devices()
print("Devices:", devices)
for i in devices:
dev = Device(i)
print(dev)