/*
* Copyright (c) 2018 ETH Zürich, Educational Development and Technology (LET)
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using System;
using SafeExamBrowser.Contracts.Communication.Events;
namespace SafeExamBrowser.Contracts.Communication
{
///
/// Defines the common functionality for all communication proxies. A proxy is needed to be able to perform inter-process communication
/// with the of another application component.
///
public interface ICommunicationProxy
{
///
/// Fired when the connection to the host was lost, e.g. if a ping request failed or a communication fault occurred.
///
event CommunicationEventHandler ConnectionLost;
///
/// Tries to establish a connection. Returns true if the connection has been accepted, otherwise false. If a
/// connection was successfully established and the auto-ping flag is set, the connection status will be periodically checked.
///
/// If the communication failed.
bool Connect(Guid? token = null, bool autoPing = true);
///
/// Terminates an open connection. Returns true if the disconnection has been acknowledged, otherwise false.
///
/// If no connection has been established.
/// If the communication failed.
bool Disconnect();
}
}