@ircam/comote-helpers 0.0.0 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/package.json +1 -1
  2. package/server.js +0 -35
  3. package/wifi-infos.js +41 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ircam/comote-helpers",
3
- "version": "0.0.0",
3
+ "version": "0.1.0",
4
4
  "description": "Server component & utilities for the CoMo.te application",
5
5
  "authors": [
6
6
  "Benjamin.Matuszewski@ircam.fr",
package/server.js CHANGED
@@ -4,9 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.Server = void 0;
7
- exports.getWifiInfos = getWifiInfos;
8
-
9
- var _systeminformation = _interopRequireDefault(require("systeminformation"));
10
7
 
11
8
  var _ws = _interopRequireDefault(require("ws"));
12
9
 
@@ -20,12 +17,6 @@ var _assignDeep = _interopRequireDefault(require("assign-deep"));
20
17
 
21
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22
19
 
23
- /**
24
- * @typedef {Object} WifiInfos
25
- * @property {number} ssid - SSID of the WiFi connection
26
- * @property {number} ip - Related IP (IPV4)
27
- */
28
-
29
20
  /**
30
21
  * @typedef {Object} CoMoteConfig
31
22
  * @property {String} id - id of the client CoMo.te
@@ -41,30 +32,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
41
32
  * @property {Boolean} autostart - enable streaming on CoMo.te application
42
33
  */
43
34
 
44
- /**
45
- * Retrieve the SSID and related IP of the first WiFi connection found, return
46
- * `null` if no WiFi connection found.
47
- *
48
- * @async
49
- * @return {WiFiInfos|null}
50
- */
51
- async function getWifiInfos() {
52
- // find first wifi connection
53
- const wifiConnections = await _systeminformation.default.wifiConnections();
54
- const conn = wifiConnections[0];
55
-
56
- if (!conn) {
57
- return null;
58
- } // find related interface
59
-
60
-
61
- const interfaces = await _systeminformation.default.networkInterfaces();
62
- const int = interfaces.find(int => int.iface === conn.iface);
63
- return {
64
- ssid: conn.ssid,
65
- ip: int.ip4
66
- };
67
- }
68
35
  /**
69
36
  * Launch WebSocket and/or OSC server according to given `CoMoteConfig` object
70
37
  *
@@ -72,8 +39,6 @@ async function getWifiInfos() {
72
39
  * @param {Object} options - options
73
40
  * @param {Object} [options.verbose=false] - logs debug informations
74
41
  */
75
-
76
-
77
42
  class Server {
78
43
  constructor(config, options) {
79
44
  /**
package/wifi-infos.js ADDED
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getWifiInfos = getWifiInfos;
7
+
8
+ var _systeminformation = _interopRequireDefault(require("systeminformation"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ /**
13
+ * @typedef {Object} WifiInfos
14
+ * @property {number} ssid - SSID of the WiFi connection
15
+ * @property {number} ip - Related IP (IPV4)
16
+ */
17
+
18
+ /**
19
+ * Retrieve the SSID and related IP of the first WiFi connection found, return
20
+ * `null` if no WiFi connection found.
21
+ *
22
+ * @async
23
+ * @return {WiFiInfos|null}
24
+ */
25
+ async function getWifiInfos() {
26
+ // find first wifi connection
27
+ const wifiConnections = await _systeminformation.default.wifiConnections();
28
+ const conn = wifiConnections[0];
29
+
30
+ if (!conn) {
31
+ return null;
32
+ } // find related interface
33
+
34
+
35
+ const interfaces = await _systeminformation.default.networkInterfaces();
36
+ const int = interfaces.find(int => int.iface === conn.iface);
37
+ return {
38
+ ssid: conn.ssid,
39
+ ip: int.ip4
40
+ };
41
+ }