# -*- coding: utf-8 -*-
#
# This file is part of the ForwardedAttrTestPython project
#
#
#
# Distributed under the terms of the GPL license.
# See LICENSE.txt for more info.

""" 

"""

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

__all__ = ["ForwardedAttrTestPython", "main"]


class ForwardedAttrTestPython(Device):
    """
    """
    __metaclass__ = DeviceMeta
    # PROTECTED REGION ID(ForwardedAttrTestPython.class_variable) ENABLED START #
    # PROTECTED REGION END #    //  ForwardedAttrTestPython.class_variable

    # ----------
    # Attributes
    # ----------

    Attr1 = attribute(
        dtype='double',
        access=AttrWriteType.READ_WRITE,
    )

    FwdAttr2 = attribute(name="FwdAttr2", label="FwdAttr2",
        forwarded=True
    )
    # ---------------
    # General methods
    # ---------------

    def init_device(self):
        Device.init_device(self)
        # PROTECTED REGION ID(ForwardedAttrTestPython.init_device) ENABLED START #
        print "Initializing the device..."

        # PROTECTED REGION END #    //  ForwardedAttrTestPython.init_device

    def always_executed_hook(self):
        # PROTECTED REGION ID(ForwardedAttrTestPython.always_executed_hook) ENABLED START #
        pass
        # PROTECTED REGION END #    //  ForwardedAttrTestPython.always_executed_hook

    def delete_device(self):
        # PROTECTED REGION ID(ForwardedAttrTestPython.delete_device) ENABLED START #
        pass
        # PROTECTED REGION END #    //  ForwardedAttrTestPython.delete_device

    # ------------------
    # Attributes methods
    # ------------------

    def read_Attr1(self):
        # PROTECTED REGION ID(ForwardedAttrTestPython.Attr1_read) ENABLED START #
        return self._attr1;
        # PROTECTED REGION END #    //  ForwardedAttrTestPython.Attr1_read

    def write_Attr1(self, value):
        # PROTECTED REGION ID(ForwardedAttrTestPython.Attr1_write) ENABLED START #
        self._attr1 = 0
        pass
        # PROTECTED REGION END #    //  ForwardedAttrTestPython.Attr1_write


    # --------
    # Commands
    # --------

    @command(
    )
    @DebugIt()
    def ReadFwdAttr(self):
        # PROTECTED REGION ID(ForwardedAttrTestPython.ReadFwdAttr) ENABLED START #
        print "Forwarded Attribue value :-> " ,  self.FwdAttr2
        # PROTECTED REGION END #    //  ForwardedAttrTestPython.ReadFwdAttr

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


def main(args=None, **kwargs):
    # PROTECTED REGION ID(ForwardedAttrTestPython.main) ENABLED START #
    return run((ForwardedAttrTestPython,), args=args, **kwargs)
    # PROTECTED REGION END #    //  ForwardedAttrTestPython.main

if __name__ == '__main__':
    main()
