import { RoleUserEnum } from "../enum/RoleUserEnum"; import { TDeterminants } from "../type/TDeterminants"; import { ConnectionStateT } from "../type/ConnectionStateT"; import { DeviceT } from "../type/DeviceT"; import { IDeterminants } from "../interface/IDeterminants"; import { NetworkQuality } from "agora-rtc-sdk-ng"; import { WSTransport } from "../../transport/WSTransport"; export class Determinants implements IDeterminants { public ConnectionState!: ConnectionStateT; public Updating!: boolean; public Role!: RoleUserEnum; public RoleIncoming!: RoleUserEnum; public HasAudio!: boolean; public HasCamera!: boolean; public HasScreen!: boolean; public HasProxy!: boolean; public Uid!: number | string; public AppId!: string; public Channel!: string; public ChannelIncoming!: string; public Muted!: boolean; public MicrophoneSelected!: DeviceT; public CameraSelected!: DeviceT; public PlayBackSelected!: DeviceT; public DeterminantsCallback!:Function; public Init!:boolean; public NetworkQuality!:NetworkQuality; public LoggerViewCallback!: Function; public volumenCallback!:Function; public userInformation!: any; public actionDispatch!: Function; public tranport!: WSTransport; constructor(determinants?: TDeterminants){ if(determinants){ this.ConnectionState = determinants.ConnectionState; this.Updating = determinants.Updating; this.Role = determinants.Role; this.HasAudio = determinants.HasAudio; this.HasCamera = determinants.HasCamera; this.HasScreen = determinants.HasScreen; if(determinants.HasProxy) this.HasProxy = determinants.HasProxy; if(determinants.Uid) this.Uid = determinants.Uid; if(determinants.AppId) this.AppId = determinants.AppId; if(determinants.Channel) this.Channel = determinants.Channel; if(determinants.Muted) this.Muted = determinants.Muted; if(determinants.MicrophoneSelected) this.MicrophoneSelected = determinants.MicrophoneSelected; if(determinants.CameraSelected) this.CameraSelected = determinants.CameraSelected; if(determinants.PlayBackSelected) this.PlayBackSelected = determinants.PlayBackSelected; if(determinants.DeterminantsCallback) this.DeterminantsCallback = determinants.DeterminantsCallback; if(determinants.Init) this.Init = determinants.Init; if(determinants.LoggerViewCallback) this.LoggerViewCallback = determinants.LoggerViewCallback; if(determinants.volumenCallback) this.volumenCallback = determinants.volumenCallback; if(determinants.userInformation) this.userInformation = determinants.userInformation; if(determinants.actionDispatch) this.actionDispatch = determinants.actionDispatch; if(determinants.tranport) this.tranport = determinants.tranport; if(determinants.ChannelIncoming) this.ChannelIncoming = determinants.ChannelIncoming; if(determinants.RoleIncoming) this.RoleIncoming = determinants.RoleIncoming; if(determinants.NetworkQuality) this.NetworkQuality = determinants.NetworkQuality; } } public doDeterminatsCallback(){ if(this.DeterminantsCallback){ this.getDeterminantsCallback()(this); } } public setDeterminantsCallback(value: Function) { this.DeterminantsCallback = value; } public getDeterminantsCallback() : Function { return this.DeterminantsCallback; } public getUid(): string | number { return this.Uid; } public setUid(value: number | string) { this.Uid = value; this.doDeterminatsCallback(); } public getHasScreen(): boolean { return this.HasScreen; } public setHasScreen(value: boolean) { this.HasScreen = value; this.doDeterminatsCallback(); } public getHasProxy(): boolean { return this.HasProxy; } public setHasProxy(value: boolean) { this.HasProxy = value; this.doDeterminatsCallback(); } public getHasCamera(): boolean { return this.HasCamera; } public setHasCamera(value: boolean) { this.HasCamera = value; this.doDeterminatsCallback(); } public getHasAudio(): boolean { return this.HasAudio; } public setHasAudio(value: boolean) { this.HasAudio = value; this.doDeterminatsCallback(); } public getUpdating(): boolean { return this.Updating; } public setUpdating(value: boolean) { this.Updating = value; this.doDeterminatsCallback(); } public getConnectionState(): ConnectionStateT { return this.ConnectionState; } public setConnectionState(value: ConnectionStateT) { this.ConnectionState = value; this.doDeterminatsCallback(); } public getAppId(): string { return this.AppId; } public setAppId(value: string) { this.AppId = value; this.doDeterminatsCallback(); } public getRole(): RoleUserEnum { return this.Role; } public setRole(value: RoleUserEnum) { this.Role = value; this.doDeterminatsCallback(); } public getChannel(): string | undefined { return this.Channel; } public setChannel(value: string | undefined) { this.Channel = value; this.doDeterminatsCallback(); } public getMuted(): boolean { return this.Muted; } public setMuted(value: boolean): void { this.Muted = value; this.doDeterminatsCallback(); } public getMicrophoneSelected(): DeviceT { return this.MicrophoneSelected; } public setMicrophoneSelected(value: DeviceT): void { this.MicrophoneSelected = value; this.doDeterminatsCallback(); } public getCameraSelected(): DeviceT { return this.CameraSelected; } public setCameraSelected(value: DeviceT): void { this.CameraSelected = value; this.doDeterminatsCallback(); } public getPlayBackSelected(): DeviceT { return this.PlayBackSelected; } public setPlayBackSelected(value: DeviceT): void { this.PlayBackSelected = value; this.doDeterminatsCallback(); } public getInit(): boolean { return this.Init; } public setInit(value: boolean): void { this.Init = value; this.doDeterminatsCallback(); } public getLoggerViewCallback(): any { return this.LoggerViewCallback; } public setLoggerViewCallback(value: any) { this.LoggerViewCallback = value; } public getNetworkQuality(): NetworkQuality { return this.NetworkQuality; } public setNetworkQuality(value: NetworkQuality): void { this.NetworkQuality = value; this.doDeterminatsCallback(); } public getVolumenCallback(): Function { return this.volumenCallback; } public setVolumenCallback(value: Function): void { this.volumenCallback = value; } public setUserInformation(value: any): void { this.userInformation = value; this.doDeterminatsCallback(); } public getUserInformation() : any{ return this.userInformation; } public setActionDispatch(value: Function): void { this.actionDispatch = value; this.doDeterminatsCallback(); } public getActionDispatch(): Function { return this.actionDispatch; } public setTranport(value: WSTransport): void { this.tranport = value; this.doDeterminatsCallback(); } public getTranport(): WSTransport { return this.tranport; } public setChannelIncoming(value: string): void { this.ChannelIncoming = value; this.doDeterminatsCallback(); } public getChannelIncoming(): string { return this.ChannelIncoming; } public setRoleIncoming(value: RoleUserEnum): void { this.RoleIncoming=value; this.doDeterminatsCallback(); } public getRoleIncoming(): RoleUserEnum { return this.RoleIncoming; } }