From 91be0b0189f346fdcc72efe9833d156720a93d1c Mon Sep 17 00:00:00 2001 From: Pranav Jerry Date: Sun, 18 Jul 2021 14:07:16 +0530 Subject: [PATCH] Added main.py This file at the moment contains debugging code. Changed HACKING.md --- HACKING.md | 7 +++---- naxalnet/iwd.py | 6 ++++++ naxalnet/main.py | 16 ++++++++++++++++ 3 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 naxalnet/main.py diff --git a/HACKING.md b/HACKING.md index ccac949..5e228fc 100644 --- a/HACKING.md +++ b/HACKING.md @@ -1,6 +1,6 @@ # Hacking -Everyone is welcome to [hack][] naxalnet. +Antinationals and urban naxals are welcome to [hack][] naxalnet. See below for how to hack. ## Reporting issues and suggesting ideas @@ -14,10 +14,9 @@ relevant label. To push to this repo, you need your username to be in the contributors list. 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, - dot to symbols) +- `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 ' '` ## Packaging diff --git a/naxalnet/iwd.py b/naxalnet/iwd.py index 413d592..1f4f335 100644 --- a/naxalnet/iwd.py +++ b/naxalnet/iwd.py @@ -132,6 +132,9 @@ class Device: adapter_path = self._proxy.Adapter self.adapter = self._iwd.get_name_from_path(adapter_path) + def __str__(self): + return self.name + def is_powered_on(self) -> bool: """returns True if devie is powered on""" return self._proxy.Powered @@ -192,3 +195,6 @@ class Device: self.power_on() self._proxy.StartOpen(name) + + +# TODO: make a class Adapter with power_on() and power_off() diff --git a/naxalnet/main.py b/naxalnet/main.py new file mode 100644 index 0000000..0051bf2 --- /dev/null +++ b/naxalnet/main.py @@ -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)