//
// Copyright (c) Microsoft Corporation. All rights reserved.
// 
//
// File generated by WinMDIDL version 8.00.0021
//

import "inspectable.idl";
import "AsyncInfo.idl";
import "EventToken.idl";
import "windowscontracts.idl";
import "Windows.Foundation.idl";
import "Windows.Devices.idl";
import "Windows.Devices.Gpio.Provider.idl";

// Forward Declare
namespace Windows
{
    namespace Devices
    {
        apicontract DevicesLowLevelContract;
    }
}
namespace Windows
{
    namespace Devices
    {
        namespace Gpio
        {
            namespace Provider
            {
                interface IGpioProvider;
            }
        }
    }
}
namespace Windows
{
    namespace Foundation
    {
        interface IAsyncAction;

        interface IClosable;

        typedef struct TimeSpan TimeSpan;
    }
}
namespace Windows
{
    namespace Devices
    {
        namespace Gpio
        {
            typedef enum GpioChangePolarity GpioChangePolarity;

            typedef enum GpioOpenStatus GpioOpenStatus;

            typedef enum GpioPinDriveMode GpioPinDriveMode;

            typedef enum GpioPinEdge GpioPinEdge;

            typedef enum GpioPinValue GpioPinValue;

            typedef enum GpioSharingMode GpioSharingMode;

            typedef struct GpioChangeCount GpioChangeCount;

            typedef struct GpioChangeRecord GpioChangeRecord;

            interface IGpioChangeCounter;

            interface IGpioChangeCounterFactory;

            interface IGpioChangeReader;

            interface IGpioChangeReaderFactory;

            interface IGpioController;

            interface IGpioControllerStatics;

            interface IGpioControllerStatics2;

            interface IGpioPin;

            interface IGpioPinValueChangedEventArgs;

            runtimeclass GpioChangeCounter;

            runtimeclass GpioChangeReader;

            runtimeclass GpioController;

            runtimeclass GpioPin;

            runtimeclass GpioPinValueChangedEventArgs;
        }
    }
}

// Generic instantiations
namespace Windows
{
    namespace Devices
    {
        namespace Gpio
        {
            declare
            {
                interface Windows.Foundation.Collections.IIterable<Windows.Devices.Gpio.GpioChangeRecord>;

                interface Windows.Foundation.Collections.IIterable<Windows.Devices.Gpio.GpioController*>;

                interface Windows.Foundation.Collections.IIterator<Windows.Devices.Gpio.GpioChangeRecord>;

                interface Windows.Foundation.Collections.IIterator<Windows.Devices.Gpio.GpioController*>;

                interface Windows.Foundation.Collections.IVectorView<Windows.Devices.Gpio.GpioChangeRecord>;

                interface Windows.Foundation.Collections.IVectorView<Windows.Devices.Gpio.GpioController*>;

                interface Windows.Foundation.Collections.IVector<Windows.Devices.Gpio.GpioChangeRecord>;

                interface Windows.Foundation.IAsyncOperation<Windows.Devices.Gpio.GpioController*>;

                interface Windows.Foundation.IAsyncOperation<Windows.Foundation.Collections.IVectorView<Windows.Devices.Gpio.GpioController*>*>;

                interface Windows.Foundation.TypedEventHandler<Windows.Devices.Gpio.GpioPin*, Windows.Devices.Gpio.GpioPinValueChangedEventArgs*>;
            }
        }
    }
}

// Type definition
namespace Windows
{
    namespace Devices
    {
        namespace Gpio
        {
            [contract(Windows.Devices.DevicesLowLevelContract, 3.0)]
            enum GpioChangePolarity
            {
                Falling = 0,
                Rising  = 1,
                Both    = 2
            };

            [contract(Windows.Devices.DevicesLowLevelContract, 1.0)]
            enum GpioOpenStatus
            {
                PinOpened        = 0,
                PinUnavailable   = 1,
                SharingViolation = 2,
                MuxingConflict   = 3,
                UnknownError     = 4
            };

            [contract(Windows.Devices.DevicesLowLevelContract, 1.0)]
            enum GpioPinDriveMode
            {
                Input                    = 0,
                Output                   = 1,
                InputPullUp              = 2,
                InputPullDown            = 3,
                OutputOpenDrain          = 4,
                OutputOpenDrainPullUp    = 5,
                OutputOpenSource         = 6,
                OutputOpenSourcePullDown = 7
            };

            [contract(Windows.Devices.DevicesLowLevelContract, 1.0)]
            enum GpioPinEdge
            {
                FallingEdge = 0,
                RisingEdge  = 1
            };

            [contract(Windows.Devices.DevicesLowLevelContract, 1.0)]
            enum GpioPinValue
            {
                Low  = 0,
                High = 1
            };

            [contract(Windows.Devices.DevicesLowLevelContract, 1.0)]
            enum GpioSharingMode
            {
                Exclusive      = 0,
                SharedReadOnly = 1
            };

            [contract(Windows.Devices.DevicesLowLevelContract, 3.0)]
            struct GpioChangeCount
            {
                UINT64 Count;
                Windows.Foundation.TimeSpan RelativeTime;
            };

            [contract(Windows.Devices.DevicesLowLevelContract, 3.0)]
            struct GpioChangeRecord
            {
                Windows.Foundation.TimeSpan RelativeTime;
                Windows.Devices.Gpio.GpioPinEdge Edge;
            };

            [contract(Windows.Devices.DevicesLowLevelContract, 3.0)]
            [exclusiveto(Windows.Devices.Gpio.GpioChangeCounter)]
            [uuid(CB5EC0DE-6801-43FF-803D-4576628A8B26)]
            interface IGpioChangeCounter : IInspectable
                requires
                    Windows.Foundation.IClosable
            {
                [propput] HRESULT Polarity([in] Windows.Devices.Gpio.GpioChangePolarity value);
                [propget] HRESULT Polarity([out] [retval] Windows.Devices.Gpio.GpioChangePolarity* value);
                [propget] HRESULT IsStarted([out] [retval] boolean* value);
                HRESULT Start();
                HRESULT Stop();
                HRESULT Read([out] [retval] Windows.Devices.Gpio.GpioChangeCount* value);
                HRESULT Reset([out] [retval] Windows.Devices.Gpio.GpioChangeCount* value);
            }

            [contract(Windows.Devices.DevicesLowLevelContract, 3.0)]
            [exclusiveto(Windows.Devices.Gpio.GpioChangeCounter)]
            [uuid(147D94B6-0A9E-410C-B4FA-F89F4052084D)]
            interface IGpioChangeCounterFactory : IInspectable
            {
                HRESULT Create([in] Windows.Devices.Gpio.GpioPin* pin, [out] [retval] Windows.Devices.Gpio.GpioChangeCounter** value);
            }

            [contract(Windows.Devices.DevicesLowLevelContract, 3.0)]
            [exclusiveto(Windows.Devices.Gpio.GpioChangeReader)]
            [uuid(0ABC885F-E031-48E8-8590-70DE78363C6D)]
            interface IGpioChangeReader : IInspectable
                requires
                    Windows.Foundation.IClosable
            {
                [propget] HRESULT Capacity([out] [retval] INT32* value);
                [propget] HRESULT Length([out] [retval] INT32* value);
                [propget] HRESULT IsEmpty([out] [retval] boolean* value);
                [propget] HRESULT IsOverflowed([out] [retval] boolean* value);
                [propput] HRESULT Polarity([in] Windows.Devices.Gpio.GpioChangePolarity value);
                [propget] HRESULT Polarity([out] [retval] Windows.Devices.Gpio.GpioChangePolarity* value);
                [propget] HRESULT IsStarted([out] [retval] boolean* value);
                HRESULT Start();
                HRESULT Stop();
                HRESULT Clear();
                HRESULT GetNextItem([out] [retval] Windows.Devices.Gpio.GpioChangeRecord* value);
                HRESULT PeekNextItem([out] [retval] Windows.Devices.Gpio.GpioChangeRecord* value);
                HRESULT GetAllItems([out] [retval] Windows.Foundation.Collections.IVector<Windows.Devices.Gpio.GpioChangeRecord>** value);
                HRESULT WaitForItemsAsync([in] INT32 count, [out] [retval] Windows.Foundation.IAsyncAction** operation);
            }

            [contract(Windows.Devices.DevicesLowLevelContract, 3.0)]
            [exclusiveto(Windows.Devices.Gpio.GpioChangeReader)]
            [uuid(A9598EF3-390E-441A-9D1C-E8DE0B2DF0DF)]
            interface IGpioChangeReaderFactory : IInspectable
            {
                HRESULT Create([in] Windows.Devices.Gpio.GpioPin* pin, [out] [retval] Windows.Devices.Gpio.GpioChangeReader** value);
                HRESULT CreateWithCapacity([in] Windows.Devices.Gpio.GpioPin* pin, [in] INT32 minCapacity, [out] [retval] Windows.Devices.Gpio.GpioChangeReader** value);
            }

            [contract(Windows.Devices.DevicesLowLevelContract, 1.0)]
            [exclusiveto(Windows.Devices.Gpio.GpioController)]
            [uuid(284012E3-7461-469C-A8BC-61D69D08A53C)]
            interface IGpioController : IInspectable
            {
                [propget] HRESULT PinCount([out] [retval] INT32* value);
                [overload("OpenPin")] HRESULT OpenPin([in] INT32 pinNumber, [out] [retval] Windows.Devices.Gpio.GpioPin** pin);
                [overload("OpenPin")] HRESULT OpenPinWithSharingMode([in] INT32 pinNumber, [in] Windows.Devices.Gpio.GpioSharingMode sharingMode, [out] [retval] Windows.Devices.Gpio.GpioPin** pin);
                HRESULT TryOpenPin([in] INT32 pinNumber, [in] Windows.Devices.Gpio.GpioSharingMode sharingMode, [out] Windows.Devices.Gpio.GpioPin** pin, [out] Windows.Devices.Gpio.GpioOpenStatus* openStatus, [out] [retval] boolean* succeeded);
            }

            [contract(Windows.Devices.DevicesLowLevelContract, 1.0)]
            [exclusiveto(Windows.Devices.Gpio.GpioController)]
            [uuid(2ED6F42E-7AF7-4116-9533-C43D99A1FB64)]
            interface IGpioControllerStatics : IInspectable
            {
                HRESULT GetDefault([out] [retval] Windows.Devices.Gpio.GpioController** value);
            }

            [contract(Windows.Devices.DevicesLowLevelContract, 2.0)]
            [exclusiveto(Windows.Devices.Gpio.GpioController)]
            [uuid(912B7D20-6CA4-4106-A373-FFFD346B0E5B)]
            interface IGpioControllerStatics2 : IInspectable
            {
                HRESULT GetControllersAsync([in] Windows.Devices.Gpio.Provider.IGpioProvider* provider, [out] [retval] Windows.Foundation.IAsyncOperation<Windows.Foundation.Collections.IVectorView<Windows.Devices.Gpio.GpioController*>*>** operation);
                HRESULT GetDefaultAsync([out] [retval] Windows.Foundation.IAsyncOperation<Windows.Devices.Gpio.GpioController*>** operation);
            }

            [contract(Windows.Devices.DevicesLowLevelContract, 1.0)]
            [exclusiveto(Windows.Devices.Gpio.GpioPin)]
            [uuid(11D9B087-AFAE-4790-9EE9-E0EAC942D201)]
            interface IGpioPin : IInspectable
                requires
                    Windows.Foundation.IClosable
            {
                [eventadd] HRESULT ValueChanged([in] Windows.Foundation.TypedEventHandler<Windows.Devices.Gpio.GpioPin*, Windows.Devices.Gpio.GpioPinValueChangedEventArgs*>* handler, [out] [retval] EventRegistrationToken* token);
                [eventremove] HRESULT ValueChanged([in] EventRegistrationToken token);
                [propget] HRESULT DebounceTimeout([out] [retval] Windows.Foundation.TimeSpan* value);
                [propput] HRESULT DebounceTimeout([in] Windows.Foundation.TimeSpan value);
                [propget] HRESULT PinNumber([out] [retval] INT32* value);
                [propget] HRESULT SharingMode([out] [retval] Windows.Devices.Gpio.GpioSharingMode* value);
                HRESULT IsDriveModeSupported([in] Windows.Devices.Gpio.GpioPinDriveMode driveMode, [out] [retval] boolean* supported);
                HRESULT GetDriveMode([out] [retval] Windows.Devices.Gpio.GpioPinDriveMode* value);
                HRESULT SetDriveMode([in] Windows.Devices.Gpio.GpioPinDriveMode value);
                HRESULT Write([in] Windows.Devices.Gpio.GpioPinValue value);
                HRESULT Read([out] [retval] Windows.Devices.Gpio.GpioPinValue* value);
            }

            [contract(Windows.Devices.DevicesLowLevelContract, 1.0)]
            [exclusiveto(Windows.Devices.Gpio.GpioPinValueChangedEventArgs)]
            [uuid(3137AAE1-703D-4059-BD24-B5B25DFFB84E)]
            interface IGpioPinValueChangedEventArgs : IInspectable
            {
                [propget] HRESULT Edge([out] [retval] Windows.Devices.Gpio.GpioPinEdge* value);
            }

            [activatable(Windows.Devices.Gpio.IGpioChangeCounterFactory, Windows.Devices.DevicesLowLevelContract, 3.0)]
            [contract(Windows.Devices.DevicesLowLevelContract, 3.0)]
            [marshaling_behavior(agile)]
            runtimeclass GpioChangeCounter
            {
                [default] interface Windows.Devices.Gpio.IGpioChangeCounter;
                interface Windows.Foundation.IClosable;
            }

            [activatable(Windows.Devices.Gpio.IGpioChangeReaderFactory, Windows.Devices.DevicesLowLevelContract, 3.0)]
            [contract(Windows.Devices.DevicesLowLevelContract, 3.0)]
            [marshaling_behavior(agile)]
            runtimeclass GpioChangeReader
            {
                [default] interface Windows.Devices.Gpio.IGpioChangeReader;
                interface Windows.Foundation.IClosable;
            }

            [contract(Windows.Devices.DevicesLowLevelContract, 1.0)]
            [marshaling_behavior(agile)]
            [static(Windows.Devices.Gpio.IGpioControllerStatics, Windows.Devices.DevicesLowLevelContract, 1.0)]
            [static(Windows.Devices.Gpio.IGpioControllerStatics2, Windows.Devices.DevicesLowLevelContract, 2.0)]
            runtimeclass GpioController
            {
                [default] interface Windows.Devices.Gpio.IGpioController;
            }

            [contract(Windows.Devices.DevicesLowLevelContract, 1.0)]
            [marshaling_behavior(agile)]
            runtimeclass GpioPin
            {
                [default] interface Windows.Devices.Gpio.IGpioPin;
                interface Windows.Foundation.IClosable;
            }

            [contract(Windows.Devices.DevicesLowLevelContract, 1.0)]
            [marshaling_behavior(agile)]
            runtimeclass GpioPinValueChangedEventArgs
            {
                [default] interface Windows.Devices.Gpio.IGpioPinValueChangedEventArgs;
            }
        }
    }
}
