Options
All
  • Public
  • Public/Protected
  • All
Menu

Class to configure the network for a raspberry pi based access point

Hierarchy

  • NetworkConfig

Index

Constructors

constructor

Properties

Private adapter

Private address

address: number

Methods

Private _captureNetworkList

  • _captureNetworkList(index: number): Promise<number>

Private _networkInfoChunk

  • _networkInfoChunk(index: number, offset: number): Promise<ArrayBuffer>
  • Get information on a given wireless network.

    You must have previously called list_networks to capture network information from a given interface and then you can iterate over those results by calling this function. If the network name is longer than 20 bytes, you can call this function with a nonzero offset in order to retrieve the higher parts of the name. The same header information is repeated with each call, not just when offset=0.

    The response contains:

    • Network auth type and flags
    • Signal quality
    • Total name length
    • Valid name length in this segment
    • up to 16 bytes of the access point ssid or carrier name depending on whether the network is wifi or cellular.

    To enquire about the active network for the interface, pass -1 as the index.

    Parameters

    • index: number
    • offset: number

    Returns Promise<ArrayBuffer>

Private _pushSettingValueChunk

  • _pushSettingValueChunk(data: ArrayBuffer, commit?: boolean): Promise<void>

activeNetwork

  • Get the active network for a given interface.

    Parameters

    • index: number

      A network interface index.

    Returns Promise<WirelessNetwork>

    WirelessNetwork show-as string: The active wireless network.

beginConnection

  • beginConnection(): Promise<any>

configEthernet

  • configEthernet(iface: number, staticIp?: null | string, dns?: null | string, netmask?: null | string, gateway?: null | string): Promise<void>
  • Set up the ethernet configuration of a device. Currently only designed for static ip allocation.

    Parameters

    • iface: number

      The index of the interface that we wish to configure as an ethernet network. This should be a wifi type interface.

    • Default value staticIp: null | string = null

      An optional static ipv4 address in X.Y.Z.W format

    • Default value dns: null | string = null

      An optional dns server in X.Y.Z.W format, only used if combined with static_ip.

    • Default value netmask: null | string = null

      An optional netmask in X.Y.Z.W format, only used if combined with static_ip.

    • Default value gateway: null | string = null

      An optional default gateway for routing traffic. Only used if combined with static_ip.

    Returns Promise<void>

configWifi

  • configWifi(iface: number, networkName: string, password?: string, staticIp?: null | string, dns?: null | string, netmask?: null | string, gateway?: null | string, shared?: boolean): Promise<void>
  • Setup a basic wifi connection.

    You need to enter the network ssid and password (if there is one). If you want a default dhcp based connection those are the only settings you need. Otherwise, you can specify a static IP address by passing static_ip, dns, netmask and gateway.

    If you want to create a wifi hotspot, you can pass shared=True and the network name and password are used to create a wifi hotspot. If you combine shared=True with a static IP then you can set the IP of the node and the netmask it will use to allocate IPs for other computers connecting to its hotspot. The dns and gateway options are ignored if shared=True.

    Parameters

    • iface: number

      The index of the interface that we wish to configure as a wifi network. This should be a wifi type interface.

    • networkName: string

      The ssid of the network that you wish to join

    • Default value password: string = ""

      An optional password for the network

    • Default value staticIp: null | string = null

      An optional static ipv4 address in X.Y.Z.W format

    • Default value dns: null | string = null

      An optional dns server in X.Y.Z.W format, only used if combined with static_ip.

    • Default value netmask: null | string = null

      An optional netmask in X.Y.Z.W format, only used if combined with static_ip.

    • Default value gateway: null | string = null

      An optional default gateway for routing traffic. Only used if combined with static_ip.

    • Default value shared: boolean = false

      Whether to setup the interface as a hotspot or not.

    Returns Promise<void>

encodeValue

  • encodeValue(value: any): ArrayBuffer

finishConnection

  • finishConnection(index: any): Promise<void>

interfaceInfo

  • Get basic information about a network interface.

    This information includes the type of interface, whether it is currently connected to a media / ethernet cable and what its IP information is.

    Parameters

    • index: number

      The index of the interface we wish to query. This must be < the count returned by list_interfaces.

    Returns Promise<NetworkInterfaceInfo>

    InterfaceInfo show-as string: An InterfaceInfo structure with the interface info.

listInterfaces

  • listInterfaces(): Promise<any>
  • Capture and count the network interfaces on this device.

    This function must be called before any other interface related functions are called since it captures the network devices for future access.

    The interfaces may be accessed by index after calling this function and their index number will always point to the same device until this function is called again.

    Returns Promise<any>

    : The count of network devices.

listNetworks

  • List all visible networks for a given interface.

    Parameters

    • index: number

      A network interface index.

    Returns Promise<WirelessNetwork[]>

    A list of visible WirelessNetwork objects

networkInfo

  • Get information on a given wireless network.

    You must have previously called list_networks to capture network information from a given interface and then you can iterate over those results by calling this function. If the network name is longer than 20 bytes, you can call this function with a nonzero offset in order to retrieve the higher parts of the name. The same header information is repeated with each call, not just when offset=0.

    The response contains:

    • Network auth type and flags
    • Signal quality
    • Total name length
    • Valid name length in this segment
    • up to 16 bytes of the access point ssid or carrier name depending on whether the network is wifi or cellular.

    To enquire about the active network for the interface, pass -1 as the index.

    Parameters

    • index: number

      The index of the network to enquire about. Pass -1 to ask about the active network

    Returns Promise<WirelessNetwork>

pushConfigSetting

  • pushConfigSetting(settingCode: SettingCodes, value: any): Promise<void>

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc