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

import "inspectable.idl";
import "AsyncInfo.idl";
import "EventToken.idl";
import "Windows.Foundation.idl";
// Additional imports to ensure that all required headers are included
cpp_quote("#if defined(__cplusplus)")
cpp_quote("}")
cpp_quote("#endif // defined(__cplusplus)")
cpp_quote("#include <Windows.Foundation.h>")
cpp_quote("#if defined(__cplusplus)")
cpp_quote("extern \"C\" {")
cpp_quote("#endif // defined(__cplusplus)")

// Forward Declare
namespace Windows
{
    namespace Foundation
    {
        interface IClosable;

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

            typedef enum GpioOpenStatus GpioOpenStatus;

            typedef enum GpioPinDriveMode GpioPinDriveMode;

            typedef enum GpioPinValue GpioPinValue;

            typedef enum GpioPinEdge GpioPinEdge;

            interface IGpioPinValueChangedEventArgs;

            interface IGpioController;

            interface IGpioControllerStatics;

            interface IGpioPin;

            runtimeclass GpioPinValueChangedEventArgs;

            runtimeclass GpioPin;

            runtimeclass GpioController;
        }
    }
}

// Generic instantiations
namespace Windows
{
    namespace Devices
    {
        namespace Gpio
        {
            declare
            {
                interface Windows.Foundation.TypedEventHandler<Windows.Devices.Gpio.GpioPin*, Windows.Devices.Gpio.GpioPinValueChangedEventArgs*>;
            }
        }
    }
}

// Type definition
namespace Windows
{
    namespace Devices
    {
        namespace Gpio
        {
            [version(0x0A000000)]
            enum GpioSharingMode
            {
                Exclusive      = 0,
                SharedReadOnly = 1
            };

            [version(0x0A000000)]
            enum GpioOpenStatus
            {
                PinOpened        = 0,
                PinUnavailable   = 1,
                SharingViolation = 2
            };

            [version(0x0A000000)]
            enum GpioPinDriveMode
            {
                Input                    = 0,
                Output                   = 1,
                InputPullUp              = 2,
                InputPullDown            = 3,
                OutputOpenDrain          = 4,
                OutputOpenDrainPullUp    = 5,
                OutputOpenSource         = 6,
                OutputOpenSourcePullDown = 7
            };

            [version(0x0A000000)]
            enum GpioPinValue
            {
                Low  = 0,
                High = 1
            };

            [version(0x0A000000)]
            enum GpioPinEdge
            {
                FallingEdge = 0,
                RisingEdge  = 1
            };

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

            [exclusiveto(Windows.Devices.Gpio.GpioController)]
            [uuid(284012E3-7461-469C-A8BC-61D69D08A53C)]
            [version(0x0A000000)]
            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);
            }

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

            [exclusiveto(Windows.Devices.Gpio.GpioPin)]
            [uuid(11D9B087-AFAE-4790-9EE9-E0EAC942D201)]
            [version(0x0A000000)]
            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);
            }

            [marshaling_behavior(agile)]
            [version(0x0A000000)]
            runtimeclass GpioPinValueChangedEventArgs
            {
                [default] interface Windows.Devices.Gpio.IGpioPinValueChangedEventArgs;
            }

            [marshaling_behavior(agile)]
            [version(0x0A000000)]
            runtimeclass GpioPin
            {
                [default] interface Windows.Devices.Gpio.IGpioPin;
                interface Windows.Foundation.IClosable;
            }

            [marshaling_behavior(agile)]
            [static(Windows.Devices.Gpio.IGpioControllerStatics, 0x0A000000)]
            [version(0x0A000000)]
            runtimeclass GpioController
            {
                [default] interface Windows.Devices.Gpio.IGpioController;
            }
        }
    }
}
