1c36cf2e9Sopenharmony_ci/* 2c36cf2e9Sopenharmony_ci * Copyright (c) 2023-2023 Huawei Device Co., Ltd. 3c36cf2e9Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4c36cf2e9Sopenharmony_ci * you may not use this file except in compliance with the License. 5c36cf2e9Sopenharmony_ci * You may obtain a copy of the License at 6c36cf2e9Sopenharmony_ci * 7c36cf2e9Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8c36cf2e9Sopenharmony_ci * 9c36cf2e9Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10c36cf2e9Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11c36cf2e9Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12c36cf2e9Sopenharmony_ci * See the License for the specific language governing permissions and 13c36cf2e9Sopenharmony_ci * limitations under the License. 14c36cf2e9Sopenharmony_ci */ 15c36cf2e9Sopenharmony_ci 16c36cf2e9Sopenharmony_ciexport enum ErrorCode { 17c36cf2e9Sopenharmony_ci INIT_WFDS_ERROR = 0, 18c36cf2e9Sopenharmony_ci WIFI_INACTIVE, 19c36cf2e9Sopenharmony_ci IPP_CONNECT_ERROR, 20c36cf2e9Sopenharmony_ci GET_CAPS_ERROR, 21c36cf2e9Sopenharmony_ci LOCATION_CLOSED, 22c36cf2e9Sopenharmony_ci CONNECTION_POP, 23c36cf2e9Sopenharmony_ci P2P_SERVICE_ERROR 24c36cf2e9Sopenharmony_ci} 25c36cf2e9Sopenharmony_ci 26c36cf2e9Sopenharmony_cienum ErrorTxt { 27c36cf2e9Sopenharmony_ci INIT_WFDS_ERROR = 'init wfds error', 28c36cf2e9Sopenharmony_ci WIFI_INACTIVE = 'wifi in active', 29c36cf2e9Sopenharmony_ci IPP_CONNECT_ERROR = 'ipp connect error', 30c36cf2e9Sopenharmony_ci GET_CAPS_ERROR = 'get caps error', 31c36cf2e9Sopenharmony_ci LOCATION_CLOSED = 'location is closed', 32c36cf2e9Sopenharmony_ci CONNECTION_POP = 'connection pop-up window', 33c36cf2e9Sopenharmony_ci P2P_SERVICE_ERROR = 'P2pService is not running' 34c36cf2e9Sopenharmony_ci} 35c36cf2e9Sopenharmony_ci 36c36cf2e9Sopenharmony_ciexport class ErrorMessage { 37c36cf2e9Sopenharmony_ci constructor(public code: ErrorCode, public message: ErrorTxt) { 38c36cf2e9Sopenharmony_ci this.code = code; 39c36cf2e9Sopenharmony_ci this.message = message; 40c36cf2e9Sopenharmony_ci } 41c36cf2e9Sopenharmony_ci} 42c36cf2e9Sopenharmony_ci 43c36cf2e9Sopenharmony_ciexport const CONNECTION_POP = new ErrorMessage(ErrorCode.CONNECTION_POP, ErrorTxt.CONNECTION_POP); 44c36cf2e9Sopenharmony_ciexport const INIT_ERROR = new ErrorMessage(ErrorCode.INIT_WFDS_ERROR, ErrorTxt.INIT_WFDS_ERROR); 45c36cf2e9Sopenharmony_ciexport const WIFI_INACTIVE = new ErrorMessage(ErrorCode.WIFI_INACTIVE, ErrorTxt.WIFI_INACTIVE); 46c36cf2e9Sopenharmony_ciexport const IPP_CONNECT_ERROR = new ErrorMessage(ErrorCode.IPP_CONNECT_ERROR, ErrorTxt.IPP_CONNECT_ERROR); 47c36cf2e9Sopenharmony_ciexport const GET_CAPS_ERROR = new ErrorMessage(ErrorCode.GET_CAPS_ERROR, ErrorTxt.GET_CAPS_ERROR); 48c36cf2e9Sopenharmony_ciexport const LOCATION_CLOSED = new ErrorMessage(ErrorCode.LOCATION_CLOSED, ErrorTxt.LOCATION_CLOSED); 49c36cf2e9Sopenharmony_ciexport const P2P_SERVICE_ERROR = new ErrorMessage(ErrorCode.P2P_SERVICE_ERROR, ErrorTxt.P2P_SERVICE_ERROR); 50c36cf2e9Sopenharmony_ci 51