1/* 2 * Copyright (c) 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 16import { processDataCallback } from './i_idl_service_ext'; 17import { insertDataToMapCallback } from './i_idl_service_ext'; 18import IdlServiceExtStub from './idl_service_ext_stub'; 19 20const ERR_OK = 0; 21const TAG: string = "[IdlServiceExtImpl]"; 22 23// 开发者需要在这个类型里对接口进行实现 24export default class ServiceExtImpl extends IdlServiceExtStub { 25 processData(data: number, callback: processDataCallback): void { 26 // 开发者自行实现业务逻辑 27 console.info(TAG, `processData: ${data}`); 28 callback(ERR_OK, data + 1); 29 } 30 31 insertDataToMap(key: string, val: number, callback: insertDataToMapCallback): void { 32 // 开发者自行实现业务逻辑 33 console.info(TAG, `insertDataToMap, key: ${key} val: ${val}`); 34 callback(ERR_OK); 35 } 36} 37