1 /* 2 * Copyright (c) 2023 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 #ifndef COOPERATE_PARAMS_H 17 #define COOPERATE_PARAMS_H 18 19 #include <string> 20 21 #include "intention_identity.h" 22 23 namespace OHOS { 24 namespace Msdp { 25 namespace DeviceStatus { 26 enum CooperateRequestID : uint32_t { 27 UNKNOWN_COOPERATE_ACTION, 28 REGISTER_LISTENER, 29 UNREGISTER_LISTENER, 30 REGISTER_HOTAREA_LISTENER, 31 UNREGISTER_HOTAREA_LISTENER, 32 GET_COOPERATE_STATE, 33 GET_COOPERATE_STATE_SYNC, 34 REGISTER_EVENT_LISTENER, 35 UNREGISTER_EVENT_LISTENER, 36 }; 37 38 struct StartCooperateParam final : public ParamBase { 39 StartCooperateParam() = default; 40 StartCooperateParam(int32_t userData, const std::string &remoteNetworkId, 41 int32_t startDeviceId, bool checkPermission); 42 bool Marshalling(MessageParcel &parcel) const override; 43 bool Unmarshalling(MessageParcel &parcel) override; 44 45 std::string remoteNetworkId; 46 int32_t userData { -1 }; 47 int32_t startDeviceId { -1 }; 48 bool checkPermission { false }; 49 }; 50 51 struct StopCooperateParam final : public ParamBase { 52 StopCooperateParam() = default; 53 StopCooperateParam(int32_t userData, bool isUnchained, bool checkPermission); 54 bool Marshalling(MessageParcel &parcel) const override; 55 bool Unmarshalling(MessageParcel &parcel) override; 56 57 int32_t userData { -1 }; 58 bool isUnchained { false }; 59 bool checkPermission { false }; 60 }; 61 62 struct GetCooperateStateParam final : public ParamBase { 63 GetCooperateStateParam() = default; 64 GetCooperateStateParam(int32_t userData, const std::string &networkId, bool checkPermission); 65 bool Marshalling(MessageParcel &parcel) const override; 66 bool Unmarshalling(MessageParcel &parcel) override; 67 68 std::string networkId; 69 int32_t userData { -1 }; 70 bool checkPermission { false }; 71 }; 72 73 struct RegisterEventListenerParam final : public ParamBase { 74 RegisterEventListenerParam() = default; 75 RegisterEventListenerParam(const std::string &networkId); 76 bool Marshalling(MessageParcel &parcel) const override; 77 bool Unmarshalling(MessageParcel &parcel) override; 78 std::string networkId; 79 }; 80 81 using UnregisterEventListenerParam = RegisterEventListenerParam; 82 83 struct GetCooperateStateSyncParam final : public ParamBase { 84 GetCooperateStateSyncParam() = default; 85 GetCooperateStateSyncParam(const std::string &udId); 86 bool Marshalling(MessageParcel &parcel) const override; 87 bool Unmarshalling(MessageParcel &parcel) override; 88 89 std::string udId; 90 }; 91 92 struct RegisterHotAreaListenerParam final : public ParamBase { 93 RegisterHotAreaListenerParam() = default; 94 RegisterHotAreaListenerParam(int32_t userData, bool checkPermission); 95 bool Marshalling(MessageParcel &parcel) const override; 96 bool Unmarshalling(MessageParcel &parcel) override; 97 int32_t userData { -1 }; 98 bool checkPermission { false }; 99 }; 100 101 using UnregisterHotAreaListenerParam = RegisterHotAreaListenerParam; 102 103 } // namespace DeviceStatus 104 } // namespace Msdp 105 } // namespace OHOS 106 #endif // COOPERATE_PARAMS_H 107