1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76

ash / webui / diagnostics_ui / resources / diagnostics_types.ts [blame]

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/**
 * @fileoverview
 * Type aliases for the mojo API.
 */

import {KeyboardInfo} from './input.mojom-webui.js';
import {TouchDeviceInfo} from './input_data_provider.mojom-webui.js';
import {CellularStateProperties, EthernetStateProperties, IPConfigProperties, Network, WiFiStateProperties} from './network_health_provider.mojom-webui.js';
import {RoutineType} from './system_routine_controller.mojom-webui.js';

export interface NetworkGuidInfo {
  networkGuids: string[];
  activeGuid: string;
}

// Radio band related to channel frequency.
export enum ChannelBand {
  UNKNOWN,
  /** 5Ghz radio band. */
  FIVE_GHZ,
  /** 2.4Ghz radio band. */
  TWO_DOT_FOUR_GHZ,
}

// Struct for holding data related to WiFi network channel.
export interface ChannelProperties {
  channel: number;
  band: ChannelBand;
}

export interface RoutineProperties {
  routine: RoutineType;
  blocking: boolean;
}

export interface TroubleshootingInfo {
  header: string;
  linkText: string;
  url: string;
}

/**
 * Type alias for ash::diagnostics::metrics::NavigationView to support message
 * handler logic and metric recording. Enum values need to be kept in sync with
 * "ash/webui/diagnostics_ui/diagnostics_metrics_message_handler.h".
 */
export enum NavigationView {
  SYSTEM,
  CONNECTIVITY,
  INPUT,
  MAX_VALUE,
}

// Type alias for the the response from InputDataProvider.GetConnectedDevices.
export interface GetConnectedDevicesResponse {
  keyboards: KeyboardInfo[];
  touchDevices: TouchDeviceInfo[];
}

// Specifying subtypes for convenience for different possible fields in
// |typeProperties|.
export type WiFiNetwork = Omit<Network, 'typeProperties'>&{
  typeProperties: {wifi?: WiFiStateProperties} | null,
};

export type CellularNetwork = Omit<Network, 'typeProperties'>&{
  typeProperties: {cellular?: CellularStateProperties} | null,
};

export type EthernetNetwork = Omit<Network, 'typeProperties'>&{
  typeProperties: {ethernet?: EthernetStateProperties} | null,
};