Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
Foo.py 3.31 KiB
# -*- coding: utf-8 -*-
#
# This file is part of the Foo project
#
#
#
# Distributed under the terms of the APACHE license.
# See LICENSE.txt for more info.

""" foo project

"""

# PyTango imports
import tango
from tango import DebugIt
from tango.server import run
from tango.server import Device
from tango.server import command
from tango import AttrQuality, DispLevel, DevState
from tango import AttrWriteType, PipeWriteType
# Additional import
# PROTECTED REGION ID(Foo.additionnal_import) ENABLED START #
# PROTECTED REGION END #    //  Foo.additionnal_import

__all__ = ["Foo", "main"]


class Foo(Device):
    """
    """
    # PROTECTED REGION ID(Foo.class_variable) ENABLED START #
    # PROTECTED REGION END #    //  Foo.class_variable

    # ---------------
    # General methods
    # ---------------

    def init_device(self):
        """Initialises the attributes and properties of the Foo."""
        Device.init_device(self)
        # PROTECTED REGION ID(Foo.init_device) ENABLED START #
        # PROTECTED REGION END #    //  Foo.init_device

    def always_executed_hook(self):
        """Method always executed before any TANGO command is executed."""
        # PROTECTED REGION ID(Foo.always_executed_hook) ENABLED START #
        # PROTECTED REGION END #    //  Foo.always_executed_hook

    def delete_device(self):
        """Hook to delete resources allocated in init_device.

        This method allows for any memory or other resources allocated in the
        init_device method to be released.  This method is called by the device
        destructor and by the device Init command.
        """
        # PROTECTED REGION ID(Foo.delete_device) ENABLED START #
        # PROTECTED REGION END #    //  Foo.delete_device
    # --------
    # Commands
    # --------

    @command(
    )
    @DebugIt()
    def On(self):
        # PROTECTED REGION ID(Foo.On) ENABLED START #
        """

        :return:None
        """
        pass
        # PROTECTED REGION END #    //  Foo.On

    def is_On_allowed(self):
        # PROTECTED REGION ID(Foo.is_On_allowed) ENABLED START #
        return self.get_state() not in [DevState.FAULT,DevState.ON]
        # PROTECTED REGION END #    //  Foo.is_On_allowed

    @command(
    )
    @DebugIt()
    def Off(self):
        # PROTECTED REGION ID(Foo.Off) ENABLED START #
        """

        :return:None
        """
        pass
        # PROTECTED REGION END #    //  Foo.Off

    def is_Off_allowed(self):
        # PROTECTED REGION ID(Foo.is_Off_allowed) ENABLED START #
        return self.get_state() not in [DevState.OFF]
        # PROTECTED REGION END #    //  Foo.is_Off_allowed

    @command(
    )
    @DebugIt()
    def Fault(self):
        # PROTECTED REGION ID(Foo.Fault) ENABLED START #
        """

        :return:None
        """
        pass
        # PROTECTED REGION END #    //  Foo.Fault

    def is_Fault_allowed(self):
        # PROTECTED REGION ID(Foo.is_Fault_allowed) ENABLED START #
        return self.get_state() not in [DevState.FAULT]
        # PROTECTED REGION END #    //  Foo.is_Fault_allowed

# ----------
# Run server
# ----------


def main(args=None, **kwargs):
    """Main function of the Foo module."""
    # PROTECTED REGION ID(Foo.main) ENABLED START #
    return run((Foo,), args=args, **kwargs)
    # PROTECTED REGION END #    //  Foo.main


if __name__ == '__main__':
    main()