// NewSwitchBinaryV1 creates a new SwitchBinary report that contains the switch status from a
// zwave node
435670
func NewSwitchBinaryV1(data []byte) (*SwitchBinaryV1, error) {
	if len(data) != 1 {
		return nil, fmt.Errorf("Wrong length, expected 1 byte got %d", len(data))
	}

	return &SwitchBinaryV1{
		CurrentValue: data[0] == 0xFF && data[0] != 0xFE,
		Valid:        data[0] != 0xFE,
		data:         data,
	}, nil
}
363242
func (p LinkADRReqPayload) MarshalBinary() ([]byte, error) {
	b := make([]byte, 0, 4)
	if p.DataRate > 15 {
		return b, errors.New("lorawan: the max value of DataRate is 15")
	}
	if p.TXPower > 15 {
		return b, errors.New("lorawan: the max value of TXPower is 15")
	}

	cm, err := p.ChMask.MarshalBinary()
	if err != nil {
		return b, err
	}
	r, err := p.Redundancy.MarshalBinary()
	if err != nil {
		return b, err
	}

	b = append(b, p.TXPower^(p.DataRate<<4))
	b = append(b, cm...)
	b = append(b, r...)

	return b, nil
}
706100
func NewSwitchMultilevelV4(data []byte) (*SwitchMultilevelV4, error) {
	if len(data) != 3 {
		return nil, fmt.Errorf("Wrong length, expected 3 byte got %d", len(data))
	}

	return &SwitchMultilevelV4{
		CurrentValue: math.Min(float64(data[0]), 100),
		TargetValue:  math.Min(float64(data[1]), 100),
		Duration:     commands.Duration(data[2]),
		Valid:        data[0] != 0xFE,
		TargetValid:  data[1] != 0xFE,
		data:         data,
	}, nil
}
674270
func (m *SocialID) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}
585028
func (m *EndpointChangeRequest) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}
7733
func (m *Endpoint) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}
1012071
func (m *SwaggerNotReadyStatus) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}
817840
func NewSwitchDemux() SwitchDemux {
	return SwitchDemux{
		All:              func(message interface{}) {},
		Tweet:            func(tweet *Tweet) {},
		DM:               func(dm *DirectMessage) {},
		StatusDeletion:   func(deletion *StatusDeletion) {},
		LocationDeletion: func(LocationDeletion *LocationDeletion) {},
		StreamLimit:      func(limit *StreamLimit) {},
		StatusWithheld:   func(statusWithheld *StatusWithheld) {},
		UserWithheld:     func(userWithheld *UserWithheld) {},
		StreamDisconnect: func(disconnect *StreamDisconnect) {},
		Warning:          func(warning *StallWarning) {},
		FriendsList:      func(friendsList *FriendsList) {},
		Event:            func(event *Event) {},
		Other:            func(message interface{}) {},
	}
}
590171
func (p *StatVFS) MarshalBinary() ([]byte, error) {
	var buf bytes.Buffer
	buf.Write([]byte{ssh_FXP_EXTENDED_REPLY})
	err := binary.Write(&buf, binary.BigEndian, p)
	return buf.Bytes(), err
}
48080
func (api *InterfaceAPI) ConnectToSwitch(interfaceID int64, switchID int64) (bool, error) {
	var (
		method = "PUT"
		uri    = fmt.Sprintf("%s/%d/to/switch/%d", api.getResourceURL(), interfaceID, switchID)
	)
	return api.modify(method, uri, nil)
}
895263
func (m *PathStatus) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}
184540
func (p NewChannelAnsPayload) MarshalBinary() ([]byte, error) {
	var b byte
	if p.ChannelFrequencyOK {
		b = (1 << 0)
	}
	if p.DataRateRangeOK {
		b = b ^ (1 << 1)
	}
	return []byte{b}, nil
}
904156
func (m *KVstoreConfiguration) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}
263208
func (s *BigSwitchBCFService) NewAddBigSwitchBcfDeviceParams(hostname string, nat bool, password string, physicalnetworkid string, username string) *AddBigSwitchBcfDeviceParams {
	p := &AddBigSwitchBcfDeviceParams{}
	p.p = make(map[string]interface{})
	p.p["hostname"] = hostname
	p.p["nat"] = nat
	p.p["password"] = password
	p.p["physicalnetworkid"] = physicalnetworkid
	p.p["username"] = username
	return p
}
309729
func (m *LabelConfigurationStatus) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}
1181988
func (l *mvccLock) MarshalBinary() ([]byte, error) {
	var (
		mh  marshalHelper
		buf bytes.Buffer
	)
	mh.WriteNumber(&buf, l.startTS)
	mh.WriteSlice(&buf, l.primary)
	mh.WriteSlice(&buf, l.value)
	mh.WriteNumber(&buf, l.op)
	mh.WriteNumber(&buf, l.ttl)
	return buf.Bytes(), errors.Trace(mh.err)
}
994413
func (m *StatusResponseClusterNodesItems0PrimaryAddress) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}