UNPKG

@robotical/roboticaljs

Version:

Javascript/TS library for Robotical products

27 lines 978 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.StateInfoGeneric = void 0; class StateInfoGeneric { constructor(_deviceManager) { this._deviceManager = _deviceManager; } updateFromMsg(rxMsg, frameTimeMs, isBinary) { // Debug // RaftLog.info(`StateInfoGeneric: updateFromMsg: rxMsg: ${rxMsg} frameTimeMs: ${frameTimeMs}`); // Handle binary or JSON if (isBinary) { // Handle using device manager this._deviceManager.handleClientMsgBinary(rxMsg); } else { // Convert Uint8Array to string const decoder = new TextDecoder('utf-8'); const jsonString = decoder.decode(rxMsg.slice(2)); // Handle using device manager this._deviceManager.handleClientMsgJson(jsonString); } return []; } } exports.StateInfoGeneric = StateInfoGeneric; //# sourceMappingURL=StateInfoGeneric.js.map