async def set_mode(self, mode, timeout=OTGW_DEFAULT_TIMEOUT):
        """
        Set the operating mode to either "Gateway" mode (:mode: =
        OTGW_MODE_GATEWAY or 1) or "Monitor" mode (:mode: =
        OTGW_MODE_MONITOR or 0), or use this method to reset the device
        (:mode: = OTGW_MODE_RESET).
        Return the newly activated mode, or the full renewed status
        dict after a reset.

        This method is a coroutine
        """
        cmd = OTGW_CMD_MODE
        status = {}
        ret = await self._wait_for_cmd(cmd, mode, timeout)
        if ret is None:
            return
        if mode is OTGW_MODE_RESET:
            self._protocol.status = {}
            await self.get_reports()
            await self.get_status()
            return dict(self._protocol.status)
        status[OTGW_MODE] = ret
        self._update_status(status)
        return ret