1 /*
2  * Copyright (c) 2023 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_I_AVCAST_STATE_LISTENER_H
17 #define OHOS_I_AVCAST_STATE_LISTENER_H
18 
19 #include <string>
20 #include "avsession_descriptor.h"
21 
22 /**
23  * @brief Router is a part related to cast media
24  * @since 10
25  */
26 namespace OHOS::AVSession {
27 class IAVCastStateListener {
28 public:
29     /**
30      * Notify Router that the device has been discovered.
31      *
32      * @param { std::vector<DeviceInfo> } deviceInfos - Discovered device infos.
33      * @since 10
34     */
35     virtual void OnDeviceAvailable(std::vector<DeviceInfo> deviceInfos) = 0;
36 
37     /**
38      * @brief Listen for the event of device logging.
39      *
40      * @param { DeviceLogEventCode } eventId - Event ID.
41      * @param { int64_t } int64_t - Param.
42      * @since 13
43     */
OnDeviceLogEvent(const DeviceLogEventCode eventId,const int64_t param)44     virtual void OnDeviceLogEvent(const DeviceLogEventCode eventId, const int64_t param) {};
45 
46     /**
47      * Listen for the event of device offline.
48      *
49      * @param { std::string& } deviceId - Offlined device ID.
50      * @since 10
51     */
52     virtual void OnDeviceOffline(const std::string& deviceId) = 0;
53 
54     /**
55      * Notify Router that the cast session should be destroy.
56      *
57      * @since 10
58     */
59     virtual void OnSessionNeedDestroy() = 0;
60 
61     /**
62      * Notify Router that the cast session has created.
63      *
64      * @param { int32_t } castId - Cast id for AVRouter's control.
65      * @since 10
66     */
67     virtual void OnSessionCreated(const int32_t castId) = 0;
68 
69     /**
70      * Notify Router that the cast engine service has died.
71      *
72      * @since 10
73     */
74     virtual void OnCastServerDied() = 0;
75 };
76 } // namespace OHOS::AVSession
77 #endif // OHOS_I_AVCAST_STATE_LISTENER_H
78