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 16export enum ErrorCode { 17 INIT_WFDS_ERROR = 0, 18 WIFI_INACTIVE, 19 IPP_CONNECT_ERROR, 20 GET_CAPS_ERROR, 21 LOCATION_CLOSED, 22 CONNECTION_POP, 23 P2P_SERVICE_ERROR 24} 25 26enum ErrorTxt { 27 INIT_WFDS_ERROR = 'init wfds error', 28 WIFI_INACTIVE = 'wifi in active', 29 IPP_CONNECT_ERROR = 'ipp connect error', 30 GET_CAPS_ERROR = 'get caps error', 31 LOCATION_CLOSED = 'location is closed', 32 CONNECTION_POP = 'connection pop-up window', 33 P2P_SERVICE_ERROR = 'P2pService is not running' 34} 35 36export class ErrorMessage { 37 constructor(public code: ErrorCode, public message: ErrorTxt) { 38 this.code = code; 39 this.message = message; 40 } 41} 42 43export const CONNECTION_POP = new ErrorMessage(ErrorCode.CONNECTION_POP, ErrorTxt.CONNECTION_POP); 44export const INIT_ERROR = new ErrorMessage(ErrorCode.INIT_WFDS_ERROR, ErrorTxt.INIT_WFDS_ERROR); 45export const WIFI_INACTIVE = new ErrorMessage(ErrorCode.WIFI_INACTIVE, ErrorTxt.WIFI_INACTIVE); 46export const IPP_CONNECT_ERROR = new ErrorMessage(ErrorCode.IPP_CONNECT_ERROR, ErrorTxt.IPP_CONNECT_ERROR); 47export const GET_CAPS_ERROR = new ErrorMessage(ErrorCode.GET_CAPS_ERROR, ErrorTxt.GET_CAPS_ERROR); 48export const LOCATION_CLOSED = new ErrorMessage(ErrorCode.LOCATION_CLOSED, ErrorTxt.LOCATION_CLOSED); 49export const P2P_SERVICE_ERROR = new ErrorMessage(ErrorCode.P2P_SERVICE_ERROR, ErrorTxt.P2P_SERVICE_ERROR); 50 51