import asyncio

from defence360agent.rpc_tools.lookup import (
    RootEndpoints,
    bind,
)
from imav.plugins.generic_sensor import Protocol


class MalwareEvents(RootEndpoints):
    @bind("malware", "generic", "event")
    async def generic_event(self, **kwargs):
        loop = asyncio.get_event_loop()
        proto = Protocol(loop, self._sink)
        proto._process_msg(kwargs)
