Example #1
0
func (request *HeloRequest) WriteTo(writer io.Writer) (written int64, err error) {
	bytesWritten, err := encoding.WriteHeader(writer, request.Header())
	written += bytesWritten
	if err != nil {
		return
	}
	bytesWritten, err = encoding.WriteInt(writer, request.Version)
	written += bytesWritten
	if err != nil {
		return
	}
	bytesWritten, err = encoding.WriteString(writer, request.Service)
	written += bytesWritten
	if err != nil {
		return
	}
	return
}
Example #2
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
}