2021-05-13 20:16:41 +02:00
|
|
|
|
using System;
|
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
using TINK.Model.Device;
|
2021-06-26 20:57:55 +02:00
|
|
|
|
using Xamarin.Essentials;
|
2021-05-13 20:16:41 +02:00
|
|
|
|
|
|
|
|
|
[assembly: Xamarin.Forms.Dependency(typeof(TINK.iOS.Device.Device))]
|
|
|
|
|
namespace TINK.iOS.Device
|
|
|
|
|
{
|
2021-06-26 20:57:55 +02:00
|
|
|
|
public class Device : ISmartDevice
|
2021-05-13 20:16:41 +02:00
|
|
|
|
{
|
|
|
|
|
[DllImport("/System/Library/Frameworks/IOKit.framework/IOKit")]
|
|
|
|
|
private static extern uint IOServiceGetMatchingService(uint masterPort, IntPtr matching);
|
|
|
|
|
|
|
|
|
|
[DllImport("/System/Library/Frameworks/IOKit.framework/IOKit")]
|
|
|
|
|
private static extern IntPtr IOServiceMatching(string s);
|
|
|
|
|
|
|
|
|
|
[DllImport("/System/Library/Frameworks/IOKit.framework/IOKit")]
|
|
|
|
|
private static extern IntPtr IORegistryEntryCreateCFProperty(uint entry, IntPtr key, IntPtr allocator, uint options);
|
|
|
|
|
|
|
|
|
|
[DllImport("/System/Library/Frameworks/IOKit.framework/IOKit")]
|
|
|
|
|
private static extern int IOObjectRelease(uint o);
|
|
|
|
|
|
2021-06-26 20:57:55 +02:00
|
|
|
|
public string Manufacturer => DeviceInfo.Manufacturer;
|
|
|
|
|
|
|
|
|
|
public string Model => DeviceInfo.Model;
|
|
|
|
|
|
2022-08-30 15:42:25 +02:00
|
|
|
|
public DevicePlatform Platform => DeviceInfo.Platform;
|
2021-06-26 20:57:55 +02:00
|
|
|
|
|
|
|
|
|
public string VersionText => DeviceInfo.VersionString;
|
2021-05-13 20:16:41 +02:00
|
|
|
|
/// <summary> Gets unitque device identifier. </summary>
|
|
|
|
|
/// <returns>Gets the identifies specifying device.</returns>
|
2021-06-26 20:57:55 +02:00
|
|
|
|
public string Identifier
|
|
|
|
|
=> UIKit.UIDevice.CurrentDevice?.IdentifierForVendor?.AsString() ?? string.Empty;
|
2022-08-30 15:42:25 +02:00
|
|
|
|
}
|
2021-05-13 20:16:41 +02:00
|
|
|
|
}
|