@momo2555/koppeliajs 0.0.159 → 0.0.160
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/dist/scripts/device.d.ts +3 -2
- package/dist/scripts/device.js +15 -6
- package/package.json +1 -1
package/dist/scripts/device.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Console } from
|
|
2
|
-
import { Resident } from
|
|
1
|
+
import { Console } from "./console.js";
|
|
2
|
+
import { Resident } from "./resident.js";
|
|
3
3
|
/**
|
|
4
4
|
* This class reprensts a device
|
|
5
5
|
*/
|
|
@@ -28,6 +28,7 @@ export declare class Device {
|
|
|
28
28
|
private _attachEvent;
|
|
29
29
|
private _enableModule;
|
|
30
30
|
setColor(color: Color): void;
|
|
31
|
+
setColorSequence(sequence: string[], reset?: boolean): void;
|
|
31
32
|
/**
|
|
32
33
|
* Vibrate the device (use the motor vibrator)
|
|
33
34
|
* @param time
|
package/dist/scripts/device.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Console } from
|
|
2
|
-
import { Message, MessageType, PeerType } from
|
|
3
|
-
import { Resident } from
|
|
1
|
+
import { Console } from "./console.js";
|
|
2
|
+
import { Message, MessageType, PeerType } from "./message.js";
|
|
3
|
+
import { Resident } from "./resident.js";
|
|
4
4
|
export class Device {
|
|
5
5
|
_address;
|
|
6
6
|
_color;
|
|
@@ -34,8 +34,9 @@ export class Device {
|
|
|
34
34
|
onEvent(eventName, callback) {
|
|
35
35
|
this._attachEvent(eventName);
|
|
36
36
|
let consoleEvent = (device, from_addr, event) => {
|
|
37
|
-
if (event == eventName && from_addr == this._address)
|
|
37
|
+
if (event == eventName && from_addr == this._address) {
|
|
38
38
|
callback();
|
|
39
|
+
}
|
|
39
40
|
};
|
|
40
41
|
this._console.onDeviceEvent(consoleEvent);
|
|
41
42
|
}
|
|
@@ -91,6 +92,14 @@ export class Device {
|
|
|
91
92
|
request.setRequest("setColor");
|
|
92
93
|
this._console.sendMessage(request);
|
|
93
94
|
}
|
|
95
|
+
setColorSequence(sequence, reset = false) {
|
|
96
|
+
let request = new Message();
|
|
97
|
+
request.setDestination(PeerType.DEVICE, this._address);
|
|
98
|
+
request.setRequest("setColorSequence");
|
|
99
|
+
request.addParam("sequence", sequence);
|
|
100
|
+
request.addParam("reset", reset);
|
|
101
|
+
this._console.sendMessage(request);
|
|
102
|
+
}
|
|
94
103
|
/**
|
|
95
104
|
* Vibrate the device (use the motor vibrator)
|
|
96
105
|
* @param time
|
|
@@ -102,7 +111,7 @@ export class Device {
|
|
|
102
111
|
let vibration = {
|
|
103
112
|
v: time,
|
|
104
113
|
toff: 0,
|
|
105
|
-
c: 1
|
|
114
|
+
c: 1,
|
|
106
115
|
};
|
|
107
116
|
if (blink) {
|
|
108
117
|
vibration.toff = blinkOff;
|
|
@@ -122,7 +131,7 @@ export class Device {
|
|
|
122
131
|
return {
|
|
123
132
|
"address": this._address,
|
|
124
133
|
"color": this._color,
|
|
125
|
-
"name": this._name
|
|
134
|
+
"name": this._name,
|
|
126
135
|
};
|
|
127
136
|
}
|
|
128
137
|
/**
|