mirror of
https://git.disroot.org/pranav/pybatmesh.git
synced 2024-12-04 20:49:35 +05:30
Pranav Jerry
6fff558405
- Renamed here_be_dragons() to main(). - Added daemon.py (doesn't do anything yet). - Added GPL disclaimer to all python files and removed the shebang #! from all files. - args is now defined outside any function in scripts.py - Changed arguments of some functions in scripts.py
60 lines
1.6 KiB
Python
60 lines
1.6 KiB
Python
# This file is part of naxalnet.
|
|
# Copyright (C) 2021 The naxalnet Authors
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
"""
|
|
daemon.py
|
|
---------
|
|
|
|
The daemon part. This is currently under construction.
|
|
"""
|
|
|
|
import logging
|
|
from naxalnet.iwd import IWD
|
|
|
|
|
|
class Daemon:
|
|
"""implements the daemon part"""
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
def __init__(self):
|
|
iwd = IWD()
|
|
self.device_add_call = self.device_remove_call = None
|
|
|
|
def on_device_add(self, callback):
|
|
"""
|
|
run the given callback with no arguments
|
|
every time a device is added
|
|
"""
|
|
self.device_add_call = callback
|
|
|
|
def on_device_remove(self, callback):
|
|
"""
|
|
run the given callback with no arguments
|
|
every time a device is removed
|
|
"""
|
|
self.device_remove_call = callback
|
|
|
|
def register_callbacks(self):
|
|
"""
|
|
register the callbacks with D-Bus
|
|
"""
|
|
|
|
def start(self):
|
|
"""
|
|
start the daemon
|
|
"""
|