Beispiel #1
0
func (request *DeliverRequest) ReadFrom(reader io.Reader) (read int64, err error) {
	bytesRead, err := encoding.ExpectHeader(reader, request.Header())
	read += bytesRead
	if err != nil {
		return
	}
	bytesRead, err = encoding.ReadUUID(reader, &request.MessageId)
	read += bytesRead
	if err != nil {
		return
	}
	bytesRead, err = encoding.ReadCSUUID(reader, &request.ClusterId, &request.DeviceId)
	read += bytesRead
	if err != nil {
		return
	}
	bytesRead, err = encoding.ReadString(reader, &request.Service)
	read += bytesRead
	if err != nil {
		return
	}
	bytesRead, err = encoding.ReadString(reader, &request.Data)
	read += bytesRead
	if err != nil {
		return
	}
	return
}
Beispiel #2
0
func (reply *DeliverReply) ReadFrom(reader io.Reader) (read int64, err error) {
	bytesRead, err := encoding.ExpectHeader(reader, reply.Header())
	read += bytesRead
	if err != nil {
		return
	}
	bytesRead, err = encoding.ReadUUID(reader, &reply.MessageId)
	read += bytesRead
	if err != nil {
		return
	}
	var rawStatus int
	bytesRead, err = encoding.ReadInt(reader, &rawStatus)
	read += bytesRead
	if err != nil {
		return
	}
	reply.Status = DeliverStatus(rawStatus)
	return
}
Beispiel #3
0
func (request *DeviceChangeRequest) ReadFrom(reader io.Reader) (read int64, err error) {
	bytesRead, err := encoding.ExpectHeader(reader, request.Header())
	read += bytesRead
	if err != nil {
		return
	}
	bytesRead, err = encoding.ReadUUID(reader, &request.MessageId)
	read += bytesRead
	if err != nil {
		return
	}
	bytesRead, err = encoding.ReadCSUUID(reader, &request.Current.ClusterId, &request.Current.DeviceId)
	read += bytesRead
	if err != nil {
		return
	}
	bytesRead, err = encoding.ReadCSUUID(reader, &request.Previous.ClusterId, &request.Previous.DeviceId)
	read += bytesRead
	if err != nil {
		return
	}
	return
}