Skip to content
Snippets Groups Projects
Commit ceceda14 authored by Raphael GIRARDOT's avatar Raphael GIRARDOT
Browse files

Initial commit

parents
No related branches found
No related tags found
No related merge requests found
# -*- coding: utf-8 -*-
# ############################################################################
# License:
# ============================================================================
#
# This file is part of ContactManager.
#
# ContactManager is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option)
# any later version.
#
# ContactManager is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# ContactManager. If not, see <https://www.gnu.org/licenses/>
#
# ============================================================================
# $Author: Raphaël GIRARDOT
# ############################################################################
# ############################################################################
# ContactManager
# ============================================================================
#
# This device is intended to manage local contact for DataStorage, updating
# its reference in PANIC phonebook.
#
# ############################################################################
import tango
from tango.server import run, Device, attribute, device_property, class_property
from tango import Database, DevState, AttrWriteType
import PyTango
__all__ = ["ContactManager", "main"]
class ContactManager(Device):
"""
ContactManager is intended to manage local contact for DataStorage, updating its reference in PANIC phonebook.
"""
# ---------
# Constants
# ---------
PANIC = "PANIC"
PHONEBOOK = "Phonebook"
PYALARM = "PyAlarm"
CONTACT_MANAGER = "ContactManager"
CONTACT_KEY_PROPERTY = "ContactKey"
CONTACT_LIST_PROPERTY = "ContactList"
DESCRIPTION_PROPERTY = "Description"
CONTACT_ATTR = "contact"
DEFAULT_CONTACT_VALUE = "Unknown"
# Value in description property of ContactManager class
DESCRIPTION_PROPERTY_DOC = f"{CONTACT_MANAGER} is intended to manage local contact for DataStorage,"
DESCRIPTION_PROPERTY_DOC = f"{DESCRIPTION_PROPERTY_DOC} updating its reference in PANIC phonebook."
# ContactList property description
CONTACT_LIST_PROPERTY_DOC = "The contacts this device should know."
CONTACT_LIST_PROPERTY_DOC = f"{CONTACT_LIST_PROPERTY_DOC}\nEach contact should be written this way:"
CONTACT_LIST_PROPERTY_DOC = f"{CONTACT_LIST_PROPERTY_DOC}\nContact_Name:PhoneBook_Value"
CONTACT_LIST_PROPERTY_DOC = f"{CONTACT_LIST_PROPERTY_DOC}\n"
CONTACT_LIST_PROPERTY_DOC = f"{CONTACT_LIST_PROPERTY_DOC}\nThe Contact_Name entries will represent the possible"
CONTACT_LIST_PROPERTY_DOC = f"{CONTACT_LIST_PROPERTY_DOC} enum labels for {CONTACT_ATTR} attribute."
CONTACT_LIST_PROPERTY_DOC = f"{CONTACT_LIST_PROPERTY_DOC}\nThe PhoneBook_Value is what to write in {PANIC} {PHONEBOOK}"
CONTACT_LIST_PROPERTY_DOC = f"{CONTACT_LIST_PROPERTY_DOC} at the key defined in {CONTACT_KEY_PROPERTY} property when"
CONTACT_LIST_PROPERTY_DOC = f"{CONTACT_LIST_PROPERTY_DOC} {CONTACT_ATTR} attribute is set with Contact_Name."
CONTACT_LIST_PROPERTY_DOC = f"{CONTACT_LIST_PROPERTY_DOC}\n"
CONTACT_LIST_PROPERTY_DOC = f"{CONTACT_LIST_PROPERTY_DOC}\nExample:"
CONTACT_LIST_PROPERTY_DOC = f"{CONTACT_LIST_PROPERTY_DOC}\nJohn:john.doe@synchrotron-soleil.fr"
CONTACT_LIST_PROPERTY_DOC = f"{CONTACT_LIST_PROPERTY_DOC}\nJack:%JACK"
CONTACT_LIST_PROPERTY_DOC = f"{CONTACT_LIST_PROPERTY_DOC}\nTelma:telma.louise@synchrotron-soleil.fr"
CONTACT_LIST_PROPERTY_DOC = f"{CONTACT_LIST_PROPERTY_DOC}\n"
CONTACT_LIST_PROPERTY_DOC = f"{CONTACT_LIST_PROPERTY_DOC}\nWith this example, {CONTACT_ATTR} attribut"
CONTACT_LIST_PROPERTY_DOC = f"{CONTACT_LIST_PROPERTY_DOC} will have the enum labels"
CONTACT_LIST_PROPERTY_DOC = f"{CONTACT_LIST_PROPERTY_DOC} [\"{DEFAULT_CONTACT_VALUE}\", \"John\", \"Jack\", \"Telma\"]."
# ContactKey property description
CONTACT_KEY_PROPERTY_DOC = "The key for which to modify the value in PANIC Phonebook."
# contact attribute description
CONTACT_ATTR_DOC = f"What to write in {PANIC} {PHONEBOOK} for the key defined in {CONTACT_KEY_PROPERTY} property."
CONTACT_ATTR_DOC = f"{CONTACT_ATTR_DOC}\nThe effective written value will be the one in {CONTACT_LIST_PROPERTY} property"
CONTACT_ATTR_DOC = f"{CONTACT_ATTR_DOC} for which the key matches the selected label in {CONTACT_ATTR} attribute."
CONTACT_ATTR_DOC = f"{CONTACT_ATTR_DOC}\n"
CONTACT_ATTR_DOC = f"{CONTACT_ATTR_DOC}\n\"{DEFAULT_CONTACT_VALUE}\" will always be present in enum labels at first index."
CONTACT_ATTR_DOC = f"{CONTACT_ATTR_DOC}\nSetting {CONTACT_ATTR} attribute with \"{DEFAULT_CONTACT_VALUE}\" will have"
CONTACT_ATTR_DOC = f"{CONTACT_ATTR_DOC} effect neither on {PANIC} {PHONEBOOK}, nore on {CONTACT_ATTR} read value."
CONTACT_ATTR_DOC = f"{CONTACT_ATTR_DOC}\n{CONTACT_ATTR} read value may return \"{DEFAULT_CONTACT_VALUE}\" when"
CONTACT_ATTR_DOC = f"{CONTACT_ATTR_DOC} the value in {PANIC} {PHONEBOOK} for the key defined in {CONTACT_KEY_PROPERTY}"
CONTACT_ATTR_DOC = f"{CONTACT_ATTR_DOC} property matches no known value, or when this key is not present"
CONTACT_ATTR_DOC = f"{CONTACT_ATTR_DOC} in {PANIC} {PHONEBOOK}."
# panicPhonebookReady attribute description
PANIC_PHONEBOOK_READY_ATTR_DOC = "Whether PANIC Phonebook was found."
# Default value in contact. This one will have no effect.
ENUM_LABELS = "enum_labels"
# Tango wildcard
WILDCARD = "*"
# Init command
INIT = "init"
# Status message when everything is OK
READY = "Ready"
# Tango Database
DB = Database()
# ---------
# Variables
# ---------
# Parsed contact key
phonebookKey = ""
# Parsed contacts
contactMap = {}
contactLabels = [DEFAULT_CONTACT_VALUE]
# Selected contact value
contactValue = 0
# panicPhonebookReady read value
panicPhonebookReadyValue = False
# ----------------
# Class Properties
# ----------------
Description = class_property(
dtype=tango.DevString,
default_value=DESCRIPTION_PROPERTY_DOC,
doc=f"About {CONTACT_MANAGER}."
)
# -----------------
# Device Properties
# -----------------
ContactKey = device_property(
dtype=tango.DevString,
doc=CONTACT_KEY_PROPERTY_DOC
)
ContactList = device_property(
dtype=tango.DevVarStringArray,
doc=CONTACT_LIST_PROPERTY_DOC
)
# -----------------------------
# Static Attributes declaration
# -----------------------------
panicPhonebookReady = attribute(
dtype='DevBoolean',
doc=PANIC_PHONEBOOK_READY_ATTR_DOC
)
# contact attribute is a dynamic attribute.
# It is definned in initialize_dynamic_attributes() method.
# ---------------
# Utility methods
# ---------------
# Traces a message in both status and info_stream
def traceMessage(self, message, e=None):
if e != None:
message = f"{message}:\n{type(e)}\n{e}"
self.info_stream(message)
self.set_status(message)
# Parses a list of "key:value" strings and returns a dictionary
def toDictionary(self, listVal):
self.debug_stream("In toDictionary()")
dictionary = {}
if listVal:
for line in listVal:
line = line.strip()
if line:
try:
index = line.index(":")
except:
index = -1
if index > -1:
dictionary[line[:index].strip()] = line[index + 1 :].strip()
return dictionary
# Parses a dictionary and returns a list of "key:value" strings
def toList(self, dictionary):
self.debug_stream("In toList()")
listVal = []
if dictionary:
for key, value in dictionary.items():
listVal.append(f"{key}:{value}")
return listVal
# Sends Init command on all exported PyAlarm devices
def initPyAlarmDevices(self):
self.traceMessage(f"Initializing {self.PYALARM} devices...")
ok = True
try:
badDevices = []
self.debug_stream(f"Getting exported {self.PYALARM} devices...")
devices = self.DB.get_device_exported_for_class(self.PYALARM).value_string
if devices:
self.debug_stream(f"Found {devices}")
for device in devices:
try:
self.debug_stream(f"Connecting to {device}...")
dev = PyTango.DeviceProxy(device)
self.debug_stream(f"Executing {self.INIT} on {device}...")
dev.command_inout(self.INIT)
self.debug_stream("Done")
except:
self.debug_stream("Error")
badDevices.append(device)
continue
else:
self.debug_stream(f"No {self.PYALARM} device found")
if badDevices:
self.traceMessage(f"Failed to init following {self.PYALARM} devices: {badDevices}")
self.set_state(PyTango.DevState.ALARM)
ok = False
except Exception as e:
self.traceMessage(f"Failed to init {self.PYALARM} devices", e)
self.set_state(PyTango.DevState.ALARM)
ok = False
return ok
# Reads the Phonebook propery from the PANIC free property
def getPanicPhonebook(self):
self.debug_stream("In getPanicPhonebook()")
return self.DB.get_property(self.PANIC, self.PHONEBOOK)
# Returns whether a dictionary represents a valid PANIC Phonebook.
# This dictionary is expected to be the result of getPanicPhonebook method.
def isValidPanicPhonebook(self, phonebook):
self.debug_stream("In isValidPanicPhonebook()")
ready = (
isinstance(phonebook, dict)
and self.PHONEBOOK in phonebook
and (
isinstance(phonebook[self.PHONEBOOK], list)
or isinstance(phonebook[self.PHONEBOOK], tango.StdStringVector)
)
)
return ready
# Returns whether PANIC Phonebook was found
def isPanicPhonebookReady(self):
self.debug_stream("In isPanicPhonebookReady()")
try:
ready = self.isValidPanicPhonebook(self.getPanicPhonebook())
except:
ready = False
return ready
# Reads PANIC Phonebook to determine which value was applied to ContactKey entry,
# and returns the matching index in contact labels
def getCurrentContact(self):
self.debug_stream("In getCurrentContact()")
readIndex = 0
if self.phonebookKey and self.contactMap:
try :
panic = self.getPanicPhonebook()
self.debug_stream(f"{self.PANIC} {self.PHONEBOOK} property:\n{panic}")
if self.isValidPanicPhonebook(panic):
phonebook = self.toDictionary(panic[self.PHONEBOOK])
self.debug_stream(f"{self.PHONEBOOK} as a dictionary:\n{phonebook}")
self.debug_stream(f"contactMap:\n{self.contactMap}")
for key, value in phonebook.items():
if (key == self.phonebookKey):
for k, v in self.contactMap.items():
if v == value:
readIndex = self.contactLabels.index(k)
break
break
except Exception as e:
readIndex = 0
self.traceMessage("Failed to read phonebook", e)
self.set_state(PyTango.DevState.ALARM)
self.debug_stream(f"Current contact index: {readIndex}")
return readIndex
# Sets this device state and status, as if it just started,
# according to previously parsed ContactList property
def initStatus(self):
self.debug_stream("In initStatus()")
# Adapt state and status according to parsed contacts
if self.contactMap:
self.set_state(PyTango.DevState.ON)
self.traceMessage(self.READY)
else:
self.set_state(PyTango.DevState.FAULT)
self.traceMessage(f"{self.CONTACT_LIST_PROPERTY} property is not correctly set")
# ---------------
# General methods
# ---------------
def init_device(self):
"""Initialises the attributes and properties of the ContactManager."""
self.debug_stream("In init_device()")
Device.init_device(self)
self.contactValue = 0
self.panicPhonebookReadyValue = False
# Set state as INIT
self.set_state(PyTango.DevState.INIT)
self.traceMessage("Initializing...")
# Update PanicPhonebookReady attribute
self.attr_panicPhonebookReady_read = self.isPanicPhonebookReady()
# Try to set Description class property if not set or set with a different value than default one
try:
prop = self.DB.get_class_property(self.CONTACT_MANAGER, self.DESCRIPTION_PROPERTY)
except:
prop = {}
if (
self.DESCRIPTION_PROPERTY not in prop
or not prop[self.DESCRIPTION_PROPERTY]
or prop[self.DESCRIPTION_PROPERTY][0] != self.DESCRIPTION_PROPERTY_DOC
):
prop[self.DESCRIPTION_PROPERTY] = self.DESCRIPTION_PROPERTY_DOC
self.DB.put_class_property(self.CONTACT_MANAGER, prop)
# Try to set device properties in database if not already set
name = self.get_name()
self.debug_stream(f"I am {name}")
prop = self.DB.get_device_property(name, self.CONTACT_LIST_PROPERTY)
if self.CONTACT_LIST_PROPERTY not in prop or not prop[self.CONTACT_LIST_PROPERTY]:
self.DB.put_device_property(name, {self.CONTACT_LIST_PROPERTY: [""]})
prop = self.DB.get_device_property(name, self.CONTACT_KEY_PROPERTY)
if self.CONTACT_KEY_PROPERTY not in prop or not prop[self.CONTACT_KEY_PROPERTY]:
self.DB.put_device_property(name, {self.CONTACT_KEY_PROPERTY: ""})
# Read contact key
if self.ContactKey:
try:
self.phonebookKey = self.ContactKey.strip()
# A phonebook key always starts with '%'
if self.phonebookKey and self.phonebookKey[0] != '%':
self.phonebookKey = '%' + self.phonebookKey
except:
self.phonebookKey = ""
else:
self.phonebookKey = ""
# Parse contacts
self.info_stream("Parsing contacts...")
self.contactMap = self.toDictionary(self.ContactList)
self.contactLabels = [self.DEFAULT_CONTACT_VALUE]
for label in self.contactMap:
self.contactLabels.append(label)
self.contactValue = self.getCurrentContact()
self.panicPhonebookReadyValue = self.isPanicPhonebookReady()
self.info_stream("Done")
self.initStatus()
# ------------------
# Attributes methods
# ------------------
# Returns the panicPhonebookReady attribute read value.
def read_panicPhonebookReady(self):
self.debug_stream("In read_panicPhonebookReady()")
return self.panicPhonebookReadyValue
# Determines for which states panicPhonebookReady can be read.
def is_panicPhonebookReady_allowed(self, attr):
self.debug_stream("In is_panicPhonebookReady_allowed()")
return self.get_state() not in [DevState.INIT]
# Dynamic attributes initialization.
# This is where contact attribute will be created.
def initialize_dynamic_attributes(self):
self.debug_stream("In initialize_dynamic_attributes()")
# contact attribute must be READ_WRITE for compatibility with atkpanel
# (atkpanel fails with WRITE only DevEnum)
contact = attribute(
name=self.CONTACT_ATTR,
dtype=tango.DevEnum,
access=AttrWriteType.READ_WRITE,
fget=self.read_contact,
fset=self.write_contact,
enum_labels=self.contactLabels,
doc=self.CONTACT_ATTR_DOC
)
self.add_attribute(
contact, ContactManager.read_contact, ContactManager.write_contact, None
)
# Returns the contact attribute read value.
def read_contact(self, attr):
self.debug_stream("In read_contact()")
return self.contactValue
# What should be done when contact attribute is set.
def write_contact(self, value):
self.debug_stream("In write_contact()")
data = value.get_write_value()
changed = (self.contactValue != data)
self.contactValue = data
self.info_stream(f"Received contact value: {self.contactLabels[data]}")
if (
self.phonebookKey
and self.contactLabels
and isinstance(data, int)
and changed
and data > 0 # 1st value is always "Unknown" and should be ignored
and data < len(self.contactLabels)
):
self.traceMessage("Applying contact...")
self.set_state(PyTango.DevState.MOVING)
key = self.contactLabels[data]
ok = True
try:
self.info_stream(f"Selected key: {key}\ncontactMap:\n{self.contactMap}")
if key in self.contactMap:
data = self.contactMap[key]
self.info_stream(f"Selected value: {data}")
panic = self.getPanicPhonebook()
if self.isValidPanicPhonebook(panic):
phonebook = self.toDictionary(panic[self.PHONEBOOK])
phonebook[self.phonebookKey] = data
panic[self.PHONEBOOK] = self.toList(phonebook)
self.info_stream(f"Applying phonebook:\n{panic}")
self.DB.put_property(self.PANIC, panic)
ok = self.initPyAlarmDevices()
else:
ok = False
self.traceMessage(f"Invalid {self.PANIC} {self.PHONEBOOK} property:\n{panic}")
self.set_state(PyTango.DevState.ALARM)
else:
self.info_stream(f"Invalid key {key}")
except Exception as e:
ok = False
self.traceMessage(f"Failed to update {self.PANIC} {self.PHONEBOOK}", e)
self.set_state(PyTango.DevState.ALARM)
if ok:
self.initStatus()
else:
self.contactValue = self.getCurrentContact()
self.initStatus()
# Determines for which states contact can be read or set.
def is_contact_allowed(self, attr):
if attr==attr.READ_REQ:
return self.get_state() not in [DevState.INIT]
else:
return self.get_state() not in [DevState.MOVING, DevState.FAULT, DevState.INIT]
# ----------
# Run server
# ----------
def main(args=None, **kwargs):
"""Main function of the ContactManager module."""
return run((ContactManager,), args=args, **kwargs)
if __name__ == '__main__':
main()
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
<p style="text-align: center"><a href="https://www.synchrotron-soleil.fr/en"><img src="https://www.synchrotron-soleil.fr/sites/default/files/logo_0.png" alt="SOLEIL Synchrotron"/></a></p> # ContactManager ContactManager is a device intended to manage local contact for DataStorage, updating its reference in PANIC phonebook. It is published under the [GNU Lesser General Public License](https://www.gnu.org/licenses/lgpl-3.0.en.html) *(see LICENSE.txt file)*. --- To properly work, this device needs: - Python &ge; 3.6.8 - pytango &ge; 9.4.1, but &ne; 9.5.1 --- ## Device Properties | Name | Type | Description | | ContactKey | String | The key for which to modify the value in PANIC Phonebook. | | ContactList | String[] | The contacts this device should know.<br />Each contact should be written this way:<br />Contact_Name:PhoneBook_Value<br /><br />The Contact_Name entries will represent the possible enum labels for contact attribute.<br />The PhoneBook_Value is what to write in PANIC Phonebook at the key defined in ContactKey property when contact attribute is set with Contact_Name.<br /><br />Example:<br />John:john.doe@synchrotron-soleil.fr<br />Jack:%JACK<br />Telma:telma.louise@synchrotron-soleil.fr<br /><br />With this example, contact attribut will have the enum labels [\"Unknown\", \"John\", \"Jack\", \"Telma\"]. | ## Attributes | Name | Dynamic | Attr. type | R/W type | Data type | Level | Description | | panicPhonebookReady | false | Scalar | READ | Tango::DEV_BOOLEAN | OPERATOR | Whether PANIC Phonebook was found. | | contact | true | Scalar | READ_WRITE | Tango::DEV_ENUM | OPERATOR | What to write in PANIC Phonebook for the key defined in ContactKey property.<br />The effective written value will be the one in ContactList property for which the key matches the selected label in contact attribute.<br /><br />"Unknown" will always be present in enum labels at first index.<br />Setting contact attribute with "Unknown" will have effect neither on PANIC Phonebook, nore on contact read value.<br />contact read value may return "Unknown" when the value in PANIC Phonebook for the key defined in ContactKey property matches no known value, or when this key is not present in PANIC Phonebook. | ## Commands | Name | Input type | Output type | Level | Description | | Init | DEV_VOID | DEV_VOID | OPERATOR | This command initializes the device, forcing it to parse its properties and rebuild its attributes. | | State | DEV_VOID | DEV_STATE | OPERATOR | This command gets the device state (stored in its device_state data member) and returns it to the caller. | | Status | DEV_VOID | CONST_DEV_STRING | OPERATOR | This command gets the device status (stored in its device_status data member) and returns it to the caller. | ## States | Name | Description | | ALARM | Device failed to update PANIC Phonebook or to init PyAlarm devices. | | FAULT | ContactList property is not correcty set. | | INIT | Device is initializing, parsing its properties and checking PANIC phonebook availability. | | MOVING | Writing PANIC Phonebook and initializing PyAlarm devices. | | ON | Device is ready to do its job. |
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment