// CN writes device ID change request to IR socket. func (request *DeviceChangeRequest) WriteNodeRequest(writer io.Writer) (written int64, err error) { bytesWritten, err := common.WriteHeader(writer, HeaderNodeDeviceChange) written += bytesWritten if err != nil { return } bytesWritten, err = common.WriteUUID(writer, request.MessageId) written += bytesWritten if err != nil { return } bytesWritten, err = common.WriteDevice(writer, request.Current) written += bytesWritten if err != nil { return } bytesWritten, err = common.WriteDevice(writer, request.Previous) written += bytesWritten if err != nil { return } bytesWritten, err = common.WriteString(writer, request.ServiceName) written += bytesWritten if err != nil { return } return }
func (request *ConnChange) WriteNodeRequest(writer io.Writer) (written int64, err error) { bytesWritten, err := common.WriteHeader(writer, HeaderNodeConnChange) written += bytesWritten if err != nil { return } bytesWritten, err = common.WriteDevice(writer, request.DeviceId) written += bytesWritten if err != nil { return } bytesWritten, err = common.WriteInt(writer, request.Change) written += bytesWritten if err != nil { return } return }
func (request *DeviceList) WriteNodeRequest(writer io.Writer) (written int64, err error) { bytesWritten, err := common.WriteHeader(writer, HeaderNodeDeviceList) written += bytesWritten if err != nil { return } length := len(request.Devices) bytesWritten, err = common.WriteInt(writer, length) written += bytesWritten if err != nil { return } for _, device := range request.Devices { bytesWritten, err = common.WriteDevice(writer, device) written += bytesWritten if err != nil { return } } return }
// Service writes delivery request to OR socket. Useful for tests and Go // services. func (request *DeliverRequest) WriteServiceRequest(writer io.Writer) (written int64, err error) { bytesWritten, err := common.WriteHeader(writer, HeaderServiceDeliver) written += bytesWritten if err != nil { return } bytesWritten, err = common.WriteUUID(writer, request.MessageId) written += bytesWritten if err != nil { return } bytesWritten, err = common.WriteDevice(writer, request.DeviceId) written += bytesWritten if err != nil { return } bytesWritten, err = common.WriteString(writer, request.Data) written += bytesWritten if err != nil { return } return }