api

package
v0.0.0-...-a36167d Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CommandStop  = 1
	CommandBoop  = 5 // state machine button
	CommandClose = 4
	CommandOpen  = 2
)

Variables

This section is empty.

Functions

func CommandForRatio

func CommandForRatio(position int) int

Returns the door command for the given position. This might not be the same if you changed it. :shrug:

Types

type BasicInfo

type BasicInfo struct {
	BaseStation string `json:"bsid"`
	Mono        int64  `json:"mono"`
	Clock       int64  `json:"clock"`
	Name        string `json:"name"`
	Version     int    `json:"version"`
}

type CommandInput

type CommandInput struct {
	Action struct {
		Command int `json:"cmd"`
	} `json:"action"`
	DeviceId string `json:"deviceId"`
}

type CommandOutput

type CommandOutput struct {
	Value string `json:"value"`
}

type DoorStatus

type DoorStatus struct {
	DeviceOrder []string           `json:"deviceOrder"`
	Devices     []DoorStatusDevice `json:"devices"`

	// we might also _just_ see Users (the "admin update" payload)
	Users []DoorStatusUsers `json:"users"`
}

DoorStatus is the top-level status structure for all devices. This is emitted regularly without a ProcessID, and is the response type for "/app/res/devices/fetch".

func (*DoorStatus) Get

func (ds *DoorStatus) Get(id string) *DoorStatusDevice

Get returns a DoorStatusDevice by ID.

func (*DoorStatus) IsAdmin

func (ds *DoorStatus) IsAdmin() bool

IsAdmin returns whether this is an admin-only payload.

type DoorStatusButton

type DoorStatusButton struct {
	Action struct {
		Base    int `json:"base"`
		Command int `json:"cmd"`
	} `json:"action"`

	Title string `json:"title"`
	Icon  string `json:"icon"`
	Hide  int    `json:"hide"`
	Row   int    `json:"row"`
	Col   int    `json:"col"`
}

DoorStatusButton is a button displayed in the UI.

type DoorStatusDevice

type DoorStatusDevice struct {
	ID           string `json:"deviceId"`
	ScreenFormat int    `json:"screenFormat"`
	Time         int64  `json:"time"`
	Hash         int    `json:"hash"`
	Name         string `json:"name"`

	Buttons []DoorStatusButton `json:"buttons"`
	Aux     []DoorStatusButton `json:"aux"`

	Device struct {
		Position int `json:"position"` // 0-100
	} `json:"device"`

	Log struct {
		ID    int64  `json:"logId"`
		Alert int    `json:"alert"`
		Text  string `json:"text"`
		Time  int    `json:"time"`
	}
}

DoorStatusDevice is the status of a single device.

type DoorStatusUsers

type DoorStatusUsers struct {
	Enabled  bool   `json:"enabled"`
	Username string `json:"userName"`
}

DoorStatusUsers lists the users available to the environment.

type RegisterRequest

type RegisterRequest struct {
	RemoteRegistrationCode string `json:"remoteRegistrationCode"`
	UserPassword           string `json:"userPassword"`
	PhoneModel             string `json:"phoneModel"`
	PhoneName              string `json:"phoneName"` // can be renamed by user in app later
}

type RegisterResponse

type RegisterResponse struct {
	dd.Credential        // this includes UserPassword, not actually part of response
	IsAdmin       bool   `json:"isAdmin,omitempty"`
	Name          string `json:"name,omitempty"`
	UserId        string `json:"userId,omitempty"`
	UserName      string `json:"userName,omitempty"`
}

Jump to

Keyboard shortcuts

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