Interface/Interface.cs
author sl
Fri, 15 Aug 2014 13:26:38 +0200
changeset 32 4c416d2878dd
parent 30 c375286d1a1c
child 43 86aad774b532
permissions -rw-r--r--
Reworking our protocols. Client name now displayed in our clients tab.
sl@24
     1
using System;
sl@24
     2
using System.Collections.Generic;
sl@24
     3
using System.Linq;
sl@24
     4
using System.Text;
sl@24
     5
using System.Threading.Tasks;
sl@24
     6
using System.ServiceModel;
sl@24
     7
using System.Collections;
sl@24
     8
sl@24
     9
sl@24
    10
namespace SharpDisplayInterface
sl@24
    11
{
sl@30
    12
    
sl@30
    13
    [ServiceContract(   CallbackContract = typeof(IDisplayServiceCallback),
sl@30
    14
                        SessionMode = SessionMode.Required)]
sl@24
    15
    public interface IDisplayService
sl@24
    16
    {
sl@32
    17
        /// <summary>
sl@32
    18
        /// Set the name of this client.
sl@32
    19
        /// Name is a convenient way to recognize your client.
sl@32
    20
        /// Naming you client is not mandatory.
sl@32
    21
        /// In the absence of a name the session ID is often used instead.
sl@32
    22
        /// </summary>
sl@32
    23
        /// <param name="aClientName"></param>
sl@24
    24
        [OperationContract(IsOneWay = true)]
sl@32
    25
        void SetName(string aClientName);
sl@24
    26
sl@32
    27
        /// <summary>
sl@32
    28
        /// Put the given text in the given field on your display.
sl@32
    29
        /// Fields are often just lines of text.
sl@32
    30
        /// </summary>
sl@32
    31
        /// <param name="aFieldIndex"></param>
sl@32
    32
        /// <param name="aText"></param>
sl@24
    33
        [OperationContract(IsOneWay = true)]
sl@32
    34
        void SetText(int aFieldIndex, string aText);
sl@26
    35
sl@32
    36
        /// <summary>
sl@32
    37
        /// Allows a client to set multiple text fields at once.
sl@32
    38
        /// First text in the list is set into field index 0.
sl@32
    39
        /// Last text in the list is set into field index N-1.
sl@32
    40
        /// </summary>
sl@32
    41
        /// <param name="aTexts"></param>
sl@24
    42
        [OperationContract(IsOneWay = true)]
sl@24
    43
        void SetTexts(System.Collections.Generic.IList<string> aTexts);
sl@32
    44
sl@32
    45
        /// <summary>
sl@32
    46
        /// Provides the number of clients currently connected
sl@32
    47
        /// </summary>
sl@32
    48
        /// <returns></returns>
sl@32
    49
        [OperationContract()]
sl@32
    50
        int ClientCount();
sl@32
    51
sl@24
    52
    }
sl@24
    53
sl@24
    54
sl@24
    55
    public interface IDisplayServiceCallback
sl@24
    56
    {
sl@24
    57
        [OperationContract(IsOneWay = true)]
sl@24
    58
        void OnConnected();
sl@24
    59
sl@32
    60
        /// <summary>
sl@32
    61
        /// Tell our client to close its connection.
sl@32
    62
        /// Notably sent when the server is shutting down.
sl@32
    63
        /// </summary>
sl@24
    64
        [OperationContract(IsOneWay = true)]
sl@32
    65
        void OnCloseOrder();
sl@24
    66
    }
sl@24
    67
sl@24
    68
sl@24
    69
sl@24
    70
}