//Output Gadgets turn devices on and off.
495440
func newOutputGadget(config *GadgetConfig) (gadget *Gadget, err error) {
	dev, err := NewOutputDevice(&config.Pin)
	if err != nil {
		panic(err)
	}

	if cmds := dev.Commands(config.Location, config.Name); cmds != nil {
		config.OnCommands = cmds.On
		config.OffCommands = cmds.Off
	} else {
		if len(config.OnCommands) == 0 {
			config.OnCommands = []string{fmt.Sprintf("turn on %s %s", config.Location, config.Name)}
		}
		if len(config.OffCommands) == 0 {
			config.OffCommands = []string{fmt.Sprintf("turn off %s %s", config.Location, config.Name)}
		}
	}
	gadget = &Gadget{
		Type:           config.Pin.Type,
		Location:       config.Location,
		Name:           config.Name,
		Direction:      "output",
		OnCommands:     config.OnCommands,
		OffCommands:    config.OffCommands,
		InitialValue:   config.InitialValue,
		Output:         dev,
		Operator:       ">=",
		UID:            fmt.Sprintf("%s %s", config.Location, config.Name),
		filterMessages: config.Pin.Type != "recorder" && config.Pin.Type != "alarm",
	}
	return gadget, nil
}
1304029
func (s *StateExitedEventDetails) SetOutput(v string) *StateExitedEventDetails {
	s.Output = &v
	return s
}
1116077
func (s *CreateApplicationInput) SetOutputs(v []*Output) *CreateApplicationInput {
	s.Outputs = v
	return s
}
523027
func (s *SendTaskSuccessInput) SetOutput(v string) *SendTaskSuccessInput {
	s.Output = &v
	return s
}
951282
func (mock *OutboundProducerMock) Output() chan []byte {
	if mock.OutputFunc == nil {
		panic("moq: OutboundProducerMock.OutputFunc is nil but OutboundProducer.Output was just called")
	}
	callInfo := struct {
	}{}
	lockOutboundProducerMockOutput.Lock()
	mock.calls.Output = append(mock.calls.Output, callInfo)
	lockOutboundProducerMockOutput.Unlock()
	return mock.OutputFunc()
}
337699
func (cfg *cloudConfig) Output(kind OutputKind) (stdout, stderr string) {
	if out, ok := cfg.attrs["output"].(map[string]interface{}); ok {
		switch out := out[string(kind)].(type) {
		case string:
			stdout = out
		case []string:
			stdout, stderr = out[0], out[1]
		}
	}

	return stdout, stderr
}
249203
func (s *UDPSession) output(buf []byte) {
	var ecc [][]byte

	// 1. FEC encoding
	if s.fecEncoder != nil {
		ecc = s.fecEncoder.encode(buf)
	}

	// 2&3. crc32 & encryption
	if s.block != nil {
		s.nonce.Fill(buf[:nonceSize])
		checksum := crc32.ChecksumIEEE(buf[cryptHeaderSize:])
		binary.LittleEndian.PutUint32(buf[nonceSize:], checksum)
		s.block.Encrypt(buf, buf)

		for k := range ecc {
			s.nonce.Fill(ecc[k][:nonceSize])
			checksum := crc32.ChecksumIEEE(ecc[k][cryptHeaderSize:])
			binary.LittleEndian.PutUint32(ecc[k][nonceSize:], checksum)
			s.block.Encrypt(ecc[k], ecc[k])
		}
	}

	// 4. WriteTo kernel
	nbytes := 0
	npkts := 0
	for i := 0; i < s.dup+1; i++ {
		if n, err := s.conn.WriteTo(buf, s.remote); err == nil {
			nbytes += n
			npkts++
		} else {
			s.notifyWriteError(err)
		}
	}

	for k := range ecc {
		if n, err := s.conn.WriteTo(ecc[k], s.remote); err == nil {
			nbytes += n
			npkts++
		} else {
			s.notifyWriteError(err)
		}
	}
	atomic.AddUint64(&DefaultSnmp.OutPkts, uint64(npkts))
	atomic.AddUint64(&DefaultSnmp.OutBytes, uint64(nbytes))
}
594348
func (s *DescribeExecutionOutput) SetOutput(v string) *DescribeExecutionOutput {
	s.Output = &v
	return s
}
404773
func (s *CreateJobInput) SetOutput(v *CreateJobOutput) *CreateJobInput {
	s.Output = v
	return s
}
341841
func (g *Gadget) Start(in <-chan Message, out chan<- Message) {
	g.out = out
	g.timerIn = make(chan bool)
	g.timerOut = make(chan bool)
	if g.Output != nil {
		if len(g.InitialValue) > 0 {
			g.readInitialValue()
		} else {
			g.off()
		}
		g.doOutputLoop(in)
	} else if g.Input != nil {
		g.doInputLoop(in)
	}
}
343003
func (c *Color) SetOutput(w io.Writer) {
	c.output = w
	if w, ok := w.(*os.File); !ok || !isatty.IsTerminal(w.Fd()) {
		c.disabled = true
	}
}
1494
func (s *AutomationExecution) SetOutputs(v map[string][]*string) *AutomationExecution {
	s.Outputs = v
	return s
}
99494
func (s *StepExecution) SetOutputs(v map[string][]*string) *StepExecution {
	s.Outputs = v
	return s
}
50997
func (c *Client) DisableOutput(id int) error {
	return c.Command("disableoutput %d", id).OK()
}
181199
func Output(w io.Writer) ServiceOption {
	return func(s *Service) error {
		s.output = w
		return nil
	}
}
735866
func (s *ApplicationDetail) SetOutputDescriptions(v []*OutputDescription) *ApplicationDetail {
	s.OutputDescriptions = v
	return s
}
881442
func (l *Logger) Output(lv Level, calldepth int, s string) error {
	if lv >= l.min {
		if (l.flag & Llevel) != 0 {
			return l.lg.Output(calldepth, fmt.Sprintf("[%v] %s", lv, s))
		}
		return l.lg.Output(calldepth, s)
	}
	return nil
}