| /* |
| * Licensed to the Apache Software Foundation (ASF) under one |
| * or more contributor license agreements. See the NOTICE file |
| * distributed with this work for additional information |
| * regarding copyright ownership. The ASF licenses this file |
| * to you under the Apache License, Version 2.0 (the |
| * "License"); you may not use this file except in compliance |
| * with the License. You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, |
| * software distributed under the License is distributed on an |
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| * KIND, either express or implied. See the License for the |
| * specific language governing permissions and limitations |
| * under the License. |
| */ |
| // package org.apache.plc4x.rust.s7.readwrite; |
| |
| // Code generated by code-generation. DO NOT EDIT. |
| use std::io::{Error, ErrorKind, Read, Write}; |
| use plc4rust::{Message, NoOption}; |
| use plc4rust::read_buffer::ReadBuffer; |
| use plc4rust::write_buffer::WriteBuffer; |
| |
| use crate::S7VarRequestParameterItem::S7VarRequestParameterItem; |
| use crate::S7VarRequestParameterItem::S7VarRequestParameterItemOptions; |
| |
| #[derive(PartialEq, Debug, Clone)] |
| pub struct S7ParameterWriteVarRequestOptions { |
| pub messageType: u8 |
| } |
| |
| #[derive(PartialEq, Debug, Clone)] |
| pub struct S7ParameterWriteVarRequest { |
| pub items: Vec<S7VarRequestParameterItem> |
| } |
| |
| impl S7ParameterWriteVarRequest { |
| pub fn numItems(&self) -> u8 { |
| self.items.len() as u8 |
| } |
| } |
| |
| impl Message for S7ParameterWriteVarRequest { |
| type M = S7ParameterWriteVarRequest; |
| type P = S7ParameterWriteVarRequestOptions; |
| |
| fn get_length_in_bits(&self) -> u32 { |
| todo!() |
| } |
| |
| fn serialize<T: Write>(&self, writer: &mut WriteBuffer<T>) -> Result<usize, Error> { |
| writer.write_u8(self.numItems())?; |
| // not handled yet; |
| Ok(0) |
| } |
| |
| fn parse<T: Read>(reader: &mut ReadBuffer<T>, parameter: Option<Self::P>) -> Result<Self::M, Error> { |
| // (Re-)define the options |
| let parameter = parameter.unwrap(); |
| let messageType = parameter.messageType; |
| let numItems = reader.read_u8()?; |
| let items = vec![]; |
| let items_read = 0 as usize; |
| // for _ in 0..(DefaultVariableLiteral{name='numItems', typeReference='null', args=null, index=null, child=null}) { |
| // do something |
| // } |
| Ok(Self::M { |
| items |
| }) |
| } |
| } |
| |
| |