/*
* Copyright (c) 2022 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 System.Collections.Generic;
using SafeExamBrowser.Server.Contracts.Data;
using SafeExamBrowser.Server.Contracts.Events;
using SafeExamBrowser.Settings.Server;
namespace SafeExamBrowser.Server.Contracts
{
///
/// Defines the communication options with a server.
///
public interface IServerProxy
{
///
/// Event fired when the proxy receives a confirmation for a raise hand notification.
///
event ServerEventHandler HandConfirmed;
///
/// Event fired when the proxy receives a confirmation for a lock screen notification.
///
event ServerEventHandler LockScreenConfirmed;
///
/// Event fired when the proxy receives a lock screen instruction.
///
event LockScreenRequestedEventHandler LockScreenRequested;
///
/// Event fired when the proxy receives new proctoring configuration values.
///
event ProctoringConfigurationReceivedEventHandler ProctoringConfigurationReceived;
///
/// Event fired when the proxy receives a proctoring instruction.
///
event ProctoringInstructionReceivedEventHandler ProctoringInstructionReceived;
///
/// Event fired when the proxy detects an instruction to terminate SEB.
///
event TerminationRequestedEventHandler TerminationRequested;
///
/// Sends a lock screen confirm notification to the server.
///
ServerResponse ConfirmLockScreen();
///
/// Attempts to initialize a connection with the server.
///
ServerResponse Connect();
///
/// Terminates a connection with the server.
///
ServerResponse Disconnect();
///
/// Retrieves a list of all currently available exams, or a list containing the specified exam.
///
ServerResponse> GetAvailableExams(string examId = default);
///
/// Retrieves the URI of the configuration file for the given exam.
///
ServerResponse GetConfigurationFor(Exam exam);
///
/// Retrieves the information required to establish a connection with the server.
///
ConnectionInfo GetConnectionInfo();
///
/// Initializes the server settings to be used for communication.
///
void Initialize(ServerSettings settings);
///
/// Initializes the configuration and server settings to be used for communication.
///
void Initialize(string api, string connectionToken, string examId, string oauth2Token, ServerSettings settings);
///
/// Sends a lock screen notification to the server.
///
ServerResponse LockScreen(string message = default);
///
/// Sends a lower hand notification to the server.
///
ServerResponse LowerHand();
///
/// Sends a raise hand notification to the server.
///
ServerResponse RaiseHand(string message = default);
///
/// Sends the selected exam to the server.
///
ServerResponse SendSelectedExam(Exam exam);
///
/// Sends the given user session identifier of a LMS and thus establishes a connection with the server.
///
ServerResponse SendSessionIdentifier(string identifier);
///
/// Starts sending ping and log data to the server.
///
void StartConnectivity();
///
/// Stops sending ping and log data to the server.
///
void StopConnectivity();
}
}