Skip to content
Snippets Groups Projects
Commit f2789213 authored by Nicolas Leclercq's avatar Nicolas Leclercq
Browse files

initial import

parent a04f82a0
No related branches found
No related tags found
No related merge requests found
......@@ -16,7 +16,7 @@ from tango.server import Device, device_property, command, attribute, run
###################################################################################################
class EbsFlags(Device):
InjectionInProgressTmoInSeconds = device_property(dtype=tango.DevUShort, default_value=120)
TopUpInjectionInProgressTmoInSeconds = device_property(dtype=tango.DevUShort, default_value=120)
class TangoHandler(logging.Handler):
......@@ -67,9 +67,9 @@ class EbsFlags(Device):
t.name = "MAIN"
# EBS flags
self.__flags = {
'InjectionInProgress': {'value':False,
'timeout':self.InjectionInProgressTmoInSeconds,
'timestamp':datetime.datetime.now()}
'TopUpInjectionInProgress': {'value':False,
'timeout':self.TopUpInjectionInProgressTmoInSeconds,
'timestamp':datetime.datetime.now()}
}
self.__injection_in_progress = False
# setup the device logger
......@@ -105,22 +105,22 @@ class EbsFlags(Device):
elapsed_seconds = (datetime.datetime.now() - flag_info['timestamp']).total_seconds()
if flag_info['value'] and elapsed_seconds >= flag_info['timeout']:
self.__logger.info("timeout expires for flag '{}' - resetting it's value to False".format(flag))
self.__flags['InjectionInProgress']['timestamp'] = datetime.datetime.now()
self.__flags['InjectionInProgress']['value'] = False
self.__flags[flag]['timestamp'] = datetime.datetime.now()
self.__flags[flag]['value'] = False
@attribute(dtype=[str], max_dim_x=4096)
def Traces(self):
return list(self.__traces)
@attribute(dtype=tango.DevBoolean)
def InjectionInProgress(self):
return self.__flags['InjectionInProgress']['value']
@InjectionInProgress.write
def InjectionInProgress(self, iip:bool):
self.__logger.info("flag InjectionInProgress set to {}".format(iip))
self.__flags['InjectionInProgress']['timestamp'] = datetime.datetime.now()
self.__flags['InjectionInProgress']['value'] = iip
def TopUpInjectionInProgress(self):
return self.__flags['TopUpInjectionInProgress']['value']
@TopUpInjectionInProgress.write
def TopUpInjectionInProgress(self, iip:bool):
self.__logger.info("flag TopUpInjectionInProgress set to {}".format(iip))
self.__flags['TopUpInjectionInProgress']['timestamp'] = datetime.datetime.now()
self.__flags['TopUpInjectionInProgress']['value'] = iip
if __name__ == '__main__':
try:
......
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