mirror of
https://gitee.com/openharmony/window_window_manager
synced 2025-02-21 08:22:29 +00:00
第三次review意见修改
Signed-off-by: rookiiie <quzhihao1@huawei.com>
This commit is contained in:
parent
d2b280ed9a
commit
0ab9742097
@ -67,32 +67,32 @@ public:
|
||||
*
|
||||
* @param subSystemId The identifier of the target subsystem.
|
||||
* @param customId A custom identifier for the data being sent.
|
||||
* @param data The Want object containing the data to be sent.
|
||||
* @param toSend The Want object containing the data to be sent.
|
||||
* @param reply A reference to a Want object that will be filled with the reply data.
|
||||
* @return DataHandlerErr::OK if the data was successfully sent and a reply was received, other errcode otherwise.
|
||||
*/
|
||||
virtual DataHandlerErr SendDataSync(SubSystemId subSystemId, uint32_t customId, AAFwk::Want& data,
|
||||
AAFwk::Want& reply) = 0;
|
||||
virtual DataHandlerErr SendDataSync(SubSystemId subSystemId, uint32_t customId, const AAFwk::Want& toSend,
|
||||
AAFwk::Want& reply) = 0;
|
||||
|
||||
/**
|
||||
* @brief Sends data synchronously to a specified subsystem without reply.
|
||||
*
|
||||
* @param subSystemId The identifier of the target subsystem.
|
||||
* @param customId A custom identifier for the data being sent.
|
||||
* @param data The Want object containing the data to be sent.
|
||||
* @param toSend The Want object containing the data to be sent.
|
||||
* @return DataHandlerErr::OK if the data was successfully sent, other errcode otherwise.
|
||||
*/
|
||||
virtual DataHandlerErr SendDataSync(SubSystemId subSystemId, uint32_t customId, AAFwk::Want& data) = 0;
|
||||
virtual DataHandlerErr SendDataSync(SubSystemId subSystemId, uint32_t customId, const AAFwk::Want& toSend) = 0;
|
||||
|
||||
/**
|
||||
* @brief Sends data asynchronously to a specified subsystem without reply.
|
||||
*
|
||||
* @param subSystemId The identifier of the target subsystem.
|
||||
* @param customId A custom identifier for the data being sent.
|
||||
* @param data The Want object containing the data to be sent.
|
||||
* @param toSend The Want object containing the data to be sent.
|
||||
* @return DataHandlerErr::OK if the data was successfully sent, other errcode otherwise.
|
||||
*/
|
||||
virtual DataHandlerErr SendDataAsync(SubSystemId subSystemId, uint32_t customId, AAFwk::Want& data) = 0;
|
||||
virtual DataHandlerErr SendDataAsync(SubSystemId subSystemId, uint32_t customId, const AAFwk::Want& toSend) = 0;
|
||||
|
||||
/**
|
||||
* @brief Registers a data consumer for a specific subsystemId.
|
||||
|
@ -46,23 +46,24 @@ public:
|
||||
DataHandler() = default;
|
||||
virtual ~DataHandler() = default;
|
||||
|
||||
DataHandlerErr SendDataSync(SubSystemId subSystemId, uint32_t customId, AAFwk::Want& data,
|
||||
DataHandlerErr SendDataSync(SubSystemId subSystemId, uint32_t customId, const AAFwk::Want& toSend,
|
||||
AAFwk::Want& reply) override;
|
||||
DataHandlerErr SendDataSync(SubSystemId subSystemId, uint32_t customId, AAFwk::Want& data) override;
|
||||
DataHandlerErr SendDataAsync(SubSystemId subSystemId, uint32_t customId, AAFwk::Want& data) override;
|
||||
DataHandlerErr RegisterDataConsumer(SubSystemId dataId, DataConsumeCallback&& callback) override;
|
||||
void UnregisterDataConsumer(SubSystemId dataId) override;
|
||||
void NotifyDataConsumer(MessageParcel& data, MessageParcel& reply);
|
||||
DataHandlerErr SendDataSync(SubSystemId subSystemId, uint32_t customId, const AAFwk::Want& toSend) override;
|
||||
DataHandlerErr SendDataAsync(SubSystemId subSystemId, uint32_t customId, const AAFwk::Want& toSend) override;
|
||||
DataHandlerErr RegisterDataConsumer(SubSystemId subSystemId, DataConsumeCallback&& callback) override;
|
||||
void UnregisterDataConsumer(SubSystemId subSystemId) override;
|
||||
void NotifyDataConsumer(MessageParcel& recieved, MessageParcel& reply);
|
||||
void SetEventHandler(const std::shared_ptr<AppExecFwk::EventHandler>& eventHandler);
|
||||
void SetRemoteProxyObject(const sptr<IRemoteObject>& remoteObject);
|
||||
|
||||
protected:
|
||||
DataHandlerErr NotifyDataConsumer(AAFwk::Want&& data, std::optional<AAFwk::Want>& reply,
|
||||
const DataTransferConfig& config);
|
||||
virtual DataHandlerErr SendData(AAFwk::Want& data, AAFwk::Want& reply, const DataTransferConfig& config) = 0;
|
||||
virtual DataHandlerErr SendData(const AAFwk::Want& toSend, AAFwk::Want& reply,
|
||||
const DataTransferConfig& config) = 0;
|
||||
DataHandlerErr PrepareSendData(MessageParcel& data, const DataTransferConfig& config, const AAFwk::Want& toSend);
|
||||
virtual bool WriteInterfaceToken(MessageParcel& data) = 0;
|
||||
DataHandlerErr ParseReply(MessageParcel& data, AAFwk::Want& reply, const DataTransferConfig& config);
|
||||
DataHandlerErr ParseReply(MessageParcel& recieved, AAFwk::Want& reply, const DataTransferConfig& config);
|
||||
void PostAsyncTask(Task&& task, const std::string& name, int64_t delayTime);
|
||||
|
||||
protected:
|
||||
|
@ -120,23 +120,23 @@ DataHandlerErr DataHandler::ParseReply(MessageParcel& replyParcel, AAFwk::Want&
|
||||
TLOGE(WmsLogTag::WMS_UIEXT, "read response failed, %{public}s", config.ToString().c_str());
|
||||
return DataHandlerErr::READ_PARCEL_ERROR;
|
||||
}
|
||||
reply = *response;
|
||||
reply = std::move(*response);
|
||||
}
|
||||
|
||||
return static_cast<DataHandlerErr>(replyCode);
|
||||
}
|
||||
|
||||
// process data from peer
|
||||
void DataHandler::NotifyDataConsumer(MessageParcel& data, MessageParcel& reply)
|
||||
void DataHandler::NotifyDataConsumer(MessageParcel& recieved, MessageParcel& reply)
|
||||
{
|
||||
sptr<DataTransferConfig> config = data.ReadParcelable<DataTransferConfig>();
|
||||
sptr<DataTransferConfig> config = recieved.ReadParcelable<DataTransferConfig>();
|
||||
if (config == nullptr) {
|
||||
TLOGE(WmsLogTag::WMS_UIEXT, "read config failed");
|
||||
reply.WriteUint32(static_cast<uint32_t>(DataHandlerErr::READ_PARCEL_ERROR));
|
||||
return;
|
||||
}
|
||||
|
||||
sptr<AAFwk::Want> sendWant = data.ReadParcelable<AAFwk::Want>();
|
||||
sptr<AAFwk::Want> sendWant = recieved.ReadParcelable<AAFwk::Want>();
|
||||
if (sendWant == nullptr) {
|
||||
TLOGE(WmsLogTag::WMS_UIEXT, "read want failed");
|
||||
reply.WriteUint32(static_cast<uint32_t>(DataHandlerErr::READ_PARCEL_ERROR));
|
||||
@ -171,7 +171,7 @@ void DataHandler::SetRemoteProxyObject(const sptr<IRemoteObject>& remoteObject)
|
||||
remoteProxy_ = remoteObject;
|
||||
}
|
||||
|
||||
DataHandlerErr DataHandler::SendDataSync(SubSystemId subSystemId, uint32_t customId, AAFwk::Want& data,
|
||||
DataHandlerErr DataHandler::SendDataSync(SubSystemId subSystemId, uint32_t customId, const AAFwk::Want& toSend,
|
||||
AAFwk::Want& reply)
|
||||
{
|
||||
DataTransferConfig config;
|
||||
@ -179,26 +179,26 @@ DataHandlerErr DataHandler::SendDataSync(SubSystemId subSystemId, uint32_t custo
|
||||
config.needReply = true;
|
||||
config.subSystemId = subSystemId;
|
||||
config.customId = customId;
|
||||
return SendData(data, reply, config);
|
||||
return SendData(toSend, reply, config);
|
||||
}
|
||||
|
||||
DataHandlerErr DataHandler::SendDataSync(SubSystemId subSystemId, uint32_t customId, AAFwk::Want& data)
|
||||
DataHandlerErr DataHandler::SendDataSync(SubSystemId subSystemId, uint32_t customId, const AAFwk::Want& toSend)
|
||||
{
|
||||
DataTransferConfig config;
|
||||
config.needSyncSend = true;
|
||||
config.subSystemId = subSystemId;
|
||||
config.customId = customId;
|
||||
AAFwk::Want reply;
|
||||
return SendData(data, reply, config);
|
||||
return SendData(toSend, reply, config);
|
||||
}
|
||||
|
||||
DataHandlerErr DataHandler::SendDataAsync(SubSystemId subSystemId, uint32_t customId, AAFwk::Want& data)
|
||||
DataHandlerErr DataHandler::SendDataAsync(SubSystemId subSystemId, uint32_t customId, const AAFwk::Want& toSend)
|
||||
{
|
||||
DataTransferConfig config;
|
||||
config.subSystemId = subSystemId;
|
||||
config.customId = customId;
|
||||
AAFwk::Want reply;
|
||||
return SendData(data, reply, config);
|
||||
return SendData(toSend, reply, config);
|
||||
}
|
||||
|
||||
DataHandlerErr DataHandler::NotifyDataConsumer(AAFwk::Want&& data, std::optional<AAFwk::Want>& reply,
|
||||
|
@ -26,8 +26,8 @@ public:
|
||||
MockDataHandler() = default;
|
||||
~MockDataHandler() override = default;
|
||||
|
||||
MOCK_METHOD(DataHandlerErr, SendData, (AAFwk::Want& data, AAFwk::Want& reply, const DataTransferConfig& config),
|
||||
(override));
|
||||
MOCK_METHOD(DataHandlerErr, SendData,
|
||||
(const AAFwk::Want& data, AAFwk::Want& reply, const DataTransferConfig& config), (override));
|
||||
MOCK_METHOD(bool, WriteInterfaceToken, (MessageParcel& data), (override));
|
||||
|
||||
// Helper methods to expose protected methods for testing
|
||||
|
Loading…
x
Reference in New Issue
Block a user