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 provide methods and properties for DRM operation
27 public class PackageDrm
29 private string _responseData;
30 private string _requestData;
31 private string _licenseUrl;
32 private PackageDrm(string responseData, string requestData, string licenseUrl)
34 _responseData = responseData;
35 _requestData = requestData;
36 _licenseUrl = licenseUrl;
40 /// Returns response data
42 /// <returns>Returns response data which is given when GenerateLicenseRequest has invoked</returns>
43 public string ResponseData { get { return _responseData; } }
46 /// Returns request data
48 /// <returns>Returns request data which is generated when GenerateLicenseRequest has invoked</returns>
49 public string RequestData { get { return _requestData; } }
52 /// Returns license URL
54 /// <returns>Returns license URL which is generated when GenerateLicenseRequest has invoked</returns>
55 public string LicenseUrl { get { return _licenseUrl; } }
57 internal static PackageDrm CreateDrmRequest(string responseData, string requestData, string licenseUrl)
59 PackageDrm packageDrm = new PackageDrm(responseData, requestData, licenseUrl);
63 internal static PackageDrm GenerateLicenseRequest(string responseData)
67 Interop.PackageManager.ErrorCode err = Interop.PackageManager.PackageManagerDrmGenerateLicenseRequest(responseData, out requestData, out licenseUrl);
68 if (err != Interop.PackageManager.ErrorCode.None)
70 throw PackageManagerErrorFactory.GetException(err, "Failed to generate license request");
73 PackageDrm packageDrm = CreateDrmRequest(responseData, requestData, licenseUrl);