added bluetoothDevices
This commit is contained in:
parent
f2fb334188
commit
143b1abe86
38
README.md
38
README.md
@ -485,7 +485,23 @@ I also created a nice little command line tool called [mmon][mmon-github-url] (m
|
||||
| | [0].default | | | X | X | | is default printer |
|
||||
| | [0].shared | X | | X | X | | is shared printer |
|
||||
|
||||
#### 12. Network related functions
|
||||
#### 12. Audio
|
||||
|
||||
| Function | Result object | Linux | BSD | Mac | Win | Sun | Comments |
|
||||
| --------------- | ------------- | ----- | ------- | --- | --- | --- | -------- |
|
||||
| si.audio(cb) | [{...}] | X | X | X | X | | get printer information |
|
||||
| | [0].id | X | | X | X | | internal id |
|
||||
| | [0].name | X | | X | X | | name |
|
||||
| | [0].manufacturer | X | | X | X | | manufacturer |
|
||||
| | [0].revision | X | | | | | revision |
|
||||
| | [0].driver | X | | | | | driver |
|
||||
| | [0].default | | | X | X | | is default |
|
||||
| | [0].in | | | X | X | | is input channel |
|
||||
| | [0].out | | | X | X | | is output channel |
|
||||
| | [0].interfaceType | X | | X | X | | interface type (PCIe, USB, HDMI, ...) |
|
||||
| | [0].status | X | | X | X | | printer status (e.g. idle) |
|
||||
|
||||
#### 13. Network related functions
|
||||
|
||||
| Function | Result object | Linux | BSD | Mac | Win | Sun | Comments |
|
||||
| --------------- | ------------- | ----- | ------- | --- | --- | --- | -------- |
|
||||
@ -539,7 +555,8 @@ I also created a nice little command line tool called [mmon][mmon-github-url] (m
|
||||
| | ms | X | X | X | X | X | response time in ms |
|
||||
| si.inetLatency(host, cb) | : number | X | X | X | X | X | response-time (ms) to external resource<br>host parameter is optional (default 8.8.8.8)|
|
||||
|
||||
#### 13. Wifi networks
|
||||
#### 14. Wifi networks
|
||||
|
||||
| Function | Result object | Linux | BSD | Mac | Win | Sun | Comments |
|
||||
| --------------- | ------------- | ----- | ------- | --- | --- | --- | -------- |
|
||||
| si.wifiNetworks(cb) | [{...}] | X | | X | X | | array of available wifi networks |
|
||||
@ -554,7 +571,20 @@ I also created a nice little command line tool called [mmon][mmon-github-url] (m
|
||||
| | [0].wpaFlags | X | | X | X | | array of WPA flags |
|
||||
| | [0].rsnFlags | X | | | | | array of RDN flags |
|
||||
|
||||
#### 14. Docker
|
||||
#### 15. Bluetooth
|
||||
|
||||
| Function | Result object | Linux | BSD | Mac | Win | Sun | Comments |
|
||||
| --------------- | ------------- | ----- | ------- | --- | --- | --- | -------- |
|
||||
| si.bluetoothDevices(cb) | [{...}] | X | | X | X | | ... |
|
||||
| | [0].device | X | | X | X | | device name |
|
||||
| | [0].name | X | | X | X | | name |
|
||||
| | [0].address | X | | X | X | | address |
|
||||
| | [0].batteryPercent | X | | X | X | | battery level percent |
|
||||
| | [0].manufacturer | X | | X | X | | manufacturer |
|
||||
| | [0].type | X | | X | X | | typoe of bluetooth device |
|
||||
| | [0].connected | X | | X | X | | is connected |
|
||||
|
||||
#### 16. Docker
|
||||
|
||||
| Function | Result object | Linux | BSD | Mac | Win | Sun | Comments |
|
||||
| --------------- | ------------- | ----- | ------- | --- | --- | --- | -------- |
|
||||
@ -652,7 +682,7 @@ I also created a nice little command line tool called [mmon][mmon-github-url] (m
|
||||
| | [0].command | X | X | X | X | X | command and arguments |
|
||||
| si.dockerAll(cb) | {...} | X | X | X | X | X | list of all containers including their stats<br>and processes in one single array |
|
||||
|
||||
#### 15. Virtual Box
|
||||
#### 17. Virtual Box
|
||||
|
||||
| Function | Result object | Linux | BSD | Mac | Win | Sun | Comments |
|
||||
| --------------- | ------------- | ----- | ------- | --- | --- | --- | -------- |
|
||||
|
||||
263
docs/audio.html
Normal file
263
docs/audio.html
Normal file
@ -0,0 +1,263 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<!-- Required meta tags -->
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
|
||||
<!-- CSS -->
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="https://pro.fontawesome.com/releases/v5.15.1/css/all.css" integrity="sha384-9ZfPnbegQSumzaE7mks2IYgHoayLtuto3AS6ieArECeaR8nCfliJVuLh/GaQ1gyM" crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="roboto/css/roboto.css">
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
<script src="main.js"></script>
|
||||
|
||||
<!-- Favicon -->
|
||||
<link rel="icon" type="image/png" sizes="192x192" href="/assets/android-icon-192x192.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/assets/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="96x96" href="/assets/favicon-96x96.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="/assets/favicon-16x16.png">
|
||||
|
||||
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/styles/default.min.css">
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/highlight.min.js"></script>
|
||||
<script>hljs.initHighlightingOnLoad();</script>
|
||||
|
||||
<title>systeminformation</title>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<nav class="nav">
|
||||
<div class="container">
|
||||
<a href="."><img class="logo float-left" src="assets/logo.png">
|
||||
<div class="title float-left">systeminformation</div>
|
||||
</a>
|
||||
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>
|
||||
<div class="text float-right todocs"><a href="./#docs">Docs Overview</a></div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<section class="container">
|
||||
<div class="row">
|
||||
<div class="col-12 col-md-4 col-lg-3 col-xl-2 menu" id="menu">
|
||||
</div>
|
||||
<div class="col-12 col-md-8 col-lg-9 col-xl-10 content">
|
||||
<div class="row">
|
||||
<div class="col-12 sectionheader">
|
||||
<div class="title">Audio</div>
|
||||
<div class="text">
|
||||
<p>In this section you will learn how to get information about detected audio devices or interfaces. Results might differ on different platforms as not everything is available/detectable on each platform:</p>
|
||||
<p>For function reference and examples we assume, that we imported <span class="code">systeminformation</span> as follows:</p>
|
||||
<pre><code class="js">const si = require('systeminformation');</code></pre>
|
||||
<h2>Detected Audio Devices</h2>
|
||||
<p>All functions in this section return a promise or can be called with a callback function (parameter <span class="code">cb</span> in the function reference)</p>
|
||||
<table class="table table-sm table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Function</th>
|
||||
<th>Result object</th>
|
||||
<th>Linux</th>
|
||||
<th>BSD</th>
|
||||
<th>Mac</th>
|
||||
<th>Win</th>
|
||||
<th>Sun</th>
|
||||
<th>Comments</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>si.audio(cb)</td>
|
||||
<td>[{...}]</td>
|
||||
<td>X</td>
|
||||
<td></td>
|
||||
<td>X</td>
|
||||
<td>X</td>
|
||||
<td></td>
|
||||
<td>audio informatiom</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>[0].id</td>
|
||||
<td>X</td>
|
||||
<td></td>
|
||||
<td>X</td>
|
||||
<td>X</td>
|
||||
<td></td>
|
||||
<td>internal ID</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>[0].name</td>
|
||||
<td>X</td>
|
||||
<td></td>
|
||||
<td>X</td>
|
||||
<td>X</td>
|
||||
<td></td>
|
||||
<td>audio name</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>[0].manufacturer</td>
|
||||
<td>X</td>
|
||||
<td></td>
|
||||
<td>X</td>
|
||||
<td>X</td>
|
||||
<td></td>
|
||||
<td>manufacturer</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>[0].revision</td>
|
||||
<td>X</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>revision</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>[0].driver</td>
|
||||
<td>X</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>driver</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>[0].default</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>X</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>is default</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>[0].in</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>X</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>is input channel</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>[0].out</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>X</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>is output channel</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>[0].interfaceType</td>
|
||||
<td>X</td>
|
||||
<td></td>
|
||||
<td>X</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>interface type (built-in, PCI, HDMI, USB...)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>[0].status</td>
|
||||
<td>X</td>
|
||||
<td></td>
|
||||
<td>X</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>status</td>
|
||||
</tr>
|
||||
<tr class="example">
|
||||
<td></td>
|
||||
<td colspan="7">
|
||||
<h5>Example</h5>
|
||||
<pre><code class="js">const si = require('systeminformation');
|
||||
si.audio().then(data => console.log(data));</code></pre class="example">
|
||||
<pre class="example">
|
||||
[
|
||||
{
|
||||
id: 0,
|
||||
name: 'MacBook Microphone',
|
||||
manufacturer: 'Apple Inc.',
|
||||
revision: null,
|
||||
driver: null,
|
||||
default: true,
|
||||
channel: 'Built-In',
|
||||
in: true,
|
||||
out: false,
|
||||
status: 'online'
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
name: 'MacBook Speaker',
|
||||
manufacturer: 'Apple Inc.',
|
||||
revision: null,
|
||||
driver: null,
|
||||
default: true,
|
||||
channel: 'Built-In',
|
||||
in: false,
|
||||
out: true,
|
||||
status: 'online'
|
||||
}
|
||||
]</pre>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<footer class="container-fluid">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-4 col-12">
|
||||
<ul class="list-unstyled">
|
||||
<li><a href="." class="medium home">Home</a></li>
|
||||
<li> </li>
|
||||
<li><a href="security.html">Security Advisories <i class="fas fa-shield-check"></i></a></li>
|
||||
<li><a href="https://github.com/sebhildebrandt/systeminformation">Github <i class="fab fa-github"></i></a></li>
|
||||
<li><a href="https://buymeacoff.ee/systeminfo" class="medium badge bg-primary"><i class="fas fa-coffee"></i> Buy me a coffee</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-lg-4 col-12">
|
||||
<ul class="list-unstyled">
|
||||
<li><a href="gettingstarted.html">Quick Start</a></li>
|
||||
<li><a href="changes.html">Version 5 Changes</a></li>
|
||||
<li><a href="history.html">Full Version history</a></li>
|
||||
<li><a href="issues.html">Known Issues</a></li>
|
||||
<li><a href="statsfunctions.html">Stats Functions</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-lg-4 col-12">
|
||||
<ul class="list-unstyled">
|
||||
<li><a href="contributors.html">Contributors</a></li>
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li><a href="copyright.html">Copyright & License <img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="MIT license" /></a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2021 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">+innovations GmbH</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<script>
|
||||
window.onload = function (e) {
|
||||
createMenu();
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
233
docs/bluetooth.html
Normal file
233
docs/bluetooth.html
Normal file
@ -0,0 +1,233 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<!-- Required meta tags -->
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
|
||||
<!-- CSS -->
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="https://pro.fontawesome.com/releases/v5.15.1/css/all.css" integrity="sha384-9ZfPnbegQSumzaE7mks2IYgHoayLtuto3AS6ieArECeaR8nCfliJVuLh/GaQ1gyM" crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="roboto/css/roboto.css">
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
<script src="main.js"></script>
|
||||
|
||||
<!-- Favicon -->
|
||||
<link rel="icon" type="image/png" sizes="192x192" href="/assets/android-icon-192x192.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/assets/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="96x96" href="/assets/favicon-96x96.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="/assets/favicon-16x16.png">
|
||||
|
||||
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/styles/default.min.css">
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/highlight.min.js"></script>
|
||||
<script>hljs.initHighlightingOnLoad();</script>
|
||||
|
||||
<title>systeminformation</title>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<nav class="nav">
|
||||
<div class="container">
|
||||
<a href="."><img class="logo float-left" src="assets/logo.png">
|
||||
<div class="title float-left">systeminformation</div>
|
||||
</a>
|
||||
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>
|
||||
<div class="text float-right todocs"><a href="./#docs">Docs Overview</a></div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<section class="container">
|
||||
<div class="row">
|
||||
<div class="col-12 col-md-4 col-lg-3 col-xl-2 menu" id="menu">
|
||||
</div>
|
||||
<div class="col-12 col-md-8 col-lg-9 col-xl-10 content">
|
||||
<div class="row">
|
||||
<div class="col-12 sectionheader">
|
||||
<div class="title">Bluetooth</div>
|
||||
<div class="text">
|
||||
<p>In this section you will learn how to get information about detected bluetooth devices. Results might differ on different platforms as not everything is available/detectable on each platform:</p>
|
||||
<p>For function reference and examples we assume, that we imported <span class="code">systeminformation</span> as follows:</p>
|
||||
<pre><code class="js">const si = require('systeminformation');</code></pre>
|
||||
<h2>Detected Bluetooth Devices</h2>
|
||||
<p>All functions in this section return a promise or can be called with a callback function (parameter <span class="code">cb</span> in the function reference)</p>
|
||||
<table class="table table-sm table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Function</th>
|
||||
<th>Result object</th>
|
||||
<th>Linux</th>
|
||||
<th>BSD</th>
|
||||
<th>Mac</th>
|
||||
<th>Win</th>
|
||||
<th>Sun</th>
|
||||
<th>Comments</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>si.bluetoothDevices(cb)</td>
|
||||
<td>[{...}]</td>
|
||||
<td>X</td>
|
||||
<td></td>
|
||||
<td>X</td>
|
||||
<td>X</td>
|
||||
<td></td>
|
||||
<td>bluetooth device informatiom</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>[0].device</td>
|
||||
<td>X</td>
|
||||
<td></td>
|
||||
<td>X</td>
|
||||
<td>X</td>
|
||||
<td></td>
|
||||
<td>device name</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>[0].name</td>
|
||||
<td>X</td>
|
||||
<td></td>
|
||||
<td>X</td>
|
||||
<td>X</td>
|
||||
<td></td>
|
||||
<td>name</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>[0].address</td>
|
||||
<td>X</td>
|
||||
<td></td>
|
||||
<td>X</td>
|
||||
<td>X</td>
|
||||
<td></td>
|
||||
<td>address</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>[0].batteryPercent</td>
|
||||
<td>X</td>
|
||||
<td></td>
|
||||
<td>X</td>
|
||||
<td>X</td>
|
||||
<td></td>
|
||||
<td>battery level percent</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>[0].manufacturer</td>
|
||||
<td>X</td>
|
||||
<td></td>
|
||||
<td>X</td>
|
||||
<td>X</td>
|
||||
<td></td>
|
||||
<td>manufacturer</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>[0].type</td>
|
||||
<td>X</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>type of device</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>[0].connected</td>
|
||||
<td>X</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>connected</td>
|
||||
</tr>
|
||||
<tr class="example">
|
||||
<td></td>
|
||||
<td colspan="7">
|
||||
<h5>Example</h5>
|
||||
<pre><code class="js">const si = require('systeminformation');
|
||||
si.bluetoothDevices().then(data => console.log(data));</code></pre class="example">
|
||||
<pre class="example">
|
||||
[
|
||||
{
|
||||
id: 0,
|
||||
name: 'MacBook Microphone',
|
||||
manufacturer: 'Apple Inc.',
|
||||
revision: null,
|
||||
driver: null,
|
||||
default: true,
|
||||
channel: 'Built-In',
|
||||
in: true,
|
||||
out: false,
|
||||
status: 'online'
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
name: 'MacBook Speaker',
|
||||
manufacturer: 'Apple Inc.',
|
||||
revision: null,
|
||||
driver: null,
|
||||
default: true,
|
||||
channel: 'Built-In',
|
||||
in: false,
|
||||
out: true,
|
||||
status: 'online'
|
||||
}
|
||||
]</pre>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<footer class="container-fluid">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-4 col-12">
|
||||
<ul class="list-unstyled">
|
||||
<li><a href="." class="medium home">Home</a></li>
|
||||
<li> </li>
|
||||
<li><a href="security.html">Security Advisories <i class="fas fa-shield-check"></i></a></li>
|
||||
<li><a href="https://github.com/sebhildebrandt/systeminformation">Github <i class="fab fa-github"></i></a></li>
|
||||
<li><a href="https://buymeacoff.ee/systeminfo" class="medium badge bg-primary"><i class="fas fa-coffee"></i> Buy me a coffee</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-lg-4 col-12">
|
||||
<ul class="list-unstyled">
|
||||
<li><a href="gettingstarted.html">Quick Start</a></li>
|
||||
<li><a href="changes.html">Version 5 Changes</a></li>
|
||||
<li><a href="history.html">Full Version history</a></li>
|
||||
<li><a href="issues.html">Known Issues</a></li>
|
||||
<li><a href="statsfunctions.html">Stats Functions</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-lg-4 col-12">
|
||||
<ul class="list-unstyled">
|
||||
<li><a href="contributors.html">Contributors</a></li>
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li><a href="copyright.html">Copyright & License <img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="MIT license" /></a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2021 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">+innovations GmbH</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<script>
|
||||
window.onload = function (e) {
|
||||
createMenu();
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
105
lib/audio.js
105
lib/audio.js
@ -28,16 +28,6 @@ const _openbsd = (_platform === 'openbsd');
|
||||
const _netbsd = (_platform === 'netbsd');
|
||||
const _sunos = (_platform === 'sunos');
|
||||
|
||||
const winPrinterStatus = {
|
||||
1: 'Other',
|
||||
2: 'Unknown',
|
||||
3: 'Idle',
|
||||
4: 'Printing',
|
||||
5: 'Warmup',
|
||||
6: 'Stopped Printing',
|
||||
7: 'Offline',
|
||||
}
|
||||
|
||||
function getLinuxAudioPci() {
|
||||
let cmd = 'lspci -v 2>/dev/null'
|
||||
let result = [];
|
||||
@ -66,13 +56,12 @@ function parseLinuxAudioPciMM(lines, audioPCI) {
|
||||
|
||||
result.id = slotId;
|
||||
result.name = util.getValue(lines, 'SDevice');
|
||||
result.type = util.getValue(lines, 'Class');
|
||||
// result.type = util.getValue(lines, 'Class');
|
||||
result.manufacturer = util.getValue(lines, 'SVendor');
|
||||
result.builtIn = null;
|
||||
result.default = null;
|
||||
result.revision = util.getValue(lines, 'Rev');
|
||||
result.driver = pciMatch && pciMatch.length === 1 && pciMatch[0].driver ? pciMatch[0].driver : '';
|
||||
result.channel = null;
|
||||
result.default = null;
|
||||
result.channel = 'PCIe';
|
||||
result.in = null;
|
||||
result.out = null;
|
||||
result.status = 'online';
|
||||
@ -80,40 +69,11 @@ function parseLinuxAudioPciMM(lines, audioPCI) {
|
||||
return result;
|
||||
}
|
||||
|
||||
function parseLinuxLpstatPrinter(lines, id) {
|
||||
const result = {};
|
||||
result.id = id
|
||||
result.name = util.getValue(lines, 'Description', ':', true);
|
||||
result.model = lines.length > 0 && lines[0] ? lines[0].split(' ')[0] : '';
|
||||
result.uri = null;
|
||||
result.uuid = null
|
||||
result.status = lines.length > 0 && lines[0] ? (lines[0].indexOf(' idle') > 0 ? 'idle' : (lines[0].indexOf(' printing') > 0 ? 'printing' : 'unknown')) : null
|
||||
result.local = util.getValue(lines, 'Location', ':', true).toLowerCase().startsWith('local');
|
||||
result.default = null;
|
||||
result.shared = util.getValue(lines, 'Shared', ' ').toLowerCase().startsWith('yes');
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// id
|
||||
// name
|
||||
// type
|
||||
// manufacturer
|
||||
// builtIn
|
||||
// default
|
||||
// revision
|
||||
// driver
|
||||
// (onboard)
|
||||
// #channels
|
||||
// in
|
||||
// out
|
||||
// interfaceType HDMI, Display - Port, Build -in, USB, PCIe(darwin: coreaudio_device_transport)
|
||||
// status
|
||||
|
||||
function parseDarwinChannel(str) {
|
||||
let result = '';
|
||||
|
||||
if (str.indexOf('builtin') >= 0) { result = 'Built-In'; }
|
||||
if (str.indexOf('extern') >= 0) { result = 'Audio-Jack'; }
|
||||
if (str.indexOf('hdmi') >= 0) { result = 'HDMI'; }
|
||||
if (str.indexOf('displayport') >= 0) { result = 'Display-Port'; }
|
||||
if (str.indexOf('usb') >= 0) { result = 'USB'; }
|
||||
@ -124,14 +84,14 @@ function parseDarwinChannel(str) {
|
||||
|
||||
function parseDarwinAudio(audioObject, id) {
|
||||
const result = {};
|
||||
const channelStr = (audioObject.coreaudio_device_transport || '');
|
||||
const channelStr = ((audioObject.coreaudio_device_transport || '') + ' ' + (audioObject._name || '')).toLowerCase();
|
||||
|
||||
result.id = id;
|
||||
result.name = audioObject._name
|
||||
result.manufacturer = audioObject.coreaudio_device_manufacturer;
|
||||
result.default = !!(audioObject.coreaudio_default_audio_input_device || '') || !!(audioObject.coreaudio_default_audio_output_device || '');
|
||||
result.revision = null;
|
||||
result.driver = null;
|
||||
result.default = !!(audioObject.coreaudio_default_audio_input_device || '') || !!(audioObject.coreaudio_default_audio_output_device || '');
|
||||
result.channel = parseDarwinChannel(channelStr);
|
||||
result.in = !!(audioObject.coreaudio_device_input || '')
|
||||
result.out = !!(audioObject.coreaudio_device_output || '')
|
||||
@ -140,19 +100,21 @@ function parseDarwinAudio(audioObject, id) {
|
||||
return result;
|
||||
}
|
||||
|
||||
function parseWindowsAudio(lines, id) {
|
||||
function parseWindowsAudio(lines) {
|
||||
const result = {};
|
||||
const status = parseInt(util.getValue(lines, 'PrinterStatus', '='), 10);
|
||||
const status = util.getValue(lines, 'StatusInfo', '=');
|
||||
// const description = util.getValue(lines, 'Description', '=');
|
||||
|
||||
result.id = id;
|
||||
result.id = util.getValue(lines, 'DeviceID', '='); // PNPDeviceID??
|
||||
result.name = util.getValue(lines, 'name', '=');
|
||||
result.model = util.getValue(lines, 'DriverName', '=');
|
||||
result.uri = null;
|
||||
result.uuid = null
|
||||
result.status = winPrinterStatus[status] ? winPrinterStatus[status] : null;
|
||||
result.local = util.getValue(lines, 'Local', '=') === 'TRUE';
|
||||
result.default = util.getValue(lines, 'Default', '=') === 'TRUE';
|
||||
result.shared = util.getValue(lines, 'Shared', '=') === 'TRUE';
|
||||
result.manufacturer = util.getValue(lines, 'manufacturer', '=');
|
||||
result.revision = null;
|
||||
result.driver = null
|
||||
result.default = null
|
||||
result.in = null
|
||||
result.out = null
|
||||
result.interfaceType = null
|
||||
result.status = status
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -177,33 +139,10 @@ function audio(callback) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (result.length === 0) {
|
||||
if (_linux) {
|
||||
cmd = 'export LC_ALL=C; lpstat -lp 2>/dev/null; unset LC_ALL';
|
||||
// lpstat
|
||||
exec(cmd, function (error, stdout) {
|
||||
const parts = ('\n' + stdout.toString()).split('\nprinter ');
|
||||
for (let i = 1; i < parts.length; i++) {
|
||||
const printers = parseLinuxLpstatPrinter(parts[i].split('\n'), i);
|
||||
result.push(printers);
|
||||
}
|
||||
});
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
} else {
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
}
|
||||
} else {
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
});
|
||||
}
|
||||
if (_darwin) {
|
||||
@ -229,7 +168,7 @@ function audio(callback) {
|
||||
});
|
||||
}
|
||||
if (_windows) {
|
||||
util.wmic('printer get /value', function (error, stdout) {
|
||||
util.wmic('path Win32_SoundDevice get /value', function (error, stdout) {
|
||||
if (!error) {
|
||||
const parts = stdout.toString().split(/\n\s*\n/);
|
||||
for (let i = 0; i < parts.length; i++) {
|
||||
|
||||
205
lib/bluetooth.js
Normal file
205
lib/bluetooth.js
Normal file
@ -0,0 +1,205 @@
|
||||
'use strict';
|
||||
// @ts-check
|
||||
// ==================================================================================
|
||||
// audio.js
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Description: System Information - library
|
||||
// for Node.js
|
||||
// Copyright: (c) 2014 - 2021
|
||||
// Author: Sebastian Hildebrandt
|
||||
// ----------------------------------------------------------------------------------
|
||||
// License: MIT
|
||||
// ==================================================================================
|
||||
// 17. bluetooth
|
||||
// ----------------------------------------------------------------------------------
|
||||
|
||||
const exec = require('child_process').exec;
|
||||
const execSync = require('child_process').execSync;
|
||||
const util = require('./util');
|
||||
// const fs = require('fs');
|
||||
|
||||
let _platform = process.platform;
|
||||
|
||||
const _linux = (_platform === 'linux');
|
||||
const _darwin = (_platform === 'darwin');
|
||||
const _windows = (_platform === 'win32');
|
||||
const _freebsd = (_platform === 'freebsd');
|
||||
const _openbsd = (_platform === 'openbsd');
|
||||
const _netbsd = (_platform === 'netbsd');
|
||||
const _sunos = (_platform === 'sunos');
|
||||
|
||||
function getLinuxAudioPci() {
|
||||
let cmd = 'lspci -v 2>/dev/null'
|
||||
let result = [];
|
||||
try {
|
||||
const parts = execSync(cmd).toString().split('\n\n');
|
||||
for (let i = 0; i < parts.length; i++) {
|
||||
const lines = parts[i].split('\n');
|
||||
if (lines && lines.length && lines[0].toLowerCase().indexOf('audio') >= 0) {
|
||||
const audio = {};
|
||||
audio.slotId = lines[0].split(' ')[0];
|
||||
audio.driver = util.getValue(lines, 'Kernel driver in use', ':', true) || util.getValue(lines, 'Kernel modules', ':', true)
|
||||
result.push(audio);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
} catch (e) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
// device("device_services")
|
||||
// name-- > Key
|
||||
// address-- > "device_addr"
|
||||
// batteryPercent-- > "device_batteryPercent"
|
||||
// manufacturer-- > "device_manufacturer"
|
||||
// type(keyboard, ...)-- > ("device_majorClassOfDevice_string"), "device_minorClassOfDevice_string"
|
||||
// connected
|
||||
|
||||
|
||||
|
||||
function parseLinuxAudioPciMM(lines, audioPCI) {
|
||||
const result = {};
|
||||
const slotId = util.getValue(lines, 'Slot');
|
||||
|
||||
const pciMatch = audioPCI.filter(function (item) { return item.slotId === slotId })
|
||||
|
||||
result.id = slotId;
|
||||
result.name = util.getValue(lines, 'SDevice');
|
||||
// result.type = util.getValue(lines, 'Class');
|
||||
result.manufacturer = util.getValue(lines, 'SVendor');
|
||||
result.revision = util.getValue(lines, 'Rev');
|
||||
result.driver = pciMatch && pciMatch.length === 1 && pciMatch[0].driver ? pciMatch[0].driver : '';
|
||||
result.default = null;
|
||||
result.channel = 'PCIe';
|
||||
result.in = null;
|
||||
result.out = null;
|
||||
result.status = 'online';
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function parseDarwinBluetoothTyoe(str) {
|
||||
let result = '';
|
||||
|
||||
if (str.indexOf('keyboard') >= 0) { result = 'Keyboard'; }
|
||||
if (str.indexOf('mouse') >= 0) { result = 'Mouse'; }
|
||||
if (str.indexOf('speaker') >= 0) { result = 'Speaker'; }
|
||||
if (str.indexOf('headset') >= 0) { result = 'Headset'; }
|
||||
// to be continued ...
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function parseDarwinBluetoothDevices(bluetoothObject) {
|
||||
const result = {};
|
||||
const typeStr = ((bluetoothObject.device_minorClassOfDevice_string || bluetoothObject.device_majorClassOfDevice_string || '') + (bluetoothObject.device_name || '')).toLowerCase();
|
||||
|
||||
result.device = bluetoothObject.device_services || '';
|
||||
result.name = bluetoothObject.device_name || '';
|
||||
result.manufacturer = bluetoothObject.device_manufacturer || '';
|
||||
result.address = bluetoothObject.device_addr || '';
|
||||
result.batteryPercent = bluetoothObject.device_batteryPercent || null;
|
||||
result.tyoe = parseDarwinBluetoothTyoe(typeStr);
|
||||
result.connected = bluetoothObject.device_isconnected === 'attrib_Yes'|| false;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function parseWindowsAudio(lines) {
|
||||
const result = {};
|
||||
const status = util.getValue(lines, 'StatusInfo', '=');
|
||||
// const description = util.getValue(lines, 'Description', '=');
|
||||
|
||||
result.id = util.getValue(lines, 'DeviceID', '='); // PNPDeviceID??
|
||||
result.name = util.getValue(lines, 'name', '=');
|
||||
result.manufacturer = util.getValue(lines, 'manufacturer', '=');
|
||||
result.revision = null;
|
||||
result.driver = null
|
||||
result.default = null
|
||||
result.in = null
|
||||
result.out = null
|
||||
result.interfaceType = null
|
||||
result.status = status
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function bluetoothDevices(callback) {
|
||||
|
||||
return new Promise((resolve) => {
|
||||
process.nextTick(() => {
|
||||
let result = [];
|
||||
if (_linux || _freebsd || _openbsd || _netbsd) {
|
||||
let cmd = 'lspci -vmm 2>/dev/null'
|
||||
exec(cmd, function (error, stdout) {
|
||||
// PCI
|
||||
if (!error) {
|
||||
const audioPCI = getLinuxAudioPci();
|
||||
const parts = stdout.toString().split('\n\n');
|
||||
for (let i = 0; i < parts.length; i++) {
|
||||
const lines = parts[i].split('\n');
|
||||
if (util.getValue(lines, 'class', ':', true).toLowerCase().indexOf('audio') >= 0) {
|
||||
const audio = parseLinuxAudioPciMM(lines, audioPCI);
|
||||
result.push(audio);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
});
|
||||
}
|
||||
if (_darwin) {
|
||||
let cmd = 'system_profiler SPBluetoothDataType -json'
|
||||
exec(cmd, function (error, stdout) {
|
||||
if (!error) {
|
||||
try {
|
||||
const outObj = JSON.parse(stdout.toString());
|
||||
if (outObj.SPBluetoothDataType && outObj.SPBluetoothDataType.length && outObj.SPBluetoothDataType[0] && outObj.SPBluetoothDataType[0]['device_title'] && outObj.SPBluetoothDataType[0]['device_title'].length) {
|
||||
for (let i = 0; i < outObj.SPBluetoothDataType[0]['device_title'].length; i++) {
|
||||
const obj = outObj.SPBluetoothDataType[0]['device_title'][i];
|
||||
const objKey = Object.keys(obj);
|
||||
if (objKey && objKey.length === 1) {
|
||||
const innerObject = obj[objKey[0]];
|
||||
innerObject.device_name = objKey[0];
|
||||
const bluetoothDevice = parseDarwinBluetoothDevices(innerObject);
|
||||
result.push(bluetoothDevice);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
util.noop()
|
||||
}
|
||||
}
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
});
|
||||
}
|
||||
if (_windows) {
|
||||
util.wmic('path Win32_SoundDevice get /value', function (error, stdout) {
|
||||
if (!error) {
|
||||
const parts = stdout.toString().split(/\n\s*\n/);
|
||||
for (let i = 0; i < parts.length; i++) {
|
||||
result.push(parseWindowsAudio(parts[i].split('\n'), i))
|
||||
}
|
||||
}
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
});
|
||||
}
|
||||
if (_sunos) {
|
||||
resolve(null);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
exports.bluetoothDevices = bluetoothDevices;
|
||||
27
lib/index.d.ts
vendored
27
lib/index.d.ts
vendored
@ -732,15 +732,25 @@ export namespace Systeminformation {
|
||||
|
||||
interface AudioData {
|
||||
id: number | string;
|
||||
bus: number;
|
||||
deviceId: number;
|
||||
name: string;
|
||||
type: string;
|
||||
removable: boolean;
|
||||
vendor: string;
|
||||
manufacturer: string;
|
||||
maxPower: string;
|
||||
serialNumber: string;
|
||||
default: boolean;
|
||||
revision: string;
|
||||
driver: string;
|
||||
in: boolean;
|
||||
out: boolean;
|
||||
interfaceType: string;
|
||||
status: string;
|
||||
}
|
||||
|
||||
interface BluetoothDeviceData {
|
||||
device: string;
|
||||
name: string;
|
||||
address: string;
|
||||
batteryPercent: number;
|
||||
manufacturer: string;
|
||||
type: string;
|
||||
connected: boolean;
|
||||
}
|
||||
|
||||
// 10. "Get All at once" - functions
|
||||
@ -760,7 +770,6 @@ export namespace Systeminformation {
|
||||
memLayout: MemLayoutData[];
|
||||
diskLayout: DiskLayoutData[];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export function version(): string;
|
||||
@ -827,6 +836,8 @@ export function usb(cb?: (data: Systeminformation.UsbData[]) => any): Promise<Sy
|
||||
|
||||
export function audio(cb?: (data: Systeminformation.AudioData[]) => any): Promise<Systeminformation.AudioData[]>;
|
||||
|
||||
export function bluetoothDevices(cb?: (data: Systeminformation.BlockDevicesData[]) => any): Promise<Systeminformation.BlockDevicesData[]>;
|
||||
|
||||
export function getStaticData(cb?: (data: Systeminformation.StaticData) => any): Promise<Systeminformation.StaticData>;
|
||||
export function getDynamicData(srv?: string, iface?: string, cb?: (data: any) => any): Promise<any>;
|
||||
export function getAllData(srv?: string, iface?: string, cb?: (data: any) => any): Promise<any>;
|
||||
|
||||
@ -40,6 +40,7 @@ const vbox = require('./virtualbox');
|
||||
const printer = require('./printer');
|
||||
const usb = require('./usb');
|
||||
const audio = require('./audio');
|
||||
const bluetooth = require('./bluetooth');
|
||||
|
||||
let _platform = process.platform;
|
||||
const _windows = (_platform === 'win32');
|
||||
@ -493,6 +494,7 @@ exports.printer = printer.printer;
|
||||
exports.usb = usb.usb;
|
||||
|
||||
exports.audio = audio.audio;
|
||||
exports.bluetoothDevices = bluetooth.bluetoothDevices;
|
||||
|
||||
exports.getStaticData = getStaticData;
|
||||
exports.getDynamicData = getDynamicData;
|
||||
|
||||
@ -16,7 +16,7 @@ function test(f) {
|
||||
else if (f === 'f') { si.fsSize().then(data => { if (data !== null) { resolve({ data, title: 'File System' }); } else { resolve('not_supported') } }) }
|
||||
else if (f === 'F') { si.fsStats().then(data => { if (data !== null) { resolve({ data, title: 'FS Stats' }); } else { resolve('not_supported') } }) }
|
||||
else if (f === 'g') { si.graphics().then(data => { if (data !== null) { resolve({ data, title: 'Graphics' }); } else { resolve('not_supported') } }) }
|
||||
else if (f === 'h') { si.bluetooth().then(data => { if (data !== null) { resolve({ data, title: 'Bluetooth' }); } else { resolve('not_supported') } }) }
|
||||
else if (f === 'h') { si.bluetoothDevices().then(data => { if (data !== null) { resolve({ data, title: 'Bluetooth' }); } else { resolve('not_supported') } }) }
|
||||
else if (f === 'i') { si.inetLatency().then(data => { if (data !== null) { resolve({ data, title: 'Internet Latency' }); } else { resolve('not_supported') } }) }
|
||||
else if (f === 'I') { si.inetChecksite('www.plus-innovations.com').then(data => { if (data !== null) { resolve({ data, title: 'Internet Check Site' }); } else { resolve('not_supported') } }) }
|
||||
else if (f === 'l') { si.cpuCurrentspeed().then(data => { if (data !== null) { resolve({ data, title: 'CPU Current Speed' }); } else { resolve('not_supported') } }) }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user