1 /* 2 * Copyright (c) 2023-2025 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 OHOS_DP_I_DISTRIBUTED_DEVICE_PROFILE_H 17 #define OHOS_DP_I_DISTRIBUTED_DEVICE_PROFILE_H 18 19 #include <vector> 20 21 #include "iremote_broker.h" 22 23 #include "access_control_profile.h" 24 #include "characteristic_profile.h" 25 #include "device_icon_info.h" 26 #include "device_icon_info_filter_options.h" 27 #include "device_profile.h" 28 #include "device_profile_filter_options.h" 29 #include "dp_subscribe_info.h" 30 #include "dp_sync_options.h" 31 #include "i_sync_completed_callback.h" 32 #include "product_info.h" 33 #include "service_info_profile.h" 34 #include "service_info_unique_key.h" 35 #include "service_profile.h" 36 #include "trust_device_profile.h" 37 #include "trusted_device_info.h" 38 #include "local_service_info.h" 39 40 namespace OHOS { 41 namespace DistributedDeviceProfile { 42 class IDistributedDeviceProfile : public OHOS::IRemoteBroker { 43 public: 44 DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.DeviceProfile.IDistributedDeviceProfile"); 45 IDistributedDeviceProfile() = default; 46 virtual ~IDistributedDeviceProfile() = default; 47 virtual int32_t PutAccessControlProfile(const AccessControlProfile& aclProfile) = 0; 48 virtual int32_t UpdateAccessControlProfile(const AccessControlProfile& aclProfile) = 0; 49 virtual int32_t GetTrustDeviceProfile(const std::string& deviceId, TrustDeviceProfile& trustDeviceProfile) = 0; 50 virtual int32_t GetAllTrustDeviceProfile(std::vector<TrustDeviceProfile>& trustDeviceProfiles) = 0; 51 virtual int32_t GetAccessControlProfile(std::map<std::string, std::string> queryParams, 52 std::vector<AccessControlProfile>& accessControlProfiles) = 0; 53 virtual int32_t GetAllAccessControlProfile(std::vector<AccessControlProfile>& accessControlProfiles) = 0; 54 virtual int32_t DeleteAccessControlProfile(int32_t accessControlId) = 0; 55 virtual int32_t PutSessionKey(uint32_t userId, const std::vector<uint8_t>& sessionKey, int32_t& sessionKeyId) = 0; 56 virtual int32_t GetSessionKey(uint32_t userId, int32_t sessionKeyId, std::vector<uint8_t>& sessionKey) = 0; 57 virtual int32_t UpdateSessionKey(uint32_t userId, int32_t sessionKeyId, const std::vector<uint8_t>& sessionKey) = 0; 58 virtual int32_t DeleteSessionKey(uint32_t userId, int32_t sessionKeyId) = 0; 59 virtual int32_t PutDeviceProfileBatch(std::vector<DeviceProfile>& deviceProfiles) = 0; 60 virtual int32_t PutServiceProfile(const ServiceProfile& serviceProfile) = 0; 61 virtual int32_t PutServiceProfileBatch(const std::vector<ServiceProfile>& serviceProfiles) = 0; 62 virtual int32_t PutCharacteristicProfile(const CharacteristicProfile& charProfile) = 0; 63 virtual int32_t PutCharacteristicProfileBatch(const std::vector<CharacteristicProfile>& charProfiles) = 0; 64 virtual int32_t GetDeviceProfile(const std::string& deviceId, DeviceProfile& deviceProfile) = 0; 65 virtual int32_t GetDeviceProfiles(DeviceProfileFilterOptions& options, 66 std::vector<DeviceProfile>& deviceProfiles) = 0; 67 virtual int32_t DeleteDeviceProfileBatch(std::vector<DeviceProfile>& deviceProfiles) = 0; 68 virtual int32_t GetServiceProfile(const std::string& deviceId, const std::string& serviceName, 69 ServiceProfile& serviceProfile) = 0; 70 virtual int32_t GetCharacteristicProfile(const std::string& deviceId, const std::string& serviceName, 71 const std::string& characteristicId, CharacteristicProfile& charProfile) = 0; 72 virtual int32_t DeleteServiceProfile(const std::string& deviceId, const std::string& serviceName, 73 bool isMultiUser = false, int32_t userId = DEFAULT_USER_ID) = 0; 74 virtual int32_t DeleteCharacteristicProfile(const std::string& deviceId, const std::string& serviceName, 75 const std::string& characteristicId, bool isMultiUser = false, int32_t userId = DEFAULT_USER_ID) = 0; 76 virtual int32_t SubscribeDeviceProfile(const SubscribeInfo& subscribeInfo) = 0; 77 virtual int32_t UnSubscribeDeviceProfile(const SubscribeInfo& subscribeInfo) = 0; 78 virtual int32_t SubscribeDeviceProfileInited(int32_t saId, sptr<IRemoteObject> dpInitedCallback) = 0; 79 virtual int32_t UnSubscribeDeviceProfileInited(int32_t saId) = 0; 80 virtual int32_t SubscribePinCodeInvalid(const std::string& bundleName, int32_t pinExchangeType, 81 sptr<IRemoteObject> pinCodeCallback) = 0; 82 virtual int32_t UnSubscribePinCodeInvalid(const std::string& bundleName, int32_t pinExchangeType) = 0; 83 virtual int32_t SyncDeviceProfile(const DistributedDeviceProfile::DpSyncOptions& syncOptions, 84 sptr<IRemoteObject> syncCompletedCallback) = 0; 85 virtual int32_t SendSubscribeInfos(std::map<std::string, SubscribeInfo> listenerMap) = 0; 86 virtual int32_t PutAllTrustedDevices(const std::vector<TrustedDeviceInfo> deviceInfos) = 0; 87 virtual int32_t PutProductInfoBatch(const std::vector<ProductInfo>& productInfos) = 0; 88 virtual int32_t PutDeviceIconInfoBatch(const std::vector<DeviceIconInfo>& deviceIconInfos) = 0; 89 virtual int32_t GetDeviceIconInfos(const DeviceIconInfoFilterOptions& filterOptions, 90 std::vector<DeviceIconInfo>& deviceIconInfos) = 0; 91 virtual int32_t PutServiceInfoProfile(const ServiceInfoProfile& serviceInfoProfile) = 0; 92 virtual int32_t DeleteServiceInfoProfile(const ServiceInfoUniqueKey& key) = 0; 93 virtual int32_t UpdateServiceInfoProfile(const ServiceInfoProfile& serviceInfoProfile) = 0; 94 virtual int32_t GetServiceInfoProfileByUniqueKey(const ServiceInfoUniqueKey& key, 95 ServiceInfoProfile& serviceInfoProfile) = 0; 96 virtual int32_t GetServiceInfoProfileListByTokenId(const ServiceInfoUniqueKey& key, 97 std::vector<ServiceInfoProfile>& serviceInfoProfiles) = 0; 98 virtual int32_t GetAllServiceInfoProfileList(std::vector<ServiceInfoProfile>& serviceInfoProfiles) = 0; 99 virtual int32_t GetServiceInfoProfileListByBundleName(const ServiceInfoUniqueKey& key, 100 std::vector<ServiceInfoProfile>& serviceInfoProfiles) = 0; 101 virtual int32_t PutLocalServiceInfo(const LocalServiceInfo& localServiceInfo) = 0; 102 virtual int32_t UpdateLocalServiceInfo(const LocalServiceInfo& localServiceInfo) = 0; 103 virtual int32_t GetLocalServiceInfoByBundleAndPinType(const std::string& bundleName, 104 int32_t pinExchangeType, LocalServiceInfo& localServiceInfo) = 0; 105 virtual int32_t DeleteLocalServiceInfo(const std::string& bundleName, int32_t pinExchangeType) = 0; 106 }; 107 } // namespace DistributedDeviceProfile 108 } // namespace OHOS 109 #endif // OHOS_DP_I_DISTRIBUTED_DEVICE_PROFILE_H 110