Documentation ¶
Index ¶
- Constants
- Variables
- func EvaluateResponses(room base.Room, responses []se.StatusResponse, count int) (rest.PublicRoom, error)
- func ExecuteAction(action base.ActionStructure, env string, responses chan<- se.StatusResponse, ...)
- func ExecuteActions(DAG []base.ActionStructure, env string, requestor string) ([]se.StatusResponse, error)
- func ExecuteCommand(action base.ActionStructure, url, requestor string) se.StatusResponse
- func GenerateActions(dbRoom base.Room, bodyRoom rest.PublicRoom, requestor string) ([]base.ActionStructure, int, error)
- func GenerateStatusCommands(room base.Room, commandMap map[string]se.StatusEvaluator) ([]se.StatusCommand, int, error)
- func GetRoomState(building, roomName, env string) (rest.PublicRoom, error)
- func PublishError(message string, action base.ActionStructure, requestor string)
- func ReconcileActions(room base.Room, actions []base.ActionStructure, inCount int) (batches []base.ActionStructure, count int, err error)
- func ReplaceIPAddressEndpoint(path string, address string) string
- func ReplaceParameters(addr string, parameters map[string]string) (string, error)
- func RunStatusCommands(commands []se.StatusCommand, env string) (outputs []se.StatusResponse, err error)
- func SetRoomState(target rest.PublicRoom, env, requestor string) (rest.PublicRoom, error)
Constants ¶
const TIMEOUT = 5
TIMEOUT is the duration constant to wait before timing out.
Variables ¶
var SET_STATE_STATUS_EVALUATORS = map[string]string{
"PowerOnDefault": "STATUS_PowerDefault",
"StandbyDefault": "STATUS_PowerDefault",
"ChangeVideoInputDefault": "STATUS_InputDefault",
"ChangeAudioInputDefault": "STATUS_InputDefault",
"ChangeVideoInputVideoSwitcher": "STATUS_InputVideoSwitcher",
"ChangeVideoInputTieredSwitcher": "STATUS_InputVideoSwitcher",
"BlankDisplayDefault": "STATUS_BlankedDefault",
"UnBlankDisplayDefault": "STATUS_BlankedDefault",
"MuteDefault": "STATUS_MutedDefault",
"UnMuteDefault": "STATUS_MutedDefault",
"SetVolumeDefault": "STATUS_VolumeDefault",
"SetVolumeTecLite": "STATUS_VolumeDefault",
"MuteDSP": "STATUS_MutedDSP",
"UnmuteDSP": "STATUS_MutedDSP",
"SetVolumeDSP": "STATUS_VolumeDSP",
}
SET_STATE_STATUS_EVALUATORS is the map containing the definitions of our evaluator strings. this is where we decide which status evaluator is used to evalutate the resultant status of a command that sets state
Functions ¶
func EvaluateResponses ¶
func EvaluateResponses(room base.Room, responses []se.StatusResponse, count int) (rest.PublicRoom, error)
EvaluateResponses organizes the responses that are received when the commands are issued.
func ExecuteAction ¶
func ExecuteAction(action base.ActionStructure, env string, responses chan<- se.StatusResponse, control *sync.WaitGroup, requestor string)
ExecuteAction builds a status response
func ExecuteActions ¶
func ExecuteActions(DAG []base.ActionStructure, env string, requestor string) ([]se.StatusResponse, error)
ExecuteActions carries out the actions defined in the struct @pre TODO DestinationDevice field is populated for every action!!
func ExecuteCommand ¶
func ExecuteCommand(action base.ActionStructure, url, requestor string) se.StatusResponse
ExecuteCommand makes a GET request given a microservice and endpoint and publishes the results returns the state the microservice reports or nothing if the microservice doesn't respond publishes a state event or an error @pre the parameters have been filled, e.g. the endpoint does not contain ":"
func GenerateActions ¶
func GenerateActions(dbRoom base.Room, bodyRoom rest.PublicRoom, requestor string) ([]base.ActionStructure, int, error)
GenerateActions evaluates and validates each command in the configuration.
func GenerateStatusCommands ¶
func GenerateStatusCommands(room base.Room, commandMap map[string]se.StatusEvaluator) ([]se.StatusCommand, int, error)
GenerateStatusCommands determines the status commands for the type of room that the device is in.
func GetRoomState ¶
func GetRoomState(building, roomName, env string) (rest.PublicRoom, error)
GetRoomState assesses the state of the room and returns a PublicRoom object.
func PublishError ¶
func PublishError(message string, action base.ActionStructure, requestor string)
PublishError creates an Event based on the error message and ActionStructure information, and then sends it to the event messaging system.
func ReconcileActions ¶
func ReconcileActions(room base.Room, actions []base.ActionStructure, inCount int) (batches []base.ActionStructure, count int, err error)
ReconcileActions produces a DAG
func ReplaceIPAddressEndpoint ¶
ReplaceIPAddressEndpoint is a simple helper
func ReplaceParameters ¶
ReplaceParameters replaces parameters in the command endpoint @pre the endpoint's IP parameter has already been replaced @post the endpoint does not contain '{{}}'
func RunStatusCommands ¶
func RunStatusCommands(commands []se.StatusCommand, env string) (outputs []se.StatusResponse, err error)
RunStatusCommands maps the device names to their commands, and then puts them in a channel to be run.
func SetRoomState ¶
func SetRoomState(target rest.PublicRoom, env, requestor string) (rest.PublicRoom, error)
SetRoomState changes the state of the room and returns a PublicRoom object.
Types ¶
This section is empty.