Skip to content

Instantly share code, notes, and snippets.

@tiagocoutinho
Last active October 14, 2015 08:36
Show Gist options
  • Save tiagocoutinho/39943e4ed266591ff7e0 to your computer and use it in GitHub Desktop.
Save tiagocoutinho/39943e4ed266591ff7e0 to your computer and use it in GitHub Desktop.
POGO PythonHL code
# -*- coding: utf-8 -*-
#
# This file is part of the CT2 project
#
# Copyright 2015 European Synchrotron Radiation Facility, Grenoble, France
#
# Distributed under the terms of the LGPL license.
# See LICENSE.txt for more info.
""" CT2 (P201/C208) ESRF counter card
CT2 (P201/C208) ESRF counter card TANGO device
"""
__all__ = ["CT2", "main"]
# 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.server import class_property, device_property
from PyTango import AttrQuality, AttrWriteType, DispLevel, DevState
# Additional import
# PROTECTED REGION ID(CT2.additionnal_import) ENABLED START #
# PROTECTED REGION END # // CT2.additionnal_import
class CT2(Device):
"""
CT2 (P201/C208) ESRF counter card TANGO device
"""
__metaclass__ = DeviceMeta
# PROTECTED REGION ID(CT2.class_variable) ENABLED START #
# PROTECTED REGION END # // CT2.class_variable
# ----------------
# Class Properties
# ----------------
# -----------------
# Device Properties
# -----------------
card_name = device_property(
dtype='str', default_value="p201"
)
# ----------
# Attributes
# ----------
counters = attribute(
dtype=('uint',),
max_dim_x=12,
)
latches = attribute(
dtype=('uint',),
max_dim_x=12,
)
data = attribute(
dtype=('uint',),
max_dim_x=65535,
)
# ---------------
# General methods
# ---------------
def init_device(self):
Device.init_device(self)
# PROTECTED REGION ID(CT2.init_device) ENABLED START #
# PROTECTED REGION END # // CT2.init_device
def always_executed_hook(self):
# PROTECTED REGION ID(CT2.always_executed_hook) ENABLED START #
pass
# PROTECTED REGION END # // CT2.always_executed_hook
def delete_device(self):
# PROTECTED REGION ID(CT2.delete_device) ENABLED START #
pass
# PROTECTED REGION END # // CT2.delete_device
# ------------------
# Attributes methods
# ------------------
def read_counters(self):
# PROTECTED REGION ID(CT2.counters_read) ENABLED START #
return [0]
# PROTECTED REGION END # // CT2.counters_read
def read_latches(self):
# PROTECTED REGION ID(CT2.latches_read) ENABLED START #
return [0]
# PROTECTED REGION END # // CT2.latches_read
def read_data(self):
# PROTECTED REGION ID(CT2.data_read) ENABLED START #
return [0]
# PROTECTED REGION END # // CT2.data_read
# --------
# Commands
# --------
@command
@DebugIt()
def reload_config(self):
# PROTECTED REGION ID(CT2.reload_config) ENABLED START #
pass
# PROTECTED REGION END # // CT2.reload_config
@command
@DebugIt()
def reset(self):
# PROTECTED REGION ID(CT2.reset) ENABLED START #
pass
# PROTECTED REGION END # // CT2.reset
@command(dtype_in=('uint16',), doc_in="list of counters to latch (first counter == 1)")
@DebugIt()
def trigger_latch(self, argin):
# PROTECTED REGION ID(CT2.trigger_latch) ENABLED START #
pass
# PROTECTED REGION END # // CT2.trigger_latch
@command(dtype_in=('uint16',), doc_in="list of counters to latch (first counter == 1)")
@DebugIt()
def start(self, argin):
# PROTECTED REGION ID(CT2.start) ENABLED START #
pass
# PROTECTED REGION END # // CT2.start
# ----------
# Run server
# ----------
def main(args=None, **kwargs):
from PyTango.server import run
return run((CT2,), args=args, **kwargs)
if __name__ == '__main__':
main()
# PROTECTED REGION ID(CT2.main_end) ENABLED START #
# PROTECTED REGION END # // CT2.main_end
@tiagocoutinho
Copy link
Author

I propose add a protected region at the end of the file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment