diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..5cafdc7 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "src/main-protos/protos"] + path = src/main-protos/protos + url = https://github.com/pioneers/protos.git diff --git a/package.json b/package.json index 807ffa8..edf977a 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,8 @@ "@types/node": "^12.0.0", "@types/react": "^17.0.0", "@types/react-dom": "^17.0.0", + "buffer": "^6.0.3", + "protobufjs": "^6.11.2", "react": "^17.0.2", "react-dom": "^17.0.2", "react-scripts": "4.0.3", diff --git a/src/App.tsx b/src/App.tsx index a53698a..1323663 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,24 +1,35 @@ -import React from 'react'; -import logo from './logo.svg'; +import React, { useEffect } from 'react'; +// import {VideoFeed} from './video-feed/VideoFeed'; +import { useRuntimeConnection } from './hooks'; import './App.css'; -function App() { +export const App = () => { + const runtimeConnection = useRuntimeConnection(); + + useEffect(() => { + runtimeConnection.connect('127.0.0.1') + }, [runtimeConnection]); + + // const ws = new WebSocket('ws://127.0.0.1:5000'); + + // ws.addEventListener('close', (ev: Event) => console.log('Connection closed', ev)); + + // ws.onopen = ((ev: Event) => { + // console.log('web socket open', ev); + // ws.send(Buffer.from([1])); + // setInterval(() => ws.send('testing'), 1000); + // }); + + // ws.addEventListener('message', (message: MessageEvent) => { + // console.log('received data: %s', message.data.toString()); + // }); + + // ws.addEventListener('error', (ev: Event) => console.log('error', ev)); + return (
-
- logo -

- Edit src/App.tsx and save to reload. -

- - Learn React - -
+

Dawn is the best software team.

+ {/* */}
); } diff --git a/src/connections/RuntimeConnection.ts b/src/connections/RuntimeConnection.ts new file mode 100644 index 0000000..fca2350 --- /dev/null +++ b/src/connections/RuntimeConnection.ts @@ -0,0 +1,280 @@ +import { Logger } from '../utils'; +import * as protos from '../main-protos/protos'; +import { Buffer } from 'buffer'; + +/** + * Define port constants, which must match with Runtime + */ +const DEFAULT_CONNECTION_PORT = 5000; + +/** + * Runtime IP Address used for TCP and UDP connections + */ +const DEFAULT_CONNECTION_IP = '192.168.0.0'; + +/** + * Define message ID constants, which must match with Runtime + */ +enum MsgType { + RUN_MODE = 0, + START_POS = 1, + LOG = 2, + DEVICE_DATA = 3, + // 4 reserved for some Shepherd msg type + INPUTS = 5, + TIME_STAMPS = 6 +} + +interface Packet { + type: MsgType; + length: number; + payload: Buffer; +} + +/** Given a data buffer, read as many TCP Packets as possible. + * If there are leftover bytes, return them so that they can be used in the next cycle of data. + */ +function readPackets(data: Buffer, previousLeftoverBytes?: Buffer): { leftoverBytes?: Buffer; processedTCPPackets: Packet[] } { + const HEADER_NUM_BYTES = 3; + + const bytesToRead = Buffer.concat([previousLeftoverBytes ?? new Uint8Array(), data]); + const processedTCPPackets: Packet[] = []; + + let leftoverBytes; + let currentPos = 0; + + while (currentPos < bytesToRead.length) { + let header: Buffer; + let msgType: number; + let msgLength: number; + let payload: Buffer; + + if (currentPos + HEADER_NUM_BYTES <= bytesToRead.length) { + // Have enough bytes to read in 3 byte header + header = bytesToRead.slice(currentPos, currentPos + HEADER_NUM_BYTES); + msgType = header[0]; + msgLength = (header[2] << 8) | header[1]; + } else { + // Don't have enough bytes to read 3 byte header so we save the bytes for the next data cycle + leftoverBytes = bytesToRead.slice(currentPos); + + return { + leftoverBytes, + processedTCPPackets + }; + } + + currentPos += HEADER_NUM_BYTES; + + if (currentPos + msgLength <= bytesToRead.length) { + // Have enough bytes to read entire payload from 1 TCP packet + payload = bytesToRead.slice(currentPos, currentPos + msgLength); + } else { + // Don't have enough bytes to read entire payload + leftoverBytes = bytesToRead.slice(currentPos); + + return { + // Note: Need to save header so we know how many bytes to read for this packet in the next data cycle + leftoverBytes: Buffer.concat([header, leftoverBytes]), + processedTCPPackets + }; + } + + const newTCPPacket = { type: msgType, length: msgLength, payload }; + processedTCPPackets.push(newTCPPacket); + + currentPos += msgLength; + } + + return { + leftoverBytes, + processedTCPPackets + }; +} + +/** + * Create TCP packet header and prepend to + * payload to send to Runtime. + */ +function createPacket(payload: unknown, messageType: MsgType): Buffer { + let encodedPayload: Uint8Array; + + switch (messageType) { + case MsgType.DEVICE_DATA: + encodedPayload = protos.DevData.encode(protos.DevData.create(payload as protos.IDevData)).finish(); + break; + case MsgType.RUN_MODE: + encodedPayload = protos.RunMode.encode(protos.RunMode.create(payload as protos.IRunMode)).finish(); + break; + case MsgType.START_POS: + encodedPayload = protos.StartPos.encode(protos.StartPos.create(payload as protos.IStartPos)).finish(); + break; + case MsgType.TIME_STAMPS: + encodedPayload = protos.TimeStamps.encode(protos.TimeStamps.create(payload as protos.ITimeStamps)).finish(); + break; + case MsgType.INPUTS: + encodedPayload = protos.UserInputs.encode( + protos.UserInputs.create({ inputs: payload as protos.Input[] } as protos.IUserInputs) + ).finish(); + break; + default: + console.log('ERROR: trying to create TCP Packet with unknown message type'); + encodedPayload = new Uint8Array(); + break; + } + + const msgLength = Buffer.byteLength(encodedPayload); + const msgLengthArr = new Uint8Array([msgLength & 0x00ff, msgLength & 0xff00]); // Assuming little-endian byte order, since runs on x64 + const msgTypeArr = new Uint8Array([messageType]); + + return Buffer.concat([Buffer.from(msgTypeArr.buffer), Buffer.from(msgLengthArr.buffer), Buffer.from(encodedPayload.buffer)], msgLength + 3); +} + +export class RuntimeConnection { + currentIp: string = DEFAULT_CONNECTION_IP; + loggerName: string = 'RuntimeConnection'; + logger: Logger = new Logger(this.loggerName); + socket: WebSocket | undefined; + leftoverBytes: Buffer | undefined; + isConnecting: boolean = false; + socketReady: boolean = false; + + constructor() { + this.tick(); + } + + private openNewConnection() { + this.isConnecting = true; + + const ip = this.currentIp; + + if (ip.includes(':')) { + // ip most likely already includes port, so no need to use `DEFAULT_CONNECTION_PORT` + this.socket = new WebSocket(`ws://${ip}`); + } else { + this.socket = new WebSocket(`ws://${ip}:${DEFAULT_CONNECTION_PORT}`); + } + + this.socket.addEventListener('open', () => { + this.logger.log('connected'); + this.socketReady = true; + this.socket!.send(new Uint8Array([1])); // Runtime needs first byte to be 1 to recognize client as Dawn (instead of Shepherd) + }); + + this.socket.addEventListener('end', () => { + this.logger.log('Runtime disconnected'); + }); + + this.socket.addEventListener('error', (ev: Event) => { + this.logger.log(`Encountered error -- ${ev}`); + }); + + /** + * Runtime TCP Message Handler. + * TODO: Distinguish between challenge outputs and console logs + * when using payload to update console + */ + this.socket.addEventListener('message', async (message: MessageEvent) => { + // this.logger.log('Received message'); + const dataArrayBuffer = await message.data.arrayBuffer(); + const { leftoverBytes, processedTCPPackets } = readPackets(Buffer.from(dataArrayBuffer), this.leftoverBytes); + + for (const packet of processedTCPPackets) { + let decoded; + + switch (packet.type) { + case MsgType.TIME_STAMPS: + decoded = protos.TimeStamps.decode(packet.payload); + const oneWayLatency = (Date.now() - Number(decoded.dawnTimestamp)) / 2; + this.logger.log(`${this.loggerName}: oneWayLatency -- ${oneWayLatency} msec`); + + // TODO: use `oneWayLatency` in UI + break; + + case MsgType.DEVICE_DATA: + try { + const sensorData: protos.Device[] = protos.DevData.decode(packet.payload).devices; + this.logger.log(`sensorData -- ${JSON.stringify(sensorData)}`) + } catch (err) { + this.logger.log(err); + } + break; + + default: + this.logger.log(`Unsupported received message type: ${packet.type}`) + } + } + + this.leftoverBytes = leftoverBytes; + }); + + this.isConnecting = false; + } + + private tick = () => { + console.log('socket connected', this.socketReady); + console.log('socket is connecting', this.isConnecting); + console.log('current ip', this.currentIp); + console.log('\n'); + + if (this.socket === undefined && !this.isConnecting) { + this.openNewConnection(); + } + + setTimeout(this.tick, 5000); + } + + public connect = (newIp: string) => { + if (newIp === this.currentIp) { + // Same ip, no need to reconnect + return; + } + + if (this.socketReady) { + this.logger.log(`Closed existing connection to connect to new ip: ${newIp}`); + // Close existing connected socket to open new connection with new ip + this.socket?.close(); + this.socket = undefined; + } + + this.currentIp = newIp; + this.openNewConnection(); + } + + /** + * Initiates latency check by sending first packet to Runtime + */ + public initiateLatencyCheck = (data: protos.ITimeStamps) => { + const message = createPacket(data, MsgType.TIME_STAMPS); + this.socket?.send(message); + }; + + public sendRunMode = (runModeData: protos.IRunMode) => { + if (!this.socketReady) { + return; + } + + const message = createPacket(runModeData, MsgType.RUN_MODE); + this.socket?.send(message); + this.logger.log(`Sent run mode data -- ${JSON.stringify(runModeData)}\n`); + }; + + public sendInputs = (data: protos.Input[], source: protos.Source) => { + if (data.length === 0) { + data.push( + protos.Input.create({ + connected: false, + source + }) + ); + } + const message = createPacket(data, MsgType.INPUTS); + this.socket?.send(message); + }; + + close = () => { + this.logger.log('Closed socket connection'); + this.socket?.close(); + this.socketReady = false; + }; +} diff --git a/src/connections/index.ts b/src/connections/index.ts new file mode 100644 index 0000000..77cc36b --- /dev/null +++ b/src/connections/index.ts @@ -0,0 +1 @@ +export { RuntimeConnection } from './RuntimeConnection'; diff --git a/src/hooks/index.ts b/src/hooks/index.ts new file mode 100644 index 0000000..85c5f63 --- /dev/null +++ b/src/hooks/index.ts @@ -0,0 +1 @@ +export { useRuntimeConnection } from './useRuntimeConnection'; diff --git a/src/hooks/useRuntimeConnection.ts b/src/hooks/useRuntimeConnection.ts new file mode 100644 index 0000000..e8833af --- /dev/null +++ b/src/hooks/useRuntimeConnection.ts @@ -0,0 +1,20 @@ +import { RuntimeConnection } from '../connections'; +import { useEffect, useState } from 'react'; + +export const useRuntimeConnection = () => { + const [runtimeConnection, _setRuntimeConnection] = useState(new RuntimeConnection()); + + useEffect(() => { + setInterval(() => runtimeConnection.sendRunMode({ mode: 2 }), 5000); + + return () => { + runtimeConnection.close(); + } + }, [runtimeConnection]); + + const connect = (newIp: string) => { + runtimeConnection.connect(newIp); + } + + return { connect }; +} \ No newline at end of file diff --git a/src/keyboard-buttons.ts b/src/keyboard-buttons.ts new file mode 100644 index 0000000..6f5d9c4 --- /dev/null +++ b/src/keyboard-buttons.ts @@ -0,0 +1,49 @@ +export const keyboardButtons = { + a: 0, + b: 1, + c: 2, + d: 3, + e: 4, + f: 5, + g: 6, + h: 7, + i: 8, + j: 9, + k: 10, + l: 11, + m: 12, + n: 13, + o: 14, + p: 15, + q: 16, + r: 17, + s: 18, + t: 19, + u: 20, + v: 21, + w: 22, + x: 23, + y: 24, + z: 25, + '1': 26, + '2': 27, + '3': 28, + '4': 29, + '5': 30, + '6': 31, + '7': 32, + '8': 33, + '9': 34, + '0': 35, + ',': 36, + '.': 37, + '/': 38, + ';': 39, + "'": 40, + '[': 41, + ']': 42, + ArrowLeft: 43, + ArrowRight: 44, + ArrowUp: 45, + ArrowDown: 46 + }; \ No newline at end of file diff --git a/src/main-protos/protos b/src/main-protos/protos new file mode 160000 index 0000000..9e52c0e --- /dev/null +++ b/src/main-protos/protos @@ -0,0 +1 @@ +Subproject commit 9e52c0e5cd7ff7b83811145dfc93dbd5ea168f84 diff --git a/src/main-protos/protos.d.ts b/src/main-protos/protos.d.ts new file mode 100644 index 0000000..66a5cc0 --- /dev/null +++ b/src/main-protos/protos.d.ts @@ -0,0 +1,1111 @@ +import * as $protobuf from "protobufjs"; +/** Properties of a Param. */ +export interface IParam { + + /** Param name */ + name?: (string|null); + + /** Param fval */ + fval?: (number|null); + + /** Param ival */ + ival?: (number|null); + + /** Param bval */ + bval?: (boolean|null); + + /** Param readonly */ + readonly?: (boolean|null); +} + +/** Represents a Param. */ +export class Param implements IParam { + + /** + * Constructs a new Param. + * @param [properties] Properties to set + */ + constructor(properties?: IParam); + + /** Param name. */ + public name: string; + + /** Param fval. */ + public fval: number; + + /** Param ival. */ + public ival: number; + + /** Param bval. */ + public bval: boolean; + + /** Param readonly. */ + public readonly: boolean; + + /** Param val. */ + public val?: ("fval"|"ival"|"bval"); + + /** + * Creates a new Param instance using the specified properties. + * @param [properties] Properties to set + * @returns Param instance + */ + public static create(properties?: IParam): Param; + + /** + * Encodes the specified Param message. Does not implicitly {@link Param.verify|verify} messages. + * @param message Param message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: Param, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Param message, length delimited. Does not implicitly {@link Param.verify|verify} messages. + * @param message Param message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: Param, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Param message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Param + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): Param; + + /** + * Decodes a Param message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Param + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): Param; + + /** + * Verifies a Param message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Param message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Param + */ + public static fromObject(object: { [k: string]: any }): Param; + + /** + * Creates a plain object from a Param message. Also converts values to other types if specified. + * @param message Param + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: Param, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Param to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; +} + +/** Properties of a Device. */ +export interface IDevice { + + /** Device name */ + name?: (string|null); + + /** Device uid */ + uid?: (number|Long|null); + + /** Device type */ + type?: (number|null); + + /** Device params */ + params?: (Param[]|null); +} + +/** Represents a Device. */ +export class Device implements IDevice { + + /** + * Constructs a new Device. + * @param [properties] Properties to set + */ + constructor(properties?: IDevice); + + /** Device name. */ + public name: string; + + /** Device uid. */ + public uid: (number|Long); + + /** Device type. */ + public type: number; + + /** Device params. */ + public params: Param[]; + + /** + * Creates a new Device instance using the specified properties. + * @param [properties] Properties to set + * @returns Device instance + */ + public static create(properties?: IDevice): Device; + + /** + * Encodes the specified Device message. Does not implicitly {@link Device.verify|verify} messages. + * @param message Device message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: Device, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Device message, length delimited. Does not implicitly {@link Device.verify|verify} messages. + * @param message Device message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: Device, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Device message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Device + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): Device; + + /** + * Decodes a Device message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Device + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): Device; + + /** + * Verifies a Device message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Device message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Device + */ + public static fromObject(object: { [k: string]: any }): Device; + + /** + * Creates a plain object from a Device message. Also converts values to other types if specified. + * @param message Device + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: Device, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Device to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; +} + +/** Properties of a DevData. */ +export interface IDevData { + + /** DevData devices */ + devices?: (Device[]|null); +} + +/** Represents a DevData. */ +export class DevData implements IDevData { + + /** + * Constructs a new DevData. + * @param [properties] Properties to set + */ + constructor(properties?: IDevData); + + /** DevData devices. */ + public devices: Device[]; + + /** + * Creates a new DevData instance using the specified properties. + * @param [properties] Properties to set + * @returns DevData instance + */ + public static create(properties?: IDevData): DevData; + + /** + * Encodes the specified DevData message. Does not implicitly {@link DevData.verify|verify} messages. + * @param message DevData message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: DevData, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DevData message, length delimited. Does not implicitly {@link DevData.verify|verify} messages. + * @param message DevData message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: DevData, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DevData message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DevData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): DevData; + + /** + * Decodes a DevData message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DevData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): DevData; + + /** + * Verifies a DevData message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DevData message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DevData + */ + public static fromObject(object: { [k: string]: any }): DevData; + + /** + * Creates a plain object from a DevData message. Also converts values to other types if specified. + * @param message DevData + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: DevData, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DevData to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; +} + +/** State enum. */ +export enum State { + POISON_IVY = 0, + DEHYDRATION = 1, + HYPOTHERMIA_START = 2, + HYPOTHERMIA_END = 3 +} + +/** Properties of a GameState. */ +export interface IGameState { + + /** GameState state */ + state?: (State|null); +} + +/** Represents a GameState. */ +export class GameState implements IGameState { + + /** + * Constructs a new GameState. + * @param [properties] Properties to set + */ + constructor(properties?: IGameState); + + /** GameState state. */ + public state: State; + + /** + * Creates a new GameState instance using the specified properties. + * @param [properties] Properties to set + * @returns GameState instance + */ + public static create(properties?: IGameState): GameState; + + /** + * Encodes the specified GameState message. Does not implicitly {@link GameState.verify|verify} messages. + * @param message GameState message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: GameState, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GameState message, length delimited. Does not implicitly {@link GameState.verify|verify} messages. + * @param message GameState message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: GameState, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GameState message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GameState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): GameState; + + /** + * Decodes a GameState message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GameState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): GameState; + + /** + * Verifies a GameState message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GameState message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GameState + */ + public static fromObject(object: { [k: string]: any }): GameState; + + /** + * Creates a plain object from a GameState message. Also converts values to other types if specified. + * @param message GameState + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: GameState, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GameState to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; +} + +/** Source enum. */ +export enum Source { + GAMEPAD = 0, + KEYBOARD = 1 +} + +/** Properties of an Input. */ +export interface IInput { + + /** Input connected */ + connected?: (boolean|null); + + /** Input buttons */ + buttons?: (number|Long|null); + + /** Input axes */ + axes?: (number[]|null); + + /** Input source */ + source?: (Source|null); +} + +/** Represents an Input. */ +export class Input implements IInput { + + /** + * Constructs a new Input. + * @param [properties] Properties to set + */ + constructor(properties?: IInput); + + /** Input connected. */ + public connected: boolean; + + /** Input buttons. */ + public buttons: (number|Long); + + /** Input axes. */ + public axes: number[]; + + /** Input source. */ + public source: Source; + + /** + * Creates a new Input instance using the specified properties. + * @param [properties] Properties to set + * @returns Input instance + */ + public static create(properties?: IInput): Input; + + /** + * Encodes the specified Input message. Does not implicitly {@link Input.verify|verify} messages. + * @param message Input message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: Input, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Input message, length delimited. Does not implicitly {@link Input.verify|verify} messages. + * @param message Input message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: Input, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Input message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Input + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): Input; + + /** + * Decodes an Input message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Input + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): Input; + + /** + * Verifies an Input message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Input message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Input + */ + public static fromObject(object: { [k: string]: any }): Input; + + /** + * Creates a plain object from an Input message. Also converts values to other types if specified. + * @param message Input + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: Input, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Input to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; +} + +/** Properties of a UserInputs. */ +export interface IUserInputs { + + /** UserInputs inputs */ + inputs?: (Input[]|null); +} + +/** Represents a UserInputs. */ +export class UserInputs implements IUserInputs { + + /** + * Constructs a new UserInputs. + * @param [properties] Properties to set + */ + constructor(properties?: IUserInputs); + + /** UserInputs inputs. */ + public inputs: Input[]; + + /** + * Creates a new UserInputs instance using the specified properties. + * @param [properties] Properties to set + * @returns UserInputs instance + */ + public static create(properties?: IUserInputs): UserInputs; + + /** + * Encodes the specified UserInputs message. Does not implicitly {@link UserInputs.verify|verify} messages. + * @param message UserInputs message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: UserInputs, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UserInputs message, length delimited. Does not implicitly {@link UserInputs.verify|verify} messages. + * @param message UserInputs message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: UserInputs, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a UserInputs message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UserInputs + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): UserInputs; + + /** + * Decodes a UserInputs message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UserInputs + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): UserInputs; + + /** + * Verifies a UserInputs message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a UserInputs message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UserInputs + */ + public static fromObject(object: { [k: string]: any }): UserInputs; + + /** + * Creates a plain object from a UserInputs message. Also converts values to other types if specified. + * @param message UserInputs + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: UserInputs, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UserInputs to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; +} + +/** Mode enum. */ +export enum Mode { + IDLE = 0, + AUTO = 1, + TELEOP = 2, + ESTOP = 3 +} + +/** Properties of a RunMode. */ +export interface IRunMode { + + /** RunMode mode */ + mode?: (Mode|null); +} + +/** Represents a RunMode. */ +export class RunMode implements IRunMode { + + /** + * Constructs a new RunMode. + * @param [properties] Properties to set + */ + constructor(properties?: IRunMode); + + /** RunMode mode. */ + public mode: Mode; + + /** + * Creates a new RunMode instance using the specified properties. + * @param [properties] Properties to set + * @returns RunMode instance + */ + public static create(properties?: IRunMode): RunMode; + + /** + * Encodes the specified RunMode message. Does not implicitly {@link RunMode.verify|verify} messages. + * @param message RunMode message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: RunMode, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RunMode message, length delimited. Does not implicitly {@link RunMode.verify|verify} messages. + * @param message RunMode message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: RunMode, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RunMode message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RunMode + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): RunMode; + + /** + * Decodes a RunMode message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RunMode + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): RunMode; + + /** + * Verifies a RunMode message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RunMode message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RunMode + */ + public static fromObject(object: { [k: string]: any }): RunMode; + + /** + * Creates a plain object from a RunMode message. Also converts values to other types if specified. + * @param message RunMode + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: RunMode, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RunMode to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; +} + +/** Properties of a RuntimeStatus. */ +export interface IRuntimeStatus { + + /** RuntimeStatus shepConnected */ + shepConnected?: (boolean|null); + + /** RuntimeStatus dawnConnected */ + dawnConnected?: (boolean|null); + + /** RuntimeStatus mode */ + mode?: (Mode|null); + + /** RuntimeStatus battery */ + battery?: (number|null); + + /** RuntimeStatus version */ + version?: (string|null); +} + +/** Represents a RuntimeStatus. */ +export class RuntimeStatus implements IRuntimeStatus { + + /** + * Constructs a new RuntimeStatus. + * @param [properties] Properties to set + */ + constructor(properties?: IRuntimeStatus); + + /** RuntimeStatus shepConnected. */ + public shepConnected: boolean; + + /** RuntimeStatus dawnConnected. */ + public dawnConnected: boolean; + + /** RuntimeStatus mode. */ + public mode: Mode; + + /** RuntimeStatus battery. */ + public battery: number; + + /** RuntimeStatus version. */ + public version: string; + + /** + * Creates a new RuntimeStatus instance using the specified properties. + * @param [properties] Properties to set + * @returns RuntimeStatus instance + */ + public static create(properties?: IRuntimeStatus): RuntimeStatus; + + /** + * Encodes the specified RuntimeStatus message. Does not implicitly {@link RuntimeStatus.verify|verify} messages. + * @param message RuntimeStatus message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: RuntimeStatus, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RuntimeStatus message, length delimited. Does not implicitly {@link RuntimeStatus.verify|verify} messages. + * @param message RuntimeStatus message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: RuntimeStatus, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RuntimeStatus message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RuntimeStatus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): RuntimeStatus; + + /** + * Decodes a RuntimeStatus message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RuntimeStatus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): RuntimeStatus; + + /** + * Verifies a RuntimeStatus message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RuntimeStatus message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RuntimeStatus + */ + public static fromObject(object: { [k: string]: any }): RuntimeStatus; + + /** + * Creates a plain object from a RuntimeStatus message. Also converts values to other types if specified. + * @param message RuntimeStatus + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: RuntimeStatus, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RuntimeStatus to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; +} + +/** Pos enum. */ +export enum Pos { + LEFT = 0, + RIGHT = 1 +} + +/** Properties of a StartPos. */ +export interface IStartPos { + + /** StartPos pos */ + pos?: (Pos|null); +} + +/** Represents a StartPos. */ +export class StartPos implements IStartPos { + + /** + * Constructs a new StartPos. + * @param [properties] Properties to set + */ + constructor(properties?: IStartPos); + + /** StartPos pos. */ + public pos: Pos; + + /** + * Creates a new StartPos instance using the specified properties. + * @param [properties] Properties to set + * @returns StartPos instance + */ + public static create(properties?: IStartPos): StartPos; + + /** + * Encodes the specified StartPos message. Does not implicitly {@link StartPos.verify|verify} messages. + * @param message StartPos message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: StartPos, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified StartPos message, length delimited. Does not implicitly {@link StartPos.verify|verify} messages. + * @param message StartPos message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: StartPos, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a StartPos message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns StartPos + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): StartPos; + + /** + * Decodes a StartPos message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns StartPos + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): StartPos; + + /** + * Verifies a StartPos message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a StartPos message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns StartPos + */ + public static fromObject(object: { [k: string]: any }): StartPos; + + /** + * Creates a plain object from a StartPos message. Also converts values to other types if specified. + * @param message StartPos + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: StartPos, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this StartPos to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; +} + +/** Properties of a Text. */ +export interface IText { + + /** Text payload */ + payload?: (string[]|null); +} + +/** Represents a Text. */ +export class Text implements IText { + + /** + * Constructs a new Text. + * @param [properties] Properties to set + */ + constructor(properties?: IText); + + /** Text payload. */ + public payload: string[]; + + /** + * Creates a new Text instance using the specified properties. + * @param [properties] Properties to set + * @returns Text instance + */ + public static create(properties?: IText): Text; + + /** + * Encodes the specified Text message. Does not implicitly {@link Text.verify|verify} messages. + * @param message Text message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: Text, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Text message, length delimited. Does not implicitly {@link Text.verify|verify} messages. + * @param message Text message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: Text, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Text message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Text + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): Text; + + /** + * Decodes a Text message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Text + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): Text; + + /** + * Verifies a Text message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Text message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Text + */ + public static fromObject(object: { [k: string]: any }): Text; + + /** + * Creates a plain object from a Text message. Also converts values to other types if specified. + * @param message Text + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: Text, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Text to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; +} + +/** Properties of a TimeStamps. */ +export interface ITimeStamps { + + /** TimeStamps dawnTimestamp */ + dawnTimestamp?: (number|Long|null); + + /** TimeStamps runtimeTimestamp */ + runtimeTimestamp?: (number|Long|null); +} + +/** Represents a TimeStamps. */ +export class TimeStamps implements ITimeStamps { + + /** + * Constructs a new TimeStamps. + * @param [properties] Properties to set + */ + constructor(properties?: ITimeStamps); + + /** TimeStamps dawnTimestamp. */ + public dawnTimestamp: (number|Long); + + /** TimeStamps runtimeTimestamp. */ + public runtimeTimestamp: (number|Long); + + /** + * Creates a new TimeStamps instance using the specified properties. + * @param [properties] Properties to set + * @returns TimeStamps instance + */ + public static create(properties?: ITimeStamps): TimeStamps; + + /** + * Encodes the specified TimeStamps message. Does not implicitly {@link TimeStamps.verify|verify} messages. + * @param message TimeStamps message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: TimeStamps, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TimeStamps message, length delimited. Does not implicitly {@link TimeStamps.verify|verify} messages. + * @param message TimeStamps message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: TimeStamps, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TimeStamps message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TimeStamps + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): TimeStamps; + + /** + * Decodes a TimeStamps message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TimeStamps + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): TimeStamps; + + /** + * Verifies a TimeStamps message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TimeStamps message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TimeStamps + */ + public static fromObject(object: { [k: string]: any }): TimeStamps; + + /** + * Creates a plain object from a TimeStamps message. Also converts values to other types if specified. + * @param message TimeStamps + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: TimeStamps, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TimeStamps to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; +} diff --git a/src/main-protos/protos.js b/src/main-protos/protos.js new file mode 100644 index 0000000..c06167a --- /dev/null +++ b/src/main-protos/protos.js @@ -0,0 +1,2753 @@ +/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/ +import * as $protobuf from "protobufjs/minimal"; + +// Common aliases +const $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; + +// Exported root namespace +const $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {}); + +export const Param = $root.Param = (() => { + + /** + * Properties of a Param. + * @exports IParam + * @interface IParam + * @property {string|null} [name] Param name + * @property {number|null} [fval] Param fval + * @property {number|null} [ival] Param ival + * @property {boolean|null} [bval] Param bval + * @property {boolean|null} [readonly] Param readonly + */ + + /** + * Constructs a new Param. + * @exports Param + * @classdesc Represents a Param. + * @implements IParam + * @constructor + * @param {IParam=} [properties] Properties to set + */ + function Param(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Param name. + * @member {string} name + * @memberof Param + * @instance + */ + Param.prototype.name = ""; + + /** + * Param fval. + * @member {number} fval + * @memberof Param + * @instance + */ + Param.prototype.fval = 0; + + /** + * Param ival. + * @member {number} ival + * @memberof Param + * @instance + */ + Param.prototype.ival = 0; + + /** + * Param bval. + * @member {boolean} bval + * @memberof Param + * @instance + */ + Param.prototype.bval = false; + + /** + * Param readonly. + * @member {boolean} readonly + * @memberof Param + * @instance + */ + Param.prototype.readonly = false; + + // OneOf field names bound to virtual getters and setters + let $oneOfFields; + + /** + * Param val. + * @member {"fval"|"ival"|"bval"|undefined} val + * @memberof Param + * @instance + */ + Object.defineProperty(Param.prototype, "val", { + get: $util.oneOfGetter($oneOfFields = ["fval", "ival", "bval"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Param instance using the specified properties. + * @function create + * @memberof Param + * @static + * @param {IParam=} [properties] Properties to set + * @returns {Param} Param instance + */ + Param.create = function create(properties) { + return new Param(properties); + }; + + /** + * Encodes the specified Param message. Does not implicitly {@link Param.verify|verify} messages. + * @function encode + * @memberof Param + * @static + * @param {Param} message Param message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Param.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.fval != null && Object.hasOwnProperty.call(message, "fval")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.fval); + if (message.ival != null && Object.hasOwnProperty.call(message, "ival")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.ival); + if (message.bval != null && Object.hasOwnProperty.call(message, "bval")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.bval); + if (message.readonly != null && Object.hasOwnProperty.call(message, "readonly")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.readonly); + return writer; + }; + + /** + * Encodes the specified Param message, length delimited. Does not implicitly {@link Param.verify|verify} messages. + * @function encodeDelimited + * @memberof Param + * @static + * @param {Param} message Param message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Param.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Param message from the specified reader or buffer. + * @function decode + * @memberof Param + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {Param} Param + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Param.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.Param(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.fval = reader.float(); + break; + case 3: + message.ival = reader.int32(); + break; + case 4: + message.bval = reader.bool(); + break; + case 5: + message.readonly = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Param message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof Param + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {Param} Param + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Param.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Param message. + * @function verify + * @memberof Param + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Param.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + let properties = {}; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.fval != null && message.hasOwnProperty("fval")) { + properties.val = 1; + if (typeof message.fval !== "number") + return "fval: number expected"; + } + if (message.ival != null && message.hasOwnProperty("ival")) { + if (properties.val === 1) + return "val: multiple values"; + properties.val = 1; + if (!$util.isInteger(message.ival)) + return "ival: integer expected"; + } + if (message.bval != null && message.hasOwnProperty("bval")) { + if (properties.val === 1) + return "val: multiple values"; + properties.val = 1; + if (typeof message.bval !== "boolean") + return "bval: boolean expected"; + } + if (message.readonly != null && message.hasOwnProperty("readonly")) + if (typeof message.readonly !== "boolean") + return "readonly: boolean expected"; + return null; + }; + + /** + * Creates a Param message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof Param + * @static + * @param {Object.} object Plain object + * @returns {Param} Param + */ + Param.fromObject = function fromObject(object) { + if (object instanceof $root.Param) + return object; + let message = new $root.Param(); + if (object.name != null) + message.name = String(object.name); + if (object.fval != null) + message.fval = Number(object.fval); + if (object.ival != null) + message.ival = object.ival | 0; + if (object.bval != null) + message.bval = Boolean(object.bval); + if (object.readonly != null) + message.readonly = Boolean(object.readonly); + return message; + }; + + /** + * Creates a plain object from a Param message. Also converts values to other types if specified. + * @function toObject + * @memberof Param + * @static + * @param {Param} message Param + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Param.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.name = ""; + object.readonly = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.fval != null && message.hasOwnProperty("fval")) { + object.fval = options.json && !isFinite(message.fval) ? String(message.fval) : message.fval; + if (options.oneofs) + object.val = "fval"; + } + if (message.ival != null && message.hasOwnProperty("ival")) { + object.ival = message.ival; + if (options.oneofs) + object.val = "ival"; + } + if (message.bval != null && message.hasOwnProperty("bval")) { + object.bval = message.bval; + if (options.oneofs) + object.val = "bval"; + } + if (message.readonly != null && message.hasOwnProperty("readonly")) + object.readonly = message.readonly; + return object; + }; + + /** + * Converts this Param to JSON. + * @function toJSON + * @memberof Param + * @instance + * @returns {Object.} JSON object + */ + Param.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Param; +})(); + +export const Device = $root.Device = (() => { + + /** + * Properties of a Device. + * @exports IDevice + * @interface IDevice + * @property {string|null} [name] Device name + * @property {number|Long|null} [uid] Device uid + * @property {number|null} [type] Device type + * @property {Array.|null} [params] Device params + */ + + /** + * Constructs a new Device. + * @exports Device + * @classdesc Represents a Device. + * @implements IDevice + * @constructor + * @param {IDevice=} [properties] Properties to set + */ + function Device(properties) { + this.params = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Device name. + * @member {string} name + * @memberof Device + * @instance + */ + Device.prototype.name = ""; + + /** + * Device uid. + * @member {number|Long} uid + * @memberof Device + * @instance + */ + Device.prototype.uid = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Device type. + * @member {number} type + * @memberof Device + * @instance + */ + Device.prototype.type = 0; + + /** + * Device params. + * @member {Array.} params + * @memberof Device + * @instance + */ + Device.prototype.params = $util.emptyArray; + + /** + * Creates a new Device instance using the specified properties. + * @function create + * @memberof Device + * @static + * @param {IDevice=} [properties] Properties to set + * @returns {Device} Device instance + */ + Device.create = function create(properties) { + return new Device(properties); + }; + + /** + * Encodes the specified Device message. Does not implicitly {@link Device.verify|verify} messages. + * @function encode + * @memberof Device + * @static + * @param {Device} message Device message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Device.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.uid != null && Object.hasOwnProperty.call(message, "uid")) + writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.uid); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 3, wireType 0 =*/24).uint32(message.type); + if (message.params != null && message.params.length) + for (let i = 0; i < message.params.length; ++i) + $root.Param.encode(message.params[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Device message, length delimited. Does not implicitly {@link Device.verify|verify} messages. + * @function encodeDelimited + * @memberof Device + * @static + * @param {Device} message Device message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Device.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Device message from the specified reader or buffer. + * @function decode + * @memberof Device + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {Device} Device + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Device.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.Device(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.uid = reader.uint64(); + break; + case 3: + message.type = reader.uint32(); + break; + case 4: + if (!(message.params && message.params.length)) + message.params = []; + message.params.push($root.Param.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Device message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof Device + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {Device} Device + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Device.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Device message. + * @function verify + * @memberof Device + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Device.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.uid != null && message.hasOwnProperty("uid")) + if (!$util.isInteger(message.uid) && !(message.uid && $util.isInteger(message.uid.low) && $util.isInteger(message.uid.high))) + return "uid: integer|Long expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isInteger(message.type)) + return "type: integer expected"; + if (message.params != null && message.hasOwnProperty("params")) { + if (!Array.isArray(message.params)) + return "params: array expected"; + for (let i = 0; i < message.params.length; ++i) { + let error = $root.Param.verify(message.params[i]); + if (error) + return "params." + error; + } + } + return null; + }; + + /** + * Creates a Device message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof Device + * @static + * @param {Object.} object Plain object + * @returns {Device} Device + */ + Device.fromObject = function fromObject(object) { + if (object instanceof $root.Device) + return object; + let message = new $root.Device(); + if (object.name != null) + message.name = String(object.name); + if (object.uid != null) + if ($util.Long) + (message.uid = $util.Long.fromValue(object.uid)).unsigned = true; + else if (typeof object.uid === "string") + message.uid = parseInt(object.uid, 10); + else if (typeof object.uid === "number") + message.uid = object.uid; + else if (typeof object.uid === "object") + message.uid = new $util.LongBits(object.uid.low >>> 0, object.uid.high >>> 0).toNumber(true); + if (object.type != null) + message.type = object.type >>> 0; + if (object.params) { + if (!Array.isArray(object.params)) + throw TypeError(".Device.params: array expected"); + message.params = []; + for (let i = 0; i < object.params.length; ++i) { + if (typeof object.params[i] !== "object") + throw TypeError(".Device.params: object expected"); + message.params[i] = $root.Param.fromObject(object.params[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Device message. Also converts values to other types if specified. + * @function toObject + * @memberof Device + * @static + * @param {Device} message Device + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Device.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.params = []; + if (options.defaults) { + object.name = ""; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.uid = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.uid = options.longs === String ? "0" : 0; + object.type = 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.uid != null && message.hasOwnProperty("uid")) + if (typeof message.uid === "number") + object.uid = options.longs === String ? String(message.uid) : message.uid; + else + object.uid = options.longs === String ? $util.Long.prototype.toString.call(message.uid) : options.longs === Number ? new $util.LongBits(message.uid.low >>> 0, message.uid.high >>> 0).toNumber(true) : message.uid; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.params && message.params.length) { + object.params = []; + for (let j = 0; j < message.params.length; ++j) + object.params[j] = $root.Param.toObject(message.params[j], options); + } + return object; + }; + + /** + * Converts this Device to JSON. + * @function toJSON + * @memberof Device + * @instance + * @returns {Object.} JSON object + */ + Device.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Device; +})(); + +export const DevData = $root.DevData = (() => { + + /** + * Properties of a DevData. + * @exports IDevData + * @interface IDevData + * @property {Array.|null} [devices] DevData devices + */ + + /** + * Constructs a new DevData. + * @exports DevData + * @classdesc Represents a DevData. + * @implements IDevData + * @constructor + * @param {IDevData=} [properties] Properties to set + */ + function DevData(properties) { + this.devices = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DevData devices. + * @member {Array.} devices + * @memberof DevData + * @instance + */ + DevData.prototype.devices = $util.emptyArray; + + /** + * Creates a new DevData instance using the specified properties. + * @function create + * @memberof DevData + * @static + * @param {IDevData=} [properties] Properties to set + * @returns {DevData} DevData instance + */ + DevData.create = function create(properties) { + return new DevData(properties); + }; + + /** + * Encodes the specified DevData message. Does not implicitly {@link DevData.verify|verify} messages. + * @function encode + * @memberof DevData + * @static + * @param {DevData} message DevData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DevData.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.devices != null && message.devices.length) + for (let i = 0; i < message.devices.length; ++i) + $root.Device.encode(message.devices[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DevData message, length delimited. Does not implicitly {@link DevData.verify|verify} messages. + * @function encodeDelimited + * @memberof DevData + * @static + * @param {DevData} message DevData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DevData.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DevData message from the specified reader or buffer. + * @function decode + * @memberof DevData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {DevData} DevData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DevData.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.DevData(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.devices && message.devices.length)) + message.devices = []; + message.devices.push($root.Device.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DevData message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof DevData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {DevData} DevData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DevData.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DevData message. + * @function verify + * @memberof DevData + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DevData.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.devices != null && message.hasOwnProperty("devices")) { + if (!Array.isArray(message.devices)) + return "devices: array expected"; + for (let i = 0; i < message.devices.length; ++i) { + let error = $root.Device.verify(message.devices[i]); + if (error) + return "devices." + error; + } + } + return null; + }; + + /** + * Creates a DevData message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof DevData + * @static + * @param {Object.} object Plain object + * @returns {DevData} DevData + */ + DevData.fromObject = function fromObject(object) { + if (object instanceof $root.DevData) + return object; + let message = new $root.DevData(); + if (object.devices) { + if (!Array.isArray(object.devices)) + throw TypeError(".DevData.devices: array expected"); + message.devices = []; + for (let i = 0; i < object.devices.length; ++i) { + if (typeof object.devices[i] !== "object") + throw TypeError(".DevData.devices: object expected"); + message.devices[i] = $root.Device.fromObject(object.devices[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a DevData message. Also converts values to other types if specified. + * @function toObject + * @memberof DevData + * @static + * @param {DevData} message DevData + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DevData.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.devices = []; + if (message.devices && message.devices.length) { + object.devices = []; + for (let j = 0; j < message.devices.length; ++j) + object.devices[j] = $root.Device.toObject(message.devices[j], options); + } + return object; + }; + + /** + * Converts this DevData to JSON. + * @function toJSON + * @memberof DevData + * @instance + * @returns {Object.} JSON object + */ + DevData.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DevData; +})(); + +/** + * State enum. + * @exports State + * @enum {number} + * @property {number} POISON_IVY=0 POISON_IVY value + * @property {number} DEHYDRATION=1 DEHYDRATION value + * @property {number} HYPOTHERMIA_START=2 HYPOTHERMIA_START value + * @property {number} HYPOTHERMIA_END=3 HYPOTHERMIA_END value + */ +export const State = $root.State = (() => { + const valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "POISON_IVY"] = 0; + values[valuesById[1] = "DEHYDRATION"] = 1; + values[valuesById[2] = "HYPOTHERMIA_START"] = 2; + values[valuesById[3] = "HYPOTHERMIA_END"] = 3; + return values; +})(); + +export const GameState = $root.GameState = (() => { + + /** + * Properties of a GameState. + * @exports IGameState + * @interface IGameState + * @property {State|null} [state] GameState state + */ + + /** + * Constructs a new GameState. + * @exports GameState + * @classdesc Represents a GameState. + * @implements IGameState + * @constructor + * @param {IGameState=} [properties] Properties to set + */ + function GameState(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GameState state. + * @member {State} state + * @memberof GameState + * @instance + */ + GameState.prototype.state = 0; + + /** + * Creates a new GameState instance using the specified properties. + * @function create + * @memberof GameState + * @static + * @param {IGameState=} [properties] Properties to set + * @returns {GameState} GameState instance + */ + GameState.create = function create(properties) { + return new GameState(properties); + }; + + /** + * Encodes the specified GameState message. Does not implicitly {@link GameState.verify|verify} messages. + * @function encode + * @memberof GameState + * @static + * @param {GameState} message GameState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GameState.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); + return writer; + }; + + /** + * Encodes the specified GameState message, length delimited. Does not implicitly {@link GameState.verify|verify} messages. + * @function encodeDelimited + * @memberof GameState + * @static + * @param {GameState} message GameState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GameState.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GameState message from the specified reader or buffer. + * @function decode + * @memberof GameState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {GameState} GameState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GameState.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.GameState(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.state = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GameState message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof GameState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {GameState} GameState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GameState.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GameState message. + * @function verify + * @memberof GameState + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GameState.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + return null; + }; + + /** + * Creates a GameState message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof GameState + * @static + * @param {Object.} object Plain object + * @returns {GameState} GameState + */ + GameState.fromObject = function fromObject(object) { + if (object instanceof $root.GameState) + return object; + let message = new $root.GameState(); + switch (object.state) { + case "POISON_IVY": + case 0: + message.state = 0; + break; + case "DEHYDRATION": + case 1: + message.state = 1; + break; + case "HYPOTHERMIA_START": + case 2: + message.state = 2; + break; + case "HYPOTHERMIA_END": + case 3: + message.state = 3; + break; + } + return message; + }; + + /** + * Creates a plain object from a GameState message. Also converts values to other types if specified. + * @function toObject + * @memberof GameState + * @static + * @param {GameState} message GameState + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GameState.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.state = options.enums === String ? "POISON_IVY" : 0; + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.State[message.state] : message.state; + return object; + }; + + /** + * Converts this GameState to JSON. + * @function toJSON + * @memberof GameState + * @instance + * @returns {Object.} JSON object + */ + GameState.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GameState; +})(); + +/** + * Source enum. + * @exports Source + * @enum {number} + * @property {number} GAMEPAD=0 GAMEPAD value + * @property {number} KEYBOARD=1 KEYBOARD value + */ +export const Source = $root.Source = (() => { + const valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "GAMEPAD"] = 0; + values[valuesById[1] = "KEYBOARD"] = 1; + return values; +})(); + +export const Input = $root.Input = (() => { + + /** + * Properties of an Input. + * @exports IInput + * @interface IInput + * @property {boolean|null} [connected] Input connected + * @property {number|Long|null} [buttons] Input buttons + * @property {Array.|null} [axes] Input axes + * @property {Source|null} [source] Input source + */ + + /** + * Constructs a new Input. + * @exports Input + * @classdesc Represents an Input. + * @implements IInput + * @constructor + * @param {IInput=} [properties] Properties to set + */ + function Input(properties) { + this.axes = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Input connected. + * @member {boolean} connected + * @memberof Input + * @instance + */ + Input.prototype.connected = false; + + /** + * Input buttons. + * @member {number|Long} buttons + * @memberof Input + * @instance + */ + Input.prototype.buttons = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Input axes. + * @member {Array.} axes + * @memberof Input + * @instance + */ + Input.prototype.axes = $util.emptyArray; + + /** + * Input source. + * @member {Source} source + * @memberof Input + * @instance + */ + Input.prototype.source = 0; + + /** + * Creates a new Input instance using the specified properties. + * @function create + * @memberof Input + * @static + * @param {IInput=} [properties] Properties to set + * @returns {Input} Input instance + */ + Input.create = function create(properties) { + return new Input(properties); + }; + + /** + * Encodes the specified Input message. Does not implicitly {@link Input.verify|verify} messages. + * @function encode + * @memberof Input + * @static + * @param {Input} message Input message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Input.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.connected != null && Object.hasOwnProperty.call(message, "connected")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.connected); + if (message.buttons != null && Object.hasOwnProperty.call(message, "buttons")) + writer.uint32(/* id 2, wireType 1 =*/17).fixed64(message.buttons); + if (message.axes != null && message.axes.length) { + writer.uint32(/* id 3, wireType 2 =*/26).fork(); + for (let i = 0; i < message.axes.length; ++i) + writer.float(message.axes[i]); + writer.ldelim(); + } + if (message.source != null && Object.hasOwnProperty.call(message, "source")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.source); + return writer; + }; + + /** + * Encodes the specified Input message, length delimited. Does not implicitly {@link Input.verify|verify} messages. + * @function encodeDelimited + * @memberof Input + * @static + * @param {Input} message Input message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Input.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Input message from the specified reader or buffer. + * @function decode + * @memberof Input + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {Input} Input + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Input.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.Input(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.connected = reader.bool(); + break; + case 2: + message.buttons = reader.fixed64(); + break; + case 3: + if (!(message.axes && message.axes.length)) + message.axes = []; + if ((tag & 7) === 2) { + let end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.axes.push(reader.float()); + } else + message.axes.push(reader.float()); + break; + case 4: + message.source = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Input message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof Input + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {Input} Input + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Input.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Input message. + * @function verify + * @memberof Input + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Input.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.connected != null && message.hasOwnProperty("connected")) + if (typeof message.connected !== "boolean") + return "connected: boolean expected"; + if (message.buttons != null && message.hasOwnProperty("buttons")) + if (!$util.isInteger(message.buttons) && !(message.buttons && $util.isInteger(message.buttons.low) && $util.isInteger(message.buttons.high))) + return "buttons: integer|Long expected"; + if (message.axes != null && message.hasOwnProperty("axes")) { + if (!Array.isArray(message.axes)) + return "axes: array expected"; + for (let i = 0; i < message.axes.length; ++i) + if (typeof message.axes[i] !== "number") + return "axes: number[] expected"; + } + if (message.source != null && message.hasOwnProperty("source")) + switch (message.source) { + default: + return "source: enum value expected"; + case 0: + case 1: + break; + } + return null; + }; + + /** + * Creates an Input message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof Input + * @static + * @param {Object.} object Plain object + * @returns {Input} Input + */ + Input.fromObject = function fromObject(object) { + if (object instanceof $root.Input) + return object; + let message = new $root.Input(); + if (object.connected != null) + message.connected = Boolean(object.connected); + if (object.buttons != null) + if ($util.Long) + (message.buttons = $util.Long.fromValue(object.buttons)).unsigned = false; + else if (typeof object.buttons === "string") + message.buttons = parseInt(object.buttons, 10); + else if (typeof object.buttons === "number") + message.buttons = object.buttons; + else if (typeof object.buttons === "object") + message.buttons = new $util.LongBits(object.buttons.low >>> 0, object.buttons.high >>> 0).toNumber(); + if (object.axes) { + if (!Array.isArray(object.axes)) + throw TypeError(".Input.axes: array expected"); + message.axes = []; + for (let i = 0; i < object.axes.length; ++i) + message.axes[i] = Number(object.axes[i]); + } + switch (object.source) { + case "GAMEPAD": + case 0: + message.source = 0; + break; + case "KEYBOARD": + case 1: + message.source = 1; + break; + } + return message; + }; + + /** + * Creates a plain object from an Input message. Also converts values to other types if specified. + * @function toObject + * @memberof Input + * @static + * @param {Input} message Input + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Input.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.axes = []; + if (options.defaults) { + object.connected = false; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.buttons = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.buttons = options.longs === String ? "0" : 0; + object.source = options.enums === String ? "GAMEPAD" : 0; + } + if (message.connected != null && message.hasOwnProperty("connected")) + object.connected = message.connected; + if (message.buttons != null && message.hasOwnProperty("buttons")) + if (typeof message.buttons === "number") + object.buttons = options.longs === String ? String(message.buttons) : message.buttons; + else + object.buttons = options.longs === String ? $util.Long.prototype.toString.call(message.buttons) : options.longs === Number ? new $util.LongBits(message.buttons.low >>> 0, message.buttons.high >>> 0).toNumber() : message.buttons; + if (message.axes && message.axes.length) { + object.axes = []; + for (let j = 0; j < message.axes.length; ++j) + object.axes[j] = options.json && !isFinite(message.axes[j]) ? String(message.axes[j]) : message.axes[j]; + } + if (message.source != null && message.hasOwnProperty("source")) + object.source = options.enums === String ? $root.Source[message.source] : message.source; + return object; + }; + + /** + * Converts this Input to JSON. + * @function toJSON + * @memberof Input + * @instance + * @returns {Object.} JSON object + */ + Input.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Input; +})(); + +export const UserInputs = $root.UserInputs = (() => { + + /** + * Properties of a UserInputs. + * @exports IUserInputs + * @interface IUserInputs + * @property {Array.|null} [inputs] UserInputs inputs + */ + + /** + * Constructs a new UserInputs. + * @exports UserInputs + * @classdesc Represents a UserInputs. + * @implements IUserInputs + * @constructor + * @param {IUserInputs=} [properties] Properties to set + */ + function UserInputs(properties) { + this.inputs = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UserInputs inputs. + * @member {Array.} inputs + * @memberof UserInputs + * @instance + */ + UserInputs.prototype.inputs = $util.emptyArray; + + /** + * Creates a new UserInputs instance using the specified properties. + * @function create + * @memberof UserInputs + * @static + * @param {IUserInputs=} [properties] Properties to set + * @returns {UserInputs} UserInputs instance + */ + UserInputs.create = function create(properties) { + return new UserInputs(properties); + }; + + /** + * Encodes the specified UserInputs message. Does not implicitly {@link UserInputs.verify|verify} messages. + * @function encode + * @memberof UserInputs + * @static + * @param {UserInputs} message UserInputs message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserInputs.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.inputs != null && message.inputs.length) + for (let i = 0; i < message.inputs.length; ++i) + $root.Input.encode(message.inputs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UserInputs message, length delimited. Does not implicitly {@link UserInputs.verify|verify} messages. + * @function encodeDelimited + * @memberof UserInputs + * @static + * @param {UserInputs} message UserInputs message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserInputs.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a UserInputs message from the specified reader or buffer. + * @function decode + * @memberof UserInputs + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {UserInputs} UserInputs + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserInputs.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.UserInputs(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.inputs && message.inputs.length)) + message.inputs = []; + message.inputs.push($root.Input.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a UserInputs message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof UserInputs + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {UserInputs} UserInputs + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserInputs.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a UserInputs message. + * @function verify + * @memberof UserInputs + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UserInputs.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.inputs != null && message.hasOwnProperty("inputs")) { + if (!Array.isArray(message.inputs)) + return "inputs: array expected"; + for (let i = 0; i < message.inputs.length; ++i) { + let error = $root.Input.verify(message.inputs[i]); + if (error) + return "inputs." + error; + } + } + return null; + }; + + /** + * Creates a UserInputs message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof UserInputs + * @static + * @param {Object.} object Plain object + * @returns {UserInputs} UserInputs + */ + UserInputs.fromObject = function fromObject(object) { + if (object instanceof $root.UserInputs) + return object; + let message = new $root.UserInputs(); + if (object.inputs) { + if (!Array.isArray(object.inputs)) + throw TypeError(".UserInputs.inputs: array expected"); + message.inputs = []; + for (let i = 0; i < object.inputs.length; ++i) { + if (typeof object.inputs[i] !== "object") + throw TypeError(".UserInputs.inputs: object expected"); + message.inputs[i] = $root.Input.fromObject(object.inputs[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a UserInputs message. Also converts values to other types if specified. + * @function toObject + * @memberof UserInputs + * @static + * @param {UserInputs} message UserInputs + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UserInputs.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.inputs = []; + if (message.inputs && message.inputs.length) { + object.inputs = []; + for (let j = 0; j < message.inputs.length; ++j) + object.inputs[j] = $root.Input.toObject(message.inputs[j], options); + } + return object; + }; + + /** + * Converts this UserInputs to JSON. + * @function toJSON + * @memberof UserInputs + * @instance + * @returns {Object.} JSON object + */ + UserInputs.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UserInputs; +})(); + +/** + * Mode enum. + * @exports Mode + * @enum {number} + * @property {number} IDLE=0 IDLE value + * @property {number} AUTO=1 AUTO value + * @property {number} TELEOP=2 TELEOP value + * @property {number} ESTOP=3 ESTOP value + */ +export const Mode = $root.Mode = (() => { + const valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "IDLE"] = 0; + values[valuesById[1] = "AUTO"] = 1; + values[valuesById[2] = "TELEOP"] = 2; + values[valuesById[3] = "ESTOP"] = 3; + return values; +})(); + +export const RunMode = $root.RunMode = (() => { + + /** + * Properties of a RunMode. + * @exports IRunMode + * @interface IRunMode + * @property {Mode|null} [mode] RunMode mode + */ + + /** + * Constructs a new RunMode. + * @exports RunMode + * @classdesc Represents a RunMode. + * @implements IRunMode + * @constructor + * @param {IRunMode=} [properties] Properties to set + */ + function RunMode(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RunMode mode. + * @member {Mode} mode + * @memberof RunMode + * @instance + */ + RunMode.prototype.mode = 0; + + /** + * Creates a new RunMode instance using the specified properties. + * @function create + * @memberof RunMode + * @static + * @param {IRunMode=} [properties] Properties to set + * @returns {RunMode} RunMode instance + */ + RunMode.create = function create(properties) { + return new RunMode(properties); + }; + + /** + * Encodes the specified RunMode message. Does not implicitly {@link RunMode.verify|verify} messages. + * @function encode + * @memberof RunMode + * @static + * @param {RunMode} message RunMode message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RunMode.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.mode != null && Object.hasOwnProperty.call(message, "mode")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.mode); + return writer; + }; + + /** + * Encodes the specified RunMode message, length delimited. Does not implicitly {@link RunMode.verify|verify} messages. + * @function encodeDelimited + * @memberof RunMode + * @static + * @param {RunMode} message RunMode message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RunMode.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RunMode message from the specified reader or buffer. + * @function decode + * @memberof RunMode + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {RunMode} RunMode + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RunMode.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.RunMode(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.mode = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RunMode message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof RunMode + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {RunMode} RunMode + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RunMode.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RunMode message. + * @function verify + * @memberof RunMode + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RunMode.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.mode != null && message.hasOwnProperty("mode")) + switch (message.mode) { + default: + return "mode: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + return null; + }; + + /** + * Creates a RunMode message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof RunMode + * @static + * @param {Object.} object Plain object + * @returns {RunMode} RunMode + */ + RunMode.fromObject = function fromObject(object) { + if (object instanceof $root.RunMode) + return object; + let message = new $root.RunMode(); + switch (object.mode) { + case "IDLE": + case 0: + message.mode = 0; + break; + case "AUTO": + case 1: + message.mode = 1; + break; + case "TELEOP": + case 2: + message.mode = 2; + break; + case "ESTOP": + case 3: + message.mode = 3; + break; + } + return message; + }; + + /** + * Creates a plain object from a RunMode message. Also converts values to other types if specified. + * @function toObject + * @memberof RunMode + * @static + * @param {RunMode} message RunMode + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RunMode.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.mode = options.enums === String ? "IDLE" : 0; + if (message.mode != null && message.hasOwnProperty("mode")) + object.mode = options.enums === String ? $root.Mode[message.mode] : message.mode; + return object; + }; + + /** + * Converts this RunMode to JSON. + * @function toJSON + * @memberof RunMode + * @instance + * @returns {Object.} JSON object + */ + RunMode.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RunMode; +})(); + +export const RuntimeStatus = $root.RuntimeStatus = (() => { + + /** + * Properties of a RuntimeStatus. + * @exports IRuntimeStatus + * @interface IRuntimeStatus + * @property {boolean|null} [shepConnected] RuntimeStatus shepConnected + * @property {boolean|null} [dawnConnected] RuntimeStatus dawnConnected + * @property {Mode|null} [mode] RuntimeStatus mode + * @property {number|null} [battery] RuntimeStatus battery + * @property {string|null} [version] RuntimeStatus version + */ + + /** + * Constructs a new RuntimeStatus. + * @exports RuntimeStatus + * @classdesc Represents a RuntimeStatus. + * @implements IRuntimeStatus + * @constructor + * @param {IRuntimeStatus=} [properties] Properties to set + */ + function RuntimeStatus(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RuntimeStatus shepConnected. + * @member {boolean} shepConnected + * @memberof RuntimeStatus + * @instance + */ + RuntimeStatus.prototype.shepConnected = false; + + /** + * RuntimeStatus dawnConnected. + * @member {boolean} dawnConnected + * @memberof RuntimeStatus + * @instance + */ + RuntimeStatus.prototype.dawnConnected = false; + + /** + * RuntimeStatus mode. + * @member {Mode} mode + * @memberof RuntimeStatus + * @instance + */ + RuntimeStatus.prototype.mode = 0; + + /** + * RuntimeStatus battery. + * @member {number} battery + * @memberof RuntimeStatus + * @instance + */ + RuntimeStatus.prototype.battery = 0; + + /** + * RuntimeStatus version. + * @member {string} version + * @memberof RuntimeStatus + * @instance + */ + RuntimeStatus.prototype.version = ""; + + /** + * Creates a new RuntimeStatus instance using the specified properties. + * @function create + * @memberof RuntimeStatus + * @static + * @param {IRuntimeStatus=} [properties] Properties to set + * @returns {RuntimeStatus} RuntimeStatus instance + */ + RuntimeStatus.create = function create(properties) { + return new RuntimeStatus(properties); + }; + + /** + * Encodes the specified RuntimeStatus message. Does not implicitly {@link RuntimeStatus.verify|verify} messages. + * @function encode + * @memberof RuntimeStatus + * @static + * @param {RuntimeStatus} message RuntimeStatus message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RuntimeStatus.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.shepConnected != null && Object.hasOwnProperty.call(message, "shepConnected")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.shepConnected); + if (message.dawnConnected != null && Object.hasOwnProperty.call(message, "dawnConnected")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.dawnConnected); + if (message.mode != null && Object.hasOwnProperty.call(message, "mode")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.mode); + if (message.battery != null && Object.hasOwnProperty.call(message, "battery")) + writer.uint32(/* id 4, wireType 5 =*/37).float(message.battery); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.version); + return writer; + }; + + /** + * Encodes the specified RuntimeStatus message, length delimited. Does not implicitly {@link RuntimeStatus.verify|verify} messages. + * @function encodeDelimited + * @memberof RuntimeStatus + * @static + * @param {RuntimeStatus} message RuntimeStatus message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RuntimeStatus.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RuntimeStatus message from the specified reader or buffer. + * @function decode + * @memberof RuntimeStatus + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {RuntimeStatus} RuntimeStatus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RuntimeStatus.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.RuntimeStatus(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.shepConnected = reader.bool(); + break; + case 2: + message.dawnConnected = reader.bool(); + break; + case 3: + message.mode = reader.int32(); + break; + case 4: + message.battery = reader.float(); + break; + case 5: + message.version = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RuntimeStatus message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof RuntimeStatus + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {RuntimeStatus} RuntimeStatus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RuntimeStatus.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RuntimeStatus message. + * @function verify + * @memberof RuntimeStatus + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RuntimeStatus.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.shepConnected != null && message.hasOwnProperty("shepConnected")) + if (typeof message.shepConnected !== "boolean") + return "shepConnected: boolean expected"; + if (message.dawnConnected != null && message.hasOwnProperty("dawnConnected")) + if (typeof message.dawnConnected !== "boolean") + return "dawnConnected: boolean expected"; + if (message.mode != null && message.hasOwnProperty("mode")) + switch (message.mode) { + default: + return "mode: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.battery != null && message.hasOwnProperty("battery")) + if (typeof message.battery !== "number") + return "battery: number expected"; + if (message.version != null && message.hasOwnProperty("version")) + if (!$util.isString(message.version)) + return "version: string expected"; + return null; + }; + + /** + * Creates a RuntimeStatus message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof RuntimeStatus + * @static + * @param {Object.} object Plain object + * @returns {RuntimeStatus} RuntimeStatus + */ + RuntimeStatus.fromObject = function fromObject(object) { + if (object instanceof $root.RuntimeStatus) + return object; + let message = new $root.RuntimeStatus(); + if (object.shepConnected != null) + message.shepConnected = Boolean(object.shepConnected); + if (object.dawnConnected != null) + message.dawnConnected = Boolean(object.dawnConnected); + switch (object.mode) { + case "IDLE": + case 0: + message.mode = 0; + break; + case "AUTO": + case 1: + message.mode = 1; + break; + case "TELEOP": + case 2: + message.mode = 2; + break; + case "ESTOP": + case 3: + message.mode = 3; + break; + } + if (object.battery != null) + message.battery = Number(object.battery); + if (object.version != null) + message.version = String(object.version); + return message; + }; + + /** + * Creates a plain object from a RuntimeStatus message. Also converts values to other types if specified. + * @function toObject + * @memberof RuntimeStatus + * @static + * @param {RuntimeStatus} message RuntimeStatus + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RuntimeStatus.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.shepConnected = false; + object.dawnConnected = false; + object.mode = options.enums === String ? "IDLE" : 0; + object.battery = 0; + object.version = ""; + } + if (message.shepConnected != null && message.hasOwnProperty("shepConnected")) + object.shepConnected = message.shepConnected; + if (message.dawnConnected != null && message.hasOwnProperty("dawnConnected")) + object.dawnConnected = message.dawnConnected; + if (message.mode != null && message.hasOwnProperty("mode")) + object.mode = options.enums === String ? $root.Mode[message.mode] : message.mode; + if (message.battery != null && message.hasOwnProperty("battery")) + object.battery = options.json && !isFinite(message.battery) ? String(message.battery) : message.battery; + if (message.version != null && message.hasOwnProperty("version")) + object.version = message.version; + return object; + }; + + /** + * Converts this RuntimeStatus to JSON. + * @function toJSON + * @memberof RuntimeStatus + * @instance + * @returns {Object.} JSON object + */ + RuntimeStatus.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RuntimeStatus; +})(); + +/** + * Pos enum. + * @exports Pos + * @enum {number} + * @property {number} LEFT=0 LEFT value + * @property {number} RIGHT=1 RIGHT value + */ +export const Pos = $root.Pos = (() => { + const valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "LEFT"] = 0; + values[valuesById[1] = "RIGHT"] = 1; + return values; +})(); + +export const StartPos = $root.StartPos = (() => { + + /** + * Properties of a StartPos. + * @exports IStartPos + * @interface IStartPos + * @property {Pos|null} [pos] StartPos pos + */ + + /** + * Constructs a new StartPos. + * @exports StartPos + * @classdesc Represents a StartPos. + * @implements IStartPos + * @constructor + * @param {IStartPos=} [properties] Properties to set + */ + function StartPos(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * StartPos pos. + * @member {Pos} pos + * @memberof StartPos + * @instance + */ + StartPos.prototype.pos = 0; + + /** + * Creates a new StartPos instance using the specified properties. + * @function create + * @memberof StartPos + * @static + * @param {IStartPos=} [properties] Properties to set + * @returns {StartPos} StartPos instance + */ + StartPos.create = function create(properties) { + return new StartPos(properties); + }; + + /** + * Encodes the specified StartPos message. Does not implicitly {@link StartPos.verify|verify} messages. + * @function encode + * @memberof StartPos + * @static + * @param {StartPos} message StartPos message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StartPos.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pos != null && Object.hasOwnProperty.call(message, "pos")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.pos); + return writer; + }; + + /** + * Encodes the specified StartPos message, length delimited. Does not implicitly {@link StartPos.verify|verify} messages. + * @function encodeDelimited + * @memberof StartPos + * @static + * @param {StartPos} message StartPos message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StartPos.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a StartPos message from the specified reader or buffer. + * @function decode + * @memberof StartPos + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {StartPos} StartPos + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StartPos.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.StartPos(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pos = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a StartPos message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof StartPos + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {StartPos} StartPos + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StartPos.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StartPos message. + * @function verify + * @memberof StartPos + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StartPos.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.pos != null && message.hasOwnProperty("pos")) + switch (message.pos) { + default: + return "pos: enum value expected"; + case 0: + case 1: + break; + } + return null; + }; + + /** + * Creates a StartPos message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof StartPos + * @static + * @param {Object.} object Plain object + * @returns {StartPos} StartPos + */ + StartPos.fromObject = function fromObject(object) { + if (object instanceof $root.StartPos) + return object; + let message = new $root.StartPos(); + switch (object.pos) { + case "LEFT": + case 0: + message.pos = 0; + break; + case "RIGHT": + case 1: + message.pos = 1; + break; + } + return message; + }; + + /** + * Creates a plain object from a StartPos message. Also converts values to other types if specified. + * @function toObject + * @memberof StartPos + * @static + * @param {StartPos} message StartPos + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StartPos.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.pos = options.enums === String ? "LEFT" : 0; + if (message.pos != null && message.hasOwnProperty("pos")) + object.pos = options.enums === String ? $root.Pos[message.pos] : message.pos; + return object; + }; + + /** + * Converts this StartPos to JSON. + * @function toJSON + * @memberof StartPos + * @instance + * @returns {Object.} JSON object + */ + StartPos.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return StartPos; +})(); + +export const Text = $root.Text = (() => { + + /** + * Properties of a Text. + * @exports IText + * @interface IText + * @property {Array.|null} [payload] Text payload + */ + + /** + * Constructs a new Text. + * @exports Text + * @classdesc Represents a Text. + * @implements IText + * @constructor + * @param {IText=} [properties] Properties to set + */ + function Text(properties) { + this.payload = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Text payload. + * @member {Array.} payload + * @memberof Text + * @instance + */ + Text.prototype.payload = $util.emptyArray; + + /** + * Creates a new Text instance using the specified properties. + * @function create + * @memberof Text + * @static + * @param {IText=} [properties] Properties to set + * @returns {Text} Text instance + */ + Text.create = function create(properties) { + return new Text(properties); + }; + + /** + * Encodes the specified Text message. Does not implicitly {@link Text.verify|verify} messages. + * @function encode + * @memberof Text + * @static + * @param {Text} message Text message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Text.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.payload != null && message.payload.length) + for (let i = 0; i < message.payload.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.payload[i]); + return writer; + }; + + /** + * Encodes the specified Text message, length delimited. Does not implicitly {@link Text.verify|verify} messages. + * @function encodeDelimited + * @memberof Text + * @static + * @param {Text} message Text message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Text.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Text message from the specified reader or buffer. + * @function decode + * @memberof Text + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {Text} Text + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Text.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.Text(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.payload && message.payload.length)) + message.payload = []; + message.payload.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Text message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof Text + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {Text} Text + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Text.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Text message. + * @function verify + * @memberof Text + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Text.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.payload != null && message.hasOwnProperty("payload")) { + if (!Array.isArray(message.payload)) + return "payload: array expected"; + for (let i = 0; i < message.payload.length; ++i) + if (!$util.isString(message.payload[i])) + return "payload: string[] expected"; + } + return null; + }; + + /** + * Creates a Text message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof Text + * @static + * @param {Object.} object Plain object + * @returns {Text} Text + */ + Text.fromObject = function fromObject(object) { + if (object instanceof $root.Text) + return object; + let message = new $root.Text(); + if (object.payload) { + if (!Array.isArray(object.payload)) + throw TypeError(".Text.payload: array expected"); + message.payload = []; + for (let i = 0; i < object.payload.length; ++i) + message.payload[i] = String(object.payload[i]); + } + return message; + }; + + /** + * Creates a plain object from a Text message. Also converts values to other types if specified. + * @function toObject + * @memberof Text + * @static + * @param {Text} message Text + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Text.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.payload = []; + if (message.payload && message.payload.length) { + object.payload = []; + for (let j = 0; j < message.payload.length; ++j) + object.payload[j] = message.payload[j]; + } + return object; + }; + + /** + * Converts this Text to JSON. + * @function toJSON + * @memberof Text + * @instance + * @returns {Object.} JSON object + */ + Text.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Text; +})(); + +export const TimeStamps = $root.TimeStamps = (() => { + + /** + * Properties of a TimeStamps. + * @exports ITimeStamps + * @interface ITimeStamps + * @property {number|Long|null} [dawnTimestamp] TimeStamps dawnTimestamp + * @property {number|Long|null} [runtimeTimestamp] TimeStamps runtimeTimestamp + */ + + /** + * Constructs a new TimeStamps. + * @exports TimeStamps + * @classdesc Represents a TimeStamps. + * @implements ITimeStamps + * @constructor + * @param {ITimeStamps=} [properties] Properties to set + */ + function TimeStamps(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TimeStamps dawnTimestamp. + * @member {number|Long} dawnTimestamp + * @memberof TimeStamps + * @instance + */ + TimeStamps.prototype.dawnTimestamp = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * TimeStamps runtimeTimestamp. + * @member {number|Long} runtimeTimestamp + * @memberof TimeStamps + * @instance + */ + TimeStamps.prototype.runtimeTimestamp = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new TimeStamps instance using the specified properties. + * @function create + * @memberof TimeStamps + * @static + * @param {ITimeStamps=} [properties] Properties to set + * @returns {TimeStamps} TimeStamps instance + */ + TimeStamps.create = function create(properties) { + return new TimeStamps(properties); + }; + + /** + * Encodes the specified TimeStamps message. Does not implicitly {@link TimeStamps.verify|verify} messages. + * @function encode + * @memberof TimeStamps + * @static + * @param {TimeStamps} message TimeStamps message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TimeStamps.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.dawnTimestamp != null && Object.hasOwnProperty.call(message, "dawnTimestamp")) + writer.uint32(/* id 1, wireType 1 =*/9).fixed64(message.dawnTimestamp); + if (message.runtimeTimestamp != null && Object.hasOwnProperty.call(message, "runtimeTimestamp")) + writer.uint32(/* id 2, wireType 1 =*/17).fixed64(message.runtimeTimestamp); + return writer; + }; + + /** + * Encodes the specified TimeStamps message, length delimited. Does not implicitly {@link TimeStamps.verify|verify} messages. + * @function encodeDelimited + * @memberof TimeStamps + * @static + * @param {TimeStamps} message TimeStamps message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TimeStamps.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TimeStamps message from the specified reader or buffer. + * @function decode + * @memberof TimeStamps + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {TimeStamps} TimeStamps + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TimeStamps.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.TimeStamps(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.dawnTimestamp = reader.fixed64(); + break; + case 2: + message.runtimeTimestamp = reader.fixed64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TimeStamps message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof TimeStamps + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {TimeStamps} TimeStamps + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TimeStamps.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TimeStamps message. + * @function verify + * @memberof TimeStamps + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TimeStamps.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.dawnTimestamp != null && message.hasOwnProperty("dawnTimestamp")) + if (!$util.isInteger(message.dawnTimestamp) && !(message.dawnTimestamp && $util.isInteger(message.dawnTimestamp.low) && $util.isInteger(message.dawnTimestamp.high))) + return "dawnTimestamp: integer|Long expected"; + if (message.runtimeTimestamp != null && message.hasOwnProperty("runtimeTimestamp")) + if (!$util.isInteger(message.runtimeTimestamp) && !(message.runtimeTimestamp && $util.isInteger(message.runtimeTimestamp.low) && $util.isInteger(message.runtimeTimestamp.high))) + return "runtimeTimestamp: integer|Long expected"; + return null; + }; + + /** + * Creates a TimeStamps message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof TimeStamps + * @static + * @param {Object.} object Plain object + * @returns {TimeStamps} TimeStamps + */ + TimeStamps.fromObject = function fromObject(object) { + if (object instanceof $root.TimeStamps) + return object; + let message = new $root.TimeStamps(); + if (object.dawnTimestamp != null) + if ($util.Long) + (message.dawnTimestamp = $util.Long.fromValue(object.dawnTimestamp)).unsigned = false; + else if (typeof object.dawnTimestamp === "string") + message.dawnTimestamp = parseInt(object.dawnTimestamp, 10); + else if (typeof object.dawnTimestamp === "number") + message.dawnTimestamp = object.dawnTimestamp; + else if (typeof object.dawnTimestamp === "object") + message.dawnTimestamp = new $util.LongBits(object.dawnTimestamp.low >>> 0, object.dawnTimestamp.high >>> 0).toNumber(); + if (object.runtimeTimestamp != null) + if ($util.Long) + (message.runtimeTimestamp = $util.Long.fromValue(object.runtimeTimestamp)).unsigned = false; + else if (typeof object.runtimeTimestamp === "string") + message.runtimeTimestamp = parseInt(object.runtimeTimestamp, 10); + else if (typeof object.runtimeTimestamp === "number") + message.runtimeTimestamp = object.runtimeTimestamp; + else if (typeof object.runtimeTimestamp === "object") + message.runtimeTimestamp = new $util.LongBits(object.runtimeTimestamp.low >>> 0, object.runtimeTimestamp.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a TimeStamps message. Also converts values to other types if specified. + * @function toObject + * @memberof TimeStamps + * @static + * @param {TimeStamps} message TimeStamps + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TimeStamps.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.dawnTimestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.dawnTimestamp = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.runtimeTimestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.runtimeTimestamp = options.longs === String ? "0" : 0; + } + if (message.dawnTimestamp != null && message.hasOwnProperty("dawnTimestamp")) + if (typeof message.dawnTimestamp === "number") + object.dawnTimestamp = options.longs === String ? String(message.dawnTimestamp) : message.dawnTimestamp; + else + object.dawnTimestamp = options.longs === String ? $util.Long.prototype.toString.call(message.dawnTimestamp) : options.longs === Number ? new $util.LongBits(message.dawnTimestamp.low >>> 0, message.dawnTimestamp.high >>> 0).toNumber() : message.dawnTimestamp; + if (message.runtimeTimestamp != null && message.hasOwnProperty("runtimeTimestamp")) + if (typeof message.runtimeTimestamp === "number") + object.runtimeTimestamp = options.longs === String ? String(message.runtimeTimestamp) : message.runtimeTimestamp; + else + object.runtimeTimestamp = options.longs === String ? $util.Long.prototype.toString.call(message.runtimeTimestamp) : options.longs === Number ? new $util.LongBits(message.runtimeTimestamp.low >>> 0, message.runtimeTimestamp.high >>> 0).toNumber() : message.runtimeTimestamp; + return object; + }; + + /** + * Converts this TimeStamps to JSON. + * @function toJSON + * @memberof TimeStamps + * @instance + * @returns {Object.} JSON object + */ + TimeStamps.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TimeStamps; +})(); + +export { $root as default }; diff --git a/src/static/video-feed/sandstorm.png b/src/static/video-feed/sandstorm.png new file mode 100644 index 0000000..3f41a72 Binary files /dev/null and b/src/static/video-feed/sandstorm.png differ diff --git a/src/static/video-feed/scoreboard.css b/src/static/video-feed/scoreboard.css new file mode 100644 index 0000000..54065e8 --- /dev/null +++ b/src/static/video-feed/scoreboard.css @@ -0,0 +1,108 @@ +body { + background-size: cover; + height: 100vh; + width: 100%; + background-color: transparent; +} + +p { + padding-left: 5px; +} + +.scoreboard-outer-container { + position: absolute; + top: 0; + right: 0; + width: 60%; + height: 100%; +} + +.scoreboard-container { + display: flex; + justify-content: space-evenly; + align-items: stretch; + flex-direction: row; + padding: 10px; + height: 200px; +} + +.total-container { + display: flex; + justify-content: space-evenly; + align-items: stretch; + flex-direction: row; + padding: 10px; + height: 250px; +} + +#stagename-container { + height: calc(10vh); +} + +.robotinfo, .time, .penalty, .stamps { + margin: 20px; + border: solid black; + background-color: white; + border-radius: 25px; + text-align: center; + font-family: "Comic Sans MS", "Comic Sans", cursive; + font-size: 2.4vw; + justify-content: center; + align-content: center; + display: flex; + flex-direction: column; +} + +.totalinfo { + margin: 15px; + border: solid black; + background-color: white; + border-radius: 25px; + text-align: center; + font-family: "Comic Sans MS", "Comic Sans", cursive; + width: calc(40vh); + visibility: visible; + font-size: 200%; + justify-content: center; + align-content: center; + display: flex; + flex-direction: column; +} + +#total { + visibility: visible; + font-size: 200% +} + +.stagename { + height: calc(10vh); + width: calc(45vh) +} + +.time, .penalty, .stamps { + flex-direction: column; + vertical-align: top; + flex-grow: 1; + flex-wrap: wrap; +} + +.robotinfo { + flex-grow: 2; +} + +.time { + color: black; +} + +.penalty { + color: red; +} + +.stamps { + color: green; +} + +mark.black { + color: black; + background: none; +} diff --git a/src/static/video-feed/scoreboard.html b/src/static/video-feed/scoreboard.html new file mode 100644 index 0000000..ef3a1aa --- /dev/null +++ b/src/static/video-feed/scoreboard.html @@ -0,0 +1,53 @@ + + + + + + + +
+
+ + +
+ Team 123 +
Bo Gears Elem.
+
+ +
+
Time
+
0:00
+
+ +
+
Penalty
+
+ 0:00
+
+ +
+
Stamps
+
- 0:00
+
+
+ +
+
+
Total Score
+
0
+
+
+
+ + + + diff --git a/src/static/video-feed/video-feed.css b/src/static/video-feed/video-feed.css new file mode 100644 index 0000000..cf69493 --- /dev/null +++ b/src/static/video-feed/video-feed.css @@ -0,0 +1,30 @@ +.video-feed-container { + position: relative; + height: 100%; + overflow: hidden; + width: 100%; + z-index: -1; +} + +#overhead-video-feed { + width: 30%; + height: 30%; + position: absolute; + top: 0; + left: 0; +} + +#shepherd-overlay { + position: absolute; + top: 0; + width: 100%; + height: 100%; +} + +#footer { + display: flex; + padding: 8px; + position: absolute; + bottom: 0; + right: 0; +} diff --git a/src/static/video-feed/video.html b/src/static/video-feed/video.html new file mode 100644 index 0000000..36c0a6c --- /dev/null +++ b/src/static/video-feed/video.html @@ -0,0 +1,17 @@ + + + + + + + + + Video Feed + + +
+ + + diff --git a/src/utils/index.ts b/src/utils/index.ts new file mode 100644 index 0000000..a1332e9 --- /dev/null +++ b/src/utils/index.ts @@ -0,0 +1 @@ +export { Logger } from './logger'; diff --git a/src/utils/logger.ts b/src/utils/logger.ts new file mode 100644 index 0000000..f5823c7 --- /dev/null +++ b/src/utils/logger.ts @@ -0,0 +1,11 @@ +export class Logger { + loggerName: string; + + constructor(loggerName: string) { + this.loggerName = loggerName; + } + + log = (message?: any, ...optionalParams: any[]) => { + console.log(`${this.loggerName}: ${message}`, ...optionalParams); + } +} \ No newline at end of file diff --git a/src/video-feed/Scoreboard.js b/src/video-feed/Scoreboard.js new file mode 100644 index 0000000..9d50b6b --- /dev/null +++ b/src/video-feed/Scoreboard.js @@ -0,0 +1,314 @@ +const io = require('socket.io-client'); +const { ipcRenderer } = require('electron'); +const $ = require('jquery'); +var socket = io('/'); +console.log('socket', socket); +addSocketCallbacks(socket); + +ipcRenderer.on('shepherdScoreboardServerIpAddress', (e, ipAddress) => { + socket.disconnect(); + socket = io.connect(`${ipAddress}`); + console.log('new socket', socket); + addSocketCallbacks(socket); +}) + +function addSocketCallbacks(socket) { + socket.on('connect', (data) => { + console.log('connected to scoreboard server'); + socket.emit('join', 'scoreboard'); + }); + + socket.on('team', (match_info) => { + console.log(`received team header with info ${match_info}`); + match_info = JSON.parse(match_info) + const team_name = match_info.team_name + const team_num = match_info.team_num + updateTeam(team_name, team_num) + setImageVisible('#total', false); + setImageVisible('.totalinfo', false); + }) + + socket.on('stage_timer_start', (secondsInStage) => { + const time = JSON.parse(secondsInStage).time + stageTimerStart(time) + }) + + // STAGE{stage, start_time} + socket.on('stage', (stage_details) => { + const stage = JSON.parse(stage_details).stage + const start_time = JSON.parse(stage_details).start_time + console.log("got stage header") + console.log(stage_details) + if (stage === "setup") { + setTime(0); + setStamp(0); + setPenalty(0); + } else if (stage === "end") { + stageTimer = false; + } else { + setStageName(stage); + setStartTime(start_time); + } + }) + + socket.on("reset_timers", () => { + resetTimers(); + }) + + + // SCORES{time, penalty, stamp_time, score, start_time} + socket.on("score", (scores) => { + console.log("receiving score"); + scores = JSON.parse(scores); + console.log(`scores are ${JSON.stringify(scores)}`); + const { time, penalty, stamp_time } = scores; + + console.log("THIS SHOULD PRINT") + console.log(time) + if (time) { + console.log("Setting time") + setTime(time); + setTotal(time + stamp_time + penalty) + } + setStamp(stamp_time); + setPenalty(penalty); + console.log(time) + // if (time) { + // console.log("Setting total") + // setTotal(time - stamp_time + penalty) + // } + }) + + socket.on("sandstorm", (sandstorm) => { + const on = JSON.parse(sandstorm).on; + if (on) { + console.log("Setting sandstorm"); + setSandstorm(); + } else { + console.log("Removing sandstorm"); + removeSandstorm(); + } + }) +} + +var stageTimer = true; +var timerA = true; +var globaltime = 0; +var startTime = 0; + +function setSandstorm() { + $('body').css('background-image', 'url(../../static/video-feed/sandstorm.png)'); +} + +function removeSandstorm() { + $('body').css('background-image', 'url()'); +} + +function setTime(time) { + stageTimer = false; + globaltime = time; + $('#stage-timer').html(secondsToTimeString(time)); +} + +function setStamp(stamp_time) { + $('#stamp_time').html("-" + secondsToTimeString(-1 * stamp_time)); +} + +function setPenalty(penalty) { + $('#penalty').html("+" + secondsToTimeString(penalty)); +} + +function setTotal(total) { + // Hypothetically make it visible here + console.log("Inside setTotal") + $('#total').html(secondsToTimeString(total)); + setImageVisible('#total', true); + setImageVisible('.totalinfo', true); +} + +function testScore(score) { + $('#score').html(score); +} + +function resetTimers() { + stageTimer = false; + timerA = false; +} + +const SETUP = "setup" +const AUTO_WAIT = "auto_wait" +const AUTO = "auto" +const WAIT = "wait" +const TELEOP = "teleop" +const END = "end" + +const stage_names = { + "setup": "Setup", + "auto_wait": "Autonomous Wait", "auto": "Autonomous Period", + "teleop": "Teleop Period", "end": "Post-Match" +} + +function setStageName(stage) { + $('#stage').html(stage_names[stage]) +} + +function updateTeam(team_name, team_num) { + //set the name and numbers of the school and the match number jk + $('#team-name').html(team_name) + $('#team-num').html("Team " + team_num) +} + +function stageTimerStart(startTime) { + stageTimer = true; + runStageTimer(startTime); +} + +function runStageTimer(startTime) { + console.log("stage timer is ", stageTimer); + if (stageTimer) { + const currTime = new Date().getTime() / 1000; + console.log(currTime); + console.log(startTime); + let time = (currTime - startTime); + $('#stage-timer').html(secondsToTimeString(time)); + setTimeout(runStageTimer, 200, startTime); + } else { + // supposedly do nothing + return + } +} + +function pad(number) { + return (number < 10 ? '0' : '') + number +} + +function secondsToTimeString(seconds) { + if (seconds < 0) { + const time = Math.floor(-1 * seconds * 100) / 100; + return "-" + Math.floor(time / 60) + ":" + pad(Math.floor(time % 60)); + } else { + const time = Math.floor(seconds * 100) / 100; + return Math.floor(time / 60) + ":" + pad(Math.floor(time % 60)); + } +} + +function setImageVisible(id, visible) { + console.log("Set visible/invisible") + $(id).css("visibility", (visible ? 'visible' : 'hidden')); +} + +function progress(timeleft, timetotal, $element) { + var progressBarWidth = timeleft * $element.width() / timetotal; + if (timeleft == timetotal) { + $element.find('div').animate({ width: progressBarWidth }, 0, 'linear').html(Math.floor(timeleft / 60) + ":" + pad(timeleft % 60)); + } else { + $element.find('div').animate({ width: progressBarWidth }, 1000, 'linear').html(Math.floor(timeleft / 60) + ":" + pad(timeleft % 60)); + } + if (timeleft > 0) { + setTimeout(function () { + if (overTimer) { + progress(timeleft - 1, timetotal, $element); + } else { + progress(0, 0, $element) + } + }, 1000); + } else { + $element.find('div').animate({ width: 0 }, 1000, 'linear').html("") + $('#overdriveText').css('color', 'white'); + // $('#overdriveText').html("OVERDRIVE!!! " + block + " size!!!"); + } +}; + +var a = 0 + , pi = Math.PI + , t = 30 + +var counter = t; + +console.log($("textbox").text() + "x") +console.log(t) + +function draw() { + // a should depend on the amount of time left + a++; + a %= 360; + var r = (a * pi / 180) + , x = Math.sin(r) * 15000 + , y = Math.cos(r) * - 15000 + , mid = (a > 180) ? 1 : 0 + , anim = + 'M 0 0 v -15000 A 15000 15000 1 ' + + mid + ' 1 ' + + x + ' ' + + y + ' z'; + //[x,y].forEach(function( d ){ + // d = Math.round( d * 1e3 ) / 1e3; + //}); + $("#loader").attr('d', anim); + console.log(counter); + + // time left should be calculated using a timer that runs separately + if (a % (360 / t) == 0) { + counter -= 1; + if (counter <= 9) { + $("#textbox").css("left = '85px';") + } + $("#textbox").html(counter); + } + if (a == 0) { + return; + } + setTimeout(draw, 20); // Redraw +}; + +function runTimer1() { + timerA = true; + console.log("timerA set to true") + console.log(timerA) + //setTimeout(timer1, 0) + launchButtonTimer('.timer1', '.circle_animation1', timerA); +} + +function timer1() { + /* how long the timer will run (seconds) */ + + var time = 30; + var initialOffset = '440'; + var i = 1; + + /* Need initial run as interval hasn't yet occured... */ + $('.circle_animation1').css('stroke-dashoffset', initialOffset - (1 * (initialOffset / time))); + + var interval = setInterval(function () { + $('.timer1').text(time - i); + if (i == time || !timerA) { + clearInterval(interval); + $('.timer1').text(30); + $('.circle_animation1').css('stroke-dashoffset', '0') + return; + } + $('.circle_animation1').css('stroke-dashoffset', initialOffset - ((i + 1) * (initialOffset / time))); + i++; + }, 1000); + +} + +function setStartTime(start_time) { + // A function that takes in the starting time of the stage as sent by Shepherd. We calculate + // the difference between the current time and the sent timestamp, and set the starting time + // to be the amount of time given in the round minus the offset. + // + // Args: + // start_time = timestamp sent by Shepherd of when the stage began in seconds + start_time = start_time / 1000; // seconds + + stageTimerStart(start_time); +} + + +/* FOR TESTING: */ +// var jq = document.createElement('script'); +// jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"; +// document.getElementsByTagName('head')[0].appendChild(jq); +// // ... give time for script to load, then type (or see below for non wait option) +// jQuery.noConflict(); \ No newline at end of file diff --git a/src/video-feed/ShepherdOverlay.tsx b/src/video-feed/ShepherdOverlay.tsx new file mode 100644 index 0000000..cb48338 --- /dev/null +++ b/src/video-feed/ShepherdOverlay.tsx @@ -0,0 +1,11 @@ +import parse from 'html-react-parser'; +import './scoreboard'; +import '../../../static/video-feed/scoreboard.css'; + +const shepherdScoreHtml = require('../../../static/video-feed/scoreboard.html'); + +export const ShepherdOverlay = () => { + return ( + parse(shepherdScoreHtml) + ); +}; diff --git a/src/video-feed/VideoFeed.tsx b/src/video-feed/VideoFeed.tsx new file mode 100644 index 0000000..c089dab --- /dev/null +++ b/src/video-feed/VideoFeed.tsx @@ -0,0 +1,151 @@ +import React, { useEffect, useRef, useState } from 'react'; +import { Button } from 'react-bootstrap'; +import OvenPlayer from 'ovenplayer'; +import { keyboardButtons } from '../keyboard-buttons'; +import * as protos from '../../protos/protos'; + +import '../static/video-feed/video-feed.css'; +import { ShepherdOverlay } from './ShepherdOverlay'; + +type Props = { + webSocket: WebSocket +} + +export const VideoFeed = (props: Props) => { + const [isKeyboardModeToggled, setIsKeyboardModeToggled] = useState(false); + const {webSocket} = props; + const [keyboardBitmap, setKeyboardBitmap] = useState(0); + const keyboardBitmapRef = useRef(0); + keyboardBitmapRef.current = keyboardBitmap; + + useEffect(() => { + const driverVideoFeed = OvenPlayer.create('driver-video-feed', { + sources: [ + { + type: 'webRTC', + file: 'ws://64.227.109.107:3333/driver/stream', + label: '720p' + } + ], + autoStart: true, + controls: false + }); + + const overheadVideoFeed = OvenPlayer.create('overhead-video-feed', { + sources: [ + { + type: 'webRTC', + file: 'ws://64.227.109.107:3333/overhead/stream', + label: '720p' + } + ], + autoStart: true, + controls: false + }); + + overheadVideoFeed.on('error', (error: any) => { + console.log(error); + }); + + driverVideoFeed.on('error', (error: any) => { + console.log(error); + }); + }, []); + + useEffect(() => { + const keyboardConnectionStatus = new protos.Input({ + connected: isKeyboardModeToggled, + axes: [], + buttons: 0, + source: protos.Source.KEYBOARD + }) + webSocket.send(protos.UserInputs.encode({ inputs: keyboardConnectionStatus }).finish()); +// ipcRenderer.send('stateUpdate', [keyboardConnectionStatus], Source.KEYBOARD); + }, [isKeyboardModeToggled, webSocket]); + + const sendKeyboardInputsToRuntime = (keyboardBitmap_: number) => { + const keyboard = new protos.Input({ + connected: true, + axes: [], + buttons: keyboardBitmap_, + source: protos.Source.KEYBOARD + }); + webSocket.send(protos.UserInputs.encode({ inputs: keyboard }).finish()); + }; + + const bitShiftLeft = (value: number, numPositions: number) => { + return value * Math.pow(2, numPositions); + }; + + // toggle keyboard control and add/remove listening for key presses to control robot + const toggleKeyboardControl = () => { + if (!isKeyboardModeToggled) { + // We need passive true so that we are able to remove the event listener when we are not in Keyboard Control mode + window.addEventListener('keydown', turnCharacterOn, { passive: true }); + window.addEventListener('keyup', turnCharacterOff, { passive: true }); + } else { + window.removeEventListener('keydown', turnCharacterOn); + window.removeEventListener('keyup', turnCharacterOff); + setKeyboardBitmap(0); + } + + setIsKeyboardModeToggled(!isKeyboardModeToggled); + }; + + const updateKeyboardBitmap = (currentCharacter: string, isKeyPressed: boolean) => { + const keyboardNum = keyboardButtons[currentCharacter]; + let newKeyboardBitmap: number = keyboardBitmapRef.current; + + const shift = bitShiftLeft(1, keyboardNum); + const MAX_INT32_BITS = 2147483648; // 2^31 + + const shiftHighBits = shift / MAX_INT32_BITS; + const shiftLowBits = shift % MAX_INT32_BITS; + const mapHighBits = newKeyboardBitmap / MAX_INT32_BITS; + const mapLowBits = newKeyboardBitmap % MAX_INT32_BITS; + + if (!isKeyPressed) { + newKeyboardBitmap = (~shiftHighBits & mapHighBits) * MAX_INT32_BITS + (~shiftLowBits & mapLowBits); + } else if (isKeyPressed) { + newKeyboardBitmap = (shiftHighBits | mapHighBits) * MAX_INT32_BITS + (shiftLowBits | mapLowBits); + } + setKeyboardBitmap(newKeyboardBitmap); + sendKeyboardInputsToRuntime(newKeyboardBitmap); + }; + + const turnCharacterOff = (e: KeyboardEvent) => { + updateKeyboardBitmap(e.key, false); + }; + + const turnCharacterOn = (e: KeyboardEvent) => { + // Handle special ctrl + q edge case + if (e.ctrlKey && e.key === 'q') { + setIsKeyboardModeToggled(false); + } else { + updateKeyboardBitmap(e.key, true); + } + }; + + return ( + <> +
+
+
+
+ +
{ShepherdOverlay()}
+ + + + ); +}; \ No newline at end of file diff --git a/src/video-feed/index.tsx b/src/video-feed/index.tsx new file mode 100644 index 0000000..e35b509 --- /dev/null +++ b/src/video-feed/index.tsx @@ -0,0 +1,5 @@ +import React from 'react'; +import ReactDOM from 'react-dom'; +import { VideoFeed } from './VideoFeed'; + +ReactDOM.render(, document.getElementById('video-feed-window')); diff --git a/tsconfig.json b/tsconfig.json index a273b0c..d0ca0f9 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -22,5 +22,8 @@ }, "include": [ "src" + ], + "exclude": [ + "src/video-feed/**" ] } diff --git a/yarn.lock b/yarn.lock index aac3c2b..24974af 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1448,6 +1448,59 @@ schema-utils "^2.6.5" source-map "^0.7.3" +"@protobufjs/aspromise@^1.1.1", "@protobufjs/aspromise@^1.1.2": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@protobufjs/aspromise/-/aspromise-1.1.2.tgz#9b8b0cc663d669a7d8f6f5d0893a14d348f30fbf" + integrity sha1-m4sMxmPWaafY9vXQiToU00jzD78= + +"@protobufjs/base64@^1.1.2": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@protobufjs/base64/-/base64-1.1.2.tgz#4c85730e59b9a1f1f349047dbf24296034bb2735" + integrity sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg== + +"@protobufjs/codegen@^2.0.4": + version "2.0.4" + resolved "https://registry.yarnpkg.com/@protobufjs/codegen/-/codegen-2.0.4.tgz#7ef37f0d010fb028ad1ad59722e506d9262815cb" + integrity sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg== + +"@protobufjs/eventemitter@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz#355cbc98bafad5978f9ed095f397621f1d066b70" + integrity sha1-NVy8mLr61ZePntCV85diHx0Ga3A= + +"@protobufjs/fetch@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@protobufjs/fetch/-/fetch-1.1.0.tgz#ba99fb598614af65700c1619ff06d454b0d84c45" + integrity sha1-upn7WYYUr2VwDBYZ/wbUVLDYTEU= + dependencies: + "@protobufjs/aspromise" "^1.1.1" + "@protobufjs/inquire" "^1.1.0" + +"@protobufjs/float@^1.0.2": + version "1.0.2" + resolved "https://registry.yarnpkg.com/@protobufjs/float/-/float-1.0.2.tgz#5e9e1abdcb73fc0a7cb8b291df78c8cbd97b87d1" + integrity sha1-Xp4avctz/Ap8uLKR33jIy9l7h9E= + +"@protobufjs/inquire@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@protobufjs/inquire/-/inquire-1.1.0.tgz#ff200e3e7cf2429e2dcafc1140828e8cc638f089" + integrity sha1-/yAOPnzyQp4tyvwRQIKOjMY48Ik= + +"@protobufjs/path@^1.1.2": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@protobufjs/path/-/path-1.1.2.tgz#6cc2b20c5c9ad6ad0dccfd21ca7673d8d7fbf68d" + integrity sha1-bMKyDFya1q0NzP0hynZz2Nf79o0= + +"@protobufjs/pool@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@protobufjs/pool/-/pool-1.1.0.tgz#09fd15f2d6d3abfa9b65bc366506d6ad7846ff54" + integrity sha1-Cf0V8tbTq/qbZbw2ZQbWrXhG/1Q= + +"@protobufjs/utf8@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@protobufjs/utf8/-/utf8-1.1.0.tgz#a777360b5b39a1a2e5106f8e858f2fd2d060c570" + integrity sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA= + "@rollup/plugin-node-resolve@^7.1.1": version "7.1.3" resolved "https://registry.yarnpkg.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-7.1.3.tgz#80de384edfbd7bfc9101164910f86078151a3eca" @@ -1771,6 +1824,11 @@ resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4= +"@types/long@^4.0.1": + version "4.0.1" + resolved "https://registry.yarnpkg.com/@types/long/-/long-4.0.1.tgz#459c65fa1867dafe6a8f322c4c51695663cc55e9" + integrity sha512-5tXH6Bx/kNGd3MgffdmP4dy2Z+G4eaXw0SE81Tq3BNadtnMR5/ySMzX4SLEzHJzSmPNn4HIdpQsBvXMUykr58w== + "@types/minimatch@*": version "3.0.3" resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d" @@ -1781,6 +1839,11 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.31.tgz#72286bd33d137aa0d152d47ec7c1762563d34055" integrity sha512-vFHy/ezP5qI0rFgJ7aQnjDXwAMrG0KqqIH7tQG5PPv3BWBayOPIQNBjVc/P6hhdZfMx51REc6tfDNXHUio893g== +"@types/node@>=13.7.0": + version "16.9.1" + resolved "https://registry.yarnpkg.com/@types/node/-/node-16.9.1.tgz#0611b37db4246c937feef529ddcc018cf8e35708" + integrity sha512-QpLcX9ZSsq3YYUUnD3nFDY8H7wctAhQj/TFKL8Ya8v5fMm3CFXxo8zStsLAl780ltoYoo1WvKUVGBQK+1ifr7g== + "@types/node@^12.0.0": version "12.20.24" resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.24.tgz#c37ac69cb2948afb4cef95f424fa0037971a9a5c" @@ -2730,7 +2793,7 @@ balanced-match@^1.0.0: resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= -base64-js@^1.0.2: +base64-js@^1.0.2, base64-js@^1.3.1: version "1.5.1" resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== @@ -2994,6 +3057,14 @@ buffer@^4.3.0: ieee754 "^1.1.4" isarray "^1.0.0" +buffer@^6.0.3: + version "6.0.3" + resolved "https://registry.yarnpkg.com/buffer/-/buffer-6.0.3.tgz#2ace578459cc8fbe2a70aaa8f52ee63b6a74c6c6" + integrity sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA== + dependencies: + base64-js "^1.3.1" + ieee754 "^1.2.1" + builtin-modules@^3.1.0: version "3.2.0" resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.2.0.tgz#45d5db99e7ee5e6bc4f362e008bf917ab5049887" @@ -5669,7 +5740,7 @@ identity-obj-proxy@3.0.0: dependencies: harmony-reflect "^1.4.6" -ieee754@^1.1.4: +ieee754@^1.1.4, ieee754@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== @@ -7007,6 +7078,11 @@ loglevel@^1.6.8: resolved "https://registry.yarnpkg.com/loglevel/-/loglevel-1.7.1.tgz#005fde2f5e6e47068f935ff28573e125ef72f197" integrity sha512-Hesni4s5UkWkwCGJMQGAh71PaLUmKFM60dHvq0zi/vDhhrzuk+4GgNbTXJ12YYQJn6ZKBDNIjYcuQGKudvqrIw== +long@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/long/-/long-4.0.0.tgz#9a7b71cfb7d361a194ea555241c92f7468d5bf28" + integrity sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA== + loose-envify@^1.1.0, loose-envify@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" @@ -8846,6 +8922,25 @@ prop-types@^15.7.2: object-assign "^4.1.1" react-is "^16.8.1" +protobufjs@^6.11.2: + version "6.11.2" + resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-6.11.2.tgz#de39fabd4ed32beaa08e9bb1e30d08544c1edf8b" + integrity sha512-4BQJoPooKJl2G9j3XftkIXjoC9C0Av2NOrWmbLWT1vH32GcSUHjM0Arra6UfTsVyfMAuFzaLucXn1sadxJydAw== + dependencies: + "@protobufjs/aspromise" "^1.1.2" + "@protobufjs/base64" "^1.1.2" + "@protobufjs/codegen" "^2.0.4" + "@protobufjs/eventemitter" "^1.1.0" + "@protobufjs/fetch" "^1.1.0" + "@protobufjs/float" "^1.0.2" + "@protobufjs/inquire" "^1.1.0" + "@protobufjs/path" "^1.1.2" + "@protobufjs/pool" "^1.1.0" + "@protobufjs/utf8" "^1.1.0" + "@types/long" "^4.0.1" + "@types/node" ">=13.7.0" + long "^4.0.0" + proxy-addr@~2.0.5: version "2.0.6" resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.6.tgz#fdc2336505447d3f2f2c638ed272caf614bbb2bf"