alarmdecoder

package module
v0.0.0-...-9ac9338 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 25, 2023 License: MIT Imports: 5 Imported by: 0

README

go-alarmdecoder

A go library for interacting with alarm decoder.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlarmDecoder

type AlarmDecoder struct {
	// contains filtered or unexported fields
}

AlarmDecoder allows for interacting with an AlarmDecoder device over serial.

func New

func New(rw io.ReadWriter) *AlarmDecoder

New returns a new AlarmDecoder. Context can be cancelled to terminate the background goroutine.

func (*AlarmDecoder) Read

func (ad *AlarmDecoder) Read() (Message, error)

Read returns a single message from the stream.

type Message

type Message struct {
	UnparsedMessage string

	// 1 Indicates if the panel is READY
	Ready bool
	// 2 Indicates if the panel is ARMED AWAY
	ArmedAway bool
	// 3 Indicates if the panel is ARMED HOME
	ArmedHome bool
	// 4 Indicates if the keypad backlight is on
	BacklightOn bool
	// 5 Indicates if the keypad is in programming mode
	ProgrammingMode bool
	// 6 Number (1-7) indicating how many beeps are associated with the message
	Beeps int
	// 7 Indicates that a zone has been bypassed
	ZoneBypassed bool
	// 8 Indicates if the panel is on AC power
	ACPower bool
	// 9 Indicates if the chime is enabled
	ChimeEnabled bool
	// 10 Indicates that an alarm has occurred. This is sticky and will be cleared after a second disarm.
	AlarmHasOccured bool
	// 11 Indicates that an alarm is currently sounding. This is cleared after the first disarm.
	AlarmSounding bool
	// 12 Indicates that the battery is low
	BatteryLow bool
	// 13 Indicates that entry delay is off (ARMED INSTANT/MAX)
	EntryDelayDisabled bool
	// 14 Indicates that there is a fire
	Fire bool
	// 15 Indicates a system issue
	SystemIssue bool
	// 16 Indicates that the panel is only watching the perimeter (ARMED STAY/NIGHT)
	PerimeterOnly bool
	// 17 System specific bits. 4 bits packed into a HEX Nibble [0-9,A-F]
	// 18 Ademco or DSC Mode A or D
	Mode string

	// This number specifies which zone is affected by the message. For example,
	// if this message is for CHECK ZONE 22 then the numeric code would be 022.
	// Most of the time this is zero-padded base10, but there are rare occurrences
	// where this may be base16, such as ECP bus failures.
	Zone string

	// There is one important piece of data included only in this field: the
	// keypad address mask. The four bytes starting at position 2 (zero-indexed)
	// indicate which keypads this message is intended for.
	RawData string

	// This section is the data that would be displayed on your keypad's screen.
	KeypadMessage string
}

Message contains

func ParseMessage

func ParseMessage(s string) (Message, error)

ParseMessage parses a message from AD2PI.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL