1 /*
2  * Copyright (c) 2020 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_ABILITY_CONNECT_RECORD_H
17 #define OHOS_ABILITY_CONNECT_RECORD_H
18 
19 #include "ipc_skeleton.h"
20 #include "samgr_lite.h"
21 
22 namespace OHOS {
23 enum ConnectStatus {
24     INIT,
25     WAIT_CONNECT,
26     CONNECTING,
27     CONNECTED,
28     DISCONNECTING,
29     DISCONNECT,
30     STOPPING,
31     STOPPED,
32 };
33 
34 class AbilityConnectRecord {
35 public:
AbilityConnectRecord(const SvcIdentity & identity,uint64_t abilityToken)36     AbilityConnectRecord(const SvcIdentity &identity, uint64_t abilityToken)
37         : connectSid_(identity), abilityToken_(abilityToken) {};
38 
39     ~AbilityConnectRecord() = default;
40 
SetStatus(ConnectStatus status)41     void SetStatus(ConnectStatus status)
42     {
43         status_ = status;
44     }
45 
GetStatus()46     ConnectStatus GetStatus() const
47     {
48         return status_;
49     }
50 
GetConnectSid()51     const SvcIdentity &GetConnectSid() const
52     {
53         return connectSid_;
54     }
55 
GetAbilityToken()56     uint64_t GetAbilityToken() const
57     {
58         return abilityToken_;
59     }
60 
61 private:
62     const SvcIdentity connectSid_;
63     const uint64_t abilityToken_;
64     ConnectStatus status_ = ConnectStatus::INIT;
65 };
66 } // namespace OHOS
67 
68 #endif // OHOS_ABILITY_CONNECT_RECORD_H
69