Beispiel #1
0

class GroupSetpointItem(EdtDataType):
    edt__cls = 'mpx.service.gsp.datatypes.GroupSetpointItem'
    __slots__ = [
        'setpoint_id', 'name', 'data_type', 'point_type', 'value', 'priority'
    ]

    def __init__(self, *args, **kw):
        super(GroupSetpointItem, self).__init__(*args, **kw)
        if self.priority is None:
            self.priority = 16  #defaults to lowest priority


edtlib.register_class(GroupSetpointItem)
register_marshaller(GroupSetpointItem, AsDictMarshaller())


class EntityMapping(EdtDataType):
    edt__cls = 'mpx.service.gsp.datatypes.EntityMapping'
    __slots__ = ['setpoint_id', 'property', 'config', 'entity_path']

    def __init__(self, *args, **kw):
        super(EntityMapping, self).__init__(*args, **kw)
        if isinstance(self.property, str):
            self.property = eval(self.property)

    def get_property_reference(self):
        if not self.entity_path.startswith('/aliases') and \
            not self.entity_path.startswith(EM):
            entity_path = EM + self.entity_path
Beispiel #2
0
            gcfg.append(repr(element))
        return(repr(gcfg))
           
edtlib.register_class(GroupCfg)
#register_marshaller(GroupCfg, AsDictMarshaller())

class GroupSetpointItem(EdtDataType):
    edt__cls = 'mpx.service.gsp.datatypes.GroupSetpointItem'
    __slots__ = ['setpoint_id', 'name', 'data_type', 'point_type', 'value', 'priority']
    def __init__(self, *args, **kw):
        super(GroupSetpointItem, self).__init__(*args, **kw)
        if self.priority is None:
            self.priority = 16 #defaults to lowest priority
            
edtlib.register_class(GroupSetpointItem)
register_marshaller(GroupSetpointItem, AsDictMarshaller())

class EntityMapping(EdtDataType):
    edt__cls = 'mpx.service.gsp.datatypes.EntityMapping'
    __slots__ = ['setpoint_id', 'property', 'config', 'entity_path'] 
    def __init__(self, *args, **kw):
        super(EntityMapping, self).__init__(*args, **kw)
        if isinstance(self.property, str):
            self.property = eval(self.property)
                           
    def get_property_reference(self):
        if not self.entity_path.startswith('/aliases') and \
            not self.entity_path.startswith(EM):
            entity_path = EM + self.entity_path
        else:
            entity_path = self.entity_path
Beispiel #3
0
    def enum(self):
        return DelphiEnum(super(DelphiEnumeratedValue, self).enum())

    def __repr__(self): 
        # Hack to force string representation as Enum's value when 
        # included in subscription's change set.  
        return repr(self.text())

class DelphiAsStrMarshaller(ObjectMarshaller):
    def encode_on(self, xmlrpc_marshaller, *args):
        value = args[0]
        if isinstance(value, DelphiEnum):
            value = value.get('str', '')
        xmlrpc_marshaller.dump_string(str(value), *args[1:])

register_marshaller(DelphiEnum, DelphiAsStrMarshaller())
register_marshaller(MeetingEnumeratedValue, DelphiAsStrMarshaller())
register_marshaller(DelphiEnumeratedValue, DelphiAsStrMarshaller())

class DelphiWebService(CompositeNode):
    def __init__(self):
        super(DelphiWebService, self).__init__()

    def configure(self, config):
        super(DelphiWebService,self).configure(config)
        if self.debug:
            msglog.log('Delphi', INFO, "enabled = %d, debug = %d" %(self.enabled, self.debug))

    def configuration(self):
        config = super(DelphiWebService,self).configuration()
        get_attribute(self, 'debug', config)
Beispiel #4
0
    def __repr__(self):
        # Hack to force string representation as Enum's value when
        # included in subscription's change set.
        return repr(self.text())


class DelphiAsStrMarshaller(ObjectMarshaller):
    def encode_on(self, xmlrpc_marshaller, *args):
        value = args[0]
        if isinstance(value, DelphiEnum):
            value = value.get('str', '')
        xmlrpc_marshaller.dump_string(str(value), *args[1:])


register_marshaller(DelphiEnum, DelphiAsStrMarshaller())
register_marshaller(MeetingEnumeratedValue, DelphiAsStrMarshaller())
register_marshaller(DelphiEnumeratedValue, DelphiAsStrMarshaller())


class DelphiWebService(CompositeNode):
    def __init__(self):
        super(DelphiWebService, self).__init__()

    def configure(self, config):
        super(DelphiWebService, self).configure(config)
        if self.debug:
            msglog.log('Delphi', INFO,
                       "enabled = %d, debug = %d" % (self.enabled, self.debug))

    def configuration(self):