-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
184 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |