• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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 FOUNDATION_RESOURCESCHEDULE_BACKGROUND_TASK_MGR_INTERFACES_INNERKITS_INCLUDE_LONGTIME_TASK_EVENT_DATA_H
17 #define FOUNDATION_RESOURCESCHEDULE_BACKGROUND_TASK_MGR_INTERFACES_INNERKITS_INCLUDE_LONGTIME_TASK_EVENT_DATA_H
18 
19 #include <cstdint>
20 #include <sys/types.h>
21 #include <string>
22 
23 #include "parcel.h"
24 
25 namespace OHOS {
26 namespace BackgroundTaskMgr {
27 class ContinuousTaskCallbackInfo : public Parcelable {
28 public:
29     ContinuousTaskCallbackInfo();
30     ContinuousTaskCallbackInfo(uint32_t typeId, int32_t creatorUid, pid_t creatorPid, std::string abilityName);
31 
32     /**
33      * @brief Get the id of type.
34      *
35      * @return The id of type.
36      */
37     uint32_t GetTypeId() const;
38 
39     /**
40      * @brief Get the uid of notification crector.
41      *
42      * @return The uid of the notification creator.
43      */
44     int32_t GetCreatorUid() const;
45 
46     /**
47      * @brief Get the pid of notification crector.
48      *
49      * @return The pid of the notification creator.
50      */
51     pid_t GetCreatorPid() const;
52 
53     /**
54      * @brief Get the name of ability.
55      *
56      * @return The name of ability.
57      */
58     std::string GetAbilityName() const;
59 
60     /**
61      * @brief Marshals a purpose into a parcel.
62      *
63      * @param parcel Indicates the parcel object for marshalling.
64      * @return True if success, else false.
65      */
66     bool Marshalling(Parcel &parcel) const override;
67     static ContinuousTaskCallbackInfo *Unmarshalling(Parcel &parcel);
68 
69 private:
70     bool ReadFromParcel(Parcel &parcel);
71 
72 private:
73     uint32_t typeId_ {0};
74     int32_t creatorUid_ {0};
75     pid_t creatorPid_ {0};
76     std::string abilityName_ {""};
77 };
78 }  // namespace BackgroundTaskMgr
79 }  // namespace OHOS
80 #endif  // FOUNDATION_RESOURCESCHEDULE_BACKGROUND_TASK_MGR_INTERFACES_INNERKITS_INCLUDE_LONGTIME_TASK_EVENT_DATA_H