Version: v1.0.0 Latest Latest

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

Go to latest
Published: Sep 23, 2016 License: Apache-2.0 Imports: 6 Imported by: 1




This section is empty.


This section is empty.


This section is empty.


type AccessorGroup

type AccessorGroup struct {
	Database *sql.DB

AccessorGroup holds all configuration for the accessors.

func (*AccessorGroup) GetAllBuildings

func (accessorGroup *AccessorGroup) GetAllBuildings() ([]Building, error)

GetAllBuildings returns a list of buildings from the database

func (*AccessorGroup) GetAllDevices

func (accessorGroup *AccessorGroup) GetAllDevices() ([]Device, error)

GetAllDevices returns a list of devices from the database

func (*AccessorGroup) GetAllRooms

func (accessorGroup *AccessorGroup) GetAllRooms() ([]Room, error)

GetAllRooms returns a list of rooms from the database

func (*AccessorGroup) GetAudioInformationForDevices

func (AccessorGroup *AccessorGroup) GetAudioInformationForDevices(devices []Device) ([]Device, error)

func (*AccessorGroup) GetBuildingByID

func (accessorGroup *AccessorGroup) GetBuildingByID(id int) (Building, error)

GetBuildingByID returns a building from the database by ID

func (*AccessorGroup) GetBuildingByShortname

func (accessorGroup *AccessorGroup) GetBuildingByShortname(shortname string) (Building, error)

GetBuildingByShortname returns a building from the database by shortname

func (*AccessorGroup) GetDeviceByBuildingAndRoomAndName

func (accessorGroup *AccessorGroup) GetDeviceByBuildingAndRoomAndName(buildingShortname string, roomName string, deviceName string) (Device, error)

func (*AccessorGroup) GetDeviceCommandsByBuildingAndRoomAndName

func (accessorGroup *AccessorGroup) GetDeviceCommandsByBuildingAndRoomAndName(buildingShortname string, roomName string, deviceName string) ([]Command, error)

func (*AccessorGroup) GetDevicePortsByBuildingAndRoomAndName

func (accessorGroup *AccessorGroup) GetDevicePortsByBuildingAndRoomAndName(buildingShortname string, roomName string, deviceName string) ([]Port, error)

func (*AccessorGroup) GetDevicesByBuildingAndRoom

func (accessorGroup *AccessorGroup) GetDevicesByBuildingAndRoom(buildingShortname string, roomName string) ([]Device, error)

func (*AccessorGroup) GetDevicesByBuildingAndRoomAndRole

func (accessorGroup *AccessorGroup) GetDevicesByBuildingAndRoomAndRole(buildingShortname string, roomName string, roleName string) ([]Device, error)

func (*AccessorGroup) GetDevicesByQuery

func (accessorGroup *AccessorGroup) GetDevicesByQuery(query string, parameters ...interface{}) ([]Device, error)

GetDevicesByQuery is a function that abstracts some of the execution and extraction of data from the database when we're looking for responses based on the COMPLETE device struct. The function MAY have the WHERE clause passed in to limit the devices found. The function MAY have any JOIN clauses necessary to the WEHRE Clause not included in the base query. JOIN statements in the base query: JOIN Rooms on Devices.roomID = Rooms.RoomID JOIN Buildings on Rooms.buildingID = Buildings.buildingID JOIN DeviceTypes on Devices.typeID = DeviceTypes.deviceTypeID If empty string is passed in no WHERE clause will be appended, and thus all devices will be returned.

Flow -> Find all devices based on the clause passed in

->	For each device found find the Ports
->	For each device found find the Commands

Examples of valid parameters. Example 1: `JOIN deviceRole on deviceRole.deviceID = Devices.deviceID JOIN DeviceRoleDefinition on DeviceRole.deviceRoleDefinitionID = DeviceRoleDefinition.deviceRoleDefinitionID WHERE LIKE 'AudioIn'` Example 2: `WHERE Devices.RoomID = 1`

func (*AccessorGroup) GetDevicesByRoleAndType

func (accessorGroup *AccessorGroup) GetDevicesByRoleAndType(deviceRole string, deviceType string) ([]Device, error)

func (*AccessorGroup) GetDisplayInformationForDevices

func (AccessorGroup *AccessorGroup) GetDisplayInformationForDevices(devices []Device) ([]Device, error)

func (*AccessorGroup) GetPowerStatesByDeviceID

func (AccessorGroup *AccessorGroup) GetPowerStatesByDeviceID(deviceID int) ([]string, error)

func (*AccessorGroup) GetRoomByBuildingAndName

func (accessorGroup *AccessorGroup) GetRoomByBuildingAndName(buildingShortname string, name string) (Room, error)

GetRoomByBuildingAndName returns a room from the database by building shortname and room name

func (*AccessorGroup) GetRoomByID

func (accessorGroup *AccessorGroup) GetRoomByID(id int) (Room, error)

GetRoomByID returns a room from the database by ID

func (*AccessorGroup) GetRoomsByBuilding

func (accessorGroup *AccessorGroup) GetRoomsByBuilding(building int) ([]Room, error)

GetRoomsByBuilding returns a room from the database by building

func (*AccessorGroup) MakeBuilding

func (accessorGroup *AccessorGroup) MakeBuilding(name string, shortname string) (Building, error)

MakeBuilding adds a building to the database

func (*AccessorGroup) MakeDevice

func (accessorGroup *AccessorGroup) MakeDevice(name string, address string, buildingShortname string, roomName string, protocol string) (Device, error)

MakeDevice adds a device to the database

func (*AccessorGroup) MakeRoom

func (accessorGroup *AccessorGroup) MakeRoom(name string, buildingShortname string, vlan int) (Room, error)

MakeRoom adds a room to the database

func (*AccessorGroup) Open

func (accessorGroup *AccessorGroup) Open(dataSourceName string)

Open creates a database connection and sets it in the struct

func (*AccessorGroup) PutDeviceAttributeByDeviceAndRoomAndBuilding

func (accessorGroup *AccessorGroup) PutDeviceAttributeByDeviceAndRoomAndBuilding(building string, room string, device string, attribute string, attributeValue string) (Device, error)

type Building

type Building struct {
	ID          int    `json:"id,omitempty"`
	Name        string `json:"name,omitempty"`
	Shortname   string `json:"shortname,omitempty"`
	Description string `json:"description,omitempty"`

type Command

type Command struct {
	Name         string   `json:"name"`
	Endpoint     Endpoint `json:"endpoint"`
	Microservice string   `json:"microservice"`

type Device

type Device struct {
	ID          int       `json:"id"`
	Name        string    `json:"name"`
	Address     string    `json:"address"`
	Input       bool      `json:"input"`
	Output      bool      `json:"output"`
	Building    Building  `json:"building"`
	Room        Room      `json:"room"`
	Type        string    `json:"type"`
	Power       string    `json:"power"`
	Blanked     *bool     `json:"blanked,omitempty"`
	Volume      *int      `json:"volume,omitempty"`
	Muted       *bool     `json:"muted,omitempty"`
	PowerStates []string  `json:"powerstates,omitempty"`
	Responding  bool      `json:"responding"`
	Ports       []Port    `json:"ports,omitempty"`
	Commands    []Command `json:"commands,omitempty"`

type DeviceRequest

type DeviceRequest struct {
	ID       int    `json:"id"`
	Name     string `json:"name"`
	Protocol string `json:"protocol"`
	Building string `json:"building"`
	Room     string `json:"room"`

type Endpoint

type Endpoint struct {
	Name string `json:"name"`
	Path string `json:"path"`

type Port

type Port struct {
	Source      string `json:"source"`
	Name        string `json:"name"`
	Destination string `json:"destination"`

type Room

type Room struct {
	ID                 int      `json:"id,omitempty"`
	Name               string   `json:"name,omitempty"`
	Description        string   `json:"description,omitempty"`
	Building           Building `json:"building,omitempty"`
	CurrentVideoInput  int      `json:"currentVideoInput,omitempty"`
	CurrentAudioInput  int      `json:"currentAudioInput,omitempty"`
	CurrentVideoOutput int      `json:"currentVideoOutput,omitempty"`
	CurrentAudioOutput int      `json:"currentAudioOutput,omitempty"`
	Devices            []Device `json:"devices,omitempty"`

type RoomRequest

type RoomRequest struct {
	ID       int    `json:"id"`
	Name     string `json:"name"`
	VLAN     int    `json:"vlan"`
	Building string `json:"building,omitempty"`

Jump to

Keyboard shortcuts

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