mirror of
https://gitee.com/openharmony/deviceprofile_device_info_manager
synced 2024-11-23 15:40:27 +00:00
删除不需要的文件和配置
Signed-off-by: guoyi <guoyi39@huawei.com>
This commit is contained in:
parent
af8411eb22
commit
59f8a14918
@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_DP_SYNC_OPTIONS_H
|
||||
#define OHOS_DP_SYNC_OPTIONS_H
|
||||
|
||||
#include <list>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "dp_parcel.h"
|
||||
#include "distributed_device_profile_constants.h"
|
||||
#include "distributed_device_profile_enums.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedDeviceProfile {
|
||||
class DpSyncOptions : public DpParcel {
|
||||
public:
|
||||
DpSyncOptions() = default;
|
||||
~DpSyncOptions() = default;
|
||||
|
||||
std::vector<std::string> GetDeviceList() const;
|
||||
SyncMode GetSyncMode() const;
|
||||
|
||||
void AddDevice(const std::string& deviceId);
|
||||
void SetSyncMode(SyncMode mode);
|
||||
bool Marshalling(MessageParcel& parcel) const override;
|
||||
bool UnMarshalling(MessageParcel& parcel) override;
|
||||
std::string dump() const override;
|
||||
|
||||
private:
|
||||
SyncMode syncMode_{SyncMode::PUSH_PULL};
|
||||
std::vector<std::string> syncDeviceIds_;
|
||||
};
|
||||
} // namespace DistributedDeviceProfile
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_DP_DEVICE_PROFILE_SYNC_OPTIONS_H
|
@ -1,88 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "dp_sync_options.h"
|
||||
#include "macro_utils.h"
|
||||
#include "distributed_device_profile_constants.h"
|
||||
#include "nlohmann/json.hpp"
|
||||
#include "profile_utils.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedDeviceProfile {
|
||||
namespace {
|
||||
const std::string TAG = "DpSyncOptions";
|
||||
}
|
||||
|
||||
std::vector<std::string> DpSyncOptions::GetDeviceList() const
|
||||
{
|
||||
return syncDeviceIds_;
|
||||
}
|
||||
|
||||
void DpSyncOptions::AddDevice(const std::string& deviceId)
|
||||
{
|
||||
syncDeviceIds_.emplace_back(deviceId);
|
||||
}
|
||||
|
||||
SyncMode DpSyncOptions::GetSyncMode() const
|
||||
{
|
||||
return syncMode_;
|
||||
}
|
||||
|
||||
void DpSyncOptions::SetSyncMode(SyncMode mode)
|
||||
{
|
||||
syncMode_ = mode;
|
||||
}
|
||||
|
||||
bool DpSyncOptions::Marshalling(MessageParcel& parcel) const
|
||||
{
|
||||
WRITE_HELPER_RET(parcel, Int32, static_cast<int32_t>(syncMode_), false);
|
||||
WRITE_HELPER_RET(parcel, Int32, static_cast<int32_t>(syncDeviceIds_.size()), false);
|
||||
for (const auto& deviceId : syncDeviceIds_) {
|
||||
WRITE_HELPER_RET(parcel, String, deviceId, false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DpSyncOptions::UnMarshalling(MessageParcel& parcel)
|
||||
{
|
||||
int32_t mode = 0;
|
||||
READ_HELPER_RET(parcel, Int32, mode, false);
|
||||
syncMode_ = static_cast<SyncMode>(mode);
|
||||
int32_t size = 0;
|
||||
READ_HELPER_RET(parcel, Int32, size, false);
|
||||
if (size > MAX_DEVICE_SIZE) {
|
||||
return false;
|
||||
}
|
||||
for (int32_t i = 0; i < size; i++) {
|
||||
std::string deviceId;
|
||||
READ_HELPER_RET(parcel, String, deviceId, false);
|
||||
syncDeviceIds_.emplace_back(deviceId);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string DpSyncOptions::dump() const
|
||||
{
|
||||
nlohmann::json json;
|
||||
json[SYNC_MODE] = static_cast<int32_t>(syncMode_);
|
||||
std::vector<std::string> syncDeviceList;
|
||||
for (const std::string& deviceId : syncDeviceIds_) {
|
||||
syncDeviceList.push_back(deviceId);
|
||||
}
|
||||
json[SYNC_DEVICE_IDS] = syncDeviceList;
|
||||
return json.dump();
|
||||
}
|
||||
} // namespace DistributedDeviceProfile
|
||||
} // namespace OHOS
|
@ -14,11 +14,7 @@
|
||||
"uid" : "dms",
|
||||
"gid" : ["dms", "shell"],
|
||||
"ondemand" : true,
|
||||
"permission" : [
|
||||
"ohos.permission.DISTRIBUTED_DATASYNC",
|
||||
"ohos.permission.ACCESS_SERVICE_DM",
|
||||
"ohos.permission.DISTRIBUTED_SOFTBUS_CENTER"
|
||||
],
|
||||
"permission" : ["ohos.permission.DISTRIBUTED_DATASYNC", "ohos.permission.ACCESS_SERVICE_DM"],
|
||||
"jobs" : {
|
||||
"on-start" : "service:deviceprofile"
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user