def linkconfig(self, netif, bw = None, delay = None,
                loss = None, duplicate = None, jitter = None, netif2 = None):
        ''' Generate CommEffect events when a Link Message is received having
        link parameters.
        '''
        if self.session.emane.version >= self.session.emane.EMANE091:
            raise NotImplementedError, \
                  "CommEffect linkconfig() not implemented for EMANE 0.9.1+"
        def z(x):
            ''' Helper to use 0 for None values. '''
            if type(x) is str:
                x = float(x)
            if x is None:
                return 0
            else:
                return int(x)

        service = self.session.emane.service
        if service is None:
            self.session.warn("%s: EMANE event service unavailable" % \
                              self._name)
            return
        if netif is None or netif2 is None:
            self.session.warn("%s: missing NEM information" % self._name)
            return
        # TODO: batch these into multiple events per transmission
        # TODO: may want to split out seconds portion of delay and jitter
        event = emaneeventcommeffect.EventCommEffect(1)
        index = 0
        e = self.session.obj(self.objid)
        nemid = e.getnemid(netif)
        nemid2 = e.getnemid(netif2)
        mbw = bw

        event.set(index, nemid, 0, z(delay), 0, z(jitter), z(loss),
                  z(duplicate), long(z(bw)), long(z(mbw)))
        service.publish(emaneeventcommeffect.EVENT_ID,
                        emaneeventservice.PLATFORMID_ANY,
                        nemid2, emaneeventservice.COMPONENTID_ANY,
                        event.export())
dataset/ETHPy150Open coreemu/core/daemon/core/emane/commeffect.py/EmaneCommEffectModel.linkconfig/original