Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Crazyradio

Hierarchy

  • EventEmitter
    • Crazyradio

Index

Constructors

constructor

Properties

Private consoleLine

consoleLine: string = ""

Private device

device: Device

Private fallbackPingInterval

fallbackPingInterval: Timer

Private fallbackPingTimeout

fallbackPingTimeout: Timer

Private inEndpoint

inEndpoint: InEndpoint

Private inStream

inStream: InStream

Private initialized

initialized: boolean = false

Private interface

interface: Interface

options

options: CrazyradioOptions = defaultOptions

Private outEndpoint

outEndpoint: OutEndpoint

Private outStream

outStream: OutStream

Private packetResponseTimeout

packetResponseTimeout: number = -1

Private pingInterval

pingInterval: number = 5

version

version: number

Static defaultMaxListeners

defaultMaxListeners: number

Methods

addListener

  • addListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

close

  • close(): Promise<Object>

configure

connect

disconnect

  • disconnect(): void

emit

  • emit(event: string | symbol, ...args: any[]): boolean
  • Parameters

    • event: string | symbol
    • Rest ...args: any[]

    Returns boolean

eventNames

  • eventNames(): Array<string | symbol>
  • Returns Array<string | symbol>

findDrones

  • findDrones(): Promise<Uri[]>

getMaxListeners

  • getMaxListeners(): number
  • Returns number

Private getVendorSetup

  • getVendorSetup(request: number, value: number, index: number, length: number): Promise<Buffer>
  • Parameters

    • request: number
    • value: number
    • index: number
    • length: number

    Returns Promise<Buffer>

init

  • For doing all the asynchronous setup of the Crazyradio

    Parameters

    • options: CrazyradioOptions
    • Default value device: Device = Crazyradio.findRadios()[0]

    Returns Promise<void>

listenerCount

  • listenerCount(type: string | symbol): number
  • Parameters

    • type: string | symbol

    Returns number

listeners

  • listeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

on

  • on(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

Private onInStreamData

  • onInStreamData(data: Buffer): void

Private onInStreamError

  • onInStreamError(err: string): void

once

  • once(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

ping

  • ping(): Promise<Object>

prependListener

  • prependListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

rawListeners

  • rawListeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

removeAllListeners

  • removeAllListeners(event?: string | symbol): this
  • Parameters

    • Optional event: string | symbol

    Returns this

removeListener

  • removeListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

scanChannels

  • scanChannels(start?: number, stop?: number, packet?: Buffer): Promise<Buffer>
  • Parameters

    • Default value start: number = 0
    • Default value stop: number = 125
    • Default value packet: Buffer = BUFFERS.SOMETHING

    Returns Promise<Buffer>

scanRange

  • scanRange(dataRate: number): Promise<Uri[]>

sendPacket

  • sendPacket(packet: Packet): Promise<Object>

Private sendVendorSetup

  • sendVendorSetup(request: number, value: number, index?: number, data?: Buffer): Promise<void>
  • Parameters

    • request: number
    • value: number
    • Default value index: number = 0
    • Default value data: Buffer = BUFFERS.NOTHING

    Returns Promise<void>

setAckEnable

  • setAckEnable(active: boolean): Promise<void>

setAckRetryCount

  • setAckRetryCount(count: number): Promise<void>

setAckRetryDelay

  • setAckRetryDelay(delay: number): Promise<void>

setAckRetryDelayBytes

  • setAckRetryDelayBytes(bytes: number): Promise<void>

setAckRetryDelayMicroseconds

  • setAckRetryDelayMicroseconds(microseconds: number): Promise<void>

setContCarrier

  • setContCarrier(active: boolean): Promise<void>

setDataRate

  • setDataRate(rate: number): Promise<void>

setMaxListeners

  • setMaxListeners(n: number): this
  • Parameters

    • n: number

    Returns this

setRadioAddress

  • setRadioAddress(address: number): Promise<void>

setRadioChannel

  • setRadioChannel(channel: number): Promise<void>

setRadioPower

  • setRadioPower(power: number): Promise<void>

Static findRadios

  • findRadios(vid?: number, pid?: number): Device[]
  • Find available Crazyradios plugged in via USB

    Parameters

    • Default value vid: number = CRAZYRADIO.VID
    • Default value pid: number = CRAZYRADIO.PID

    Returns Device[]

Static findUSBDevices

  • findUSBDevices(): Device[]

Static listenerCount

  • listenerCount(emitter: EventEmitter, event: string | symbol): number
  • Parameters

    • emitter: EventEmitter
    • event: string | symbol

    Returns number

Generated using TypeDoc