Description:start 1,2;then stop 1, no effect

Match-id-b881a02477efc503a68aa4e4ad687c0a26402fc1
This commit is contained in:
xxxx
2022-06-25 09:22:35 +08:00
parent 85833213fb
commit 133364205c
13 changed files with 108 additions and 107 deletions
+8 -22
View File
@@ -64,24 +64,15 @@ namespace DistributedInput {
constexpr int32_t FAILURE_UNREGISTING = -60003;
/**
* Input Type NULL.
* Device Type definitions
*/
constexpr uint32_t INPUT_TYPE_NULL = 0;
/**
* Input Type MOUSE.
*/
constexpr uint32_t INPUT_TYPE_MOUSE = 1;
/**
* Input Type KEYBOARD.
*/
constexpr uint32_t INPUT_TYPE_KEYBOARD = 2;
/**
* Input Type TOUCH.
*/
constexpr uint32_t INPUT_TYPE_TOUCH = 4;
enum class DInputDeviceType : uint32_t {
NONE = 0x0000,
MOUSE = 0x0001,
KEYBOARD = 0x0002,
TOUCHPAD = MOUSE,
ALL = MOUSE | KEYBOARD,
};
/**
* Maximum number of signalled FDs to handle at a time.
@@ -93,11 +84,6 @@ namespace DistributedInput {
*/
constexpr uint32_t INPUT_EVENT_BUFFER_SIZE = 256;
/**
* Input Type ALL.
*/
constexpr uint32_t INPUT_TYPE_ALL = INPUT_TYPE_MOUSE | INPUT_TYPE_KEYBOARD | INPUT_TYPE_TOUCH;
constexpr int32_t INPUT_LOAD_SA_TIMEOUT_MS = 10000;
constexpr int32_t SESSION_WAIT_TIMEOUT_SECOND = 5;
@@ -189,7 +189,8 @@ HWTEST_F(DistributedInputInnerTest, StartRemoteInput01, testing::ext::TestSize.L
{
string deviceId = "StartRemoteInput01";
sptr<TestStartDInputCallback> callback = new TestStartDInputCallback();
int32_t ret = DistributedInputKit::StartRemoteInput(deviceId, INPUT_TYPE_ALL, callback);
int32_t ret =
DistributedInputKit::StartRemoteInput(deviceId, static_cast<uint32_t>(DInputDeviceType::ALL), callback);
EXPECT_EQ(SUCCESS, ret);
}
@@ -197,7 +198,8 @@ HWTEST_F(DistributedInputInnerTest, StartRemoteInput02, testing::ext::TestSize.L
{
string deviceId = "";
sptr<TestStartDInputCallback> callback = new TestStartDInputCallback();
int32_t ret = DistributedInputKit::StartRemoteInput(deviceId, INPUT_TYPE_ALL, callback);
int32_t ret =
DistributedInputKit::StartRemoteInput(deviceId, static_cast<uint32_t>(DInputDeviceType::ALL), callback);
EXPECT_EQ(SUCCESS, ret);
}
@@ -205,7 +207,8 @@ HWTEST_F(DistributedInputInnerTest, StartRemoteInput03, testing::ext::TestSize.L
{
string deviceId = "StartRemoteInput01";
sptr<TestStartDInputCallback> callback = nullptr;
int32_t ret = DistributedInputKit::StartRemoteInput(deviceId, INPUT_TYPE_ALL, callback);
int32_t ret =
DistributedInputKit::StartRemoteInput(deviceId, static_cast<uint32_t>(DInputDeviceType::ALL), callback);
EXPECT_EQ(SUCCESS, ret);
}
@@ -213,7 +216,8 @@ HWTEST_F(DistributedInputInnerTest, StartRemoteInput04, testing::ext::TestSize.L
{
string deviceId = "";
sptr<TestStartDInputCallback> callback = nullptr;
int32_t ret = DistributedInputKit::StartRemoteInput(deviceId, INPUT_TYPE_ALL, callback);
int32_t ret =
DistributedInputKit::StartRemoteInput(deviceId, static_cast<uint32_t>(DInputDeviceType::ALL), callback);
EXPECT_EQ(SUCCESS, ret);
}
@@ -221,7 +225,8 @@ HWTEST_F(DistributedInputInnerTest, StopRemoteInput01, testing::ext::TestSize.Le
{
string deviceId = "StopRemoteInput01";
sptr<TestStopDInputCallback> callback = new TestStopDInputCallback();
int32_t ret = DistributedInputKit::StopRemoteInput(deviceId, INPUT_TYPE_ALL, callback);
int32_t ret =
DistributedInputKit::StopRemoteInput(deviceId, static_cast<uint32_t>(DInputDeviceType::ALL), callback);
EXPECT_EQ(SUCCESS, ret);
}
@@ -229,7 +234,8 @@ HWTEST_F(DistributedInputInnerTest, StopRemoteInput02, testing::ext::TestSize.Le
{
string deviceId = "";
sptr<TestStopDInputCallback> callback = new TestStopDInputCallback();
int32_t ret = DistributedInputKit::StopRemoteInput(deviceId, INPUT_TYPE_ALL, callback);
int32_t ret =
DistributedInputKit::StopRemoteInput(deviceId, static_cast<uint32_t>(DInputDeviceType::ALL), callback);
EXPECT_EQ(SUCCESS, ret);
}
@@ -237,7 +243,8 @@ HWTEST_F(DistributedInputInnerTest, StopRemoteInput03, testing::ext::TestSize.Le
{
string deviceId = "StopRemoteInput01";
sptr<TestStopDInputCallback> callback = nullptr;
int32_t ret = DistributedInputKit::StopRemoteInput(deviceId, INPUT_TYPE_ALL, callback);
int32_t ret =
DistributedInputKit::StopRemoteInput(deviceId, static_cast<uint32_t>(DInputDeviceType::ALL), callback);
EXPECT_EQ(SUCCESS, ret);
}
@@ -245,7 +252,8 @@ HWTEST_F(DistributedInputInnerTest, StopRemoteInput04, testing::ext::TestSize.Le
{
string deviceId = "";
sptr<TestStopDInputCallback> callback = nullptr;
int32_t ret = DistributedInputKit::StopRemoteInput(deviceId, INPUT_TYPE_ALL, callback);
int32_t ret =
DistributedInputKit::StopRemoteInput(deviceId, static_cast<uint32_t>(DInputDeviceType::ALL), callback);
EXPECT_EQ(SUCCESS, ret);
}
@@ -285,7 +293,7 @@ HWTEST_F(DistributedInputInnerTest, IsStartDistributedInput1, testing::ext::Test
{
DistributedInputClient::GetInstance().ReleaseSource();
DistributedInputClient::GetInstance().InitSink();
DInputServerType ret = DistributedInputKit::IsStartDistributedInput(INPUT_TYPE_ALL);
DInputServerType ret = DistributedInputKit::IsStartDistributedInput(static_cast<uint32_t>(DInputDeviceType::ALL));
if (ret == DInputServerType::NULL_SERVER_TYPE) {
EXPECT_EQ(SUCCESS, 0);
@@ -296,7 +304,7 @@ HWTEST_F(DistributedInputInnerTest, IsStartDistributedInput1, testing::ext::Test
HWTEST_F(DistributedInputInnerTest, IsStartDistributedInput2, testing::ext::TestSize.Level0)
{
DInputServerType ret = DistributedInputKit::IsStartDistributedInput(INPUT_TYPE_ALL);
DInputServerType ret = DistributedInputKit::IsStartDistributedInput(static_cast<uint32_t>(DInputDeviceType::ALL));
if (ret == DInputServerType::NULL_SERVER_TYPE) {
EXPECT_EQ(SUCCESS, 0);
@@ -68,13 +68,13 @@ void DistributedInputClient::StartDInputServerCb::OnResult(const int32_t& status
{
if (DInputServerType::SOURCE_SERVER_TYPE == static_cast<DInputServerType>(status)) {
DistributedInputClient::GetInstance().serverType = DInputServerType::SOURCE_SERVER_TYPE;
DistributedInputClient::GetInstance().inputTypes = inputTypes;
DistributedInputClient::GetInstance().inputTypes_ = static_cast<DInputDeviceType>(inputTypes);
} else if (DInputServerType::SINK_SERVER_TYPE == static_cast<DInputServerType>(status)) {
DistributedInputClient::GetInstance().serverType = DInputServerType::SINK_SERVER_TYPE;
DistributedInputClient::GetInstance().inputTypes = inputTypes;
DistributedInputClient::GetInstance().inputTypes_ = static_cast<DInputDeviceType>(inputTypes);
} else {
DistributedInputClient::GetInstance().serverType = DInputServerType::NULL_SERVER_TYPE;
DistributedInputClient::GetInstance().inputTypes = INPUT_TYPE_NULL;
DistributedInputClient::GetInstance().inputTypes_ = DInputDeviceType::NONE;
}
}
@@ -143,7 +143,7 @@ private:
const std::string localDevId_ = "localNodeDevice";
DInputServerType serverType = DInputServerType::NULL_SERVER_TYPE;
uint32_t inputTypes = INPUT_TYPE_NULL;
DInputDeviceType inputTypes_ = DInputDeviceType::NONE;
sptr<RegisterDInputCb> callbackRegister = nullptr;
sptr<UnregisterDInputCb> callbackUnregister = nullptr;
+13 -10
View File
@@ -110,13 +110,13 @@ void DistributedInputClient::StartDInputServerCb::OnResult(const int32_t& status
{
if (DInputServerType::SOURCE_SERVER_TYPE == static_cast<DInputServerType>(status)) {
DistributedInputClient::GetInstance().serverType = DInputServerType::SOURCE_SERVER_TYPE;
DistributedInputClient::GetInstance().inputTypes = inputTypes;
DistributedInputClient::GetInstance().inputTypes_ = static_cast<DInputDeviceType>(inputTypes);
} else if (DInputServerType::SINK_SERVER_TYPE == static_cast<DInputServerType>(status)) {
DistributedInputClient::GetInstance().serverType = DInputServerType::SINK_SERVER_TYPE;
DistributedInputClient::GetInstance().inputTypes = inputTypes;
DistributedInputClient::GetInstance().inputTypes_ = static_cast<DInputDeviceType>(inputTypes);
} else {
DistributedInputClient::GetInstance().serverType = DInputServerType::NULL_SERVER_TYPE;
DistributedInputClient::GetInstance().inputTypes = INPUT_TYPE_NULL;
DistributedInputClient::GetInstance().inputTypes_ = DInputDeviceType::NONE;
}
}
@@ -181,7 +181,7 @@ int32_t DistributedInputClient::ReleaseSource()
}
serverType = DInputServerType::NULL_SERVER_TYPE;
inputTypes = INPUT_TYPE_NULL;
inputTypes_ = DInputDeviceType::NONE;
m_bIsAlreadyInitWhiteList = false;
callbackRegister = nullptr;
callbackUnregister = nullptr;
@@ -199,7 +199,7 @@ int32_t DistributedInputClient::ReleaseSink()
return ERR_DH_INPUT_CLIENT_GET_SINK_PROXY_FAIL;
}
serverType = DInputServerType::NULL_SERVER_TYPE;
inputTypes = INPUT_TYPE_NULL;
inputTypes_ = DInputDeviceType::NONE;
m_bIsAlreadyInitWhiteList = false;
sinkTypeCallback = nullptr;
WhiteListUtil::GetInstance().ClearWhiteList(localDevId_);
@@ -315,8 +315,9 @@ int32_t DistributedInputClient::StartRemoteInput(
}
if (deviceId.empty() || callback == nullptr ||
inputTypes > INPUT_TYPE_ALL || inputTypes == INPUT_TYPE_NULL ||
!(inputTypes & INPUT_TYPE_ALL)) {
inputTypes > static_cast<uint32_t>(DInputDeviceType::ALL) ||
inputTypes == static_cast<uint32_t>(DInputDeviceType::NONE) ||
!(inputTypes & static_cast<uint32_t>(DInputDeviceType::ALL))) {
return ERR_DH_INPUT_CLIENT_START_FAIL;
}
@@ -334,7 +335,9 @@ int32_t DistributedInputClient::StopRemoteInput(
}
if (deviceId.empty() || callback == nullptr ||
inputTypes > INPUT_TYPE_ALL || inputTypes == INPUT_TYPE_NULL || !(inputTypes & INPUT_TYPE_ALL)) {
inputTypes > static_cast<uint32_t>(DInputDeviceType::ALL) ||
inputTypes == static_cast<uint32_t>(DInputDeviceType::NONE) ||
!(inputTypes & static_cast<uint32_t>(DInputDeviceType::ALL))) {
return ERR_DH_INPUT_CLIENT_STOP_FAIL;
}
@@ -367,7 +370,7 @@ bool DistributedInputClient::IsNeedFilterOut(const std::string& deviceId, const
DInputServerType DistributedInputClient::IsStartDistributedInput(const uint32_t& inputType)
{
DHLOGI("%s called, inputType: %d, inputTypes: %d, ", __func__, inputType, inputTypes);
DHLOGI("%s called, inputType: %d, inputTypes: %d, ", __func__, inputType, static_cast<uint32_t>(inputTypes_));
int32_t retSource = 0;
int32_t retSink = 0;
@@ -387,7 +390,7 @@ DInputServerType DistributedInputClient::IsStartDistributedInput(const uint32_t&
serverType = DInputServerType::SINK_SERVER_TYPE;
}
if (inputType & inputTypes) {
if (inputType & static_cast<uint32_t>(inputTypes_)) {
return serverType;
} else {
return DInputServerType::NULL_SERVER_TYPE;
@@ -140,15 +140,14 @@ void DistributedInputCollector::StopCollectEventsThread()
void DistributedInputCollector::SetInputTypes(const uint32_t& inputType)
{
if ((inputType & INPUT_TYPE_MOUSE) != 0) {
inputTypes_ = 0;
if ((inputType & static_cast<uint32_t>(DInputDeviceType::MOUSE)) != 0) {
inputTypes_ |= INPUT_DEVICE_CLASS_CURSOR;
}
if ((inputType & INPUT_TYPE_KEYBOARD) != 0) {
if ((inputType & static_cast<uint32_t>(DInputDeviceType::KEYBOARD)) != 0) {
inputTypes_ |= INPUT_DEVICE_CLASS_KEYBOARD;
}
if ((inputType & INPUT_TYPE_TOUCH) != 0) {
inputTypes_ |= INPUT_DEVICE_CLASS_CURSOR;
}
inputHub_->SetSupportInputType(inputTypes_);
}
@@ -98,7 +98,7 @@ private:
std::shared_ptr<AppExecFwk::EventRunner> runner_;
std::shared_ptr<DistributedInputSinkEventHandler> handler_;
bool InitAuto();
uint32_t inputTypes_;
DInputDeviceType inputTypes_;
};
} // namespace DistributedInput
} // namespace DistributedHardware
@@ -37,19 +37,19 @@ REGISTER_SYSTEM_ABILITY_BY_ID(DistributedInputSinkManager, DISTRIBUTED_HARDWARE_
DistributedInputSinkManager::DistributedInputSinkManager(int32_t saId, bool runOnCreate)
: SystemAbility(saId, runOnCreate)
{
inputTypes_ = 0;
inputTypes_ = DInputDeviceType::NONE;
}
DistributedInputSinkManager::DInputSinkListener::DInputSinkListener(DistributedInputSinkManager *manager)
{
sinkManagerObj_ = manager;
sinkManagerObj_->SetInputTypes(INPUT_TYPE_NULL);
sinkManagerObj_->SetInputTypes(static_cast<uint32_t>(DInputDeviceType::NONE));
DHLOGI("DInputSinkListener init.");
}
DistributedInputSinkManager::DInputSinkListener::~DInputSinkListener()
{
sinkManagerObj_->SetInputTypes(INPUT_TYPE_NULL);
sinkManagerObj_->SetInputTypes(static_cast<uint32_t>(DInputDeviceType::NONE));
sinkManagerObj_ = nullptr;
DHLOGI("DInputSinkListener destory.");
}
@@ -109,7 +109,7 @@ void DistributedInputSinkManager::DInputSinkListener::onPrepareRemoteInput(
void DistributedInputSinkManager::DInputSinkListener::onUnprepareRemoteInput(const int32_t& sessionId)
{
DHLOGI("onUnprepareRemoteInput called, sessionId: %s", GetAnonyInt32(sessionId).c_str());
onStopRemoteInput(sessionId, INPUT_TYPE_ALL);
onStopRemoteInput(sessionId, static_cast<uint32_t>(DInputDeviceType::ALL));
DistributedInputSinkSwitch::GetInstance().RemoveSession(sessionId);
nlohmann::json jsonStr;
@@ -125,12 +125,30 @@ void DistributedInputSinkManager::DInputSinkListener::onStartRemoteInput(
int32_t curSessionId = DistributedInputSinkSwitch::GetInstance().GetSwitchOpenedSession();
DHLOGI("onStartRemoteInput called, curSessionId:%s, new sessionId: %s",
GetAnonyInt32(curSessionId).c_str(), GetAnonyInt32(sessionId).c_str());
// set new session
int32_t startRes = DistributedInputSinkSwitch::GetInstance().StartSwitch(sessionId);
sinkManagerObj_->SetStartTransFlag((startRes == DH_SUCCESS) ?
DInputServerType::SINK_SERVER_TYPE :
DInputServerType::NULL_SERVER_TYPE);
int32_t startRes = DH_SUCCESS;
if (curSessionId == sessionId) {
DHLOGI("sessionId switch state is true, need not switch");
} else {
DHLOGI("sessionId switch state is false, need to switch");
int32_t startRes = DistributedInputSinkSwitch::GetInstance().StartSwitch(sessionId);
sinkManagerObj_->SetStartTransFlag((startRes == DH_SUCCESS) ?
DInputServerType::SINK_SERVER_TYPE :
DInputServerType::NULL_SERVER_TYPE);
if ((curSessionId != ERR_DH_INPUT_SERVER_SINK_GET_OPEN_SESSION_FAIL) && (startRes == DH_SUCCESS)) {
DHLOGI("notify curSessionId:%s Interrupted.", GetAnonyInt32(curSessionId).c_str());
nlohmann::json jsonStrStp;
jsonStrStp[DINPUT_SOFTBUS_KEY_CMD_TYPE] = TRANS_SINK_MSG_ONSTOP;
jsonStrStp[DINPUT_SOFTBUS_KEY_INPUT_TYPE] = inputTypes;
jsonStrStp[DINPUT_SOFTBUS_KEY_RESP_VALUE] = false;
std::string smsgStp = jsonStrStp.dump();
DistributedInputSinkTransport::GetInstance().RespStopRemoteInput(curSessionId, smsgStp);
sinkManagerObj_->SetInputTypes(static_cast<uint32_t>(DInputDeviceType::NONE));
DistributedInputCollector::GetInstance().SetInputTypes(sinkManagerObj_->GetInputTypes());
}
}
bool result = (startRes == DH_SUCCESS) ? true : false;
nlohmann::json jsonStrSta;
@@ -141,24 +159,6 @@ void DistributedInputSinkManager::DInputSinkListener::onStartRemoteInput(
DistributedInputSinkTransport::GetInstance().RespStartRemoteInput(sessionId, smsgSta);
// Notify the interrupted master status
if (curSessionId == ERR_DH_INPUT_SERVER_SINK_GET_OPEN_SESSION_FAIL) {
DHLOGI("onStartRemoteInput called, this is the only session.");
} else if (result) {
DHLOGI("onStartRemoteInput called, notify curSessionId:%s Interrupted.",
GetAnonyInt32(curSessionId).c_str());
nlohmann::json jsonStrStp;
jsonStrStp[DINPUT_SOFTBUS_KEY_CMD_TYPE] = TRANS_SINK_MSG_ONSTOP;
jsonStrStp[DINPUT_SOFTBUS_KEY_INPUT_TYPE] = inputTypes;
jsonStrStp[DINPUT_SOFTBUS_KEY_RESP_VALUE] = false;
std::string smsgStp = jsonStrStp.dump();
DistributedInputSinkTransport::GetInstance().RespStopRemoteInput(curSessionId, smsgStp);
sinkManagerObj_->SetInputTypes(INPUT_TYPE_NULL);
DistributedInputCollector::GetInstance().SetInputTypes(sinkManagerObj_->GetInputTypes());
} else {
DHLOGI("onStartRemoteInput called, new session is error, not notify curSession.");
}
// add the input type
if (startRes == DH_SUCCESS) {
sinkManagerObj_->SetInputTypes(sinkManagerObj_->GetInputTypes() | inputTypes);
@@ -191,18 +191,18 @@ void DistributedInputSinkManager::DInputSinkListener::onStopRemoteInput(
std::string smsg = jsonStr.dump();
DistributedInputSinkTransport::GetInstance().RespStopRemoteInput(sessionId, smsg);
if (sinkManagerObj_->GetInputTypes() == INPUT_TYPE_NULL) {
if (sinkManagerObj_->GetInputTypes() == static_cast<uint32_t>(DInputDeviceType::NONE)) {
DistributedInputSinkSwitch::GetInstance().StopSwitch(sessionId);
if (DistributedInputSinkSwitch::GetInstance().GetSwitchOpenedSession() ==
ERR_DH_INPUT_SERVER_SINK_GET_OPEN_SESSION_FAIL) {
DHLOGI("onStartRemoteInput called, all session is stop.");
DHLOGI("all session is stop.");
sinkManagerObj_->SetStartTransFlag(DInputServerType::NULL_SERVER_TYPE);
}
}
IStartDInputServerCallback *startServerCB = sinkManagerObj_->GetStartDInputServerCback();
if (startServerCB == nullptr) {
DHLOGE("onStartRemoteInput called, startServerCB is null.");
DHLOGE("startServerCB is null.");
} else {
startServerCB->OnResult(
static_cast<int32_t>(sinkManagerObj_->GetStartTransFlag()), sinkManagerObj_->GetInputTypes());
@@ -348,12 +348,12 @@ void DistributedInputSinkManager::SetInitWhiteListFlag(bool isInit)
uint32_t DistributedInputSinkManager::GetInputTypes()
{
return inputTypes_;
return static_cast<uint32_t>(inputTypes_);
}
void DistributedInputSinkManager::SetInputTypes(const uint32_t& inputTypess)
void DistributedInputSinkManager::SetInputTypes(const uint32_t& inputTypes)
{
inputTypes_ = inputTypess;
inputTypes_ = static_cast<DInputDeviceType>(inputTypes);
}
} // namespace DistributedInput
} // namespace DistributedHardware
@@ -311,7 +311,7 @@ void DistributedInputSourceManager::DInputSourceManagerEventHandler::NotifyUnreg
std::string dhId = innerMsg[INPUT_SOURCEMANAGER_KEY_HWID];
bool result = innerMsg[INPUT_SOURCEMANAGER_KEY_RESULT];
if (result) {
sourceManagerObj_->SetDeviceMapValue(deviceId, INPUT_TYPE_NULL);
sourceManagerObj_->SetDeviceMapValue(deviceId, DINPUT_SOURCE_SWITCH_OFF);
}
sourceManagerObj_->RunUnregisterCallback(deviceId, dhId,
result ? DH_SUCCESS : ERR_DH_INPUT_SERVER_SOURCE_MANAGER_UNREGISTER_MSG_IS_BAD);
@@ -340,7 +340,7 @@ void DistributedInputSourceManager::DInputSourceManagerEventHandler::NotifyUnpre
std::string deviceId = innerMsg[INPUT_SOURCEMANAGER_KEY_DEVID];
bool result = innerMsg[INPUT_SOURCEMANAGER_KEY_RESULT];
if (result) {
sourceManagerObj_->SetDeviceMapValue(deviceId, INPUT_TYPE_NULL);
sourceManagerObj_->SetDeviceMapValue(deviceId, DINPUT_SOURCE_SWITCH_OFF);
}
sourceManagerObj_->RunUnprepareCallback(deviceId,
result ? DH_SUCCESS : ERR_DH_INPUT_SERVER_SOURCE_MANAGER_UNPREPARE_MSG_IS_BAD);
@@ -419,7 +419,8 @@ void DistributedInputSourceManager::DInputSourceManagerEventHandler::NotifyStart
sourceManagerObj_->SetStartTransFlag(startTransFlag);
if (sourceManagerObj_->GetStartDInputServerCback() != nullptr) {
sourceManagerObj_->GetStartDInputServerCback()->OnResult(serType, INPUT_TYPE_NULL);
sourceManagerObj_->GetStartDInputServerCback()->OnResult(
serType, static_cast<uint32_t>(DInputDeviceType::NONE));
} else {
DHLOGE("ProcessEvent GetStartDInputServerCback() is null.");
}
@@ -1106,12 +1107,12 @@ uint32_t DistributedInputSourceManager::GetInputTypesMap(const std::string devic
if (key != InputTypesMap_.end()) {
return InputTypesMap_[deviceId];
}
return INPUT_TYPE_NULL;
return static_cast<uint32_t>(DInputDeviceType::NONE);
}
uint32_t DistributedInputSourceManager::GetAllInputTypesMap()
{
uint32_t rInputTypes = INPUT_TYPE_NULL;
uint32_t rInputTypes = static_cast<uint32_t>(DInputDeviceType::NONE);
std::map<std::string, uint32_t>::iterator iter;
for (iter = InputTypesMap_.begin(); iter != InputTypesMap_.end(); iter++) {
rInputTypes |= iter->second;
@@ -1121,7 +1122,7 @@ uint32_t DistributedInputSourceManager::GetAllInputTypesMap()
void DistributedInputSourceManager::SetInputTypesMap(const std::string deviceId, uint32_t value)
{
if (value == INPUT_TYPE_NULL) {
if (value == static_cast<uint32_t>(DInputDeviceType::NONE)) {
std::map<std::string, uint32_t>::iterator key = InputTypesMap_.find(deviceId);
if (key != InputTypesMap_.end()) {
InputTypesMap_.erase(key);
@@ -248,7 +248,7 @@ HWTEST_F(DistributedInputSourceManagerTest, StartRemoteInput01, testing::ext::Te
{
std::string devId = "umkyu1b165e1be98151891erbe8r91ev";
sptr<TestStartDInputCallback> callback = new TestStartDInputCallback();
int32_t ret = sourceManager_->StartRemoteInput(devId, INPUT_TYPE_ALL, callback);
int32_t ret = sourceManager_->StartRemoteInput(devId, static_cast<uint32_t>(DInputDeviceType::ALL), callback);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL, ret);
}
@@ -256,7 +256,7 @@ HWTEST_F(DistributedInputSourceManagerTest, StartRemoteInput02, testing::ext::Te
{
std::string devId = "umkyu1b165e1be98151891erbe8r91ev";
sptr<TestStartDInputCallback> callback;
int32_t ret = sourceManager_->StartRemoteInput(devId, INPUT_TYPE_ALL, callback);
int32_t ret = sourceManager_->StartRemoteInput(devId, static_cast<uint32_t>(DInputDeviceType::ALL), callback);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL, ret);
}
@@ -264,7 +264,7 @@ HWTEST_F(DistributedInputSourceManagerTest, StartRemoteInput03, testing::ext::Te
{
std::string devId = "";
sptr<TestStartDInputCallback> callback = new TestStartDInputCallback();
int32_t ret = sourceManager_->StartRemoteInput(devId, INPUT_TYPE_ALL, callback);
int32_t ret = sourceManager_->StartRemoteInput(devId, static_cast<uint32_t>(DInputDeviceType::ALL), callback);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL, ret);
}
@@ -272,7 +272,7 @@ HWTEST_F(DistributedInputSourceManagerTest, StopRemoteInput01, testing::ext::Tes
{
std::string devId = "umkyu1b165e1be98151891erbe8r91ev";
sptr<TestStopDInputCallback> callback = new TestStopDInputCallback();
int32_t ret = sourceManager_->StopRemoteInput(devId, INPUT_TYPE_ALL, callback);
int32_t ret = sourceManager_->StopRemoteInput(devId, static_cast<uint32_t>(DInputDeviceType::ALL), callback);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL, ret);
}
@@ -280,7 +280,7 @@ HWTEST_F(DistributedInputSourceManagerTest, StopRemoteInput02, testing::ext::Tes
{
std::string devId = "";
sptr<TestStopDInputCallback> callback = new TestStopDInputCallback();
int32_t ret = sourceManager_->StopRemoteInput(devId, INPUT_TYPE_ALL, callback);
int32_t ret = sourceManager_->StopRemoteInput(devId, static_cast<uint32_t>(DInputDeviceType::ALL), callback);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL, ret);
}
@@ -288,7 +288,7 @@ HWTEST_F(DistributedInputSourceManagerTest, StopRemoteInput03, testing::ext::Tes
{
std::string devId = "umkyu1b165e1be98151891erbe8r91ev";
sptr<TestStopDInputCallback> callback;
int32_t ret = sourceManager_->StopRemoteInput(devId, INPUT_TYPE_ALL, callback);
int32_t ret = sourceManager_->StopRemoteInput(devId, static_cast<uint32_t>(DInputDeviceType::ALL), callback);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL, ret);
}
@@ -90,28 +90,32 @@ HWTEST_F(DistributedInputSourceTransTest, UnprepareRemoteInput03, testing::ext::
HWTEST_F(DistributedInputSourceTransTest, StartRemoteInput01, testing::ext::TestSize.Level0)
{
std::string deviceId = "tttt0001";
int32_t ret = DistributedInputSourceTransport::GetInstance().StartRemoteInput(deviceId, INPUT_TYPE_ALL);
int32_t ret = DistributedInputSourceTransport::GetInstance().StartRemoteInput(
deviceId, static_cast<uint32_t>(DInputDeviceType::ALL));
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_START_FAIL, ret);
}
HWTEST_F(DistributedInputSourceTransTest, StartRemoteInput02, testing::ext::TestSize.Level0)
{
std::string deviceId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
int32_t ret = DistributedInputSourceTransport::GetInstance().StartRemoteInput(deviceId, INPUT_TYPE_ALL);
int32_t ret = DistributedInputSourceTransport::GetInstance().StartRemoteInput(
deviceId, static_cast<uint32_t>(DInputDeviceType::ALL));
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_START_FAIL, ret);
}
HWTEST_F(DistributedInputSourceTransTest, StopRemoteInput01, testing::ext::TestSize.Level0)
{
std::string deviceId = "tttt0001";
int32_t ret = DistributedInputSourceTransport::GetInstance().StopRemoteInput(deviceId, INPUT_TYPE_ALL);
int32_t ret = DistributedInputSourceTransport::GetInstance().StopRemoteInput(
deviceId, static_cast<uint32_t>(DInputDeviceType::ALL));
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_STOP_FAIL, ret);
}
HWTEST_F(DistributedInputSourceTransTest, StopRemoteInput02, testing::ext::TestSize.Level0)
{
std::string deviceId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
int32_t ret = DistributedInputSourceTransport::GetInstance().StopRemoteInput(deviceId, INPUT_TYPE_ALL);
int32_t ret = DistributedInputSourceTransport::GetInstance().StopRemoteInput(
deviceId, static_cast<uint32_t>(DInputDeviceType::ALL));
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_STOP_FAIL, ret);
DistributedInputSourceTransport::GetInstance().CloseInputSoftbus(deviceId);
}
@@ -64,13 +64,13 @@ void DistributedInputClient::StartDInputServerCb::OnResult(const int32_t& status
{
if (DInputServerType::SOURCE_SERVER_TYPE == static_cast<DInputServerType>(status)) {
DistributedInputClient::GetInstance().serverType = DInputServerType::SOURCE_SERVER_TYPE;
DistributedInputClient::GetInstance().inputTypes = inputTypes;
DistributedInputClient::GetInstance().inputTypes_ = static_cast<DInputDeviceType>(inputTypes);
} else if (DInputServerType::SINK_SERVER_TYPE == static_cast<DInputServerType>(status)) {
DistributedInputClient::GetInstance().serverType = DInputServerType::SINK_SERVER_TYPE;
DistributedInputClient::GetInstance().inputTypes = inputTypes;
DistributedInputClient::GetInstance().inputTypes_ = static_cast<DInputDeviceType>(inputTypes);
} else {
DistributedInputClient::GetInstance().serverType = DInputServerType::NULL_SERVER_TYPE;
DistributedInputClient::GetInstance().inputTypes = INPUT_TYPE_NULL;
DistributedInputClient::GetInstance().inputTypes_ = DInputDeviceType::NONE;
}
}
@@ -64,13 +64,13 @@ void DistributedInputClient::StartDInputServerCb::OnResult(const int32_t& status
{
if (DInputServerType::SOURCE_SERVER_TYPE == static_cast<DInputServerType>(status)) {
DistributedInputClient::GetInstance().serverType = DInputServerType::SOURCE_SERVER_TYPE;
DistributedInputClient::GetInstance().inputTypes = inputTypes;
DistributedInputClient::GetInstance().inputTypes_ = static_cast<DInputDeviceType>(inputTypes);
} else if (DInputServerType::SINK_SERVER_TYPE == static_cast<DInputServerType>(status)) {
DistributedInputClient::GetInstance().serverType = DInputServerType::SINK_SERVER_TYPE;
DistributedInputClient::GetInstance().inputTypes = inputTypes;
DistributedInputClient::GetInstance().inputTypes_ = static_cast<DInputDeviceType>(inputTypes);
} else {
DistributedInputClient::GetInstance().serverType = DInputServerType::NULL_SERVER_TYPE;
DistributedInputClient::GetInstance().inputTypes = INPUT_TYPE_NULL;
DistributedInputClient::GetInstance().inputTypes_ = DInputDeviceType::NONE;
}
}