def sendevent(self, model):
        ''' Send an event message on behalf of a mobility model.
            This communicates the current and end (max) times to the GUI.
        '''
        if model.state == model.STATE_STOPPED:
            eventtype = coreapi.CORE_EVENT_STOP
        elif model.state == model.STATE_RUNNING:
            eventtype = coreapi.CORE_EVENT_START
        elif model.state == model.STATE_PAUSED:
            eventtype = coreapi.CORE_EVENT_PAUSE
        data = "start=%d" % int(model.lasttime - model.timezero)
        data += " end=%d" % int(model.endtime)
        tlvdata = ""
        tlvdata += coreapi.CoreEventTlv.pack(coreapi.CORE_TLV_EVENT_NODE,
                                             model.objid)
        tlvdata += coreapi.CoreEventTlv.pack(coreapi.CORE_TLV_EVENT_TYPE,
                                             eventtype)
        tlvdata += coreapi.CoreEventTlv.pack(coreapi.CORE_TLV_EVENT_NAME,
                                             "mobility:%s" % model._name)
        tlvdata += coreapi.CoreEventTlv.pack(coreapi.CORE_TLV_EVENT_DATA,
                                             data)
        tlvdata += coreapi.CoreEventTlv.pack(coreapi.CORE_TLV_EVENT_TIME,
                                             "%s" % time.time())
        msg = coreapi.CoreEventMessage.pack(0, tlvdata)
        try:
            self.session.broadcastraw(None, msg)
        except Exception, e:
            self.warn("Error sending Event Message: %s" % e)
dataset/ETHPy150Open coreemu/core/daemon/core/mobility.py/MobilityManager.sendevent/original