Skip to content

Commit

Permalink
updated constants
Browse files Browse the repository at this point in the history
  • Loading branch information
pelikhan committed Jan 9, 2024
1 parent e122dc5 commit b16189c
Show file tree
Hide file tree
Showing 4 changed files with 184 additions and 0 deletions.
63 changes: 63 additions & 0 deletions pccontroller/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
namespace jacdac {
// Service PC controller constants
export const SRV_PCCONTROLLER = 0x113d0987
export const enum PCControllerCmd {
/**
* Argument: url string (bytes). Open a URL in the default browser.
*
* ```
* const [url] = jdunpack<[string]>(buf, "s")
* ```
*/
OpenUrl = 0x80,

/**
* Argument: name string (bytes). Start an app.
*
* ```
* const [name] = jdunpack<[string]>(buf, "s")
* ```
*/
StartApp = 0x81,

/**
* Argument: text string (bytes). Send text to the active window.
*
* ```
* const [text] = jdunpack<[string]>(buf, "s")
* ```
*/
SendText = 0x82,

/**
* Argument: script string (bytes). Run a script.
*
* ```
* const [script] = jdunpack<[string]>(buf, "s")
* ```
*/
RunScript = 0x83,
}

export namespace PCControllerCmdPack {
/**
* Pack format for 'open_url' data.
*/
export const OpenUrl = "s"

/**
* Pack format for 'start_app' data.
*/
export const StartApp = "s"

/**
* Pack format for 'send_text' data.
*/
export const SendText = "s"

/**
* Pack format for 'run_script' data.
*/
export const RunScript = "s"
}
}
22 changes: 22 additions & 0 deletions pccontroller/pxt.g.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "jacdac-pccontroller",
"version": "0.0.0",
"description": "Send various events to PC, including opening a URL, start an app, sending text, etc.",
"files": [
"constants.ts",
"client.g.ts"
],
"testFiles": [
"test.ts"
],
"supportedTargets": [
"microbit",
"arcade",
"maker",
"calliopemini"
],
"dependencies": {
"core": "*",
"jacdac": "github:microsoft/pxt-jacdac"
}
}
77 changes: 77 additions & 0 deletions pcmonitor/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
namespace jacdac {
// Service PC monitor constants
export const SRV_PCMONITOR = 0x18627b15
export const enum PCMonitorReg {
/**
* Read-only % uint8_t. CPU usage in percent.
*
* ```
* const [cpuUsage] = jdunpack<[number]>(buf, "u8")
* ```
*/
CpuUsage = 0x190,

/**
* Read-only °C uint8_t. CPU temperature in Celsius.
*
* ```
* const [cpuTemperature] = jdunpack<[number]>(buf, "u8")
* ```
*/
CpuTemperature = 0x191,

/**
* Read-only % uint8_t. RAM usage in percent.
*
* ```
* const [ramUsage] = jdunpack<[number]>(buf, "u8")
* ```
*/
RamUsage = 0x192,

/**
* GPU info.
*
* ```
* const [usage, temperature] = jdunpack<[number, number]>(buf, "u8 u8")
* ```
*/
GpuInformation = 0x193,

/**
* Network transmit/receive speed in Kbytes per second.
*
* ```
* const [tx, rx] = jdunpack<[number, number]>(buf, "u16 u16")
* ```
*/
NetworkInformation = 0x195,
}

export namespace PCMonitorRegPack {
/**
* Pack format for 'cpu_usage' data.
*/
export const CpuUsage = "u8"

/**
* Pack format for 'cpu_temperature' data.
*/
export const CpuTemperature = "u8"

/**
* Pack format for 'ram_usage' data.
*/
export const RamUsage = "u8"

/**
* Pack format for 'gpu_information' data.
*/
export const GpuInformation = "u8 u8"

/**
* Pack format for 'network_information' data.
*/
export const NetworkInformation = "u16 u16"
}
}
22 changes: 22 additions & 0 deletions pcmonitor/pxt.g.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "jacdac-pcmonitor",
"version": "0.0.0",
"description": "Measures PC monitor.",
"files": [
"constants.ts",
"client.g.ts"
],
"testFiles": [
"test.ts"
],
"supportedTargets": [
"microbit",
"arcade",
"maker",
"calliopemini"
],
"dependencies": {
"core": "*",
"jacdac": "github:microsoft/pxt-jacdac"
}
}

0 comments on commit b16189c

Please sign in to comment.