RDK Documentation (Open Sourced RDK Components)
mediabrowser.h
1 /*
2  * If not stated otherwise in this file or this component's Licenses.txt file the
3  * following copyright and licenses apply:
4  *
5  * Copyright 2021 RDK Management
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18 */
19 
20 #ifndef _XUPNP_MEDIABROWSER_H
21 #define _XUPNP_MEDIABROWSER_H
22 
23 #include <stdbool.h>
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 #define METHOD_DISCOVER_MEDIA_DEVICES_SIZE "Device.Methods.dlna.getDiscoveredDevicesSize()"
29 #define METHOD_GET_MEDIA_DEVICE_AT "Device.Methods.dlna.getDiscoveredDeviceAt()"
30 #define METHOD_BROWSE_CONTENT_ON_MEDIA_SERVER "Device.Methods.dlna.browseContentOnServer()"
31 
32 /**
33  * This method initializes the RPC communication between rdkservice and xupnp dlna counter part
34  * return true if the RPC initialization succeeds , false otherwise.
35  * */
36 bool InitializeRPC();
37 
38 /**
39  * Returns a count of discovered servers
40  *
41  * param size OUT count of servers present in the array
42  *
43  * return true if the RPC call succeeds, false otherwise
44  */
45 bool getDiscoveredMediaServers(int * size);
46 
47 
48 /**
49  * Returns a list of discovered servers
50  *
51  * param index IN the index for device for which information is requested, starts from 0.
52  * param friendlyName OUT will provide the name of the server
53  * param udn OUT the device unique id
54  * param error OUT sets to one if an error occured.
55  *
56  * return true if the RPC call succeeds, false otherwise
57  */
58 bool getDiscoveredMediaServerAt(int index, char **friendlyName, char ** udn,int * error);
59 
60 /**
61  * Returns the contents from the specified directory. This method can be repeatedly invoked on the
62  * same directory if the max_entries is less than total content size, by givign appropriate
63  * starting point.
64  *
65  * param server IN server the server object representing media server
66  * param path_id IN the path id representing the directory for which the content
67  * is requested, if NULL, root directory is assumed
68  * param start_index IN starting index of contents,
69  * zero if calling first time,
70  * param max_entries IN the maximum number of entries expected in result
71  * param total_count OUT total number of items present.
72  * param content_list OUT content list in xml format with meta-data information.
73  * Refer "ContentDirectory:1 Service Template Version 1.01" for more details.
74  * param error OUT sets to one if an error occured, 0 otherwise.
75  *
76  * return true if the RPC call succeeds, false otherwise
77  */
78 
79 bool browseContentOnServer(const char * server_udn, const char * path_id, int start_index,
80  int max_entries, int *total_count, char ** content_list, int * error);
81 
82 /**
83  * Clean up the IPC communication channel between rdkservice and xupnp dlna counter part
84  * */
85 void cleanup();
86 #ifdef __cplusplus
87 }
88 #endif
89 
90 #endif //_XUPNP_MEDIABROWSER_H