sharee.bike-App/LastenradBayern/TINK.iOS/Device/Device.cs

35 lines
1.3 KiB
C#
Raw Normal View History

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