Options
All
  • Public
  • Public/Protected
  • All
Menu

hap-nodejs

Index

Enumerations

Classes

Interfaces

Type aliases

Variables

Functions

Type aliases

AccessoriesCallback: (error: HAPHttpError | undefined, result?: AccessoriesResponse) => void

Type declaration

    • (error: HAPHttpError | undefined, result?: AccessoriesResponse): void
    • Parameters

      • error: HAPHttpError | undefined
      • Optional result: AccessoriesResponse

      Returns void

AccessoryCharacteristicChange: ServiceCharacteristicChange & { service: Service }
AddPairingCallback: PairingsCallback
AdditionalAuthorizationHandler: (additionalAuthorizationData: string | undefined) => boolean

Type declaration

    • (additionalAuthorizationData: string | undefined): boolean
    • Parameters

      • additionalAuthorizationData: string | undefined

      Returns boolean

Address: { address: string; type?: "v4" | "v6" }
deprecated

just supply the address directly in PrepareStreamRequest

Type declaration

  • address: string
  • Optional type?: "v4" | "v6"
AudioCodec: { samplerate: number; type: string }
deprecated

replaced by AudioStreamingCodec

Type declaration

  • samplerate: number
  • type: string
AudioCodecConfiguration: { codecType: AudioCodecTypes; parameters: AudioCodecParameters }

Type declaration

AudioCodecParameters: { bitrate: AudioBitrate; channels: number; rtpTime?: RTPTime; samplerate: AudioSamplerate }

Type declaration

AudioFrame: { data: Buffer; rms: number }

Type declaration

  • data: Buffer
  • rms: number
AudioInfo: { bit_rate: number; channel: number; codec: AudioStreamingCodecType; comfortNoiseEnabled: boolean; comfort_pt: number; max_bit_rate: number; packet_time: number; pt: number; rtcp_interval: number; sample_rate: AudioStreamingSamplerate; ssrc: number }

Type declaration

AudioRecordingCodec: { audioChannels?: number; bitrateMode?: AudioBitrate; samplerate: AudioRecordingSamplerate[] | AudioRecordingSamplerate; type: AudioRecordingCodecType }

Type declaration

AudioRecordingOptions: { codecs: AudioRecordingCodec | AudioRecordingCodec[] }

Type declaration

AudioStreamingCodec: { audioChannels?: number; bitrate?: AudioBitrate; samplerate: AudioStreamingSamplerate[] | AudioStreamingSamplerate; type: AudioStreamingCodecType | string }

Type declaration

AudioStreamingOptions: { codecs: AudioStreamingCodec[]; comfort_noise?: boolean; twoWayAudio?: boolean }

Type declaration

ButtonConfiguration: { buttonID: number; buttonName?: string; buttonType: ButtonType }

Type declaration

  • buttonID: number
  • Optional buttonName?: string
  • buttonType: ButtonType
CameraRecordingOptions: { audio: AudioRecordingOptions; mediaContainerConfiguration: MediaContainerConfiguration | MediaContainerConfiguration[]; overrideEventTriggerOptions?: EventTriggerOption[]; prebufferLength: number; video: VideoRecordingOptions }

Describes options passed to the RecordingManagement.

Type declaration

CameraStreamingOptions: CameraStreamingOptionsBase & (CameraStreamingOptionsLegacySRTP | CameraStreamingOptionsSupportedCryptoSuites)
CharacteristicChange: { context?: CharacteristicContext; newValue: Nullable<CharacteristicValue>; oldValue: Nullable<CharacteristicValue>; originator?: HAPConnection; reason: ChangeReason }

Type declaration

CharacteristicContext: any
CharacteristicEvents: Record<string, any>
deprecated
CharacteristicGetCallback: (status?: HAPStatus | null | Error, value?: Nullable<CharacteristicValue>) => void

Type declaration

CharacteristicGetHandler: (context: CharacteristicContext, connection?: HAPConnection) => Promise<Nullable<CharacteristicValue>> | Nullable<CharacteristicValue>

Type declaration

CharacteristicSetCallback: (error?: HAPStatus | null | Error, writeResponse?: Nullable<CharacteristicValue>) => void

Type declaration

CharacteristicSetHandler: (value: CharacteristicValue, context: CharacteristicContext, connection?: HAPConnection) => Promise<Nullable<CharacteristicValue> | void> | Nullable<CharacteristicValue> | void

Type declaration

CharacteristicValue: PrimitiveTypes | PrimitiveTypes[] | {}
ControllerIdentifier: string | ControllerType
ControllerType: string | DefaultControllerType

ControllerType is basically a string uniquely identifying the type of Controller. An Accessory only allows one type of Controller to be configured.

There are predefined types DefaultControllerType for all controller implementations provided by hap-nodejs. You can define custom ControllerTypes if you wish to, but be careful that it does not collide with any known definitions.

DataSendCloseReason: HDSProtocolSpecificErrorReason
deprecated

Renamed to HDSProtocolSpecificErrorReason.

ErrorHandler: (error: HDSProtocolSpecificErrorReason) => void

Type declaration

EventAccessory: "identify" | "listening" | "service-configurationChange" | "service-characteristic-change"
deprecated

Use AccessoryEventTypes instead

EventHandler: (message: Record<any, any>) => void

Type declaration

    • (message: Record<any, any>): void
    • Parameters

      • message: Record<any, any>

      Returns void

deprecated

Use ServiceEventTypes instead

FrameHandler: (frame: AudioFrame) => void

Type declaration

GlobalEventHandler: (connection: DataStreamConnection, message: Record<any, any>) => void

Type declaration

GlobalRequestHandler: (connection: DataStreamConnection, id: number, message: Record<any, any>) => void

Type declaration

HAPHttpError: { httpCode: HAPHTTPCode; status: HAPStatus }

Type declaration

HAPPincode: string

Defines a pincode for the HAP accessory. Must have a format like "XXX-XX-XXX".

IPv4Address: string
IPv6Address: string
IdentificationCallback: (identifiedSession?: PreparedDataStreamSession) => void

Type declaration

IdentifyCallback: VoidCallback
InterfaceName: string
ListPairingsCallback: PairingsCallback<PairingInformation[]>
MacAddress: string

Defines a mac address. Must have a format like 'XX:XX:XX:XX:XX:XX' with XX being a valid hexadecimal string

NodeCallback<T>: (err: Nullable<Error> | undefined, data?: T) => void

Type parameters

  • T

Type declaration

    • (err: Nullable<Error> | undefined, data?: T): void
    • Parameters

      • err: Nullable<Error> | undefined
      • Optional data: T

      Returns void

Nullable<T>: T | null

Type parameters

  • T

PairCallback: VoidCallback
PairingsCallback<T>: (error: TLVErrorCode | 0, data?: T) => void

Type parameters

  • T = void

Type declaration

PrepareSessionCallback: (error?: Error, preparedSession?: PreparedDataStreamSession) => void

Type declaration

PrepareStreamCallback: (error?: Error, response?: PrepareStreamResponse) => void

Type declaration

PrepareStreamRequest: { addressVersion: "ipv4" | "ipv6"; audio: Source; sessionID: StreamSessionIdentifier; targetAddress: string; video: Source }

Type declaration

PrepareStreamResponse: { address?: string | Address; addressOverride?: string; audio?: SourceResponse | ProxiedSourceResponse; video: SourceResponse | ProxiedSourceResponse }

Type declaration

  • Optional address?: string | Address
    deprecated

    The local ip address will be automatically determined by HAP-NodeJS. Any value set will be ignored. You may only still set a value to support version prior to 0.7.9

  • Optional addressOverride?: string

    Any value set to this optional property will overwrite the automatically determined local address, which is sent as RTP endpoint to the iOS device.

  • Optional audio?: SourceResponse | ProxiedSourceResponse
  • video: SourceResponse | ProxiedSourceResponse
PreparedDataStreamSession: { accessoryKeySalt: Buffer; accessoryToControllerEncryptionKey: Buffer; connectTimeout?: NodeJS.Timeout; connection: HAPConnection; controllerToAccessoryEncryptionKey: Buffer; port?: number }

Type declaration

  • accessoryKeySalt: Buffer
  • accessoryToControllerEncryptionKey: Buffer
  • Optional connectTimeout?: NodeJS.Timeout
  • connection: HAPConnection
  • controllerToAccessoryEncryptionKey: Buffer
  • Optional port?: number
PreparedStreamRequestCallback: (response: PreparedStreamResponse) => void

Type declaration

PreparedStreamResponse: PrepareStreamResponse
deprecated
PrimitiveTypes: string | number | boolean
RTPTime: 20 | 30 | 40 | 60
ReadCharacteristicsCallback: (error: HAPHttpError | undefined, response?: CharacteristicsReadResponse) => void

Type declaration

    • (error: HAPHttpError | undefined, response?: CharacteristicsReadResponse): void
    • Parameters

      • error: HAPHttpError | undefined
      • Optional response: CharacteristicsReadResponse

      Returns void

ReconfigureStreamRequest: { sessionID: StreamSessionIdentifier; type: RECONFIGURE; video: ReconfiguredVideoInfo }

Type declaration

ReconfiguredVideoInfo: { fps: number; height: number; max_bit_rate: number; rtcp_interval: number; width: number }

Type declaration

  • fps: number
  • height: number
  • max_bit_rate: number
  • rtcp_interval: number
  • width: number
RemovePairingCallback: PairingsCallback
RequestHandler: (id: number, message: Record<any, any>) => void

Type declaration

    • (id: number, message: Record<any, any>): void
    • Parameters

      • id: number
      • message: Record<any, any>

      Returns void

Resolution: [number, number, number]
ResourceRequestCallback: (error: HAPHttpError | undefined, resource?: Buffer) => void

Type declaration

    • Parameters

      Returns void

ResponseHandler: (error: Error | undefined, status: HDSStatus | undefined, message: Record<any, any>) => void

Type declaration

    • (error: Error | undefined, status: HDSStatus | undefined, message: Record<any, any>): void
    • Parameters

      • error: Error | undefined
      • status: HDSStatus | undefined
      • message: Record<any, any>

      Returns void

SerializedServiceMap: Record<string, ServiceId>
ServiceCharacteristicChange: CharacteristicChange & { characteristic: Characteristic }
ServiceId: string
SessionIdentifier: string

UUID string uniquely identifying every HAP connection.

SnapshotRequest: { height: number; reason?: ResourceRequestReason; width: number }

Type declaration

  • height: number
  • Optional reason?: ResourceRequestReason

    An optional ResourceRequestReason. The client decides if it wants to send this value. It is typically only sent in the context of HomeKit Secure Video Cameras. This value might be used by a CameraStreamingDelegate for informational purposes. When handleSnapshotRequest is called, it is already checked if the respective reason is allowed in the current camera configuration.

  • width: number
SnapshotRequestCallback: (error?: Error | HAPStatus, buffer?: Buffer) => void

Type declaration

    • (error?: Error | HAPStatus, buffer?: Buffer): void
    • Parameters

      • Optional error: Error | HAPStatus
      • Optional buffer: Buffer

      Returns void

Source: { port: number; proxy_rtcp?: number; proxy_rtp?: number; srtpCryptoSuite: SRTPCryptoSuites; srtp_key: Buffer; srtp_salt: Buffer }

Type declaration

  • port: number
  • Optional proxy_rtcp?: number
  • Optional proxy_rtp?: number
  • srtpCryptoSuite: SRTPCryptoSuites
  • srtp_key: Buffer
  • srtp_salt: Buffer
StartStreamRequest: { audio: AudioInfo; sessionID: StreamSessionIdentifier; type: START; video: VideoInfo }

Type declaration

StateChangeDelegate: () => void

Type declaration

    • (): void
    • Returns void

StopStreamRequest: { sessionID: StreamSessionIdentifier; type: STOP }

Type declaration

StreamAudioParams: { codecs: AudioCodec[]; comfort_noise: boolean }
deprecated

replaced by AudioStreamingOptions

Type declaration

StreamControllerOptions: CameraStreamingOptions
deprecated

renamed to {@see CameraStreamingOptions}

StreamRequest: { audio?: AudioInfo; sessionID: SessionIdentifier; type: StreamRequestTypes; video?: VideoInfo }
deprecated

replaced by StreamingRequest

Type declaration

StreamRequestCallback: (error?: Error) => void

Type declaration

    • (error?: Error): void
    • Parameters

      • Optional error: Error

      Returns void

StreamSessionIdentifier: string
StreamVideoParams: { codec?: VideoCodec; resolutions: [number, number, number][] }
deprecated

replaced by VideoStreamingOptions

Type declaration

  • Optional codec?: VideoCodec
  • resolutions: [number, number, number][]
SupportedButtonConfiguration: { buttonID: number; buttonType: ButtonType }

Type declaration

SupportedConfiguration: { hardwareImplemented: boolean; maximumTargets: number; supportedButtonConfiguration: SupportedButtonConfiguration[]; ticksPerSecond: number }

Type declaration

TLVEncodable: Buffer | number | string
TargetConfiguration: { buttonConfiguration: Record<number, ButtonConfiguration>; targetCategory?: TargetCategory; targetIdentifier: number; targetName?: string }

Type declaration

VideoCodec: { levels: number[]; profiles: number[] }
deprecated

replaced by H264CodecParameters

Type declaration

  • levels: number[]
  • profiles: number[]
VideoInfo: { codec: VideoCodecType; cvoId?: number; fps: number; height: number; level: H264Level; max_bit_rate: number; mtu: number; packetizationMode: VideoCodecPacketizationMode; profile: H264Profile; pt: number; rtcp_interval: number; ssrc: number; width: number }

Type declaration

  • codec: VideoCodecType
  • Optional cvoId?: number
  • fps: number
  • height: number
  • level: H264Level
  • max_bit_rate: number
  • mtu: number
  • packetizationMode: VideoCodecPacketizationMode
  • profile: H264Profile
  • pt: number
  • rtcp_interval: number
  • ssrc: number
  • width: number
VideoStreamingOptions: { codec: H264CodecParameters; cvoId?: number; resolutions: Resolution[] }

Type declaration

VoidCallback: (err?: Nullable<Error>) => void

Type declaration

    • Parameters

      Returns void

WithUUID<T>: T & { UUID: string }

Type parameters

  • T

WriteCharacteristicsCallback: (error: HAPHttpError | undefined, response?: CharacteristicsWriteResponse) => void

Type declaration

    • (error: HAPHttpError | undefined, response?: CharacteristicsWriteResponse): void
    • Parameters

      • error: HAPHttpError | undefined
      • Optional response: CharacteristicsWriteResponse

      Returns void

Variables

AccessoryLoader: __module = accessoryLoader
Codes: typeof TLVErrorCode = TLVErrorCode
deprecated

please use TLVErrorCode as naming is more precise

LegacyTypes: __module = legacyTypes
Status: typeof HAPStatus = HAPStatus
deprecated

please use HAPStatus as naming is more precise

uuid: __module = uuidFunctions

Functions

  • HAPLibraryVersion(): string
  • This method can be used to retrieve the current running library version of the HAP-NodeJS framework.

    Returns string

    The SemVer version string.

  • IsKnownHAPStatusError(status: HAPStatus): boolean
  • clone<T, U>(object: T, extend?: U): T & U
  • A simple clone function that also allows you to pass an "extend" object whose properties will be added to the cloned copy of the original object passed.

    Type parameters

    • T

    • U

    Parameters

    • object: T
    • Optional extend: U

    Returns T & U

  • decode(buffer: Buffer): Record<number, Buffer>
  • This method is the legacy way of decoding tlv data. It will not properly decode multiple list of the same id. Should the decoder encounter multiple instances of the same id, it will just concatenate the buffer data.

    Parameters

    • buffer: Buffer

      TLV8 data

    Returns Record<number, Buffer>

  • decodeList(data: Buffer, entryStartId: number): Record<number, Buffer>[]
  • Parameters

    • data: Buffer
    • entryStartId: number

    Returns Record<number, Buffer>[]

  • decodeWithLists(buffer: Buffer): Record<number, Buffer | Buffer[]>
  • Parameters

    • buffer: Buffer

    Returns Record<number, Buffer | Buffer[]>

  • epochMillisFromMillisSince2001_01_01(millis: number): number
  • epochMillisFromMillisSince2001_01_01Buffer(millis: Buffer): number
  • init(storagePath?: string): void
  • deprecated

    the need to manually initialize the internal storage was removed. If you want to set a custom storage path location, please use HAPStorage.setCustomStoragePath directly.

    Parameters

    • Optional storagePath: string

    Returns void

  • Loads all accessories from the given folder. Handles object-literal-style accessories, "accessory factories", and new-API style modules.

    Parameters

    • dir: string

    Returns Accessory[]

  • once<T>(func: T): any
  • Accepts object-literal JSON structures from previous versions of HAP-NodeJS and parses them into newer-style structures of Accessory/Service/Characteristic objects.

    Parameters

    • json: any

    Returns Accessory

  • parseServiceJSON(json: any): Service
  • readUInt16(buffer: Buffer): number
  • readUInt32(buffer: Buffer): number
  • readUInt64(buffer: Buffer): number
  • deprecated

    This is pretty much broken

    Parameters

    • buffer: Buffer

    Returns number

  • readUInt64BE(buffer: Buffer, offset?: number): number
  • readVariableUIntLE(buffer: Buffer, offset?: number): number
  • writeFloat32LE(value: number): Buffer
  • writeUInt16(value: number): Buffer
  • writeUInt32(value: number): Buffer
  • writeUInt64(value: number): Buffer
  • writeVariableUIntLE(number: number, offset?: number): Buffer