Exemple #1
0
func (request *DeviceChangeRequest) WriteTo(writer io.Writer) (written int64, err error) {
	bytesWritten, err := encoding.WriteHeader(writer, request.Header())
	written += bytesWritten
	if err != nil {
		return
	}
	bytesWritten, err = encoding.WriteCSUUID(writer, request.Current.ClusterId, request.Current.DeviceId)
	written += bytesWritten
	if err != nil {
		return
	}
	bytesWritten, err = encoding.WriteUUID(writer, request.MessageId)
	written += bytesWritten
	if err != nil {
		return
	}
	bytesWritten, err = encoding.WriteCSUUID(writer, request.Previous.ClusterId, request.Previous.DeviceId)
	written += bytesWritten
	if err != nil {
		return
	}
	return
}
Exemple #2
0
func (connChange *ConnChange) WriteTo(writer io.Writer) (written int64, err error) {
	bytesWritten, err := encoding.WriteHeader(writer, connChange.Header())
	written += bytesWritten
	if err != nil {
		return
	}
	bytesWritten, err = encoding.WriteCSUUID(writer, connChange.ClusterId, connChange.DeviceId)
	written += bytesWritten
	if err != nil {
		return
	}
	bytesWritten, err = encoding.WriteInt(writer, int(connChange.Status))
	written += bytesWritten
	if err != nil {
		return
	}
	return
}
Exemple #3
0
func (deviceList *DeviceList) WriteTo(writer io.Writer) (written int64, err error) {
	bytesWritten, err := encoding.WriteHeader(writer, deviceList.Header())
	written += bytesWritten
	if err != nil {
		return
	}
	length := len(deviceList.Devices)
	bytesWritten, err = encoding.WriteInt(writer, length)
	written += bytesWritten
	if err != nil {
		return
	}
	for _, device := range deviceList.Devices {
		bytesWritten, err = encoding.WriteCSUUID(writer, device.ClusterId, device.DeviceId)
		written += bytesWritten
		if err != nil {
			return
		}
	}
	return
}
Exemple #4
0
func (request *DeliverRequest) WriteTo(writer io.Writer) (written int64, err error) {
	bytesWritten, err := encoding.WriteHeader(writer, request.Header())
	written += bytesWritten
	if err != nil {
		return
	}
	bytesWritten, err = encoding.WriteCSUUID(writer, request.ClusterId, request.DeviceId)
	written += bytesWritten
	if err != nil {
		return
	}
	bytesWritten, err = encoding.WriteUUID(writer, request.MessageId)
	written += bytesWritten
	if err != nil {
		return
	}
	bytesWritten, err = encoding.WriteString(writer, request.Data)
	written += bytesWritten
	if err != nil {
		return
	}
	return
}