1 /* 2 * Copyright (c) 2021 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_DISTRIBUTED_DEVICE_PROFILE_SERVICE_H 17 #define OHOS_DISTRIBUTED_DEVICE_PROFILE_SERVICE_H 18 19 #include "distributed_device_profile_stub.h" 20 #include "single_instance.h" 21 22 #include "system_ability.h" 23 24 namespace OHOS { 25 namespace DeviceProfile { 26 class DistributedDeviceProfileService : public SystemAbility, public DistributedDeviceProfileStub { 27 DECLARE_SYSTEM_ABILITY(DistributedDeviceProfileService); 28 DECLARE_SINGLE_INSTANCE_BASE(DistributedDeviceProfileService); 29 30 public: 31 DistributedDeviceProfileService(); 32 ~DistributedDeviceProfileService() = default; 33 34 int32_t PutDeviceProfile(const ServiceCharacteristicProfile& profile) override; 35 int32_t DeleteDeviceProfile(const std::string& serviceId) override; 36 int32_t GetDeviceProfile(const std::string& udid, const std::string& serviceId, 37 ServiceCharacteristicProfile& profile) override; 38 int32_t SubscribeProfileEvents(const std::list<SubscribeInfo>& subscribeInfos, 39 const sptr<IRemoteObject>& profileEventNotifier, 40 std::list<ProfileEvent>& failedEvents) override; 41 int32_t UnsubscribeProfileEvents(const std::list<ProfileEvent>& profileEvents, 42 const sptr<IRemoteObject>& profileEventNotifier, 43 std::list<ProfileEvent>& failedEvents) override; 44 int32_t SyncDeviceProfile(const SyncOptions& syncOptions, 45 const sptr<IRemoteObject>& profileEventNotifier) override; 46 int32_t Dump(int32_t fd, const std::vector<std::u16string>& args) override; 47 48 protected: 49 void OnStart() override; 50 void OnStop() override; 51 52 private: 53 bool Init(); 54 }; 55 } // namespace DeviceProfile 56 } // namespace OHOS 57 #endif // OHOS_DISTRIBUTED_DEVICE_PROFILE_SERVICE_H