1/* 2 * Copyright (C) 2022 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17export enum MessageType { 18 UNKNOWN = 0, 19 PING, 20 PONG, 21 BUGREPORT, 22 TIMESTAMP, 23 FILES, 24} 25 26export interface Message { 27 type: MessageType; 28} 29 30export class MessagePing implements Message { 31 type = MessageType.PING; 32} 33 34export class MessagePong implements Message { 35 type = MessageType.PONG; 36} 37 38export class MessageBugReport implements Message { 39 type = MessageType.BUGREPORT; 40 41 constructor(public file: File, public timestampNs?: bigint, public issueId?: string) {} 42} 43 44export class MessageTimestamp implements Message { 45 type = MessageType.TIMESTAMP; 46 47 constructor(public timestampNs: bigint, public sections?: string[]) {} 48} 49 50export class MessageFiles implements Message { 51 type = MessageType.FILES; 52 53 constructor(public files: File[], public timestampNs?: bigint, public issueId?: string) {} 54} 55