brilliantsole 0.0.25 → 0.0.27
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.
- package/README.md +16 -10
- package/assets/3d/rightHand.glb +0 -0
- package/assets/images/ukaton-pressure-0.svg +9 -0
- package/assets/images/ukaton-pressure-1.svg +9 -0
- package/assets/images/ukaton-pressure-10.svg +9 -0
- package/assets/images/ukaton-pressure-11.svg +9 -0
- package/assets/images/ukaton-pressure-12.svg +9 -0
- package/assets/images/ukaton-pressure-13.svg +9 -0
- package/assets/images/ukaton-pressure-14.svg +9 -0
- package/assets/images/ukaton-pressure-15.svg +9 -0
- package/assets/images/ukaton-pressure-2.svg +9 -0
- package/assets/images/ukaton-pressure-3.svg +9 -0
- package/assets/images/ukaton-pressure-4.svg +9 -0
- package/assets/images/ukaton-pressure-5.svg +9 -0
- package/assets/images/ukaton-pressure-6.svg +9 -0
- package/assets/images/ukaton-pressure-7.svg +9 -0
- package/assets/images/ukaton-pressure-8.svg +9 -0
- package/assets/images/ukaton-pressure-9.svg +9 -0
- package/assets/images/ukaton-right-insole.svg +798 -0
- package/build/brilliantsole.cjs +255 -119
- package/build/brilliantsole.cjs.map +1 -1
- package/build/brilliantsole.js +283 -140
- package/build/brilliantsole.js.map +1 -1
- package/build/brilliantsole.ls.js +210 -103
- package/build/brilliantsole.ls.js.map +1 -1
- package/build/brilliantsole.min.js +1 -1
- package/build/brilliantsole.min.js.map +1 -1
- package/build/brilliantsole.module.d.ts +76 -60
- package/build/brilliantsole.module.js +282 -140
- package/build/brilliantsole.module.js.map +1 -1
- package/build/brilliantsole.module.min.d.ts +76 -60
- package/build/brilliantsole.module.min.js +1 -1
- package/build/brilliantsole.module.min.js.map +1 -1
- package/build/brilliantsole.node.module.d.ts +75 -60
- package/build/brilliantsole.node.module.js +254 -119
- package/build/brilliantsole.node.module.js.map +1 -1
- package/build/dts/BS.d.ts +2 -2
- package/build/dts/Device.d.ts +11 -7
- package/build/dts/DeviceManager.d.ts +1 -0
- package/build/dts/InformationManager.d.ts +6 -5
- package/build/dts/connection/BaseConnectionManager.d.ts +2 -0
- package/build/dts/connection/ClientConnectionManager.d.ts +4 -0
- package/build/dts/connection/bluetooth/BluetoothConnectionManager.d.ts +1 -0
- package/build/dts/connection/bluetooth/NobleConnectionManager.d.ts +1 -0
- package/build/dts/connection/bluetooth/WebBluetoothConnectionManager.d.ts +1 -0
- package/build/dts/devicePair/DevicePair.d.ts +14 -10
- package/build/dts/devicePair/DevicePairPressureSensorDataManager.d.ts +8 -4
- package/build/dts/devicePair/DevicePairSensorDataManager.d.ts +2 -2
- package/build/dts/server/BaseClient.d.ts +1 -0
- package/build/dts/utils/CenterOfPressureHelper.d.ts +2 -2
- package/build/dts/utils/MathUtils.d.ts +2 -0
- package/build/index.d.ts +76 -60
- package/build/index.node.d.ts +75 -60
- package/examples/3d/script.js +90 -17
- package/examples/balance/script.js +2 -1
- package/examples/basic/index.html +21 -2
- package/examples/basic/script.js +17 -3
- package/examples/bottango/index.html +11 -1
- package/examples/bottango/script.js +2 -2
- package/examples/center-of-pressure/index.html +114 -114
- package/examples/center-of-pressure/script.js +1 -1
- package/examples/device-pair/index.html +58 -58
- package/examples/device-pair/script.js +12 -8
- package/examples/gloves/index.html +116 -0
- package/examples/gloves/scene.html +124 -0
- package/examples/gloves/script.js +615 -0
- package/examples/graph/index.html +11 -1
- package/examples/graph/script.js +2 -2
- package/examples/pressure/index.html +180 -12
- package/examples/pressure/script.js +144 -7
- package/examples/recording/index.html +191 -183
- package/examples/server/index.html +11 -1
- package/examples/server/script.js +6 -3
- package/examples/ukaton-firmware-update/index.html +20 -0
- package/examples/ukaton-firmware-update/manifest.json +11 -0
- package/examples/ukaton-firmware-update/merged-firmware.bin +0 -0
- package/examples/webxr/script.js +3 -3
- package/package.json +1 -1
- package/src/BS.ts +3 -8
- package/src/Device.ts +41 -8
- package/src/DeviceInformationManager.ts +4 -2
- package/src/DeviceManager.ts +10 -1
- package/src/FileTransferManager.ts +1 -1
- package/src/FirmwareManager.ts +1 -1
- package/src/InformationManager.ts +24 -7
- package/src/TfliteManager.ts +1 -1
- package/src/connection/BaseConnectionManager.ts +23 -6
- package/src/connection/ClientConnectionManager.ts +13 -1
- package/src/connection/bluetooth/BluetoothConnectionManager.ts +6 -1
- package/src/connection/bluetooth/NobleConnectionManager.ts +8 -1
- package/src/connection/bluetooth/WebBluetoothConnectionManager.ts +5 -1
- package/src/devicePair/DevicePair.ts +53 -27
- package/src/devicePair/DevicePairPressureSensorDataManager.ts +51 -23
- package/src/devicePair/DevicePairSensorDataManager.ts +5 -5
- package/src/scanner/NobleScanner.ts +5 -3
- package/src/sensor/BarometerSensorDataManager.ts +1 -1
- package/src/sensor/MotionSensorDataManager.ts +1 -1
- package/src/sensor/PressureSensorDataManager.ts +13 -8
- package/src/sensor/SensorConfigurationManager.ts +3 -3
- package/src/sensor/SensorDataManager.ts +1 -1
- package/src/server/BaseClient.ts +43 -2
- package/src/server/BaseServer.ts +149 -39
- package/src/server/udp/UDPServer.ts +1 -1
- package/src/server/websocket/WebSocketClient.ts +3 -2
- package/src/server/websocket/WebSocketServer.ts +1 -1
- package/src/utils/CenterOfPressureHelper.ts +5 -5
- package/src/utils/MathUtils.ts +31 -1
- package/src/utils/ParseUtils.ts +1 -1
- package/src/utils/checksum.ts +1 -1
- package/src/utils/mcumgr.js +1 -1
package/examples/basic/script.js
CHANGED
|
@@ -117,6 +117,12 @@ device.addEventListener("deviceInformation", () => {
|
|
|
117
117
|
deviceInformationPre.textContent = JSON.stringify(device.deviceInformation, null, 2);
|
|
118
118
|
});
|
|
119
119
|
|
|
120
|
+
// MTU
|
|
121
|
+
const deviceMtuSpan = document.getElementById("mtu");
|
|
122
|
+
device.addEventListener("getMtu", () => {
|
|
123
|
+
deviceMtuSpan.innerText = device.mtu;
|
|
124
|
+
});
|
|
125
|
+
|
|
120
126
|
// BATTERY LEVEL
|
|
121
127
|
|
|
122
128
|
/** @type {HTMLSpanElement} */
|
|
@@ -263,16 +269,24 @@ BS.SensorTypes.forEach((sensorType) => {
|
|
|
263
269
|
});
|
|
264
270
|
device.addEventListener("getSensorConfiguration", () => {
|
|
265
271
|
for (const sensorType in device.sensorConfiguration) {
|
|
266
|
-
document.querySelector(`.sensorTypeConfiguration[data-sensor-type="${sensorType}"] input`).value =
|
|
272
|
+
document.querySelector(`.sensorTypeConfiguration[data-sensor-type="${sensorType}"] .input`).value =
|
|
267
273
|
device.sensorConfiguration[sensorType];
|
|
268
274
|
}
|
|
269
275
|
});
|
|
270
276
|
device.addEventListener("isConnected", () => {
|
|
271
277
|
for (const sensorType in device.sensorConfiguration) {
|
|
272
|
-
document.querySelector(`[data-sensor-type="${sensorType}"] input`).disabled = !device.isConnected;
|
|
278
|
+
document.querySelector(`[data-sensor-type="${sensorType}"] .input`).disabled = !device.isConnected;
|
|
273
279
|
}
|
|
274
280
|
});
|
|
275
281
|
|
|
282
|
+
// PRESSURE RANGE
|
|
283
|
+
|
|
284
|
+
/** @type {HTMLButtonElement} */
|
|
285
|
+
const resetPressureRangeButton = document.getElementById("resetPressureRange");
|
|
286
|
+
resetPressureRangeButton.addEventListener("click", () => {
|
|
287
|
+
device.resetPressureRange();
|
|
288
|
+
});
|
|
289
|
+
|
|
276
290
|
// SENSOR DATA
|
|
277
291
|
|
|
278
292
|
/** @type {HTMLTemplateElement} */
|
|
@@ -1000,7 +1014,7 @@ device.addEventListener("firmwareImages", () => {
|
|
|
1000
1014
|
});
|
|
1001
1015
|
|
|
1002
1016
|
device.addEventListener("isConnected", () => {
|
|
1003
|
-
if (device.isConnected) {
|
|
1017
|
+
if (device.isConnected && device.canUpdateFirmware) {
|
|
1004
1018
|
device.getFirmwareImages();
|
|
1005
1019
|
}
|
|
1006
1020
|
});
|
|
@@ -60,7 +60,17 @@
|
|
|
60
60
|
<template id="sensorTypeConfigurationTemplate">
|
|
61
61
|
<label class="sensorTypeConfiguration">
|
|
62
62
|
<b class="sensorType"></b>
|
|
63
|
-
<input class="sensorRate" type="number" min="0" value="" disabled />ms
|
|
63
|
+
<!-- <input class="sensorRate" type="number" min="0" value="" disabled />ms -->
|
|
64
|
+
<select class="sensorRate input">
|
|
65
|
+
<optgroup label="sensor rate (ms)">
|
|
66
|
+
<option value="0">0ms</option>
|
|
67
|
+
<option value="5">5ms</option>
|
|
68
|
+
<option value="10">10ms</option>
|
|
69
|
+
<option value="20">20ms</option>
|
|
70
|
+
<option value="40">40ms</option>
|
|
71
|
+
<option value="100">100ms</option>
|
|
72
|
+
</optgroup>
|
|
73
|
+
</select>
|
|
64
74
|
</label>
|
|
65
75
|
</template>
|
|
66
76
|
</div>
|
|
@@ -152,13 +152,13 @@ BS.SensorTypes.forEach((sensorType) => {
|
|
|
152
152
|
});
|
|
153
153
|
device.addEventListener("getSensorConfiguration", () => {
|
|
154
154
|
for (const sensorType in device.sensorConfiguration) {
|
|
155
|
-
document.querySelector(`.sensorTypeConfiguration[data-sensor-type="${sensorType}"] input`).value =
|
|
155
|
+
document.querySelector(`.sensorTypeConfiguration[data-sensor-type="${sensorType}"] .input`).value =
|
|
156
156
|
device.sensorConfiguration[sensorType];
|
|
157
157
|
}
|
|
158
158
|
});
|
|
159
159
|
device.addEventListener("isConnected", () => {
|
|
160
160
|
for (const sensorType in device.sensorConfiguration) {
|
|
161
|
-
document.querySelector(`[data-sensor-type="${sensorType}"] input`).disabled = !device.isConnected;
|
|
161
|
+
document.querySelector(`[data-sensor-type="${sensorType}"] .input`).disabled = !device.isConnected;
|
|
162
162
|
}
|
|
163
163
|
});
|
|
164
164
|
|
|
@@ -1,132 +1,132 @@
|
|
|
1
1
|
<html>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
<head>
|
|
3
|
+
<title>Center of Pressure | BrilliantSole JavaScript SDK</title>
|
|
4
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
5
|
+
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
|
|
6
|
+
<script type="module" src="./script.js"></script>
|
|
7
|
+
</head>
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
<style>
|
|
10
|
+
#centerOfPressureContainer {
|
|
11
|
+
height: 300px;
|
|
12
|
+
aspect-ratio: 1;
|
|
13
|
+
border: solid black;
|
|
14
|
+
border-radius: 20px;
|
|
15
|
+
overflow: hidden;
|
|
16
|
+
display: flex;
|
|
17
|
+
margin-top: 2rem;
|
|
18
|
+
}
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
#centerOfPressureRange {
|
|
21
|
+
width: calc(100% - 2rem);
|
|
22
|
+
height: calc(100% - 2rem);
|
|
23
|
+
margin: auto;
|
|
24
|
+
position: relative;
|
|
25
|
+
}
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
#centerOfPressure {
|
|
28
|
+
position: absolute;
|
|
29
|
+
}
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
31
|
+
#centerOfPressure .visual {
|
|
32
|
+
border-radius: 50%;
|
|
33
|
+
background-color: red;
|
|
34
|
+
width: 2rem;
|
|
35
|
+
height: 2rem;
|
|
36
|
+
left: -1rem;
|
|
37
|
+
top: -1rem;
|
|
38
|
+
position: relative;
|
|
39
|
+
z-index: 1;
|
|
40
|
+
}
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
42
|
+
#target {
|
|
43
|
+
position: absolute;
|
|
44
|
+
display: none;
|
|
45
|
+
}
|
|
46
|
+
#target .visual {
|
|
47
|
+
border-radius: 15px;
|
|
48
|
+
background-color: yellow;
|
|
49
|
+
width: 100%;
|
|
50
|
+
height: 100%;
|
|
51
|
+
display: flex;
|
|
52
|
+
}
|
|
53
|
+
#target .ring {
|
|
54
|
+
box-sizing: border-box;
|
|
55
|
+
border: solid blue thick;
|
|
56
|
+
border-radius: 15px;
|
|
57
|
+
width: 100%;
|
|
58
|
+
height: 100%;
|
|
59
|
+
margin: auto;
|
|
60
|
+
}
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
#target.hover .visual {
|
|
63
|
+
background-color: limegreen;
|
|
64
|
+
}
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
#target:not(.hover) .ring {
|
|
67
|
+
display: none;
|
|
68
|
+
}
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
70
|
+
@keyframes shrink {
|
|
71
|
+
from {
|
|
72
|
+
width: 100%;
|
|
73
|
+
height: 100%;
|
|
74
|
+
}
|
|
75
|
+
to {
|
|
76
|
+
width: 0%;
|
|
77
|
+
height: 0%;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
80
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
81
|
+
#target.hover .ring {
|
|
82
|
+
animation-name: shrink;
|
|
83
|
+
animation-duration: 3s;
|
|
84
|
+
animation-timing-function: linear;
|
|
85
|
+
}
|
|
86
|
+
</style>
|
|
87
87
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
<body>
|
|
89
|
+
<nav>
|
|
90
|
+
<a href="../../">home</a>
|
|
91
|
+
</nav>
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
<h1>Center of Pressure | BrilliantSole JavaScript SDK</h1>
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
95
|
+
<div>
|
|
96
|
+
<h2>available devices</h2>
|
|
97
|
+
<div id="availableDevices">
|
|
98
|
+
<template id="availableDeviceTemplate">
|
|
99
|
+
<div class="availableDevice">
|
|
100
|
+
<ul>
|
|
101
|
+
<li><b>name: </b> <span class="name"></span></li>
|
|
102
|
+
<li><b>type: </b> <span class="type"></span></li>
|
|
103
|
+
<li><button class="toggleConnection">connect</button></li>
|
|
104
|
+
</ul>
|
|
105
|
+
</div>
|
|
106
|
+
</template>
|
|
107
|
+
</div>
|
|
108
|
+
</div>
|
|
109
109
|
|
|
110
|
-
|
|
110
|
+
<br />
|
|
111
111
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
112
|
+
<div>
|
|
113
|
+
<button id="addDevice">add device</button>
|
|
114
|
+
<button id="togglePressureData" disabled>enable pressure data</button>
|
|
115
|
+
<button id="resetPressureRange" disabled>recalibrate</button>
|
|
116
|
+
<button id="toggleGame">start game</button>
|
|
117
|
+
</div>
|
|
118
118
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
</div>
|
|
129
|
-
</div>
|
|
119
|
+
<div id="centerOfPressureContainer">
|
|
120
|
+
<div id="centerOfPressureRange">
|
|
121
|
+
<div id="centerOfPressure">
|
|
122
|
+
<div class="visual"></div>
|
|
123
|
+
</div>
|
|
124
|
+
<div id="target">
|
|
125
|
+
<div class="visual">
|
|
126
|
+
<div class="ring"></div>
|
|
127
|
+
</div>
|
|
130
128
|
</div>
|
|
131
|
-
|
|
129
|
+
</div>
|
|
130
|
+
</div>
|
|
131
|
+
</body>
|
|
132
132
|
</html>
|
|
@@ -59,7 +59,7 @@ BS.DeviceManager.AddEventListener("availableDevices", (event) => {
|
|
|
59
59
|
getDevices();
|
|
60
60
|
|
|
61
61
|
// CONNECTION
|
|
62
|
-
const devicePair = BS.DevicePair.
|
|
62
|
+
const devicePair = BS.DevicePair.insoles;
|
|
63
63
|
|
|
64
64
|
/** @type {HTMLButtonElement} */
|
|
65
65
|
const addDeviceButton = document.getElementById("addDevice");
|
|
@@ -1,72 +1,72 @@
|
|
|
1
1
|
<html>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
<head>
|
|
3
|
+
<title>Device Pair | BrilliantSole JavaScript SDK</title>
|
|
4
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
5
|
+
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
|
|
6
|
+
<script type="module" src="./script.js"></script>
|
|
7
|
+
</head>
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
<style>
|
|
10
|
+
#devices {
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: row;
|
|
13
|
+
gap: 1rem;
|
|
14
|
+
}
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
.pressure {
|
|
17
|
+
height: 10rem;
|
|
18
|
+
}
|
|
19
|
+
</style>
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
<body>
|
|
22
|
+
<nav>
|
|
23
|
+
<a href="../../">home</a>
|
|
24
|
+
</nav>
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
<h1>Device Pair | BrilliantSole JavaScript SDK</h1>
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
28
|
+
<div>
|
|
29
|
+
<h2>available devices</h2>
|
|
30
|
+
<div id="availableDevices">
|
|
31
|
+
<template id="availableDeviceTemplate">
|
|
32
|
+
<div class="availableDevice">
|
|
33
|
+
<ul>
|
|
34
|
+
<li><b>name: </b> <span class="name"></span></li>
|
|
35
|
+
<li><b>type: </b> <span class="type"></span></li>
|
|
36
|
+
<li><button class="toggleConnection">connect</button></li>
|
|
37
|
+
</ul>
|
|
38
|
+
</div>
|
|
39
|
+
</template>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
<br />
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
<div>
|
|
46
|
+
<button id="addDevice">add device</button>
|
|
47
|
+
<button id="togglePressureData" disabled>enable pressure data</button>
|
|
48
|
+
<button id="resetPressureRange" disabled>recalibrate</button>
|
|
49
|
+
</div>
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
<div id="devicePair">
|
|
52
|
+
<h2>Device Pair</h2>
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
<h3>pressure</h3>
|
|
55
|
+
<pre class="pressure"></pre>
|
|
56
|
+
</div>
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
<div id="devices"></div>
|
|
59
59
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
60
|
+
<template id="deviceTemplate">
|
|
61
|
+
<div class="device">
|
|
62
|
+
<h2><span class="side"></span> side</h2>
|
|
63
|
+
<p>
|
|
64
|
+
<button class="toggleConnection" disabled>disconnect</button>
|
|
65
|
+
</p>
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
67
|
+
<h3>pressure</h3>
|
|
68
|
+
<pre class="pressure"></pre>
|
|
69
|
+
</div>
|
|
70
|
+
</template>
|
|
71
|
+
</body>
|
|
72
72
|
</html>
|
|
@@ -59,7 +59,7 @@ BS.DeviceManager.AddEventListener("availableDevices", (event) => {
|
|
|
59
59
|
getDevices();
|
|
60
60
|
|
|
61
61
|
// CONNECTION
|
|
62
|
-
const devicePair = BS.DevicePair.
|
|
62
|
+
const devicePair = BS.DevicePair.insoles;
|
|
63
63
|
|
|
64
64
|
/** @type {HTMLButtonElement} */
|
|
65
65
|
const addDeviceButton = document.getElementById("addDevice");
|
|
@@ -116,7 +116,7 @@ devicePair.sides.forEach((side) => {
|
|
|
116
116
|
|
|
117
117
|
devicePair.addEventListener("deviceIsConnected", (event) => {
|
|
118
118
|
const { device } = event.message;
|
|
119
|
-
if (device.
|
|
119
|
+
if (device.side != side) {
|
|
120
120
|
return;
|
|
121
121
|
}
|
|
122
122
|
|
|
@@ -128,7 +128,7 @@ devicePair.sides.forEach((side) => {
|
|
|
128
128
|
|
|
129
129
|
devicePair.addEventListener("deviceConnectionStatus", (event) => {
|
|
130
130
|
const { device } = event.message;
|
|
131
|
-
if (device.
|
|
131
|
+
if (device.side != side) {
|
|
132
132
|
return;
|
|
133
133
|
}
|
|
134
134
|
|
|
@@ -150,7 +150,7 @@ devicePair.sides.forEach((side) => {
|
|
|
150
150
|
const pressurePre = deviceContainer.querySelector(".pressure");
|
|
151
151
|
devicePair.addEventListener("devicePressure", (event) => {
|
|
152
152
|
const { device } = event.message;
|
|
153
|
-
if (device.
|
|
153
|
+
if (device.side != side) {
|
|
154
154
|
return;
|
|
155
155
|
}
|
|
156
156
|
|
|
@@ -158,8 +158,10 @@ devicePair.sides.forEach((side) => {
|
|
|
158
158
|
|
|
159
159
|
pressurePre.textContent = JSON.stringify(
|
|
160
160
|
{
|
|
161
|
-
center: pressure.
|
|
162
|
-
|
|
161
|
+
center: pressure.center,
|
|
162
|
+
scaledSum: pressure.scaledSum,
|
|
163
|
+
normalizedCenter: pressure.normalizedCenter,
|
|
164
|
+
normalizedSum: pressure.normalizedSum,
|
|
163
165
|
},
|
|
164
166
|
(key, value) => value?.toFixed?.(3) || value,
|
|
165
167
|
2
|
|
@@ -178,8 +180,10 @@ devicePair.addEventListener("pressure", (event) => {
|
|
|
178
180
|
|
|
179
181
|
devicePairPressurePre.textContent = JSON.stringify(
|
|
180
182
|
{
|
|
181
|
-
center: pressure.
|
|
182
|
-
|
|
183
|
+
center: pressure.center,
|
|
184
|
+
scaledSum: pressure.scaledSum,
|
|
185
|
+
normalizedCenter: pressure.normalizedCenter,
|
|
186
|
+
normalizedSum: pressure.normalizedSum,
|
|
183
187
|
},
|
|
184
188
|
(key, value) => value?.toFixed?.(3) || value,
|
|
185
189
|
2
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
<html>
|
|
2
|
+
<head>
|
|
3
|
+
<title>Gloves | BrilliantSole JavaScript SDK</title>
|
|
4
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
5
|
+
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
|
|
6
|
+
<!-- <script src="https://aframe.io/releases/1.5.0/aframe.min.js"></script> -->
|
|
7
|
+
<script src="https://aframe.io/releases/1.6.0/aframe.min.js"></script>
|
|
8
|
+
<!-- required to get aframe-orbit-controls-component to work -->
|
|
9
|
+
<script>
|
|
10
|
+
THREE.Quaternion.prototype.inverse = THREE.Quaternion.prototype.invert;
|
|
11
|
+
THREE.Math = THREE.MathUtils;
|
|
12
|
+
</script>
|
|
13
|
+
<!-- https://github.com/tizzle/aframe-orbit-controls-component -->
|
|
14
|
+
<script src="https://cdn.rawgit.com/tizzle/aframe-orbit-controls-component/v0.1.14/dist/aframe-orbit-controls-component.min.js"></script>
|
|
15
|
+
<script type="module" src="./script.js"></script>
|
|
16
|
+
</head>
|
|
17
|
+
|
|
18
|
+
<style>
|
|
19
|
+
#gloves {
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: row;
|
|
22
|
+
height: 100%;
|
|
23
|
+
gap: 0.5rem;
|
|
24
|
+
}
|
|
25
|
+
.glove {
|
|
26
|
+
position: relative;
|
|
27
|
+
height: 100%;
|
|
28
|
+
min-width: 700px;
|
|
29
|
+
flex: 1;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.scene {
|
|
33
|
+
width: 100%;
|
|
34
|
+
height: 100%;
|
|
35
|
+
margin: auto;
|
|
36
|
+
border-radius: 2rem;
|
|
37
|
+
overflow: hidden;
|
|
38
|
+
border: solid black;
|
|
39
|
+
box-sizing: border-box;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.scene iframe {
|
|
43
|
+
width: 100%;
|
|
44
|
+
height: 100%;
|
|
45
|
+
border: none;
|
|
46
|
+
}
|
|
47
|
+
</style>
|
|
48
|
+
|
|
49
|
+
<body>
|
|
50
|
+
<nav>
|
|
51
|
+
<a href="../../">home</a>
|
|
52
|
+
</nav>
|
|
53
|
+
|
|
54
|
+
<h1>Gloves | BrilliantSole JavaScript SDK</h1>
|
|
55
|
+
|
|
56
|
+
<button id="toggleServerConnection">connect to server</button>
|
|
57
|
+
|
|
58
|
+
<div>
|
|
59
|
+
<h2>available devices</h2>
|
|
60
|
+
<div id="availableDevices">
|
|
61
|
+
<template id="availableDeviceTemplate">
|
|
62
|
+
<div class="availableDevice">
|
|
63
|
+
<ul>
|
|
64
|
+
<li><b>name: </b> <span class="name"></span></li>
|
|
65
|
+
<li><b>type: </b> <span class="type"></span></li>
|
|
66
|
+
<li><button class="toggleConnection">connect</button></li>
|
|
67
|
+
</ul>
|
|
68
|
+
</div>
|
|
69
|
+
</template>
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
|
|
73
|
+
<p>
|
|
74
|
+
<button id="addDevice">add device</button>
|
|
75
|
+
</p>
|
|
76
|
+
|
|
77
|
+
<div id="gloves"></div>
|
|
78
|
+
|
|
79
|
+
<template id="gloveTemplate">
|
|
80
|
+
<div class="glove">
|
|
81
|
+
<p>
|
|
82
|
+
<button class="toggleConnection" disabled>disconnect</button>
|
|
83
|
+
<br />
|
|
84
|
+
<select class="orientation" disabled>
|
|
85
|
+
<optgroup label="orientation">
|
|
86
|
+
<option value="none">no orientation</option>
|
|
87
|
+
<option>gameRotation</option>
|
|
88
|
+
<option>rotation</option>
|
|
89
|
+
<option>orientation</option>
|
|
90
|
+
<option>gyroscope</option>
|
|
91
|
+
</optgroup>
|
|
92
|
+
</select>
|
|
93
|
+
<button disabled class="resetOrientation">reset orientation</button>
|
|
94
|
+
<br />
|
|
95
|
+
<select class="position" disabled>
|
|
96
|
+
<optgroup label="position">
|
|
97
|
+
<option value="none">no position</option>
|
|
98
|
+
<option>acceleration</option>
|
|
99
|
+
<option>gravity</option>
|
|
100
|
+
<option>linearAcceleration</option>
|
|
101
|
+
</optgroup>
|
|
102
|
+
</select>
|
|
103
|
+
<br />
|
|
104
|
+
<button disabled class="togglePressure">enable pressure</button>
|
|
105
|
+
<button disabled class="resetPressure">reset pressure</button>
|
|
106
|
+
<br />
|
|
107
|
+
<button disabled class="toggleCursor">enable cursor</button>
|
|
108
|
+
<br />
|
|
109
|
+
</p>
|
|
110
|
+
<div class="scene">
|
|
111
|
+
<iframe src="./scene.html"></iframe>
|
|
112
|
+
</div>
|
|
113
|
+
</div>
|
|
114
|
+
</template>
|
|
115
|
+
</body>
|
|
116
|
+
</html>
|