UNPKG

vodafone-station-cli

Version:

Access your Vodafone Station from the comfort of the command line.

83 lines (82 loc) 2.91 kB
import { AxiosInstance } from 'axios'; import { CookieJar } from 'tough-cookie'; import type { Protocol as HttpProtocol } from './discovery'; import { Log } from '../logger'; export type DocsisChannelType = 'OFDM' | 'OFDMA' | 'SC-QAM'; export type Modulation = '16QAM' | '32QAM' | '64QAM' | '256QAM' | '1024QAM' | '2048QAM' | '4096QAM' | 'QPSK' | 'Unknown'; export type Protocol = 'TCP' | 'UDP'; export interface HumanizedDocsisChannelStatus { channelId: string; channelType: DocsisChannelType; frequency: number; lockStatus: string; modulation: Modulation; powerLevel: number; snr: number; } export interface DiagnosedDocsisChannelStatus extends HumanizedDocsisChannelStatus { diagnose: Diagnose; } export interface DiagnosedDocsis31ChannelStatus extends HumanizedDocsis31ChannelStatus { diagnose: Diagnose; } export interface Diagnose { color: 'green' | 'red' | 'yellow'; description: string; deviation: boolean; } export interface HumanizedDocsis31ChannelStatus extends Omit<HumanizedDocsisChannelStatus, 'frequency'> { frequencyEnd: number; frequencyStart: number; } export interface DocsisStatus { downstream: HumanizedDocsisChannelStatus[]; downstreamOfdm: HumanizedDocsis31ChannelStatus[]; time: string; upstream: HumanizedDocsisChannelStatus[]; upstreamOfdma: HumanizedDocsis31ChannelStatus[]; } export interface DiagnosedDocsisStatus { downstream: DiagnosedDocsisChannelStatus[]; downstreamOfdm: DiagnosedDocsis31ChannelStatus[]; time: string; upstream: DiagnosedDocsisChannelStatus[]; upstreamOfdma: DiagnosedDocsis31ChannelStatus[]; } export interface ExposedHostSettings { enabled: boolean; endPort: number; index: number; mac: string; protocol: Protocol; serviceName: string; startPort: number; } export interface HostExposureSettings { hosts: ExposedHostSettings[]; } export interface GenericModem { docsis(): Promise<DocsisStatus>; getHostExposure(): Promise<HostExposureSettings>; login(password: string): Promise<void>; logout(): Promise<void>; restart(): Promise<unknown>; } export declare abstract class Modem implements GenericModem { protected readonly modemIp: string; protected readonly protocol: HttpProtocol; protected readonly logger: Log; static USERNAME: string; protected readonly cookieJar: CookieJar; protected readonly httpClient: AxiosInstance; constructor(modemIp: string, protocol: HttpProtocol, logger: Log); get baseUrl(): string; docsis(): Promise<DocsisStatus>; getHostExposure(): Promise<HostExposureSettings>; login(_password: string): Promise<void>; logout(): Promise<void>; restart(): Promise<unknown>; setHostExposure(_: HostExposureSettings): Promise<void>; private initAxios; } export declare function normalizeModulation(modulation: string): Modulation;