1 /*
2  * Copyright (c) 2024 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 
16 #include <string>
17 
18 #include "distributed_mission_manager_helper.h"
19 
20 #include "ability_manager_client.h"
21 #include "dms_sa_client.h"
22 #include "hilog_tag_wrapper.h"
23 #include "ipc_skeleton.h"
24 #include "napi_common_data.h"
25 #include "napi_common_util.h"
26 #include "napi_common_want.h"
27 #include "napi_remote_object.h"
28 
29 using namespace OHOS::AppExecFwk;
30 
31 namespace OHOS {
32 namespace AAFwk {
33 
CheckContinueKeyExist(napi_env & env,const napi_value & value)34 bool CheckContinueKeyExist(napi_env &env, const napi_value &value)
35 {
36     bool isSrcDeviceId = false;
37     napi_has_named_property(env, value, "srcDeviceId", &isSrcDeviceId);
38     bool isDstDeviceId = false;
39     napi_has_named_property(env, value, "dstDeviceId", &isDstDeviceId);
40     bool isMissionId = false;
41     napi_has_named_property(env, value, "missionId", &isMissionId);
42     bool isWantParam = false;
43     napi_has_named_property(env, value, "wantParam", &isWantParam);
44     if (!isSrcDeviceId && !isDstDeviceId && !isMissionId && !isWantParam) {
45         TAG_LOGE(AAFwkTag::MISSION, "Wrong argument key");
46         return false;
47     }
48     return true;
49 }
50 
CheckBundleNameExist(napi_env & env,const napi_value & value)51 bool CheckBundleNameExist(napi_env &env, const napi_value &value)
52 {
53     bool isSrcDeviceId = false;
54     napi_has_named_property(env, value, "srcDeviceId", &isSrcDeviceId);
55     bool isDstDeviceId = false;
56     napi_has_named_property(env, value, "dstDeviceId", &isDstDeviceId);
57     bool isBundleName = false;
58     napi_has_named_property(env, value, "bundleName", &isBundleName);
59     bool isWantParam = false;
60     napi_has_named_property(env, value, "wantParam", &isWantParam);
61     if (!isSrcDeviceId && !isDstDeviceId && !isBundleName && !isWantParam) {
62         return false;
63     }
64     return true;
65 }
66 }
67 }