2 * Copyright (c) 2021 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.
19 namespace Tizen.Applications
22 /// A class to represent peer info.
24 /// <since_tizen> 9 </since_tizen>
25 public class PeerInfo : IDisposable
27 private readonly string LogTag = "Tizen.Cion";
28 internal PeerInfoSafeHandle _handle;
30 internal PeerInfo(PeerInfoSafeHandle handle)
36 /// Gets the device id.
38 /// <since_tizen> 9 </since_tizen>
39 public string DeviceId
43 Interop.Cion.ErrorCode ret = Interop.CionPeerInfo.CionPeerInfoGetDeviceId(_handle, out string deviceId);
44 if (ret != Interop.Cion.ErrorCode.None)
46 Log.Error(LogTag, "Failed to get device id.");
54 /// Gets the device name.
56 /// <since_tizen> 9 </since_tizen>
57 public string DeviceName
61 Interop.Cion.ErrorCode ret = Interop.CionPeerInfo.CionPeerInfoGetDeviceName(_handle, out string deviceName);
62 if (ret != Interop.Cion.ErrorCode.None)
64 Log.Error(LogTag, "Failed to get device name.");
72 /// Gets the device platform.
74 /// <since_tizen> 9 </since_tizen>
75 public string DevicePlatform
79 Interop.Cion.ErrorCode ret = Interop.CionPeerInfo.CionPeerInfoGetDevicePlatform(_handle, out string devicePlatform);
80 if (ret != Interop.Cion.ErrorCode.None)
82 Log.Error(LogTag, "Failed to get device platform.");
85 return devicePlatform;
90 /// Gets the device platform version.
92 /// <since_tizen> 9 </since_tizen>
93 public string DevicePlatformVersion
97 Interop.Cion.ErrorCode ret = Interop.CionPeerInfo.CionPeerInfoGetDevicePlatformVersion(_handle, out string devicePlatformVersion);
98 if (ret != Interop.Cion.ErrorCode.None)
100 Log.Error(LogTag, "Failed to get device platform version.");
103 return devicePlatformVersion;
108 /// Gets the device type.
110 /// <since_tizen> 9 </since_tizen>
111 public string DeviceType
115 Interop.Cion.ErrorCode ret = Interop.CionPeerInfo.CionPeerInfoGetDeviceType(_handle, out string deviceType);
116 if (ret != Interop.Cion.ErrorCode.None)
118 Log.Error(LogTag, "Failed to get device platform type.");
126 /// Gets the application id.
128 /// <since_tizen> 9 </since_tizen>
133 Interop.Cion.ErrorCode ret = Interop.CionPeerInfo.CionPeerInfoGetAppId(_handle, out string AppId);
134 if (ret != Interop.Cion.ErrorCode.None)
136 Log.Error(LogTag, "Failed to get application id.");
144 /// Gets the application version.
146 /// <since_tizen> 9 </since_tizen>
147 public string AppVersion
151 Interop.Cion.ErrorCode ret = Interop.CionPeerInfo.CionPeerInfoGetAppVersion(_handle, out string AppVersion);
152 if (ret != Interop.Cion.ErrorCode.None)
154 Log.Error(LogTag, "Failed to get application version.");
164 /// <since_tizen> 9 </since_tizen>
169 Interop.Cion.ErrorCode ret = Interop.CionPeerInfo.CionPeerInfoGetUuid(_handle, out string uuid);
170 if (ret != Interop.Cion.ErrorCode.None)
172 Log.Error(LogTag, "Failed to get UUID.");
179 #region IDisposable Support
180 private bool disposedValue = false;
183 /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects.
185 /// <param name="disposing">If true, disposes any disposable objects. If false, does not dispose disposable objects.</param>
186 /// <since_tizen> 9 </since_tizen>
187 protected virtual void Dispose(bool disposing)
195 disposedValue = true;
200 /// Releases all resources used by the PeerInfo class.
202 /// <since_tizen> 9 </since_tizen>
203 public void Dispose()
206 GC.SuppressFinalize(this);