import { EventEmitter } from "events"; import { SRTLoggingLevel, SRTResult, SRTSockOpt, SRTSockStatus } from "../src/srt-api-enums"; import { SRTReadReturn, SRTFileDescriptor, SRTEpollEvent, SRTSockOptValue, SRTStats } from "./srt-api" export type AsyncSRTCallback = (result: T) => void; export class AsyncSRT extends EventEmitter { static TimeoutMs: number; /** * * @param sender * @returns SRTSOCKET identifier (integer value) */ createSocket(sender: boolean, callback?: AsyncSRTCallback): Promise /** * * @param socket * @param address * @param port */ bind(socket: number, address: string, port: number, callback?: AsyncSRTCallback): Promise /** * * @param socket * @param backlog */ listen(socket: number, backlog: number, callback?: AsyncSRTCallback): Promise /** * * @param socket * @param host * @param port */ connect(socket: number, host: string, port: number, callback?: AsyncSRTCallback): Promise /** * * @param socket * @returns File descriptor of incoming connection pipe */ accept(socket: number, callback?: AsyncSRTCallback): Promise /** * * @param socket */ close(socket: number, callback?: AsyncSRTCallback): Promise /** * * @param socket * @param chunkSize */ read(socket: number, chunkSize: number, callback?: AsyncSRTCallback): Promise /** * * @param socket * @param chunk */ write(socket: number, chunk: Buffer, callback?: AsyncSRTCallback): Promise /** * * @param socket * @param option * @param value */ setSockOpt(socket: number, option: SRTSockOpt, value: SRTSockOptValue, callback?: AsyncSRTCallback): Promise /** * * @param socket * @param option */ getSockOpt(socket: number, option: SRTSockOpt, callback?: AsyncSRTCallback): Promise /** * * @param socket */ getSockState(socket: number, callback?: AsyncSRTCallback): Promise /** * @returns epid */ epollCreate(callback?: AsyncSRTCallback): Promise /** * * @param epid * @param socket * @param events */ epollAddUsock(epid: number, socket: number, events: number, callback?: AsyncSRTCallback): Promise /** * * @param epid * @param msTimeOut */ epollUWait(epid: number, msTimeOut: number, callback?: AsyncSRTCallback): Promise /** * * @param logLevel */ setLogLevel(logLevel: SRTLoggingLevel, callback?: AsyncSRTCallback): Promise /** * * @param socket * @param clear if true, accumulated stats are cleared after each call */ stats(socket: number, clear: boolean, callback?: AsyncSRTCallback): Promise }