--------------------------------------------------------------------------------
-- <auto-generated>                                                           --
--     This code was generated by a tool.                                     --
--                                                                            --
--     Changes to this file may cause incorrect behavior and will be lost if  --
--     the code is regenerated.                                               --
-- </auto-generated>                                                          --
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--                                                                            --
--    Copyright(c) 2018 Alexander Gamper, All Rights Reserved.                --
--                                                                            --
--    Ada-WinRT                                                               --
--                                                                            --
-- This program is free software: you can redistribute it and / or modify     --
-- it under the terms of the GNU Lesser General Public License as published by--
-- the Free Software Foundation, either version 3 of the License, or          --
-- (at your option) any later version.                                        --
--                                                                            --
-- This program is distributed in the hope that it will be useful,            --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of             --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the               --
-- GNU Lesser General Public License for more details.                        --
--                                                                            --
-- You should have received a copy of the GNU Lesser General Public License   --
-- along with this program.If not, see http://www.gnu.org/licenses            --
--                                                                            --
--------------------------------------------------------------------------------
limited with Windows.Devices.I2c.Provider;
with Windows.Foundation;
with Windows.Foundation.Collections;
--------------------------------------------------------------------------------
package Windows.Devices.I2c is

   pragma preelaborate;
   
   ------------------------------------------------------------------------
   -- Enums
   ------------------------------------------------------------------------
   
   type I2cBusSpeed is (
      StandardMode,
      FastMode
   );
   for I2cBusSpeed use (
      StandardMode => 0,
      FastMode => 1
   );
   for I2cBusSpeed'Size use 32;
   
   type I2cBusSpeed_Ptr is access I2cBusSpeed;
   
   type I2cSharingMode is (
      Exclusive,
      Shared
   );
   for I2cSharingMode use (
      Exclusive => 0,
      Shared => 1
   );
   for I2cSharingMode'Size use 32;
   
   type I2cSharingMode_Ptr is access I2cSharingMode;
   
   type I2cTransferStatus is (
      FullTransfer,
      PartialTransfer,
      SlaveAddressNotAcknowledged,
      ClockStretchTimeout,
      UnknownError
   );
   for I2cTransferStatus use (
      FullTransfer => 0,
      PartialTransfer => 1,
      SlaveAddressNotAcknowledged => 2,
      ClockStretchTimeout => 3,
      UnknownError => 4
   );
   for I2cTransferStatus'Size use 32;
   
   type I2cTransferStatus_Ptr is access I2cTransferStatus;
   
   ------------------------------------------------------------------------
   -- Record types
   ------------------------------------------------------------------------
   
   type I2cTransferResult is record
      Status : Windows.Devices.I2c.I2cTransferStatus;
      BytesTransferred : Windows.UInt32;
   end record;
   pragma Convention (C_Pass_By_Copy , I2cTransferResult);
   
   type I2cTransferResult_Ptr is access I2cTransferResult;
   
   ------------------------------------------------------------------------
   -- Forward Declaration - Delegates/Events
   ------------------------------------------------------------------------
   
   type AsyncOperationCompletedHandler_II2cController_Interface;
   type AsyncOperationCompletedHandler_II2cController is access all AsyncOperationCompletedHandler_II2cController_Interface'Class;
   type AsyncOperationCompletedHandler_II2cController_Ptr is access all AsyncOperationCompletedHandler_II2cController;
   type AsyncOperationCompletedHandler_II2cDevice_Interface;
   type AsyncOperationCompletedHandler_II2cDevice is access all AsyncOperationCompletedHandler_II2cDevice_Interface'Class;
   type AsyncOperationCompletedHandler_II2cDevice_Ptr is access all AsyncOperationCompletedHandler_II2cDevice;
   
   ------------------------------------------------------------------------
   -- Forward Declaration - Interfaces
   ------------------------------------------------------------------------
   
   type IAsyncOperation_II2cController_Interface;
   type IAsyncOperation_II2cController is access all IAsyncOperation_II2cController_Interface'Class;
   type IAsyncOperation_II2cController_Ptr is access all IAsyncOperation_II2cController;
   type IAsyncOperation_II2cDevice_Interface;
   type IAsyncOperation_II2cDevice is access all IAsyncOperation_II2cDevice_Interface'Class;
   type IAsyncOperation_II2cDevice_Ptr is access all IAsyncOperation_II2cDevice;
   type II2cConnectionSettings_Interface;
   type II2cConnectionSettings is access all II2cConnectionSettings_Interface'Class;
   type II2cConnectionSettings_Ptr is access all II2cConnectionSettings;
   type II2cConnectionSettingsFactory_Interface;
   type II2cConnectionSettingsFactory is access all II2cConnectionSettingsFactory_Interface'Class;
   type II2cConnectionSettingsFactory_Ptr is access all II2cConnectionSettingsFactory;
   type II2cController_Interface;
   type II2cController is access all II2cController_Interface'Class;
   type II2cController_Ptr is access all II2cController;
   type II2cControllerStatics_Interface;
   type II2cControllerStatics is access all II2cControllerStatics_Interface'Class;
   type II2cControllerStatics_Ptr is access all II2cControllerStatics;
   type II2cDevice_Interface;
   type II2cDevice is access all II2cDevice_Interface'Class;
   type II2cDevice_Ptr is access all II2cDevice;
   type II2cDeviceStatics_Interface;
   type II2cDeviceStatics is access all II2cDeviceStatics_Interface'Class;
   type II2cDeviceStatics_Ptr is access all II2cDeviceStatics;
   
   ------------------------------------------------------------------------
   -- Interfaces
   ------------------------------------------------------------------------
   
   ------------------------------------------------------------------------
   
   IID_IAsyncOperation_II2cController : aliased constant Windows.IID := (2767920596, 32969, 23137, (174, 141, 200, 167, 175, 192, 50, 117 ));
   
   type IAsyncOperation_II2cController_Interface is interface and Windows.IInspectable_Interface;
   
   function put_Completed
   (
      This       : access IAsyncOperation_II2cController_Interface
      ; handler : Windows.Devices.I2c.AsyncOperationCompletedHandler_II2cController
   )
   return Windows.HRESULT is abstract;
   
   function get_Completed
   (
      This       : access IAsyncOperation_II2cController_Interface
      ; RetVal : access Windows.Devices.I2c.AsyncOperationCompletedHandler_II2cController
   )
   return Windows.HRESULT is abstract;
   
   function GetResults
   (
      This       : access IAsyncOperation_II2cController_Interface
      ; RetVal : access Windows.Devices.I2c.II2cController
   )
   return Windows.HRESULT is abstract;
   
   ------------------------------------------------------------------------
   
   IID_IAsyncOperation_II2cDevice : aliased constant Windows.IID := (512392408, 58395, 23105, (130, 177, 128, 5, 80, 18, 174, 0 ));
   
   type IAsyncOperation_II2cDevice_Interface is interface and Windows.IInspectable_Interface;
   
   function put_Completed
   (
      This       : access IAsyncOperation_II2cDevice_Interface
      ; handler : Windows.Devices.I2c.AsyncOperationCompletedHandler_II2cDevice
   )
   return Windows.HRESULT is abstract;
   
   function get_Completed
   (
      This       : access IAsyncOperation_II2cDevice_Interface
      ; RetVal : access Windows.Devices.I2c.AsyncOperationCompletedHandler_II2cDevice
   )
   return Windows.HRESULT is abstract;
   
   function GetResults
   (
      This       : access IAsyncOperation_II2cDevice_Interface
      ; RetVal : access Windows.Devices.I2c.II2cDevice
   )
   return Windows.HRESULT is abstract;
   
   ------------------------------------------------------------------------
   
   IID_II2cConnectionSettings : aliased constant Windows.IID := (4074443527, 43887, 17977, (167, 103, 84, 83, 109, 195, 70, 15 ));
   
   type II2cConnectionSettings_Interface is interface and Windows.IInspectable_Interface;
   
   function get_SlaveAddress
   (
      This       : access II2cConnectionSettings_Interface
      ; RetVal : access Windows.Int32
   )
   return Windows.HRESULT is abstract;
   
   function put_SlaveAddress
   (
      This       : access II2cConnectionSettings_Interface
      ; value : Windows.Int32
   )
   return Windows.HRESULT is abstract;
   
   function get_BusSpeed
   (
      This       : access II2cConnectionSettings_Interface
      ; RetVal : access Windows.Devices.I2c.I2cBusSpeed
   )
   return Windows.HRESULT is abstract;
   
   function put_BusSpeed
   (
      This       : access II2cConnectionSettings_Interface
      ; value : Windows.Devices.I2c.I2cBusSpeed
   )
   return Windows.HRESULT is abstract;
   
   function get_SharingMode
   (
      This       : access II2cConnectionSettings_Interface
      ; RetVal : access Windows.Devices.I2c.I2cSharingMode
   )
   return Windows.HRESULT is abstract;
   
   function put_SharingMode
   (
      This       : access II2cConnectionSettings_Interface
      ; value : Windows.Devices.I2c.I2cSharingMode
   )
   return Windows.HRESULT is abstract;
   
   ------------------------------------------------------------------------
   
   IID_II2cConnectionSettingsFactory : aliased constant Windows.IID := (2176157363, 38547, 16817, (162, 67, 222, 212, 246, 230, 105, 38 ));
   
   type II2cConnectionSettingsFactory_Interface is interface and Windows.IInspectable_Interface;
   
   function Create
   (
      This       : access II2cConnectionSettingsFactory_Interface
      ; slaveAddress : Windows.Int32
      ; RetVal : access Windows.Devices.I2c.II2cConnectionSettings
   )
   return Windows.HRESULT is abstract;
   
   ------------------------------------------------------------------------
   
   IID_II2cController : aliased constant Windows.IID := (3297423794, 34720, 16742, (142, 62, 180, 184, 249, 124, 215, 41 ));
   
   type II2cController_Interface is interface and Windows.IInspectable_Interface;
   
   function GetDevice
   (
      This       : access II2cController_Interface
      ; settings : Windows.Devices.I2c.II2cConnectionSettings
      ; RetVal : access Windows.Devices.I2c.II2cDevice
   )
   return Windows.HRESULT is abstract;
   
   ------------------------------------------------------------------------
   
   IID_II2cControllerStatics : aliased constant Windows.IID := (1090257765, 24325, 20094, (132, 189, 16, 13, 184, 224, 174, 197 ));
   
   type II2cControllerStatics_Interface is interface and Windows.IInspectable_Interface;
   
   function GetControllersAsync
   (
      This       : access II2cControllerStatics_Interface
      ; provider : Windows.Devices.I2c.Provider.II2cProvider
      ; RetVal : access Windows.Address -- Generic Parameter Type
   )
   return Windows.HRESULT is abstract;
   
   function GetDefaultAsync
   (
      This       : access II2cControllerStatics_Interface
      ; RetVal : access Windows.Devices.I2c.IAsyncOperation_II2cController -- Generic Parameter Type
   )
   return Windows.HRESULT is abstract;
   
   ------------------------------------------------------------------------
   
   IID_II2cDevice : aliased constant Windows.IID := (2251735350, 47557, 20336, (148, 73, 204, 70, 220, 111, 87, 235 ));
   
   type II2cDevice_Interface is interface and Windows.IInspectable_Interface;
   
   function get_DeviceId
   (
      This       : access II2cDevice_Interface
      ; RetVal : access Windows.String
   )
   return Windows.HRESULT is abstract;
   
   function get_ConnectionSettings
   (
      This       : access II2cDevice_Interface
      ; RetVal : access Windows.Devices.I2c.II2cConnectionSettings
   )
   return Windows.HRESULT is abstract;
   
   function Write
   (
      This       : access II2cDevice_Interface
      ; buffer : Windows.UInt8_Ptr
   )
   return Windows.HRESULT is abstract;
   
   function WritePartial
   (
      This       : access II2cDevice_Interface
      ; buffer : Windows.UInt8_Ptr
      ; RetVal : access Windows.Devices.I2c.I2cTransferResult
   )
   return Windows.HRESULT is abstract;
   
   function Read
   (
      This       : access II2cDevice_Interface
      ; buffer : Windows.UInt8_Ptr
   )
   return Windows.HRESULT is abstract;
   
   function ReadPartial
   (
      This       : access II2cDevice_Interface
      ; buffer : Windows.UInt8_Ptr
      ; RetVal : access Windows.Devices.I2c.I2cTransferResult
   )
   return Windows.HRESULT is abstract;
   
   function WriteRead
   (
      This       : access II2cDevice_Interface
      ; writeBuffer : Windows.UInt8_Ptr
      ; readBuffer : Windows.UInt8_Ptr
   )
   return Windows.HRESULT is abstract;
   
   function WriteReadPartial
   (
      This       : access II2cDevice_Interface
      ; writeBuffer : Windows.UInt8_Ptr
      ; readBuffer : Windows.UInt8_Ptr
      ; RetVal : access Windows.Devices.I2c.I2cTransferResult
   )
   return Windows.HRESULT is abstract;
   
   ------------------------------------------------------------------------
   
   IID_II2cDeviceStatics : aliased constant Windows.IID := (2443394019, 29492, 17682, (150, 188, 251, 174, 148, 89, 245, 246 ));
   
   type II2cDeviceStatics_Interface is interface and Windows.IInspectable_Interface;
   
   function GetDeviceSelector
   (
      This       : access II2cDeviceStatics_Interface
      ; RetVal : access Windows.String
   )
   return Windows.HRESULT is abstract;
   
   function GetDeviceSelectorFromFriendlyName
   (
      This       : access II2cDeviceStatics_Interface
      ; friendlyName : Windows.String
      ; RetVal : access Windows.String
   )
   return Windows.HRESULT is abstract;
   
   function FromIdAsync
   (
      This       : access II2cDeviceStatics_Interface
      ; deviceId : Windows.String
      ; settings : Windows.Devices.I2c.II2cConnectionSettings
      ; RetVal : access Windows.Devices.I2c.IAsyncOperation_II2cDevice -- Generic Parameter Type
   )
   return Windows.HRESULT is abstract;
   
   ------------------------------------------------------------------------
   -- Delegates/Events
   ------------------------------------------------------------------------
   
   ------------------------------------------------------------------------
   
   IID_AsyncOperationCompletedHandler_II2cController : aliased constant Windows.IID := (1878412146, 42410, 22918, (181, 99, 39, 97, 42, 251, 55, 60 ));
   
   type AsyncOperationCompletedHandler_II2cController_Interface(Callback : access procedure (asyncInfo : Windows.Devices.I2c.IAsyncOperation_II2cController ; asyncStatus : Windows.Foundation.AsyncStatus)) is new Windows.IMulticastDelegate_Interface(IID_AsyncOperationCompletedHandler_II2cController'access) with null record;
   function Invoke
   (
      This       : access AsyncOperationCompletedHandler_II2cController_Interface
      ; asyncInfo : Windows.Devices.I2c.IAsyncOperation_II2cController
      ; asyncStatus : Windows.Foundation.AsyncStatus
   )
   return Windows.HRESULT;
   
   ------------------------------------------------------------------------
   
   IID_AsyncOperationCompletedHandler_II2cDevice : aliased constant Windows.IID := (771079018, 24179, 23267, (160, 178, 34, 225, 201, 216, 239, 77 ));
   
   type AsyncOperationCompletedHandler_II2cDevice_Interface(Callback : access procedure (asyncInfo : Windows.Devices.I2c.IAsyncOperation_II2cDevice ; asyncStatus : Windows.Foundation.AsyncStatus)) is new Windows.IMulticastDelegate_Interface(IID_AsyncOperationCompletedHandler_II2cDevice'access) with null record;
   function Invoke
   (
      This       : access AsyncOperationCompletedHandler_II2cDevice_Interface
      ; asyncInfo : Windows.Devices.I2c.IAsyncOperation_II2cDevice
      ; asyncStatus : Windows.Foundation.AsyncStatus
   )
   return Windows.HRESULT;
   
   ------------------------------------------------------------------------
   -- Classes
   ------------------------------------------------------------------------
   
   subtype I2cConnectionSettings is Windows.Devices.I2c.II2cConnectionSettings;
   function Create
   (
      slaveAddress : Windows.Int32
   )
   return Windows.Devices.I2c.II2cConnectionSettings;
   
   subtype I2cController is Windows.Devices.I2c.II2cController;
   subtype I2cDevice is Windows.Devices.I2c.II2cDevice;
   
   ------------------------------------------------------------------------
   -- Static Procedures/functions
   ------------------------------------------------------------------------
   
   function GetControllersAsync
   (
      provider : Windows.Devices.I2c.Provider.II2cProvider
   )
   return Windows.Address;
   
   function GetDefaultAsync
   return Windows.Devices.I2c.IAsyncOperation_II2cController;
   
   function FromIdAsync
   (
      deviceId : Windows.String
      ; settings : Windows.Devices.I2c.II2cConnectionSettings
   )
   return Windows.Devices.I2c.IAsyncOperation_II2cDevice;
   
   function GetDeviceSelector
   return Windows.String;
   
   function GetDeviceSelectorFromFriendlyName
   (
      friendlyName : Windows.String
   )
   return Windows.String;
   
end;
