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 OHOS_REMOTE_SESSION_SYNCER_H 17 #define OHOS_REMOTE_SESSION_SYNCER_H 18 19 #include "avsession_info.h" 20 #include "avmeta_data.h" 21 #include "avplayback_state.h" 22 #include "avmedia_description.h" 23 #include "avqueue_item.h" 24 #include "avcontrol_command.h" 25 26 namespace OHOS::AVSession { 27 class RemoteSessionSyncer { 28 public: 29 using ObjectDataNotifier = std::function<void(const SessionDataCategory category, const std::string& deviceId)>; 30 using ObjectDisconnectNotifier = std::function<void(const std::string& deviceId)>; 31 32 virtual int32_t Init() = 0; 33 34 virtual int32_t PutAVMetaData(const AVMetaData& metaData) = 0; 35 36 virtual int32_t GetAVMetaData(AVMetaData& metaData) = 0; 37 38 virtual int32_t PutAVPlaybackState(const AVPlaybackState& state) = 0; 39 40 virtual int32_t GetAVPlaybackState(AVPlaybackState& state) = 0; 41 42 virtual int32_t PutControlCommand(const AVControlCommand& command) = 0; 43 44 virtual int32_t GetControlCommand(AVControlCommand& command) = 0; 45 46 virtual int32_t PutCommonCommand(const std::string& commonCommand, const AAFwk::WantParams& commandArgs) = 0; 47 48 virtual int32_t GetCommonCommand(std::string& commonCommand, AAFwk::WantParams& commandArgs) = 0; 49 50 virtual int32_t PutSessionEvent(const std::string& event, const AAFwk::WantParams& args) = 0; 51 52 virtual int32_t GetSessionEvent(std::string& event, AAFwk::WantParams& args) = 0; 53 54 virtual int32_t PutAVQueueItems(const std::vector<AVQueueItem>& items) = 0; 55 56 virtual int32_t GetAVQueueItems(std::vector<AVQueueItem>& items) = 0; 57 58 virtual int32_t PutAVQueueTitle(const std::string& items) = 0; 59 60 virtual int32_t GetAVQueueTitle(std::string& items) = 0; 61 62 virtual int32_t PutExtras(const AAFwk::WantParams& extras) = 0; 63 64 virtual int32_t GetExtras(AAFwk::WantParams& extras) = 0; 65 66 virtual int32_t RegisterDataNotifier(const ObjectDataNotifier& notifier) = 0; 67 68 virtual int32_t RegisterDisconnectNotifier(const ObjectDisconnectNotifier& notifier) = 0; 69 70 virtual void Destroy() = 0; 71 72 virtual ~RemoteSessionSyncer() = default; 73 }; 74 } // namespace OHOS::AVSession 75 #endif // OHOS_REMOTE_SESSION_SYNCER_H