identity_item_data.cpp
Go to the documentation of this file.
1 
27 
28 namespace eip {
29 
31 {
32  // TODO: verify that this is correct
33  return sizeof(encap_protocol_version)
34  + sizeof(sockaddr)
35  + sizeof(vendor_id)
36  + sizeof(device_type)
37  + sizeof(product_code)
38  + sizeof(revision)
39  + sizeof(status)
40  + sizeof(serial_number)
41  + sizeof(EIP_USINT)
42  + product_name.length()
43  + sizeof(state);
44 }
45 
47 {
49  writer.write(sockaddr);
50  writer.write(vendor_id);
51  writer.write(device_type);
52  writer.write(product_code);
53  writer.write(revision);
54  writer.write(status);
55  writer.write(serial_number);
56 
57  EIP_USINT name_length = product_name.size();
58  writer.write(name_length);
59  writer.writeBytes(product_name.c_str(), name_length);
60  writer.write(state);
61  return writer;
62 }
63 
65 {
67  reader.read(sockaddr);
68  reader.read(vendor_id);
69  reader.read(device_type);
70  reader.read(product_code);
71  reader.read(revision);
72  reader.read(status);
73  reader.read(serial_number);
74 
75  EIP_USINT name_length;
76  reader.read(name_length);
77  product_name.resize(name_length);
78  reader.readBytes(&product_name[0], name_length);
79  reader.read(state);
80  return reader;
81 }
82 
83 } // namespace eip
eip::serialization::Writer
Definition: writer.h:41
eip::IdentityItemData::vendor_id
EIP_UINT vendor_id
Definition: identity_item_data.h:51
eip::serialization::Reader
Definition: reader.h:42
eip
Definition: connection.h:41
eip::IdentityItemData::status
EIP_WORD status
Definition: identity_item_data.h:55
eip::serialization::Writer::write
void write(const T &v)
Definition: writer.h:50
eip::IdentityItemData::device_type
EIP_UINT device_type
Definition: identity_item_data.h:52
eip::IdentityItemData::getLength
virtual size_t getLength() const
Definition: identity_item_data.cpp:30
eip::IdentityItemData::serial_number
EIP_UDINT serial_number
Definition: identity_item_data.h:56
EIP_USINT
uint8_t EIP_USINT
Definition: eip_types.h:36
eip::serialization::Reader::read
void read(T &v)
Definition: reader.h:51
eip::serialization::Writer::writeBytes
virtual void writeBytes(const void *p, size_t n)=0
eip::serialization::Reader::readBytes
virtual void readBytes(void *buf, size_t n)=0
eip::IdentityItemData::serialize
virtual Writer & serialize(Writer &writer) const
Definition: identity_item_data.cpp:46
eip::IdentityItemData::product_code
EIP_UINT product_code
Definition: identity_item_data.h:53
eip::IdentityItemData::state
EIP_USINT state
Definition: identity_item_data.h:58
eip::IdentityItemData::encap_protocol_version
EIP_UINT encap_protocol_version
Definition: identity_item_data.h:49
eip::IdentityItemData::sockaddr
sockaddr_in sockaddr
Definition: identity_item_data.h:50
eip::IdentityItemData::product_name
string product_name
Definition: identity_item_data.h:57
eip::IdentityItemData::revision
EIP_USINT revision[2]
Definition: identity_item_data.h:54
eip::IdentityItemData::deserialize
virtual Reader & deserialize(Reader &reader, size_t length)
Definition: identity_item_data.h:77
identity_item_data.h


odva_ethernetip
Author(s): Kareem Shehata
autogenerated on Wed Mar 2 2022 00:38:56