sharee.bike-App/LastenradBayern/ShareeBike.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;
2024-04-09 12:53:23 +02:00
using ShareeBike.Model.Device;
2021-11-07 19:42:59 +01:00
using Xamarin.Essentials;
2024-04-09 12:53:23 +02:00
[assembly: Xamarin.Forms.Dependency(typeof(ShareeBike.iOS.Device.Device))]
namespace ShareeBike.iOS.Device
2021-11-07 19:42:59 +01:00
{
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
}