updated constants
This commit is contained in:
Родитель
846ef8bf1e
Коммит
c68f6c90ee
|
@ -0,0 +1,2 @@
|
|||
# Autogenerated file.
|
||||
from .client import PCControllerClient # type: ignore
|
|
@ -0,0 +1,42 @@
|
|||
# Autogenerated file. Do not edit.
|
||||
from jacdac.bus import Bus, Client
|
||||
from .constants import *
|
||||
|
||||
|
||||
|
||||
class PCControllerClient(Client):
|
||||
"""
|
||||
Send various events to PC, including opening a URL, start an app, sending text, etc.
|
||||
Implements a client for the `PC controller <https://microsoft.github.io/jacdac-docs/services/pccontroller>`_ service.
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self, bus: Bus, role: str) -> None:
|
||||
super().__init__(bus, JD_SERVICE_CLASS_PCCONTROLLER, JD_PCCONTROLLER_PACK_FORMATS, role)
|
||||
|
||||
|
||||
|
||||
def open_url(self, url: str) -> None:
|
||||
"""
|
||||
Open a URL in the default browser.
|
||||
"""
|
||||
self.send_cmd_packed(JD_PCCONTROLLER_CMD_OPEN_URL, url)
|
||||
|
||||
def start_app(self, name: str) -> None:
|
||||
"""
|
||||
Start an app.
|
||||
"""
|
||||
self.send_cmd_packed(JD_PCCONTROLLER_CMD_START_APP, name)
|
||||
|
||||
def send_text(self, text: str) -> None:
|
||||
"""
|
||||
Send text to the active window.
|
||||
"""
|
||||
self.send_cmd_packed(JD_PCCONTROLLER_CMD_SEND_TEXT, text)
|
||||
|
||||
def run_script(self, script: str) -> None:
|
||||
"""
|
||||
Run a script.
|
||||
"""
|
||||
self.send_cmd_packed(JD_PCCONTROLLER_CMD_RUN_SCRIPT, script)
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
# Autogenerated constants for PC controller service
|
||||
from jacdac.constants import *
|
||||
JD_SERVICE_CLASS_PCCONTROLLER = const(0x113d0987)
|
||||
JD_PCCONTROLLER_CMD_OPEN_URL = const(0x80)
|
||||
JD_PCCONTROLLER_CMD_START_APP = const(0x81)
|
||||
JD_PCCONTROLLER_CMD_SEND_TEXT = const(0x82)
|
||||
JD_PCCONTROLLER_CMD_RUN_SCRIPT = const(0x83)
|
||||
JD_PCCONTROLLER_PACK_FORMATS = {
|
||||
JD_PCCONTROLLER_CMD_OPEN_URL: "s",
|
||||
JD_PCCONTROLLER_CMD_START_APP: "s",
|
||||
JD_PCCONTROLLER_CMD_SEND_TEXT: "s",
|
||||
JD_PCCONTROLLER_CMD_RUN_SCRIPT: "s"
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
# Autogenerated file.
|
||||
from .client import PCMonitorClient # type: ignore
|
|
@ -0,0 +1,55 @@
|
|||
# Autogenerated file. Do not edit.
|
||||
from jacdac.bus import Bus, Client
|
||||
from .constants import *
|
||||
from typing import Optional, Tuple
|
||||
|
||||
|
||||
class PCMonitorClient(Client):
|
||||
"""
|
||||
Measures PC monitor.
|
||||
Implements a client for the `PC monitor <https://microsoft.github.io/jacdac-docs/services/pcmonitor>`_ service.
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self, bus: Bus, role: str) -> None:
|
||||
super().__init__(bus, JD_SERVICE_CLASS_PCMONITOR, JD_PCMONITOR_PACK_FORMATS, role)
|
||||
|
||||
|
||||
@property
|
||||
def cpu_usage(self) -> Optional[int]:
|
||||
"""
|
||||
CPU usage in percent., _: %
|
||||
"""
|
||||
return self.register(JD_PCMONITOR_REG_CPU_USAGE).value()
|
||||
|
||||
@property
|
||||
def cpu_temperature(self) -> Optional[int]:
|
||||
"""
|
||||
CPU temperature in Celsius., _: °C
|
||||
"""
|
||||
return self.register(JD_PCMONITOR_REG_CPU_TEMPERATURE).value()
|
||||
|
||||
@property
|
||||
def ram_usage(self) -> Optional[int]:
|
||||
"""
|
||||
RAM usage in percent., _: %
|
||||
"""
|
||||
return self.register(JD_PCMONITOR_REG_RAM_USAGE).value()
|
||||
|
||||
@property
|
||||
def gpu_information(self) -> Optional[Tuple[int, int]]:
|
||||
"""
|
||||
GPU info., usage: %,temperature: °C
|
||||
"""
|
||||
return self.register(JD_PCMONITOR_REG_GPU_INFORMATION).value()
|
||||
|
||||
@property
|
||||
def network_information(self) -> Optional[Tuple[int, int]]:
|
||||
"""
|
||||
Network transmit/receive speed in Kbytes per second.
|
||||
|
||||
A measure of PC monitor., tx: KB,rx: KB
|
||||
"""
|
||||
return self.register(JD_PCMONITOR_REG_NETWORK_INFORMATION).value()
|
||||
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
# Autogenerated constants for PC monitor service
|
||||
from jacdac.constants import *
|
||||
JD_SERVICE_CLASS_PCMONITOR = const(0x18627b15)
|
||||
JD_PCMONITOR_REG_CPU_USAGE = const(0x190)
|
||||
JD_PCMONITOR_REG_CPU_TEMPERATURE = const(0x191)
|
||||
JD_PCMONITOR_REG_RAM_USAGE = const(0x192)
|
||||
JD_PCMONITOR_REG_GPU_INFORMATION = const(0x193)
|
||||
JD_PCMONITOR_REG_NETWORK_INFORMATION = const(0x195)
|
||||
JD_PCMONITOR_PACK_FORMATS = {
|
||||
JD_PCMONITOR_REG_CPU_USAGE: "u8",
|
||||
JD_PCMONITOR_REG_CPU_TEMPERATURE: "u8",
|
||||
JD_PCMONITOR_REG_RAM_USAGE: "u8",
|
||||
JD_PCMONITOR_REG_GPU_INFORMATION: "u8 u8",
|
||||
JD_PCMONITOR_REG_NETWORK_INFORMATION: "u16 u16"
|
||||
}
|
Загрузка…
Ссылка в новой задаче