Skip to content
Snippets Groups Projects
Commit 4f6a7c87 authored by Thomas Juerges's avatar Thomas Juerges
Browse files

Forgot to add important files

parent e37679dc
No related branches found
No related tags found
No related merge requests found
# -*- coding: utf-8 -*-
#
# This file is part of the Crossecho project
#
#
#
# Distributed under the terms of the APACHE license.
# See LICENSE.txt for more info.
""" LOFAR2.0 Station Software
Implementation of a Tango device on top of an existing OPC-UA server in Python3.
"""
# 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, pipe
from PyTango.server import device_property
from PyTango import AttrQuality, DispLevel, DevState
from PyTango import AttrWriteType, PipeWriteType
# Additional import
# PROTECTED REGION ID(Crossecho.additionnal_import) ENABLED START #
# PROTECTED REGION END # // Crossecho.additionnal_import
__all__ = ["Crossecho", "main"]
class Crossecho(Device):
"""
Implementation of a Tango device on top of an existing OPC-UA server in Python3.
"""
__metaclass__ = DeviceMeta
# PROTECTED REGION ID(Crossecho.class_variable) ENABLED START #
# PROTECTED REGION END # // Crossecho.class_variable
# -----------------
# Device Properties
# -----------------
OPC_Server_Name = device_property(
dtype='str', default_value="localhost"
)
OPC_Server_Port = device_property(
dtype='str', default_value="55555"
)
# ----------
# Attributes
# ----------
RCU_modes = attribute(
dtype=('str',),
max_dim_x=1024,
)
crosslet_stat = attribute(
dtype=('double',),
max_dim_x=10240,
)
# -----
# Pipes
# -----
xlt_stat = pipe(
label="xlt",
)
# ---------------
# General methods
# ---------------
def init_device(self):
Device.init_device(self)
# PROTECTED REGION ID(Crossecho.init_device) ENABLED START #
# PROTECTED REGION END # // Crossecho.init_device
def always_executed_hook(self):
# PROTECTED REGION ID(Crossecho.always_executed_hook) ENABLED START #
pass
# PROTECTED REGION END # // Crossecho.always_executed_hook
def delete_device(self):
# PROTECTED REGION ID(Crossecho.delete_device) ENABLED START #
pass
# PROTECTED REGION END # // Crossecho.delete_device
# ------------------
# Attributes methods
# ------------------
def read_RCU_modes(self):
# PROTECTED REGION ID(Crossecho.RCU_modes_read) ENABLED START #
return ['']
# PROTECTED REGION END # // Crossecho.RCU_modes_read
def read_crosslet_stat(self):
# PROTECTED REGION ID(Crossecho.crosslet_stat_read) ENABLED START #
return [0.0]
# PROTECTED REGION END # // Crossecho.crosslet_stat_read
# -------------
# Pipes methods
# -------------
def read_xlt_stat(self):
# PROTECTED REGION ID(Crossecho.xlt_stat_read) ENABLED START #
return dict(x=0,y=0)
# PROTECTED REGION END # // Crossecho.xlt_stat_read
# --------
# Commands
# --------
@command(
)
@DebugIt()
def record_cross(self):
# PROTECTED REGION ID(Crossecho.record_cross) ENABLED START #
pass
# PROTECTED REGION END # // Crossecho.record_cross
def is_record_cross_allowed(self):
# PROTECTED REGION ID(Crossecho.is_record_cross_allowed) ENABLED START #
return self.get_state() not in [DevState.OFF,DevState.INIT,DevState.FAULT]
# PROTECTED REGION END # // Crossecho.is_record_cross_allowed
# ----------
# Run server
# ----------
def main(args=None, **kwargs):
# PROTECTED REGION ID(Crossecho.main) ENABLED START #
return run((Crossecho,), args=args, **kwargs)
# PROTECTED REGION END # // Crossecho.main
if __name__ == '__main__':
main()
numpy==1.18.1
opcua==0.98.9
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment