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 DEVICE_PROFILE_DP_COMMAND_H
17 #define DEVICE_PROFILE_DP_COMMAND_H
18 
19 #include <iosfwd>
20 #include <list>
21 #include <stdint.h>
22 
23 #include "device_profile_log.h"
24 #include "errors.h"
25 #include "iprofile_event_callback.h"
26 #include "shell_command.h"
27 
28 namespace OHOS {
29 namespace DeviceProfile {
30 class DpShellCommand : public OHOS::DeviceProfile::ShellCommand {
31 public:
32     DpShellCommand(int argc, char *argv[]);
~DpShellCommand()33     ~DpShellCommand() override {}
34 
35 private:
36     ErrCode CreateCommandMap() override;
37     ErrCode CreateMessageMap() override;
38     ErrCode init() override;
39 
40     ErrCode HelpCommand();
41     ErrCode GetDeviceCommand();
42     ErrCode QueryCommand();
43     ErrCode PutCommand();
44     ErrCode DeleteCommand();
45     ErrCode SyncCommand();
46     ErrCode SubscribeCommand();
47 
48     int32_t HandleUnknownOption(char optopt);
49     int32_t HandleNormalOption(int option, std::string& deviceId,
50         std::string& serviceId, std::string& serviceType);
51     int32_t HandleSyncOption(int option, std::string& mode,
52         std::list<std::string>& deviceIds);
53     int32_t HandleSubscribeOption(int option, std::string& deviceId,
54         std::list<std::string>& serviceIds);
55 };
56 
57 class ProfileEventCallback : public IProfileEventCallback {
58 public:
59     void OnSyncCompleted(const SyncResult& syncResults) override;
60     void OnProfileChanged(const ProfileChangeNotification& changeNotification) override;
61 };
62 }  // namespace DeviceProfile
63 }  // namespace OHOS
64 
65 #endif  // DEVICE_PROFILE_DP_COMMAND_H