• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 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 COLLABORATION_MANAGER_H
17 #define COLLABORATION_MANAGER_H
18 
19 #include <string>
20 #include "avsession_log.h"
21 #include "avsession_errors.h"
22 #include "collaboration_manager_utils.h"
23 #include "plugin_lib.h"
24 
25 namespace OHOS::AVSession {
26 class CollaborationManager {
27 public:
28     static CollaborationManager& GetInstance();
29     CollaborationManager();
30     virtual ~CollaborationManager();
31     void SendCollaborationApplyResult(const std::function<void(const int32_t code)>& callback);
32     void SendCollaborationOnStop(const std::function<void(void)>& callback);
33     int32_t ReadCollaborationManagerSo();
34     int32_t RegisterLifecycleCallback();
35     int32_t UnRegisterLifecycleCallback();
36     int32_t PublishServiceState(const char* peerNetworkId, ServiceCollaborationManagerBussinessStatus state);
37     int32_t ApplyAdvancedResource(const char* peerNetworkId);
38 
39     std::function<void(const int32_t code)> sendCollaborationApplyResult_;
40     std::function<void(void)> sendCollaborationOnStop_;
41 
42 private:
43     const int32_t remoteHardwareListSize_ = 2;
44     const int32_t localHardwareListSize_ = 0;
45     const std::string serviceName_ = "URLCasting";
46     const std::string dataType_ = "DATA_TYPE_BYTES";
47     PluginLib pluginLib_ {"/system/lib64/libcfwk_allconnect_client.z.so"};
48     ServiceCollaborationManager_ResourceRequestInfoSets *resourceRequest_ =
49         new ServiceCollaborationManager_ResourceRequestInfoSets();
50     ServiceCollaborationManager_API exportapi_;
51 
52     using CollaborationManagerExportFunType = int32_t (*)(ServiceCollaborationManager_API *exportapi);
53     CollaborationManagerExportFunType collaborationManagerExportFun_;
54     ServiceCollaborationManager_HardwareRequestInfo localHardwareList_;
55     ServiceCollaborationManager_HardwareRequestInfo remoteHardwareList_[2];
56     ServiceCollaborationManager_CommunicationRequestInfo communicationRequest_;
57 };
58 }   // namespace OHOS::AVSession
59 #endif //COLLABORATION_MANAGER_H