How to use the kervi.hal function in kervi

To help you get started, we’ve selected a few kervi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kervi / kervi / kervi / build / lib / kervi / application / __init__.py View on Github external
if opt in ("--start-service"):
                service_commands += ["start"]

            if opt in ("--stop-service"):
                service_commands = ["stop"]
            
            if opt in ("--restart-service"):
                service_commands = ["restart"]
            if opt in ("--service-status"):
                service_commands = ["status"]

        if service_commands:
            import kervi.hal as hal
            hal_driver = hal._load(self.config.platform.driver)
            if hal_driver:
                hal.service_commands(
                    service_commands,
                    self.config.application.name,
                    self.config.application.id,
                    script_path
                )
            exit()

        if detect_devices:
            import kervi.hal as hal
            hal_driver = hal._load(self.config.platform.driver)
            if hal_driver:
                devices = hal.detect_devices()
                print("devices:")
                _pretty_print(devices)
            exit()
github kervi / kervi / kervi / kervi / application / __init__.py View on Github external
import kervi.hal as hal
            hal_driver = hal._load(self.config.platform.driver)
            if hal_driver:
                hal.service_commands(
                    service_commands,
                    self.config.application.name,
                    self.config.application.id,
                    script_path
                )
            exit()

        if detect_devices:
            import kervi.hal as hal
            hal_driver = hal._load(self.config.platform.driver)
            if hal_driver:
                devices = hal.detect_devices()
                print("devices:")
                _pretty_print(devices)
            exit()
        self._log_handler = KerviLogHandler(self.config)
        self._log_queue = self._log_handler._log_queue 
        self._logger = KerviLog("application")
        #self._validateSettings()
        self.started = False
        self._webserver_port = None

        try:
            from kervi.version import VERSION
        except:
            VERSION="0.0.0"

        self._logger.verbose("kervi version: %s", VERSION)
github kervi / kervi / kervi / kervi / module / __init__.py View on Github external
import kervi.hal as hal
            hal_driver = hal._load(self.config.platform.driver)
            if hal_driver:
                hal.service_commands(
                    service_commands,
                    self.config.application.name,
                    self.config.application.id,
                    script_path
                )
            exit()

        if detect_devices:
            import kervi.hal as hal
            hal_driver = hal._load(self.config.platform.driver)
            if hal_driver:
                devices = hal.detect_devices()
                print("devices:")
                _pretty_print(devices)
            exit()

        self._log_handler = KerviLogHandler(self.config)
        self._log_queue = self._log_handler._log_queue 
        self._logger = KerviLog("module")
        


        self._logger.info("Starting kervi module, please wait")

        try:
            from kervi.version import VERSION
        except:
            VERSION="0.0.0"
github kervi / kervi / kervi / build / lib / kervi / vision / camera.py View on Github external
def __init__(self, camera_id, name, camera_source = None, **kwargs):
        CameraBase.__init__(self, camera_id, name, type="frame", **kwargs)
        self._device_driver = hal.get_camera_driver(camera_source)

        self._device_driver.camera = self
        self._frame_format = self._device_driver.buffer_type

        protocol = "http://"
        if encryption.enabled():
            protocol = "https://"

        self.ip_address = nethelper.get_ip_address()
        self.ip_port = nethelper.get_free_port()
        self.source = protocol + str(self.ip_address) + ":" + str(self.ip_port) + "/" + camera_id# + ".png"
        self.source = {
            "server": protocol + str(self.ip_address) + ":" + str(self.ip_port),
            "path": "/"+camera_id
        }
        self.current_frame = None
github kervi / kervi / kervi / build / lib / kervi / application / __init__.py View on Github external
def _shutdown_action(self):
        import kervi.hal as hal
        hal.device_shutdown()
github kervi / kervi / kervi / build / lib / kervi / application / __init__.py View on Github external
def _reboot_action(self):
        import kervi.hal as hal
        hal.device_reboot()
github kervi / kervi / kervi / build / lib / kervi / utility / application_helpers.py View on Github external
def init_process(self, **kwargs):
        print("load:", self.name)
        #import kervi.core_sensors.cpu_sensors
        try:
            import kervi.hal as hal
            hal._load()
            __import__(self.name, fromlist=[''])

        except ImportError:
            self.spine.log.exception("load module:{0}", self.name)
        #import kervi.utility.storage
        self.spine.send_command("startThreads", local_only=True)
        self.spine.trigger_event(
            "moduleLoaded",
            self.name,
        )