コード例 #1
0
ファイル: protocol.go プロジェクト: kitcambridge/csor
func (reply *DeviceChangeReply) WriteTo(writer io.Writer) (written int64, err error) {
	bytesWritten, err := encoding.WriteHeader(writer, reply.Header())
	written += bytesWritten
	if err != nil {
		return
	}
	bytesWritten, err = encoding.WriteUUID(writer, reply.MessageId)
	written += bytesWritten
	if err != nil {
		return
	}
	bytesWritten, err = encoding.WriteInt(writer, int(reply.Status))
	written += bytesWritten
	if err != nil {
		return
	}
	return
}
コード例 #2
0
ファイル: protocol.go プロジェクト: kitcambridge/csor
func (reply *DeliverReply) WriteTo(writer io.Writer) (written int64, err error) {
	bytesWritten, err := encoding.WriteHeader(writer, reply.Header())
	written += bytesWritten
	if err != nil {
		return
	}
	rawSuccess := int(reply.Success)
	bytesWritten, err = encoding.WriteInt(writer, rawSuccess)
	written += bytesWritten
	if err != nil {
		return
	}
	bytesWritten, err = encoding.WriteUUID(writer, reply.MessageId)
	written += bytesWritten
	if err != nil {
		return
	}
	return
}
コード例 #3
0
ファイル: protocol.go プロジェクト: kitcambridge/csor
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
}
コード例 #4
0
ファイル: protocol.go プロジェクト: kitcambridge/csor
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
}