//  Copyright (c) Microsoft Corporation. All rights reserved.
//
//  WindowsRuntimeAPISet

//*@@@+++@@@@******************************************************************
//
// Microsoft Windows PlayToDevices
//
//*@@@---@@@@******************************************************************
//

import "windows.foundation.idl";
import "Windows.Storage.Streams.Idl";
import "Windows.Storage.Idl";
#include <sdkddkver.h>

//////////////////////////////////////////////////////////////////////
//
// This file contains the public API surface for the device controller. This API is not
// projected and is available only in native C++.
//
//////////////////////////////////////////////////////////////////////

namespace Windows.Media.Streaming
{
    //////////////////////////////////////////////////////////////////////
    //
    // Forward declarations
    //
    //////////////////////////////////////////////////////////////////////    
    interface IBasicDevice;
    interface IActiveBasicDevice;    
    interface IDeviceController;    
    interface IDeviceIcon;
    interface IActiveBasicDeviceStatics;

    runtimeclass BasicDevice;    
    runtimeclass ActiveBasicDevice;        
    runtimeclass DevicePair;
    
    //////////////////////////////////////////////////////////////////////
    //
    // Enums/Structs
    //
    //////////////////////////////////////////////////////////////////////    
    [ 
        version( NTDDI_WIN8 ), 
        flags, v1_enum
    ]
    typedef enum DeviceTypes
    {
        Unknown                 = 0x0,
        DigitalMediaRenderer    = 0x1,
        DigitalMediaServer      = 0x2,
        DigitalMediaPlayer      = 0x4,
    } DeviceTypes;

    //////////////////////////////////////////////////////////////////////
    [ version( NTDDI_WIN8 ), v1_enum ]
    typedef enum ConnectionStatus
    {
        Online = 0,
        Offline,
        Sleeping
    } ConnectionStatus;


    [
        version( NTDDI_WIN8 ),
        uuid(a88a7d06-988c-4403-9d8a-015bed140b34)
    ]
    delegate HRESULT DeviceControllerFinderHandler(
        [ in ] IDeviceController*   sender,
        [ in ] HSTRING              uniqueDeviceName,
        [ in ] IBasicDevice*        device );

    [
        version( NTDDI_WIN8 ),
        uuid(b571c28c-a472-48d5-88d2-8adcaf1b8813)
    ]
    delegate HRESULT ConnectionStatusHandler(
        [ in ] IBasicDevice* sender,
        [ in ] ConnectionStatus arg );
        

    //////////////////////////////////////////////////////////////////////
    //
    // Interfaces/Classes
    //
    //////////////////////////////////////////////////////////////////////            
    [
        version( NTDDI_WIN8 ),
        uuid(4feeb26d-50a7-402b-896a-be95064d6bff)
    ]
    interface IDeviceController : IInspectable
    {
        [ propget ] HRESULT CachedDevices( [ out, retval ] IVector< IBasicDevice >** value );

        HRESULT AddDevice( [ in ] HSTRING uniqueDeviceName ); 

        HRESULT RemoveDevice( [ in ] IBasicDevice* device );        

        [ eventadd ] HRESULT DeviceArrival(
            [ in ]          DeviceControllerFinderHandler*     handler,
            [ out, retval ] EventRegistrationToken*                 token );

        [ eventremove ] HRESULT DeviceArrival( [ in ] EventRegistrationToken token );

        [ eventadd ] HRESULT DeviceDeparture(
            [ in ]          DeviceControllerFinderHandler*     handler,
            [ out, retval ] EventRegistrationToken*                 token );

        [ eventremove ] HRESULT DeviceDeparture( [ in ] EventRegistrationToken token );
    };
    
    //////////////////////////////////////////////////////////////////////
    [
        version( NTDDI_WIN8 ),
        uuid(f4f26cbb-7962-48b7-80f7-c3a5d753bcb0)
    ]
    interface IBasicDevice : IInspectable
    {
        [ propget ] HRESULT FriendlyName( [ out, retval ] HSTRING* value );

        [ propput ] HRESULT FriendlyName( [ in ] HSTRING value );

        [ propget ] HRESULT ManufacturerName( [ out, retval ] HSTRING* value );

        [ propget ] HRESULT ManufacturerUrl( [ out, retval ] HSTRING* value );

        [ propget ] HRESULT UniqueDeviceName( [ out, retval ] HSTRING* value );

        [ propget ] HRESULT ModelName( [ out, retval ] HSTRING* value );

        [ propget ] HRESULT ModelNumber( [ out, retval ] HSTRING* value );

        [ propget ] HRESULT ModelUrl( [ out, retval ] HSTRING* value );

        [ propget ] HRESULT Description( [ out, retval ] HSTRING* value );

        [ propget ] HRESULT SerialNumber( [ out, retval ] HSTRING* value );

        [ propget ] HRESULT PresentationUrl( [ out, retval ] HSTRING* value );

        [ propget ] HRESULT RemoteStreamingUrls( [ out, retval ] IVector< HSTRING >** value );

        [ propget ] HRESULT PhysicalAddresses( [ out, retval ] IVector< HSTRING >** value );

        [ propget ] HRESULT IpAddresses( [ out, retval ] IVector< HSTRING >** value );

        [ propget ] HRESULT CanWakeDevices( [ out, retval ] boolean* value );

        [ propget ] HRESULT DiscoveredOnCurrentNetwork( [ out, retval ] boolean* value );

        [ propget ] HRESULT Type( [ out, retval ] Windows.Media.Streaming.DeviceTypes* value );

        [ propget ] HRESULT Icons( [ out, retval ] IVector< IDeviceIcon >** value );

        [ propget ] HRESULT ConnectionStatus( [ out, retval ] ConnectionStatus* value );

        [ eventadd ] HRESULT ConnectionStatusChanged(
            [ in ] ConnectionStatusHandler* handler,
            [ out, retval ] EventRegistrationToken* token );

        [ eventremove ] HRESULT ConnectionStatusChanged( [ in ] EventRegistrationToken token );
    };

    //////////////////////////////////////////////////////////////////////
    [version(NTDDI_WINBLUE), uuid(b64d6974-6e79-49af-9933-908b6e9a160c)]
    interface IActiveBasicDevice : IInspectable requires IBasicDevice
    {        
        [propget] HRESULT MaxVolume( [out, retval] UINT32* value );

        [propget] HRESULT IsMuteSupported( [ out, retval ] boolean* value );

        [propget] HRESULT IsSetNextSourceSupported( [ out, retval ] boolean* value );        

        [propget] HRESULT IsAudioSupported( [ out, retval ] boolean* value );

        [propget] HRESULT IsVideoSupported( [ out, retval ] boolean* value );        

        [propget] HRESULT IsImageSupported( [ out, retval ] boolean* value );  

        [propget] HRESULT IsSearchSupported( [ out, retval ] boolean* value );  

        HRESULT GetCachedSinkProtocolInfo( [ out, retval ] HSTRING* value );        

        HRESULT SetCachedSinkProtocolInfo( [ in ] HSTRING value );                

        HRESULT GetCachedExtraSinkProtocolInfo( [ out, retval ] HSTRING* value );        

        HRESULT GetEffectiveBandwidth( [ in ] boolean transmitSpeed, [ out, retval ] ULONG64 *currentSpeed );

        HRESULT GetCachedBitrateMeasurement( [ in ] GUID physicalNetworkInterface, [ out, retval ] UINT64 *bitrate );

        HRESULT SetCachedBitrateMeasurement( [ in ] GUID physicalNetworkInterface, [ in ] UINT64 bitrate );     

        [propget] HRESULT LogicalNetworkInterface( [ out, retval ] GUID *logicalNetworkInterface );

        [propget] HRESULT PhysicalNetworkInterface( [out, retval ] GUID *physicalNetworkInterface );  

        HRESULT NotifyStreamingStatus( [ in ] boolean fIsStreaming );     
    };

    //////////////////////////////////////////////////////////////////////
    [
        version( NTDDI_WIN8 ),
        uuid(8ffb1a1e-023d-4de1-b556-ab5abf01929c)
    ]
    interface IDeviceIcon : IInspectable
    {
        [propget] HRESULT Width([out, retval] UINT32* value);
        [propget] HRESULT Height([out, retval] UINT32* value);
        [propget] HRESULT ContentType([out, retval] HSTRING *value);  
        [propget] HRESULT Stream([out, retval] Windows.Storage.Streams.IRandomAccessStreamWithContentType** value);
    };    

    //////////////////////////////////////////////////////////////////////
    [ 
        version( NTDDI_WIN8 ),
        activatable( NTDDI_WIN8 ),
        threading(mta)
    ]
    runtimeclass DeviceController
    {
        [default] interface IDeviceController;
    }

    ///////////////////////////////////////////////////////////////////////////
    [ 
        version( NTDDI_WIN8 ),
        activatable( NTDDI_WIN8 )
    ]
    runtimeclass BasicDevice
    {
        [default] interface IBasicDevice;
    }

    ///////////////////////////////////////////////////////////////////////////
    [ 
        version( NTDDI_WINBLUE ),
        activatable( NTDDI_WINBLUE ),
        static( IActiveBasicDeviceStatics, NTDDI_WINBLUE )
    ]
    runtimeclass ActiveBasicDevice
    {
        [default] interface IActiveBasicDevice;
    }

    
    ///////////////////////////////////////////////////////////////////////////
    [
        version( NTDDI_WINBLUE ),
        uuid(6d33255d-3642-4618-9db6-43524f4deadc)
    ]
    interface IActiveBasicDeviceStatics : IInspectable
    {
        HRESULT CreateBasicDeviceAsync(
            [ in ] HSTRING deviceIdentifier,
            [ in ] Windows.Media.Streaming.DeviceTypes type,
            [ out, retval ] Windows.Foundation.IAsyncOperation<ActiveBasicDevice>** value ); 

        HRESULT CloneBasicDeviceAsync(
            [ in ] IBasicDevice *basicDevice,
            [ out, retval ] Windows.Foundation.IAsyncOperation<ActiveBasicDevice>** value );                     

        HRESULT GetDevicesOnMatchingNetworkAsync(
            [ in ] IActiveBasicDevice *server,
            [ in ] IActiveBasicDevice *renderer,
            [ in ] boolean optimizeForProxying,
            [ in ] boolean allowChangeRendererNetwork,
            [ out, retval ] Windows.Foundation.IAsyncOperation<DevicePair>** operation);    

        HRESULT CreateDevicesOnMatchingNetworkAsync(
            [ in ] HSTRING serverUDN,
            [ in ] IActiveBasicDevice *renderer,
            [ in ] boolean optimizeForProxying,
            [ in ] boolean allowChangeRendererNetwork,
            [ out, retval ] Windows.Foundation.IAsyncOperation<DevicePair>** operation);                
    }    

    ///////////////////////////////////////////////////////////////////////////
    [version(NTDDI_WINBLUE), uuid(f1a423f1-b7b4-449c-a90d-aea8e17c5e5f)]
    interface IDevicePair : IInspectable
    {
        [propget] HRESULT Server([ out, retval ] ActiveBasicDevice** value);
        [propget] HRESULT Renderer([ out, retval ] ActiveBasicDevice** value);
    };

    ///////////////////////////////////////////////////////////////////////////
    [version(NTDDI_WINBLUE)]
    runtimeclass DevicePair
    {
        [default] interface IDevicePair;
    }    
} // end of Windows.Media.Streaming namespace









