!1043 add all connect user prompt language

Merge pull request !1043 from 仝月姣/master
This commit is contained in:
openharmony_ci 2024-08-20 10:31:33 +00:00 committed by Gitee
commit 4e15fab88c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 93 additions and 1 deletions

View File

@ -64,6 +64,41 @@ enum {
// offset of dms error, only be used in this file.
constexpr ErrCode DMS_SERVICE_ERR_OFFSET = ErrCodeOffset(SUBSYS_DISTRIBUTEDSCHEDULE, DMS_MODULE_TYPE_SERVICE);
enum DmsInterfaceSdkErr {
/**
* Result(16300501) for the distributed sched work abnormally.
*/
ERR_DMS_WORK_ABNORMALLY = 16300501,
/**
* Result(16300503) throw to js for the application is not installed on the remote end and installation-free is
* not supported.
*/
ERR_REMOTE_UNINSTALLED_AND_UNFREEINSTALL = 16300503,
/**
* Result(16300504) throw to js for the application is not installed on the remote end but installation-free is
* supported, try again with freeInstall flag.
*/
ERR_CONTINUE_WITHOUT_FREEINSTALL_FLAG = 16300504,
/**
* Result(16300506) throw to js for the local continuation task is already in progress.
*/
ERR_CONTINUE_ALREADY_IN_PROGRESS = 16300506,
/**
* Result(16300507) throw to js for Failed to get the missionInfo of the specified bundle name.
*/
ERR_GET_MISSION_INFO_OF_BUNDLE_NAME = 16300507,
/**
* Result(16300508) throw to js for bind error due to the remote device hotspot enable, try again after disable
* the remote device hotspot.
*/
ERR_BIND_REMOTE_HOTSPOT_ENABLE_STATE = 16300508,
/**
* Result(16300509) throw to js for the remote device has been linked with other devices, try again when
* the remote device is idle.
*/
ERR_BIND_REMOTE_IN_BUSY_LINK = 16300509,
};
enum {
/**
* Result(29360128) for invalid parameters.

View File

@ -187,6 +187,7 @@ private:
int32_t SetWantForContinuation(AAFwk::Want& newWant);
void SetCleanMissionFlag(const OHOS::AAFwk::Want& want);
int32_t ConvertToDmsSdkErr(int32_t result);
void NotifyContinuationCallbackResult(int32_t result);
bool GetLocalDeviceId(std::string& localDeviceId);
bool CheckDeviceIdFromRemote(const std::string& localDevId, const std::string& destDevId,
@ -210,6 +211,9 @@ private:
private:
static constexpr int32_t INVALID_SESSION_ID = -1;
static constexpr int32_t ERROR_BASE_DSOFTBUS_WIFI = -200000;
static constexpr int32_t ERROR_PEER_THREE_VAP_CONFLICT = ERROR_BASE_DSOFTBUS_WIFI - 6604;
static const std::map<int32_t, int32_t> DMS_CONVERT_TO_SDK_ERR_MAP;
std::shared_ptr<DSchedContinueStateMachine> stateMachine_;
std::shared_ptr<DSchedContinueEventHandler> eventHandler_;

View File

@ -43,6 +43,7 @@
#endif
#include "scene_board_judgement.h"
#include "softbus_adapter/transport/dsched_transport_softbus_adapter.h"
#include "softbus_error_code.h"
namespace OHOS {
namespace DistributedSchedule {
@ -78,6 +79,45 @@ constexpr int32_t GET_ABILITY_STATE_RETRY_TIMES = 40;
constexpr int32_t GET_ABILITY_STATE_SLEEP_TIME = 50;
}
const std::map<int32_t, int32_t> DSchedContinue::DMS_CONVERT_TO_SDK_ERR_MAP = {
std::map<int32_t, int32_t>::value_type(SoftBusErrNo::SOFTBUS_CONN_PASSIVE_TYPE_AP_STA_CHIP_CONFLICT,
DmsInterfaceSdkErr::ERR_BIND_REMOTE_HOTSPOT_ENABLE_STATE),
std::map<int32_t, int32_t>::value_type(SoftBusErrNo::SOFTBUS_CONN_PASSIVE_TYPE_AP_P2P_CHIP_CONFLICT,
DmsInterfaceSdkErr::ERR_BIND_REMOTE_HOTSPOT_ENABLE_STATE),
std::map<int32_t, int32_t>::value_type(SoftBusErrNo::SOFTBUS_CONN_PASSIVE_TYPE_AP_HML_CHIP_CONFLICT,
DmsInterfaceSdkErr::ERR_BIND_REMOTE_HOTSPOT_ENABLE_STATE),
std::map<int32_t, int32_t>::value_type(SoftBusErrNo::SOFTBUS_CONN_PASSIVE_TYPE_AP_STA_HML_CHIP_CONFLICT,
DmsInterfaceSdkErr::ERR_BIND_REMOTE_HOTSPOT_ENABLE_STATE),
std::map<int32_t, int32_t>::value_type(SoftBusErrNo::SOFTBUS_CONN_PASSIVE_TYPE_AP_STA_P2P_CHIP_CONFLICT,
DmsInterfaceSdkErr::ERR_BIND_REMOTE_HOTSPOT_ENABLE_STATE),
std::map<int32_t, int32_t>::value_type(SoftBusErrNo::SOFTBUS_CONN_PASSIVE_TYPE_AP_P2P_HML_CHIP_CONFLICT,
DmsInterfaceSdkErr::ERR_BIND_REMOTE_HOTSPOT_ENABLE_STATE),
std::map<int32_t, int32_t>::value_type(ERROR_PEER_THREE_VAP_CONFLICT,
DmsInterfaceSdkErr::ERR_BIND_REMOTE_HOTSPOT_ENABLE_STATE),
std::map<int32_t, int32_t>::value_type(SoftBusErrNo::SOFTBUS_CONN_PASSIVE_TYPE_HML_NUM_LIMITED_CONFLICT,
DmsInterfaceSdkErr::ERR_BIND_REMOTE_IN_BUSY_LINK),
std::map<int32_t, int32_t>::value_type(SoftBusErrNo::SOFTBUS_CONN_PV1_PEER_GC_CONNECTED_TO_ANOTHER_DEVICE,
DmsInterfaceSdkErr::ERR_BIND_REMOTE_IN_BUSY_LINK),
std::map<int32_t, int32_t>::value_type(SoftBusErrNo::SOFTBUS_CONN_PV2_PEER_GC_CONNECTED_TO_ANOTHER_DEVICE,
DmsInterfaceSdkErr::ERR_BIND_REMOTE_IN_BUSY_LINK),
std::map<int32_t, int32_t>::value_type(SoftBusErrNo::SOFTBUS_CONN_PASSIVE_TYPE_STA_P2P_HML_55_CONFLICT,
DmsInterfaceSdkErr::ERR_BIND_REMOTE_IN_BUSY_LINK),
std::map<int32_t, int32_t>::value_type(SoftBusErrNo::SOFTBUS_CONN_PASSIVE_TYPE_STA_P2P_HML_225_CONFLICT,
DmsInterfaceSdkErr::ERR_BIND_REMOTE_IN_BUSY_LINK),
std::map<int32_t, int32_t>::value_type(SoftBusErrNo::SOFTBUS_CONN_PASSIVE_TYPE_STA_P2P_HML_255_CONFLICT,
DmsInterfaceSdkErr::ERR_BIND_REMOTE_IN_BUSY_LINK),
std::map<int32_t, int32_t>::value_type(SoftBusErrNo::SOFTBUS_CONN_PASSIVE_TYPE_STA_P2P_HML_525_CONFLICT,
DmsInterfaceSdkErr::ERR_BIND_REMOTE_IN_BUSY_LINK),
std::map<int32_t, int32_t>::value_type(SoftBusErrNo::SOFTBUS_CONN_PASSIVE_TYPE_STA_P2P_HML_555_CONFLICT,
DmsInterfaceSdkErr::ERR_BIND_REMOTE_IN_BUSY_LINK),
std::map<int32_t, int32_t>::value_type(SoftBusErrNo::SOFTBUS_CONN_PASSIVE_TYPE_P2P_GO_GC_CONFLICT,
DmsInterfaceSdkErr::ERR_BIND_REMOTE_IN_BUSY_LINK),
std::map<int32_t, int32_t>::value_type(CONTINUE_ALREADY_IN_PROGRESS,
DmsInterfaceSdkErr::ERR_CONTINUE_ALREADY_IN_PROGRESS),
};
DSchedContinue::DSchedContinue(int32_t subServiceType, int32_t direction, const sptr<IRemoteObject>& callback,
const DSchedContinueInfo& continueInfo) : subServiceType_(subServiceType), direction_(direction),
continueInfo_(continueInfo), callback_(callback)
@ -1067,6 +1107,19 @@ int32_t DSchedContinue::ExecuteContinueEnd(int32_t result)
return ERR_OK;
}
int32_t DSchedContinue::ConvertToDmsSdkErr(int32_t result)
{
if (result == ERR_OK) {
return result;
}
auto it = DMS_CONVERT_TO_SDK_ERR_MAP.find(result);
if (it != DMS_CONVERT_TO_SDK_ERR_MAP.end()) {
return it->second;
}
return DmsInterfaceSdkErr::ERR_DMS_WORK_ABNORMALLY;
}
void DSchedContinue::NotifyContinuationCallbackResult(int32_t result)
{
HILOGD("continuation result is: %{public}d", result);
@ -1080,7 +1133,7 @@ void DSchedContinue::NotifyContinuationCallbackResult(int32_t result)
HILOGE("write token failed");
return;
}
PARCEL_WRITE_HELPER_NORET(data, Int32, (result == ERR_OK) ? 0 : NOTIFYCOMPLETECONTINUATION_FAILED);
PARCEL_WRITE_HELPER_NORET(data, Int32, ConvertToDmsSdkErr(result));
MessageParcel reply;
MessageOption option;
int32_t ret = callback_->SendRequest(NOTIFY_MISSION_CALLBACK_RESULT, data, reply, option);