1/* 2 * Copyright (c) 2023-2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * Request from the main thread send to worker thread 18 */ 19export class WorkerRequest { 20 requestCode: RequestCode; 21 data: Object; 22 23 constructor(requestCode: RequestCode) { 24 this.requestCode = requestCode; 25 } 26} 27 28/** 29 * Response from worker thread send to the main thread 30 */ 31export class WorkerResponse { 32 requestCode: RequestCode; 33 responseCode: ResponseCode; 34 data: Object; 35 36 constructor(requestCode: RequestCode, responseCode: ResponseCode) { 37 this.requestCode = requestCode; 38 this.responseCode = responseCode; 39 } 40} 41 42/** 43 * Request Code 44 */ 45export enum RequestCode { 46 P2P_START_DISCOVERY, 47 P2P_CANCEL_DISCOVERY, 48 GET_CAPS, 49} 50 51/** 52 * Response Code 53 */ 54export enum ResponseCode { 55 OK, 56 ERROR 57}