• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef HDC_DAEMON_UNITY_H
16 #define HDC_DAEMON_UNITY_H
17 #include "daemon_common.h"
18 
19 namespace Hdc {
20 class HdcDaemonUnity : public HdcTaskBase {
21 public:
22     HdcDaemonUnity(HTaskInfo hTaskInfo);
23     virtual ~HdcDaemonUnity();
24     bool CommandDispatch(const uint16_t command, uint8_t *payload, const int payloadSize) override;
25     void StopTask() override;
26     bool ReadyForRelease() override;
27 
28 private:
29     static void OnFdRead(uv_fs_t *req);
30     int ExecuteShell(const string &shellCommand, string optionPath = "");
31     bool FindMountDeviceByPath(const char *toQuery, char *dev);
32     bool RemountPartition(const char *dir);
33     bool CallRemount();
34     bool RemountDevice();
35     bool RebootDevice(const string &cmd);
36     bool SetDeviceRunMode(const char *cmd);
37     bool GetHiLog(const char *cmd);
38     bool ListJdwpProcess(void *daemonIn);
39     bool AsyncCmdOut(bool finish, int64_t exitStatus, const string result);
40     bool TrackJdwpProcess(void *daemonIn, const string& param);
41     void RemoveJdwpTracker();
42     int ExecuteShellExtend(const uint8_t *payload, const int payloadSize);
43     int ExecuteOptionShell(const string &shellCommand, const string &bundleName);
44     bool CheckbundlePath(const string &bundleName, string &mountPath);
45     AsyncCmd asyncCommand;
46     uint16_t currentDataCommand;
47 #ifdef UNIT_TEST
48     int countUt = 0;
49 #endif
50 };
51 }  // namespace Hdc
52 #endif  // HDC_DAEMON_UNITY_H
53