mirror of
https://git.disroot.org/pranav/pybatmesh.git
synced 2025-01-25 08:01:47 +05:30
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
|
||
|
"""
|