diff --git a/interfaces/kits/js/BUILD.gn b/interfaces/kits/js/BUILD.gn index 9ed76cd29be96697f10fe0427abd432581612aa3..03a4665f73b121ef534fa0c60685f1b2e2fdc514 100644 --- a/interfaces/kits/js/BUILD.gn +++ b/interfaces/kits/js/BUILD.gn @@ -761,7 +761,6 @@ ohos_shared_library("ani_file_fs") { "src/mod_fs/properties/copy_listener/trans_listener_core.cpp", "src/mod_fs/properties/create_randomaccessfile_core.cpp", "src/mod_fs/properties/create_stream_core.cpp", - "src/mod_fs/properties/dfs_listener/file_dfs_listener_stub.cpp", "src/mod_fs/properties/dup_core.cpp", "src/mod_fs/properties/fdatasync_core.cpp", "src/mod_fs/properties/fdopen_stream_core.cpp", diff --git a/interfaces/kits/js/src/mod_fs/properties/dfs_listener/file_dfs_listener_stub.cpp b/interfaces/kits/js/src/mod_fs/properties/dfs_listener/file_dfs_listener_stub.cpp deleted file mode 100644 index e996e718719e02b87085923782e4bf576ac1d14c..0000000000000000000000000000000000000000 --- a/interfaces/kits/js/src/mod_fs/properties/dfs_listener/file_dfs_listener_stub.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2024 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "file_dfs_listener_interface_code.h" -#include "file_dfs_listener_stub.h" -#include "filemgmt_libhilog.h" - -namespace OHOS { -namespace FileManagement { -namespace ModuleFileIO { -using namespace FileManagement; -namespace { - constexpr int NO_ERROR = 0; - constexpr int E_INVAL_ARG = 1; -} - -FileDfsListenerStub::FileDfsListenerStub() -{ - opToInterfaceMap_[static_cast - (Storage::DistributedFile::FileDfsListenerInterfaceCode::FILE_DFS_LISTENER_ON_STATUS)] = - &FileDfsListenerStub::HandleOnStatus; -} - -int32_t FileDfsListenerStub::OnRemoteRequest(uint32_t code, - MessageParcel &data, - MessageParcel &reply, - MessageOption &option) -{ - if (data.ReadInterfaceToken() != GetDescriptor()) { - return FILE_DFS_LISTENER_DESCRIPTOR_IS_EMPTY; - } - switch (code) { - case static_cast(Storage::DistributedFile::FileDfsListenerInterfaceCode::FILE_DFS_LISTENER_ON_STATUS): - return HandleOnStatus(data, reply); - default: - HILOGE("Cannot response request %{public}d: unknown tranction", code); - return IPCObjectStub::OnRemoteRequest(code, data, reply, option); - } -} - -int32_t FileDfsListenerStub::HandleOnStatus(MessageParcel &data, MessageParcel &reply) -{ - std::string networkId; - if (!data.ReadString(networkId)) { - HILOGE("Read networkId failed"); - return E_INVAL_ARG; - } - int32_t status; - if (!data.ReadInt32(status)) { - HILOGE("Read status failed"); - return E_INVAL_ARG; - } - if (networkId.empty() || status < 0) { - HILOGE("Invalid arguments"); - return E_INVAL_ARG; - } - OnStatus(networkId, status); - return NO_ERROR; -} - -} // namespace ModuleFileIO -} // namespace FileManagement -} // namespace OHOS \ No newline at end of file diff --git a/interfaces/kits/js/src/mod_fs/properties/dfs_listener/file_dfs_listener_stub.h b/interfaces/kits/js/src/mod_fs/properties/dfs_listener/file_dfs_listener_stub.h deleted file mode 100644 index 3b5f782e6971dc29c651bde3481eebef70c9d816..0000000000000000000000000000000000000000 --- a/interfaces/kits/js/src/mod_fs/properties/dfs_listener/file_dfs_listener_stub.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef INTERFACES_KITS_JS_SRC_MOD_FS_PROPERTIES_DFS_LISTENER_FILE_DFS_LISTENER_STUB_H -#define INTERFACES_KITS_JS_SRC_MOD_FS_PROPERTIES_DFS_LISTENER_FILE_DFS_LISTENER_STUB_H - -#include -#include "i_file_dfs_listener.h" -#include "iremote_stub.h" -#include "message_option.h" -#include "message_parcel.h" -#include "refbase.h" - -namespace OHOS { -namespace FileManagement { -namespace ModuleFileIO { -class FileDfsListenerStub : public IRemoteStub { -public: - FileDfsListenerStub(); - virtual ~FileDfsListenerStub() = default; - int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; - -private: - using FileDfsListenerInterface = int32_t (FileDfsListenerStub::*)(MessageParcel &data, MessageParcel &reply); - std::map opToInterfaceMap_; - - int32_t HandleOnStatus(MessageParcel &data, MessageParcel &reply); -}; - -} // namespace ModuleFileIO -} // namespace FileManagement -} // namespace OHOS - -#endif // INTERFACES_KITS_JS_SRC_MOD_FS_PROPERTIES_DFS_LISTENER_FILE_DFS_LISTENER_STUB_H \ No newline at end of file