or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/comtypes@1.4.x
tile.json

tessl/pypi-comtypes

tessl install tessl/pypi-comtypes@1.4.0

Pure Python COM package for Windows COM automation and interoperability

Agent Success

Agent success rate when using this tile

88%

Improvement

Agent success rate improvement when using this tile compared to baseline

0.99x

Baseline

Agent success rate without this tile

89%

task.mdevals/scenario-8/

Temperature Monitor COM Event Source

A Windows COM server that monitors temperature changes and notifies connected clients through COM events.

Requirements

Build a COM server that acts as a temperature monitoring system with the following capabilities:

Temperature Monitor Server

Create a COM server class that:

  • Maintains an internal temperature value (float, in Celsius)
  • Allows clients to connect and receive temperature change notifications
  • Fires events when the temperature changes
  • Supports multiple simultaneous client connections
  • Provides methods to update the temperature value

Event Interface

The server should support an event interface that notifies clients when:

  • Temperature changes occur (provides old and new temperature values)
  • Temperature exceeds a warning threshold of 75°C
  • Temperature returns to normal (below 75°C)

Client Management

The implementation should:

  • Allow multiple clients to connect to receive events
  • Properly manage connection and disconnection of clients
  • Fire events to all connected clients when temperature changes

Test Cases

  • When a client connects and temperature is updated, the client receives a temperature change event with correct old and new values @test
  • When temperature exceeds 75°C, all connected clients receive a warning event @test
  • Multiple clients can connect simultaneously and all receive the same events @test
  • When a client disconnects, it no longer receives events but other clients continue to receive them @test

Implementation

@generates

API

"""Temperature monitoring COM server with event support."""

# COM server class that implements temperature monitoring
class TemperatureMonitor:
    """COM server that monitors temperature and fires events to connected clients."""

    def set_temperature(self, celsius: float) -> None:
        """Update the current temperature and fire events to connected clients.

        Args:
            celsius: The new temperature value in Celsius
        """
        pass

    def get_temperature(self) -> float:
        """Get the current temperature value.

        Returns:
            The current temperature in Celsius
        """
        pass


# Event sink interface that clients implement to receive events
class ITemperatureEvents:
    """Interface that clients implement to receive temperature events."""

    def on_temperature_changed(self, old_temp: float, new_temp: float) -> None:
        """Called when temperature changes.

        Args:
            old_temp: Previous temperature value
            new_temp: New temperature value
        """
        pass

    def on_temperature_warning(self, temp: float) -> None:
        """Called when temperature exceeds 75°C.

        Args:
            temp: Current temperature that triggered the warning
        """
        pass

    def on_temperature_normal(self, temp: float) -> None:
        """Called when temperature returns below 75°C after a warning.

        Args:
            temp: Current temperature
        """
        pass

Dependencies { .dependencies }

comtypes { .dependency }

Provides COM interoperability support for implementing event sources.