@robotical/webapp-types 1.0.7 → 1.0.9

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 (38) hide show
  1. package/dist-types/src/analytics/AnalyticsManager.d.ts +28 -0
  2. package/dist-types/src/analytics/AnalyticsManager.js +171 -0
  3. package/dist-types/src/application/ApplicationManager/ApplicationManager.d.ts +8 -2
  4. package/dist-types/src/application/ApplicationManager/ApplicationManager.js +23 -8
  5. package/dist-types/src/application/RAFTs/Cog/Cog.d.ts +1 -1
  6. package/dist-types/src/application/RAFTs/Cog/Cog.js +1 -1
  7. package/dist-types/src/application/RAFTs/Cog/PublishedDataAnalyser.d.ts +36 -16
  8. package/dist-types/src/application/RAFTs/Cog/PublishedDataAnalyser.js +130 -88
  9. package/dist-types/src/application/RAFTs/Cog/PublishedDataGetter.d.ts +1 -1
  10. package/dist-types/src/application/RAFTs/Cog/PublishedDataGetter.js +1 -1
  11. package/dist-types/src/application/RAFTs/Marty/Marty.d.ts +5 -3
  12. package/dist-types/src/application/RAFTs/Marty/Marty.js +24 -16
  13. package/dist-types/src/application/RAFTs/RAFT.d.ts +5 -1
  14. package/dist-types/src/application/RAFTs/RAFT.js +30 -1
  15. package/dist-types/src/application/RAFTs/RAFTInterface.d.ts +1 -1
  16. package/dist-types/src/application/RAFTs/RaftObserver.d.ts +1 -1
  17. package/dist-types/src/application/RAFTs/raft-subscription-helpers.js +1 -1
  18. package/dist-types/src/components/modals/DisconnectConfirmation/index.js +3 -1
  19. package/dist-types/src/components/modals/VerificationModal/index.js +1 -1
  20. package/dist-types/src/components/modals/VerificationModalPhoneApp/index.js +1 -1
  21. package/dist-types/src/components/oneoffs/LEDs/index.js +1 -1
  22. package/dist-types/src/components/oneoffs/RaftSignal/index.d.ts +7 -0
  23. package/dist-types/src/components/oneoffs/{RICSignal → RaftSignal}/index.js +2 -2
  24. package/dist-types/src/state-observables/modal/ModalState.d.ts +1 -0
  25. package/dist-types/src/state-observables/modal/ModalState.js +1 -0
  26. package/dist-types/src/store/SelectedRaftContext.d.ts +2 -0
  27. package/dist-types/src/store/SelectedRaftContext.js +2 -1
  28. package/dist-types/src/wrapper-app/WrapperAppManager.d.ts +2 -2
  29. package/dist-types/src/wrapper-app/WrapperAppManager.js +3 -3
  30. package/dist-types/src/wrapper-app/connectors/CogConnector/CogConnector.d.ts +1 -1
  31. package/dist-types/src/wrapper-app/connectors/CogConnector/CogConnector.js +1 -1
  32. package/dist-types/src/wrapper-app/connectors/Connector.d.ts +2 -2
  33. package/dist-types/src/wrapper-app/connectors/Connector.js +1 -1
  34. package/dist-types/src/wrapper-app/connectors/ConnectorInterface.d.ts +1 -1
  35. package/dist-types/src/wrapper-app/connectors/MartyConnector/MartyConnector.d.ts +1 -1
  36. package/dist-types/src/wrapper-app/connectors/MartyConnector/MartyConnector.js +1 -1
  37. package/package.json +1 -1
  38. package/dist-types/src/components/oneoffs/RICSignal/index.d.ts +0 -7
@@ -0,0 +1,28 @@
1
+ /**
2
+ * AnalyticsManager
3
+ *
4
+ * This class is responsible for managing the analytics services for the testing phase.
5
+ * Analytics gathered:
6
+ * - Connections
7
+ * - Disconnections
8
+ * - Visited pages
9
+ * - emoji feedback
10
+ * - text feedback
11
+ *
12
+ * Each of them will be stored as an event. They will stored in the order they were received so we can track the user's journey.
13
+ * There will be a timestamp for each event.
14
+ *
15
+ * We store client's id in a cookie so we can track the user's journey.
16
+ */
17
+ type EventType = "connection" | "disconnection" | "page" | "emojifeedback" | "textfeedback" | "connection_issue" | "connection_issue_resolved";
18
+ export declare class AnalyticsManager {
19
+ private static instance;
20
+ private clientId;
21
+ private eventsStorer;
22
+ private constructor();
23
+ static getInstance(): AnalyticsManager;
24
+ private getClientId;
25
+ private generateClientId;
26
+ logEvent(eventType: EventType, data: any): void;
27
+ }
28
+ export {};
@@ -0,0 +1,171 @@
1
+ /**
2
+ * AnalyticsManager
3
+ *
4
+ * This class is responsible for managing the analytics services for the testing phase.
5
+ * Analytics gathered:
6
+ * - Connections
7
+ * - Disconnections
8
+ * - Visited pages
9
+ * - emoji feedback
10
+ * - text feedback
11
+ *
12
+ * Each of them will be stored as an event. They will stored in the order they were received so we can track the user's journey.
13
+ * There will be a timestamp for each event.
14
+ *
15
+ * We store client's id in a cookie so we can track the user's journey.
16
+ */
17
+ var __assign = (this && this.__assign) || function () {
18
+ __assign = Object.assign || function(t) {
19
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
20
+ s = arguments[i];
21
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
22
+ t[p] = s[p];
23
+ }
24
+ return t;
25
+ };
26
+ return __assign.apply(this, arguments);
27
+ };
28
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
29
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
30
+ return new (P || (P = Promise))(function (resolve, reject) {
31
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
32
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
33
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
34
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
35
+ });
36
+ };
37
+ var __generator = (this && this.__generator) || function (thisArg, body) {
38
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
39
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
40
+ function verb(n) { return function (v) { return step([n, v]); }; }
41
+ function step(op) {
42
+ if (f) throw new TypeError("Generator is already executing.");
43
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
44
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
45
+ if (y = 0, t) op = [op[0] & 2, t.value];
46
+ switch (op[0]) {
47
+ case 0: case 1: t = op; break;
48
+ case 4: _.label++; return { value: op[1], done: false };
49
+ case 5: _.label++; y = op[1]; op = [0]; continue;
50
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
51
+ default:
52
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
53
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
54
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
55
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
56
+ if (t[2]) _.ops.pop();
57
+ _.trys.pop(); continue;
58
+ }
59
+ op = body.call(thisArg, _);
60
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
61
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
62
+ }
63
+ };
64
+ var AnalyticsManager = /** @class */ (function () {
65
+ function AnalyticsManager() {
66
+ this.clientId = this.getClientId();
67
+ this.eventsStorer = new EventsStorer(this.clientId);
68
+ }
69
+ AnalyticsManager.getInstance = function () {
70
+ if (!AnalyticsManager.instance) {
71
+ AnalyticsManager.instance = new AnalyticsManager();
72
+ }
73
+ return AnalyticsManager.instance;
74
+ };
75
+ AnalyticsManager.prototype.getClientId = function () {
76
+ var clientId = localStorage.getItem('@robotical/webapp/analytics/clientId');
77
+ if (!clientId) {
78
+ clientId = this.generateClientId();
79
+ localStorage.setItem('@robotical/webapp/analytics/clientId', clientId);
80
+ }
81
+ return clientId;
82
+ };
83
+ AnalyticsManager.prototype.generateClientId = function () {
84
+ return Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
85
+ };
86
+ AnalyticsManager.prototype.logEvent = function (eventType, data) {
87
+ var event = new AnalyticsEvent(eventType, data);
88
+ this.eventsStorer.addEvent(event);
89
+ };
90
+ return AnalyticsManager;
91
+ }());
92
+ export { AnalyticsManager };
93
+ var AnalyticsEvent = /** @class */ (function () {
94
+ function AnalyticsEvent(type, data) {
95
+ this.type = type;
96
+ this.data = data;
97
+ this.isProcessed = false;
98
+ this.timestamp = new Date().toString();
99
+ this.urlSafeTimestamp = new Date().toISOString().replaceAll("T", "_").replaceAll(":", "-").replaceAll("/", "-").replaceAll(".", "_");
100
+ }
101
+ AnalyticsEvent.prototype.process = function () {
102
+ this.isProcessed = true;
103
+ };
104
+ return AnalyticsEvent;
105
+ }());
106
+ var EventsStorer = /** @class */ (function () {
107
+ function EventsStorer(clientId) {
108
+ this.clientId = clientId;
109
+ this.events = [];
110
+ this.processing = false;
111
+ }
112
+ EventsStorer.prototype.addEvent = function (event) {
113
+ this.events.push(event);
114
+ this._processEvents();
115
+ };
116
+ EventsStorer.prototype._processEvents = function () {
117
+ return __awaiter(this, void 0, void 0, function () {
118
+ var _i, _a, event_1;
119
+ return __generator(this, function (_b) {
120
+ switch (_b.label) {
121
+ case 0:
122
+ if (this.processing)
123
+ return [2 /*return*/];
124
+ this.processing = true;
125
+ _i = 0, _a = this.events;
126
+ _b.label = 1;
127
+ case 1:
128
+ if (!(_i < _a.length)) return [3 /*break*/, 4];
129
+ event_1 = _a[_i];
130
+ if (!!event_1.isProcessed) return [3 /*break*/, 3];
131
+ this._processEvent(event_1);
132
+ return [4 /*yield*/, this._delay(1000)];
133
+ case 2:
134
+ _b.sent(); // 1 second debounce time
135
+ _b.label = 3;
136
+ case 3:
137
+ _i++;
138
+ return [3 /*break*/, 1];
139
+ case 4:
140
+ this.processing = false;
141
+ return [2 /*return*/];
142
+ }
143
+ });
144
+ });
145
+ };
146
+ EventsStorer.prototype._delay = function (ms) {
147
+ return new Promise(function (resolve) { return setTimeout(resolve, ms); });
148
+ };
149
+ EventsStorer.prototype._processEvent = function (event) {
150
+ event.process();
151
+ var data = __assign(__assign(__assign({}, event), event.data), { data: undefined, isProcessed: undefined, urlSafeTimestamp: undefined });
152
+ var path = "".concat(this.clientId, "/").concat(event.urlSafeTimestamp, "-").concat(event.type);
153
+ FirebaseInteractor.put(path, data);
154
+ };
155
+ return EventsStorer;
156
+ }());
157
+ var FirebaseInteractor = /** @class */ (function () {
158
+ function FirebaseInteractor() {
159
+ }
160
+ FirebaseInteractor.put = function (path, data) {
161
+ fetch("".concat(this.db_href, "/").concat(path, ".json"), {
162
+ method: 'PUT',
163
+ body: JSON.stringify(data),
164
+ headers: {
165
+ 'Content-Type': 'application/json'
166
+ }
167
+ });
168
+ };
169
+ FirebaseInteractor.db_href = "https://app-v2-analytics-default-rtdb.firebaseio.com";
170
+ return FirebaseInteractor;
171
+ }());
@@ -6,9 +6,10 @@ import Cog from "../RAFTs/Cog/Cog";
6
6
  import { FOUND_RAFT_ON_DISCOVERY_RESPONSE } from "../../types/phone-app-communicator";
7
7
  import { RaftObserver } from "../RAFTs/RaftObserver";
8
8
  import { RaftInfoEvents } from "../../types/events/raft-info";
9
- import { RaftConnEvent, RaftUpdateEvent, RaftPublishEvent } from "@robdobsn/raftjs";
9
+ import { RaftConnEvent, RaftUpdateEvent, RaftPublishEvent } from "@robotical/raftjs";
10
10
  import { ConnectedRaftItem } from "../../store/SelectedRaftContext";
11
11
  import Toaster from "../../utils/Toaster";
12
+ import { AnalyticsManager } from "../../analytics/AnalyticsManager";
12
13
  export default class ApplicationManager {
13
14
  private _observers;
14
15
  static wrapperAppCommunicator: WebAppCommunicator;
@@ -16,8 +17,13 @@ export default class ApplicationManager {
16
17
  [key: string]: RAFT;
17
18
  };
18
19
  connectedRaftsContext: ConnectedRaftItem[];
20
+ returnToMainApp: () => void;
21
+ private _router;
22
+ setRouter(router: any): void;
23
+ navigateTo(path: string): void;
19
24
  ricSelectedCb: ((raft: RAFT) => void) | null;
20
25
  toaster: typeof Toaster;
26
+ analyticsManager: AnalyticsManager;
21
27
  showBackHomeButton: () => void;
22
28
  hideBackHomeButton: () => void;
23
29
  connectedRaftContextMethods: {
@@ -55,7 +61,7 @@ export default class ApplicationManager {
55
61
  * Removes raft after a certain time
56
62
  * Removes from the rics list after x seconds so that we can still get the last event
57
63
  */
58
- _removeRIC(raftId: string, timeout: number): void;
64
+ _removeRaft(raftId: string, timeout: number): void;
59
65
  /**
60
66
  * Start looking for rics to connect to
61
67
  * This is used from the Phone App only
@@ -45,11 +45,12 @@ import VerificationModal from "../../components/modals/VerificationModal";
45
45
  import { raftFoundSubscriptionHelper } from "../RAFTs/raft-subscription-helpers";
46
46
  import { AppSentMessage } from "../../types/communication-between-apps/wrapper-communication";
47
47
  import VerificationModalPhoneApp from "../../components/modals/VerificationModalPhoneApp";
48
- import { RaftChannelBLE, } from "@robdobsn/raftjs";
48
+ import { RaftChannelBLE, } from "@robotical/raftjs";
49
49
  import Logger from "../../services/logger/Logger";
50
50
  import isPhoneApp from "../../utils/phone-app-communication/is-phone-app";
51
51
  import DisconnectConfirmationModal from "../../components/modals/DisconnectConfirmation";
52
52
  import Toaster from "../../utils/Toaster";
53
+ import { AnalyticsManager } from "../../analytics/AnalyticsManager";
53
54
  var SHOW_LOGS = true;
54
55
  var TAG = "ApplicationManager";
55
56
  var ApplicationManager = /** @class */ (function () {
@@ -59,10 +60,11 @@ var ApplicationManager = /** @class */ (function () {
59
60
  // Connected RICs
60
61
  this.connectedRafts = {};
61
62
  this.connectedRaftsContext = [];
63
+ this.returnToMainApp = function () { };
62
64
  // Callback to call when a RAFT is selected (Phone App only)
63
65
  // We need that to make sure the connection button gets the selected RAFT once the user selects one
64
66
  this.ricSelectedCb = null;
65
- // // RICNotificationsManager
67
+ // RICNotificationsManager
66
68
  // private _ricNotificationsManager: RICNotificationsManager = new RICNotificationsManager(
67
69
  // this
68
70
  // );
@@ -75,6 +77,8 @@ var ApplicationManager = /** @class */ (function () {
75
77
  // public sessionDbs = new SessionsDBManager();
76
78
  // toaster
77
79
  this.toaster = Toaster;
80
+ // Analytics Manager
81
+ this.analyticsManager = AnalyticsManager.getInstance();
78
82
  this.showBackHomeButton = function () { };
79
83
  this.hideBackHomeButton = function () { };
80
84
  // connected raft context methods
@@ -85,10 +89,21 @@ var ApplicationManager = /** @class */ (function () {
85
89
  };
86
90
  this.isPhoneApp = isPhoneApp;
87
91
  // super();
88
- // AnalyticsManager.appStartSession();
92
+ // DatabaseManager.appStartSession();
89
93
  this.connectGenericMarty = this.connectGenericMarty.bind(this);
90
94
  this.connectGenericCog = this.connectGenericCog.bind(this);
91
95
  }
96
+ ApplicationManager.prototype.setRouter = function (router) {
97
+ this._router = router;
98
+ };
99
+ ApplicationManager.prototype.navigateTo = function (path) {
100
+ if (this._router) {
101
+ this._router.navigate(path);
102
+ }
103
+ else {
104
+ Logger.error(SHOW_LOGS, TAG, "Router is not set");
105
+ }
106
+ };
92
107
  ApplicationManager.prototype.createNewCog = function (id) {
93
108
  return new Cog(id);
94
109
  };
@@ -126,7 +141,7 @@ var ApplicationManager = /** @class */ (function () {
126
141
  case 1:
127
142
  _a.trys.push([1, 3, , 4]);
128
143
  return [4 /*yield*/, window.applicationManager.startDiscovery(function (newRaft) {
129
- _this.connectedRaftContextMethods.addConnectedRaft({ id: newRaft.id, name: newRaft.getFriendlyName() || "", isSelected: true });
144
+ _this.connectedRaftContextMethods.addConnectedRaft({ id: newRaft.id, type: newRaft.type, name: newRaft.getFriendlyName() || "", isSelected: true });
130
145
  afterRaftConnectedCb(newRaft);
131
146
  })];
132
147
  case 2:
@@ -143,7 +158,7 @@ var ApplicationManager = /** @class */ (function () {
143
158
  case 6:
144
159
  newRaft = _a.sent();
145
160
  if (newRaft) {
146
- this.connectedRaftContextMethods.addConnectedRaft({ id: newRaft.id, name: newRaft.getFriendlyName() || "", isSelected: true });
161
+ this.connectedRaftContextMethods.addConnectedRaft({ id: newRaft.id, type: newRaft.type, name: newRaft.getFriendlyName() || "", isSelected: true });
147
162
  afterRaftConnectedCb(newRaft);
148
163
  }
149
164
  return [3 /*break*/, 8];
@@ -292,7 +307,7 @@ var ApplicationManager = /** @class */ (function () {
292
307
  return [4 /*yield*/, raft.disconnect()];
293
308
  case 1:
294
309
  _a.sent();
295
- this._removeRIC(raftId, 11000);
310
+ this._removeRaft(raftId, 3000);
296
311
  return [2 /*return*/];
297
312
  }
298
313
  });
@@ -302,7 +317,7 @@ var ApplicationManager = /** @class */ (function () {
302
317
  * Removes raft after a certain time
303
318
  * Removes from the rics list after x seconds so that we can still get the last event
304
319
  */
305
- ApplicationManager.prototype._removeRIC = function (raftId, timeout) {
320
+ ApplicationManager.prototype._removeRaft = function (raftId, timeout) {
306
321
  var _this = this;
307
322
  var ricRemovalTimeout = setTimeout(function () {
308
323
  delete _this.connectedRafts[raftId];
@@ -360,7 +375,7 @@ var ApplicationManager = /** @class */ (function () {
360
375
  case 0: return [4 /*yield*/, ((_a = this.connectedRafts[raftId]) === null || _a === void 0 ? void 0 : _a.stopVerifyingRaft(isCorrectRIC))];
361
376
  case 1:
362
377
  _b.sent();
363
- this._removeRIC(raftId, 11000);
378
+ this._removeRaft(raftId, 3000);
364
379
  return [2 /*return*/];
365
380
  }
366
381
  });
@@ -2,7 +2,7 @@ import RAFT from "../RAFT";
2
2
  import RICInterface from "../RAFTInterface";
3
3
  import { RaftTypeE } from "../../../types/raft";
4
4
  import { CogStateInfo, RICLedLcdColours } from "@robotical/roboticaljs";
5
- import { RaftConnEvent, RaftPublishEvent, RaftUpdateEvent } from "@robdobsn/raftjs";
5
+ import { RaftConnEvent, RaftPublishEvent, RaftUpdateEvent } from "@robotical/raftjs";
6
6
  import { RaftInfoEvents } from "../../../types/events/raft-info";
7
7
  import PublishedDataAnalyser from "./PublishedDataAnalyser";
8
8
  export declare class Cog extends RAFT implements RICInterface {
@@ -51,7 +51,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
51
51
  };
52
52
  import RAFT from "../RAFT";
53
53
  import { RaftTypeE } from "../../../types/raft";
54
- import { deviceAttrGetLatestFormatted, RaftConnEvent, RaftPublishEvent } from "@robdobsn/raftjs";
54
+ import { deviceAttrGetLatestFormatted, RaftConnEvent, RaftPublishEvent } from "@robotical/raftjs";
55
55
  import { RaftInfoEvents } from "../../../types/events/raft-info";
56
56
  import PublishedDataAnalyser from "./PublishedDataAnalyser";
57
57
  var Cog = /** @class */ (function (_super) {
@@ -1,32 +1,52 @@
1
+ /// <reference types="node" />
1
2
  import { CogStateInfo } from "@robotical/roboticaljs";
2
3
  import RAFT from "../RAFT";
3
4
  import PublishedDataGetter from "./PublishedDataGetter";
5
+ import EventEmitter from "events";
4
6
  interface CogState {
5
- tilt: boolean | "forward" | "backward" | "left" | "right";
6
- movementType: boolean | "shake" | "move";
7
- rotation: boolean | "clockwise" | "counter-clockwise";
8
- buttonClick: boolean;
9
- objectSense: boolean | "left" | "right";
10
- lightSense: boolean | "left" | "right";
11
- irMessage: boolean | "left" | "right";
7
+ tilt: "none" | "forward" | "backward" | "left" | "right";
8
+ movementType: "none" | "shake" | "move";
9
+ rotation: "none" | "clockwise" | "counterClockwise";
10
+ buttonClick: "none" | "click" | "release";
11
+ objectSense: "none" | "left" | "right";
12
+ lightSense: "none" | "high" | "mid" | "low";
12
13
  }
13
- declare class PublishedDataAnalyser {
14
+ declare class PublishedDataAnalyser extends EventEmitter {
14
15
  private cog;
15
16
  cogState: CogState;
16
17
  private pubSub;
18
+ eventsMap: {
19
+ tilt: {
20
+ [key in CogState["tilt"]]: string;
21
+ };
22
+ movementType: {
23
+ [key in CogState["movementType"]]: string;
24
+ };
25
+ rotation: {
26
+ [key in CogState["rotation"]]: string;
27
+ };
28
+ buttonClick: {
29
+ [key in CogState["buttonClick"]]: string;
30
+ };
31
+ objectSense: {
32
+ [key in CogState["objectSense"]]: string;
33
+ };
34
+ lightSense: {
35
+ [key in CogState["lightSense"]]: string;
36
+ };
37
+ };
17
38
  TiltDetection: typeof TiltDetection;
18
39
  PublishedDataGetter: typeof PublishedDataGetter;
19
40
  constructor(cog: RAFT);
20
41
  subscribeToPublishedData(): void;
21
42
  unsubscribeFromPublishedData(): void;
22
43
  analyse(data: CogStateInfo): void;
23
- detectMovement(ax: number, ay: number, az: number): boolean;
24
- detectTilt(ax: number, ay: number, az: number, isMoving: boolean): void;
25
- detectRotation(gz: number, isMoving: boolean): void;
26
- detectButtonClick(buttonLightValue: number): void;
27
- detectObjectSense(leftIRValue: number, rightIRValue: number): void;
28
- detectLightSense(ambientLightValue: number): void;
29
- detectIRMessage(data: CogStateInfo): void;
44
+ setTilt(tilt: CogState["tilt"]): void;
45
+ setMovementType(movementType: CogState["movementType"]): void;
46
+ setRotation(rotation: CogState["rotation"]): void;
47
+ setButtonClick(buttonClick: CogState["buttonClick"]): void;
48
+ setObjectSense(objectSense: CogState["objectSense"]): void;
49
+ setLightSense(lightSense: CogState["lightSense"]): void;
30
50
  }
31
51
  declare class TiltDetection {
32
52
  distance(a: number, b: number): number;
@@ -35,6 +55,6 @@ declare class TiltDetection {
35
55
  y: number;
36
56
  z: number;
37
57
  };
38
- detectTilt(ax: number, ay: number, az: number, isMoving: boolean | undefined, cogState: CogState, cogVersion: string): void;
58
+ detectTilt(ax: number, ay: number, az: number, isMoving: boolean | undefined, analyser: PublishedDataAnalyser, cogVersion: string): void;
39
59
  }
40
60
  export default PublishedDataAnalyser;