2 * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.Collections.Generic;
19 using System.Runtime.InteropServices;
20 using System.Threading.Tasks;
22 namespace Tizen.Applications
25 /// This class provides the methods and properties for the DRM operation.
27 /// <since_tizen> 4 </since_tizen>
28 public class PackageDrm
30 private string _responseData;
31 private string _requestData;
32 private string _licenseUrl;
33 private PackageDrm(string responseData, string requestData, string licenseUrl)
35 _responseData = responseData;
36 _requestData = requestData;
37 _licenseUrl = licenseUrl;
41 /// Returns the response data.
43 /// <returns>Returns the response data which is given when GenerateLicenseRequest has been invoked.</returns>
44 /// <since_tizen> 4 </since_tizen>
45 public string ResponseData { get { return _responseData; } }
48 /// Returns the request data.
50 /// <returns>Returns the request data which is generated when GenerateLicenseRequest has been invoked.</returns>
51 /// <since_tizen> 4 </since_tizen>
52 public string RequestData { get { return _requestData; } }
55 /// Returns the license URL.
57 /// <returns>Returns the license URL which is generated when GenerateLicenseRequest has been invoked.</returns>
58 /// <since_tizen> 4 </since_tizen>
59 public string LicenseUrl { get { return _licenseUrl; } }
61 internal static PackageDrm CreateDrmRequest(string responseData, string requestData, string licenseUrl)
63 PackageDrm packageDrm = new PackageDrm(responseData, requestData, licenseUrl);
67 internal static PackageDrm GenerateLicenseRequest(string responseData)
71 Interop.PackageManager.ErrorCode err = Interop.PackageManager.PackageManagerDrmGenerateLicenseRequest(responseData, out requestData, out licenseUrl);
72 if (err != Interop.PackageManager.ErrorCode.None)
74 throw PackageManagerErrorFactory.GetException(err, "Failed to generate license request");
77 PackageDrm packageDrm = CreateDrmRequest(responseData, requestData, licenseUrl);