//
// 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.Storage.Streams.idl";

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

        typedef struct TimeSpan TimeSpan;

        apicontract UniversalApiContract;
    }
}
namespace Windows
{
    namespace Storage
    {
        namespace Streams
        {
            interface IInputStream;

            interface IOutputStream;
        }
    }
}
namespace Windows
{
    namespace Devices
    {
        namespace SerialCommunication
        {
            typedef enum SerialError SerialError;

            typedef enum SerialHandshake SerialHandshake;

            typedef enum SerialParity SerialParity;

            typedef enum SerialPinChange SerialPinChange;

            typedef enum SerialStopBitCount SerialStopBitCount;

            interface IErrorReceivedEventArgs;

            interface IPinChangedEventArgs;

            interface ISerialDevice;

            interface ISerialDeviceStatics;

            runtimeclass ErrorReceivedEventArgs;

            runtimeclass PinChangedEventArgs;

            runtimeclass SerialDevice;
        }
    }
}

// Generic instantiations
namespace Windows
{
    namespace Devices
    {
        namespace SerialCommunication
        {
            declare
            {
                interface Windows.Foundation.IAsyncOperation<Windows.Devices.SerialCommunication.SerialDevice*>;

                interface Windows.Foundation.TypedEventHandler<Windows.Devices.SerialCommunication.SerialDevice*, Windows.Devices.SerialCommunication.ErrorReceivedEventArgs*>;

                interface Windows.Foundation.TypedEventHandler<Windows.Devices.SerialCommunication.SerialDevice*, Windows.Devices.SerialCommunication.PinChangedEventArgs*>;
            }
        }
    }
}

// Type definition
namespace Windows
{
    namespace Devices
    {
        namespace SerialCommunication
        {
            [contract(Windows.Foundation.UniversalApiContract, 1.0)]
            enum SerialError
            {
                Frame         = 0,
                BufferOverrun = 1,
                ReceiveFull   = 2,
                ReceiveParity = 3,
                TransmitFull  = 4
            };

            [contract(Windows.Foundation.UniversalApiContract, 1.0)]
            enum SerialHandshake
            {
                None                 = 0,
                RequestToSend        = 1,
                XOnXOff              = 2,
                RequestToSendXOnXOff = 3
            };

            [contract(Windows.Foundation.UniversalApiContract, 1.0)]
            enum SerialParity
            {
                None  = 0,
                Odd   = 1,
                Even  = 2,
                Mark  = 3,
                Space = 4
            };

            [contract(Windows.Foundation.UniversalApiContract, 1.0)]
            enum SerialPinChange
            {
                BreakSignal   = 0,
                CarrierDetect = 1,
                ClearToSend   = 2,
                DataSetReady  = 3,
                RingIndicator = 4
            };

            [contract(Windows.Foundation.UniversalApiContract, 1.0)]
            enum SerialStopBitCount
            {
                One          = 0,
                OnePointFive = 1,
                Two          = 2
            };

            [contract(Windows.Foundation.UniversalApiContract, 1.0)]
            [exclusiveto(Windows.Devices.SerialCommunication.ErrorReceivedEventArgs)]
            [uuid(FCC6BF59-1283-4D8A-BFDF-566B33DDB28F)]
            interface IErrorReceivedEventArgs : IInspectable
            {
                [propget] HRESULT Error([out] [retval] Windows.Devices.SerialCommunication.SerialError* value);
            }

            [contract(Windows.Foundation.UniversalApiContract, 1.0)]
            [exclusiveto(Windows.Devices.SerialCommunication.PinChangedEventArgs)]
            [uuid(A2BF1DB0-FC9C-4607-93D0-FA5E8343EE22)]
            interface IPinChangedEventArgs : IInspectable
            {
                [propget] HRESULT PinChange([out] [retval] Windows.Devices.SerialCommunication.SerialPinChange* value);
            }

            [contract(Windows.Foundation.UniversalApiContract, 1.0)]
            [exclusiveto(Windows.Devices.SerialCommunication.SerialDevice)]
            [uuid(E187CCC6-2210-414F-B65A-F5553A03372A)]
            interface ISerialDevice : IInspectable
                requires
                    Windows.Foundation.IClosable
            {
                [propget] HRESULT BaudRate([out] [retval] UINT32* value);
                [propput] HRESULT BaudRate([in] UINT32 value);
                [propget] HRESULT BreakSignalState([out] [retval] boolean* value);
                [propput] HRESULT BreakSignalState([in] boolean value);
                [propget] HRESULT BytesReceived([out] [retval] UINT32* value);
                [propget] HRESULT CarrierDetectState([out] [retval] boolean* value);
                [propget] HRESULT ClearToSendState([out] [retval] boolean* value);
                [propget] HRESULT DataBits([out] [retval] UINT16* value);
                [propput] HRESULT DataBits([in] UINT16 value);
                [propget] HRESULT DataSetReadyState([out] [retval] boolean* value);
                [propget] HRESULT Handshake([out] [retval] Windows.Devices.SerialCommunication.SerialHandshake* value);
                [propput] HRESULT Handshake([in] Windows.Devices.SerialCommunication.SerialHandshake value);
                [propget] HRESULT IsDataTerminalReadyEnabled([out] [retval] boolean* value);
                [propput] HRESULT IsDataTerminalReadyEnabled([in] boolean value);
                [propget] HRESULT IsRequestToSendEnabled([out] [retval] boolean* value);
                [propput] HRESULT IsRequestToSendEnabled([in] boolean value);
                [propget] HRESULT Parity([out] [retval] Windows.Devices.SerialCommunication.SerialParity* value);
                [propput] HRESULT Parity([in] Windows.Devices.SerialCommunication.SerialParity value);
                [propget] HRESULT PortName([out] [retval] HSTRING* value);
                [propget] HRESULT ReadTimeout([out] [retval] Windows.Foundation.TimeSpan* value);
                [propput] HRESULT ReadTimeout([in] Windows.Foundation.TimeSpan value);
                [propget] HRESULT StopBits([out] [retval] Windows.Devices.SerialCommunication.SerialStopBitCount* value);
                [propput] HRESULT StopBits([in] Windows.Devices.SerialCommunication.SerialStopBitCount value);
                [propget] HRESULT UsbVendorId([out] [retval] UINT16* value);
                [propget] HRESULT UsbProductId([out] [retval] UINT16* value);
                [propget] HRESULT WriteTimeout([out] [retval] Windows.Foundation.TimeSpan* value);
                [propput] HRESULT WriteTimeout([in] Windows.Foundation.TimeSpan value);
                [propget] HRESULT InputStream([out] [retval] Windows.Storage.Streams.IInputStream** value);
                [propget] HRESULT OutputStream([out] [retval] Windows.Storage.Streams.IOutputStream** value);
                [eventadd] HRESULT ErrorReceived([in] Windows.Foundation.TypedEventHandler<Windows.Devices.SerialCommunication.SerialDevice*, Windows.Devices.SerialCommunication.ErrorReceivedEventArgs*>* reportHandler, [out] [retval] EventRegistrationToken* token);
                [eventremove] HRESULT ErrorReceived([in] EventRegistrationToken token);
                [eventadd] HRESULT PinChanged([in] Windows.Foundation.TypedEventHandler<Windows.Devices.SerialCommunication.SerialDevice*, Windows.Devices.SerialCommunication.PinChangedEventArgs*>* reportHandler, [out] [retval] EventRegistrationToken* token);
                [eventremove] HRESULT PinChanged([in] EventRegistrationToken token);
            }

            [contract(Windows.Foundation.UniversalApiContract, 1.0)]
            [exclusiveto(Windows.Devices.SerialCommunication.SerialDevice)]
            [uuid(058C4A70-0836-4993-AE1A-B61AE3BE056B)]
            interface ISerialDeviceStatics : IInspectable
            {
                [overload("GetDeviceSelector")] HRESULT GetDeviceSelector([out] [retval] HSTRING* value);
                [overload("GetDeviceSelector")] HRESULT GetDeviceSelectorFromPortName([in] HSTRING portName, [out] [retval] HSTRING* result);
                HRESULT GetDeviceSelectorFromUsbVidPid([in] UINT16 vendorId, [in] UINT16 productId, [out] [retval] HSTRING* result);
                HRESULT FromIdAsync([in] HSTRING deviceId, [out] [retval] Windows.Foundation.IAsyncOperation<Windows.Devices.SerialCommunication.SerialDevice*>** result);
            }

            [contract(Windows.Foundation.UniversalApiContract, 1.0)]
            [marshaling_behavior(agile)]
            runtimeclass ErrorReceivedEventArgs
            {
                [default] interface Windows.Devices.SerialCommunication.IErrorReceivedEventArgs;
            }

            [contract(Windows.Foundation.UniversalApiContract, 1.0)]
            [marshaling_behavior(agile)]
            runtimeclass PinChangedEventArgs
            {
                [default] interface Windows.Devices.SerialCommunication.IPinChangedEventArgs;
            }

            [contract(Windows.Foundation.UniversalApiContract, 1.0)]
            [marshaling_behavior(agile)]
            [static(Windows.Devices.SerialCommunication.ISerialDeviceStatics, Windows.Foundation.UniversalApiContract, 1.0)]
            runtimeclass SerialDevice
            {
                [default] interface Windows.Devices.SerialCommunication.ISerialDevice;
                interface Windows.Foundation.IClosable;
            }
        }
    }
}
